Whamcloud - gitweb
LU-3428 build: fix 'uninitialized variables' errors
[fs/lustre-release.git] / libsysio / configure.in
index 5ce600f..890b7ee 100644 (file)
@@ -3,25 +3,46 @@ AC_INIT(libsysio, 1.2)
 AC_CANONICAL_SYSTEM
 
 case "$host_os" in
-  aix*)
-       ;;
-  linux*)
-       ;;
-  *)
-       AC_MSG_WARN('***' ${host_os}: Unsupported OS target)
-       ;;
+       aix*)
+               ;;
+       linux*)
+               ;;
+       *)
+               AC_MSG_WARN('***' ${host_os}: Unsupported OS target)
+               ;;
 esac
 
-AM_INIT_AUTOMAKE([subdir-objects])
+AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-ustar])
+AM_MAINTAINER_MODE([enable])
 AC_PROG_CC
 AM_PROG_CC_C_O
-
 AC_PROG_RANLIB
+AC_CHECK_TOOL(CC, gcc, [no])
+AC_CHECK_TOOL(LD, ld, [no])
+AC_CHECK_TOOL(AR, ar, [no])
+AC_CHECK_TOOL(OBJDUMP, objdump, [no])
+AC_CHECK_TOOL(STRIP, strip, [no])
 AC_PROG_MAKE_SET
 AC_HEADER_STDC
 AC_HEADER_STAT
 AC_HEADER_TIME
 
+AS_IF([test "x$cross_compiling" = xyes],
+       [case $host_vendor in
+               # The K1OM architecture is an extension of the x86 architecture.
+               # So, the $host_arch is x86_64.
+               k1om)
+                       CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'`
+                       if test $CC_TARGET_ARCH != x86_64-$host_vendor-linux ; then
+                               AC_MSG_ERROR([Cross compiler not found in PATH.])
+                       fi
+                       CCAS=$CC
+                       ;;
+               *)
+                       ;;
+       esac]
+)
+
 if test ${target_cpu} == "powerpc64"; then
        AC_MSG_WARN([set compiler with -m64])
        CC="$CC -m64"
@@ -405,6 +426,51 @@ AC_MSG_RESULT(no)
 CFLAGS="$tmp_flags"
 
 
+AC_MSG_CHECKING(for POSIX 2008 preadv)
+tmp_flags="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Werror"
+AC_TRY_COMPILE([
+#include <sys/uio.h>
+ssize_t preadv (int __fd, const struct iovec *__iovec,
+                int __count, off_t off)
+{
+    return 0;
+}
+],[
+],[
+AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
+AC_MSG_RESULT(yes)
+],[
+AC_MSG_RESULT(no)
+])
+CFLAGS="$tmp_flags"
+
+AC_MSG_CHECKING(for POSIX 2008 scandir)
+tmp_flags="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Werror"
+AC_TRY_COMPILE([
+#define _BSD_SOURCE
+
+#include <stdio.h>
+#include <dirent.h>
+
+int scandir(const char *dir,
+        struct dirent ***namelist,
+        int(*filter)(const struct dirent *),
+        int(*compar)(const struct dirent **,
+                     const struct dirent **)
+       );
+
+],[
+], [
+AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
+AC_MSG_RESULT(yes) 
+],[
+AC_MSG_RESULT(no)
+])
+CFLAGS="$tmp_flags"
+
+
 AC_MSG_CHECKING(whether .text pseudo-op must be used)
 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
 cat > conftest.s <<EOF
@@ -511,4 +577,3 @@ fi
 AC_OUTPUT(
        Makefile
        tests/Makefile)
-