Test for check.h before trying to assume that a test program compiles and
runs when cross-compiling
---
 m4/check.m4 |   51 +++++++++++++++++++++++++++++----------------------
 1 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/m4/check.m4 b/m4/check.m4
index 272fb84..e8fabb7 100644
--- a/m4/check.m4
+++ b/m4/check.m4
@@ -7,10 +7,6 @@ AC_DEFUN([AM_PATH_CHECK],
   AC_ARG_WITH([check],
   [  --with-check=PATH       prefix where check is installed [default=auto]])
  
-  min_check_version=ifelse([$1], ,0.8.2,$1)
-
-  AC_MSG_CHECKING(for check - version >= $min_check_version)
-
   if test x$with_check = xno; then
     AC_MSG_RESULT(disabled)
     ifelse([$3], , AC_MSG_ERROR([disabling check is not supported]), [$3])
@@ -29,8 +25,15 @@ AC_DEFUN([AM_PATH_CHECK],
     CFLAGS="$CFLAGS $CHECK_CFLAGS"
     LIBS="$CHECK_LIBS $LIBS"
 
-    rm -f conf.check-test
-    AC_TRY_RUN([
+    AC_CHECK_HEADER([check.h],, no_check=yes)
+
+    if test "x$no_check" = x ; then
+      min_check_version=ifelse([$1], ,0.8.2,$1)
+
+      AC_MSG_CHECKING(for check - version >= $min_check_version)
+
+      rm -f conf.check-test
+      AC_TRY_RUN([
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -83,21 +86,21 @@ int main ()
 }
 ],, no_check=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"])
 
-    CFLAGS="$ac_save_CFLAGS"
-    LIBS="$ac_save_LIBS"
+      CFLAGS="$ac_save_CFLAGS"
+      LIBS="$ac_save_LIBS"
 
-    if test "x$no_check" = x ; then
-      AC_MSG_RESULT(yes)
-      ifelse([$2], , :, [$2])
-    else
-      AC_MSG_RESULT(no)
-      if test -f conf.check-test ; then
-        :
+      if test "x$no_check" = x ; then
+        AC_MSG_RESULT(yes)
+        ifelse([$2], , :, [$2])
       else
-        echo "*** Could not run check test program, checking why..."
-        CFLAGS="$CFLAGS $CHECK_CFLAGS"
-        LIBS="$CHECK_LIBS $LIBS"
-        AC_TRY_LINK([
+        AC_MSG_RESULT(no)
+        if test -f conf.check-test ; then
+          :
+        else
+          echo "*** Could not run check test program, checking why..."
+          CFLAGS="$CFLAGS $CHECK_CFLAGS"
+          LIBS="$CHECK_LIBS $LIBS"
+          AC_TRY_LINK([
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -113,14 +116,18 @@ int main ()
       [ echo "*** The test program failed to compile or link. See the file 
config.log for"
         echo "*** the exact error that occured." ])
       
-        CFLAGS="$ac_save_CFLAGS"
-        LIBS="$ac_save_LIBS"
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+        fi
       fi
+      rm -f conf.check-test
+    else
+      CFLAGS="$ac_save_CFLAGS"
+      LIBS="$ac_save_LIBS"
 
       CHECK_CFLAGS=""
       CHECK_LIBS=""
 
-      rm -f conf.check-test
       ifelse([$3], , AC_MSG_ERROR([check not found]), [$3])
     fi
 
-- 
1.5.4.3


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Schrodinger-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/schrodinger-devel

Reply via email to