]> Savannah Git Hosting - gnulib.git/commitdiff
d-ino: Avoid guessing "no" when cross-compiling to glibc/Linux systems.
authorBruno Haible <bruno@clisp.org>
Sat, 5 May 2012 09:55:41 +0000 (11:55 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 5 May 2012 09:55:41 +0000 (11:55 +0200)
* m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Require
AC_CANONICAL_HOST. When cross-compiling to a glibc/Linux platform,
set gl_cv_struct_dirent_d_ino to "guessing yes".

ChangeLog
m4/d-ino.m4

index de58612bfa06142cc78f27c513ed5da5c449f79a..9f6d6c460584990f94f53837373beb68c4e56f2d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-05-05  Bruno Haible  <bruno@clisp.org>
+
+       d-ino: Avoid guessing "no" when cross-compiling to glibc/Linux systems.
+       * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Require
+       AC_CANONICAL_HOST. When cross-compiling to a glibc/Linux platform,
+       set gl_cv_struct_dirent_d_ino to "guessing yes".
+
 2012-05-05  Bruno Haible  <bruno@clisp.org>
 
        fseeko-tests, ftello-tests: Avoid "guessing no" when cross-compiling.
index 03087bf5e758230557fc650779b1f035eee39342..16d46aad96ba46dce90ff0a883d56d3c4aaf9281 100644 (file)
@@ -1,4 +1,4 @@
-# serial 12
+# serial 13
 
 dnl From Jim Meyering.
 dnl
@@ -13,7 +13,8 @@ dnl
 # with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
-  [AC_CACHE_CHECK([for d_ino member in directory struct],
+  [AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+   AC_CACHE_CHECK([for d_ino member in directory struct],
                   gl_cv_struct_dirent_d_ino,
      [AC_RUN_IFELSE(
         [AC_LANG_PROGRAM(
@@ -37,10 +38,18 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
            ]])],
            [gl_cv_struct_dirent_d_ino=yes],
            [gl_cv_struct_dirent_d_ino=no],
-           [gl_cv_struct_dirent_d_ino=no])])
-   if test $gl_cv_struct_dirent_d_ino = yes; then
-     AC_DEFINE([D_INO_IN_DIRENT], [1],
-       [Define if struct dirent has a member d_ino that actually works.])
-   fi
+           [case "$host_os" in
+                           # Guess yes on glibc systems with Linux kernel.
+              linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
+                           # If we don't know, assume the worst.
+              *)           gl_cv_struct_dirent_d_ino="guessing no" ;;
+            esac
+           ])])
+   case "$gl_cv_struct_dirent_d_ino" in
+     *yes)
+       AC_DEFINE([D_INO_IN_DIRENT], [1],
+         [Define if struct dirent has a member d_ino that actually works.])
+       ;;
+   esac
   ]
 )