Whamcloud - gitweb
LU-864 test: Hostname name doesn't equal NID and use facet_mntpt
[fs/lustre-release.git] / libsysio / configure.in
index 9f83269..1487c60 100644 (file)
@@ -1,8 +1,10 @@
-AC_INIT(libsysio, 0.1)
+AC_INIT(libsysio, 1.2)
 
-AC_CANONICAL_HOST
+AC_CANONICAL_SYSTEM
 
 case "$host_os" in
+  aix*)
+       ;;
   linux*)
        ;;
   *)
@@ -10,16 +12,21 @@ case "$host_os" in
        ;;
 esac
 
-AM_INIT_AUTOMAKE([subdir-objects])
+AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-ustar])
+AC_PROG_CC
 AM_PROG_CC_C_O
 
-AC_PROG_CC
 AC_PROG_RANLIB
 AC_PROG_MAKE_SET
 AC_HEADER_STDC
 AC_HEADER_STAT
 AC_HEADER_TIME
 
+if test ${target_cpu} == "powerpc64"; then
+       AC_MSG_WARN([set compiler with -m64])
+       CC="$CC -m64"
+fi
+
 have_lib_dir=yes;
 AC_ARG_WITH(lib-dir,
   AC_HELP_STRING([--with-lib-dir=<sysio lib build directory>],
@@ -101,6 +108,28 @@ AC_ARG_WITH(zero-sum-memory,
   [with_zero_sum_memory=no])
 AC_SUBST(ZERO_SUM_MEMORY)
 
+AC_ARG_WITH(defer-init-cwd,
+  AC_HELP_STRING([--with-defer-init-cwd],
+    [defer initialization of current working directory]),
+  [    case "${withval}" in
+        yes) DEFER_INIT_CWD=-DDEFER_INIT_CWD=1 ;;
+        no) ;;
+        *) AC_MSG_ERROR(bad value ${withval} for --with-defer-init-cwd) ;;
+       esac],
+  [with_defer_init_cwd=no])
+AC_SUBST(DEFER_INIT_CWD)
+
+AC_ARG_WITH(tracing,
+  AC_HELP_STRING([--with-tracing],
+    [enable tracing support]),
+  [    case "${withval}" in
+        yes) TRACING=-DSYSIO_TRACING=1 ;;
+        no) ;;
+        *) AC_MSG_ERROR(bad value ${withval} for --with-tracing) ;;
+       esac],
+  [TRACING=-DSYSIO_TRACING=1])
+AC_SUBST(TRACING)
+
 AC_ARG_WITH(cplant_yod,
    AC_HELP_STRING([--with-cplant-yod],[build cplant yod I/O driver]),
    [   case "${withval}" in    
@@ -158,6 +187,16 @@ if test x$with_lustre_hack = xyes; then
        AC_DEFINE(HAVE_LUSTRE_HACK)
 fi
 
+AC_ARG_WITH(alternate-symbols,
+  AC_HELP_STRING([--with-alternate-symbols@<:@=<qualifier>@:>@],
+    [Prepend standard, public, symbols with a unique qualifer]),
+  [    case "${withval}" in
+        yes) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES=sysio_ ;;
+        no) ;;
+        *) SYSIO_LABEL_NAMES=-DSYSIO_LABEL_NAMES="${withval}" ;;
+       esac])
+AC_SUBST(SYSIO_LABEL_NAMES)
+
 # We keep the original values in `$config_*' and never modify them, so we
 # can write them unchanged into config.make.  Everything else uses
 # $machine, $vendor, and $os, and changes them whenever convenient.
@@ -198,6 +237,64 @@ if test "$machine" = rs6000; then
        machine="powerpc"
 fi
 
+case "$host_os" in
+  gnu* | linux*)
+       AC_DEFINE(_XOPEN_SOURCE, 600)
+       ;;
+  aix*)
+       # ... and always needed...
+       AC_DEFINE(__USE_LARGEFILE64)
+       AC_DEFINE(_LARGE_FILES)
+       AC_DEFINE(_LARGE_FILE_API)
+       AC_DEFINE(_ALL_SOURCE)
+       AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
+       ;;
+esac
+
+AC_MSG_CHECKING(for symlink support)
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/stat.h>
+],[
+#ifndef S_ISLNK
+#error
+#endif
+],
+       symlink_support="yes",
+       symlink_support="no"
+)
+AC_MSG_RESULT($symlink_support)
+
+if test x$symlink_support = xyes; then
+       AC_MSG_CHECKING(if readlink returns int)
+       AC_TRY_COMPILE([
+#include <unistd.h>
+       ],[
+               extern int readlink(const char *, char *, size_t);
+       ],
+               readlink_returns_int="yes",
+               readlink_returns_int="no"
+       )
+       AC_MSG_RESULT($readlink_returns_int)
+       if test x$readlink_returns_int = no; then
+               AC_DEFINE(HAVE_POSIX_1003_READLINK,
+                         1,
+                         [readlink returns ssize_t])
+       fi
+fi
+
+AC_MSG_CHECKING(if readlink returns ssize_t)
+AC_TRY_COMPILE([
+       #include <unistd.h>
+],[
+       ssize_t readlink(const char *, char *, size_t);
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
+],[
+       AC_MSG_RESULT([no])
+])
+
 # If we can't provoke the declaration of stat64 then we assume the
 # environment supports 64-bit file support naturally. Beware!
 AC_MSG_CHECKING(whether _LARGEFILE64_SOURCE definition is required)
@@ -235,61 +332,6 @@ fi
 AC_MSG_RESULT($alpha_linux_env)
 AM_CONDITIONAL(TEST_ALPHA_ARG, test x$alpha_linux_env = xyes)
 
-# check for 64 bit stat, fstat, truncate, ftruncate syscalls
-# 
-AC_MSG_CHECKING(for 64 bit stat and truncate syscalls)
-AC_TRY_COMPILE([
-#include <sys/stat.h>
-#include <syscall.h>
-extern int syscall();],
-[char path[] = "/";
-int fd = 0;
-struct stat buf;
-syscall(SYS_stat64,path,&buf);
-syscall(SYS_fstat64,fd,&buf);
-syscall(SYS_truncate64, path, buf.st_size);
-syscall(SYS_ftruncate64, fd, buf.st_size);
-],
-       sysstat64_exists=yes,
-       sysstat64_exists=no)
-AC_MSG_RESULT($sysstat64_exists)
-if test x$sysstat64_exists = xno; then
-       AC_DEFINE(USE_NATIVE_STAT)
-fi
-
-# Check for fdatasync syscall
-#
-AC_MSG_CHECKING(for fdatasync system call)
-if test x$alpha_linux_env = xyes; then
-       _syscallnum=SYS_osf_fdatasync
-else
-       _syscallnum=SYS_fdatasync
-fi
-AC_TRY_COMPILE([
-#include <syscall.h>
-extern int syscall();],
-[int fd = 0;
-syscall(SYS_fdatasync, fd);],
-       syscall_fdatasync_exists=yes,
-       syscall_fdatasync_exists=no)
-AC_MSG_RESULT($syscall_fdatasync_exists)
-if test x$syscall_fdatasync_exists = xyes; then
-       AC_DEFINE_UNQUOTED(NATIVE_FDATASYNC, $_syscallnum)
-fi
-
-# Check for SYS_utime
-#
-AC_MSG_CHECKING(for utime system call)
-AC_TRY_COMPILE([
-#include <syscall.h>
-extern int syscall();],
-[syscall(SYS_utime);],
-       syscall_utime_exists=yes,
-       syscall_utime_exists=no)
-AC_MSG_RESULT($syscall_utime_exists)
-if test x$syscall_utime_exists = xno; then
-       AC_DEFINE(USE_NATIVE_UTIME)
-fi
 # Check for __st_ino 
 #
 AC_MSG_CHECKING(for __st_ino)
@@ -318,50 +360,140 @@ if test x$have_st_gen = xyes; then
        AC_DEFINE(HAVE_GENERATION)
 fi
 
+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(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(sysio_asm_dot_text, [dnl
+AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
 cat > conftest.s <<EOF
        .text
 EOF
-       sysio_asm_dot_text=
+       am_cv_sysio_asm_dot_text=
        if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
-               sysio_asm_dot_text=.text
+               am_cv_sysio_asm_dot_text=.text
        fi
        rm -f conftest*])
-if test -z "$sysio_dot_text"; then
+if test -z "$am_cv_sysio_asm_dot_text"; then
        AC_MSG_RESULT(no)
 else
        AC_MSG_RESULT(yes)
 fi
 
 AC_CACHE_CHECK(for assembler global-symbol directive,
-  sysio_asm_global_directive, [dnl
-sysio_asm_global_directive=UNKNOWN
+  am_cv_sysio_asm_global_directive, [dnl
+am_cv_sysio_asm_global_directive=UNKNOWN
 for ac_globl in .globl .global .EXPORT; do
        cat > conftest.s <<EOF
-               ${sysio_asm_dot_text}
+               ${am_cv_sysio_asm_dot_text}
                ${ac_globl} foo
 foo:
 EOF
        if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
-       sysio_asm_global_directive=${ac_globl}
+       am_cv_sysio_asm_global_directive=${ac_globl}
        fi
        rm -f conftest*
-       test $sysio_asm_global_directive != UNKNOWN && break
+       test $am_cv_sysio_asm_global_directive != UNKNOWN && break
 done])
-if test $sysio_asm_global_directive = UNKNOWN; then
+if test $am_cv_sysio_asm_global_directive = UNKNOWN; then
        AC_MSG_ERROR(cannot determine asm global directive)
 #else
-#      AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${sysio_asm_global_directive})
+#      AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${am_cv_sysio_asm_global_directive})
 fi
 
 AC_CACHE_CHECK(for .set assembler directive,
-  sysio_asm_set_directive, [dnl
+  am_cv_sysio_asm_set_directive, [dnl
 cat > conftest.s<<EOF
-${sysio_asm_dot_text}
+${am_cv_sysio_asm_dot_text}
 foo:
 .set bar, foo
-${sysio_asm_global_directive} bar
+${am_cv_sysio_asm_global_directive} bar
 EOF
        # The alpha-dec-osf1 assembler gives only a warning for `.set'
        # (but it doesn't work), so we must do a linking check to be sure.
@@ -371,53 +503,53 @@ main () { printf ("%d\n", bar); }
 EOF
        if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
           -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
-               sysio_asm_set_directive=yes
+               am_cv_sysio_asm_set_directive=yes
        else
-               sysio_asm_set_directive=no
+               am_cv_sysio_asm_set_directive=no
        fi
        rm -f conftest*])
-#if test $sysio_asm_set_directive = yes; then
+#if test $am_cv_sysio_asm_set_directive = yes; then
 #      AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
 #fi
 
-AC_CACHE_CHECK(for assembler .weak directive, sysio_asm_weak_directive,
+AC_CACHE_CHECK(for assembler .weak directive, am_cv_sysio_asm_weak_directive,
               [dnl
 cat > conftest.s <<EOF
-${sysio_dot_text}
+${am_cv_sysio_asm_dot_text}
 foo:
 .weak foo
 EOF
        if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
-               sysio_asm_weak_directive=yes
+               am_cv_sysio_asm_weak_directive=yes
        else
-               sysio_asm_weak_directive=no
+               am_cv_sysio_asm_weak_directive=no
        fi
        rm -f conftest*])
 
-if test $sysio_asm_weak_directive = no; then
+if test $am_cv_sysio_asm_weak_directive = no; then
        AC_CACHE_CHECK(for assembler .weakext directive,
-                      sysio_asm_weakext_directive, [dnl
+                      am_cv_sysio_asm_weakext_directive, [dnl
 cat > conftest.s <<EOF
-${sysio_dot_text}
-${sysio_asm_global_directive} foo
+${am_cv_sysio_asm_dot_text}
+${am_cv_sysio_asm_global_directive} foo
 foo:
 .weakext bar foo
 .weakext baz
-${sysio_asm_global_directive} baz
+${am_cv_sysio_asm_global_directive} baz
 baz:
 EOF
                if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
-                       sysio_asm_weakext_directive=yes
+                       am_cv_sysio_asm_weakext_directive=yes
                else
-                       sysio_asm_weakext_directive=no
+                       am_cv_sysio_asm_weakext_directive=no
                fi
                rm -f conftest*])
 fi # no .weak
 
-if test x$sysio_asm_weak_directive = xyes; then
+if test x$am_cv_sysio_asm_weak_directive = xyes; then
        AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
 fi
-if test x$sysio_asm_weakext_directive = xyes; then
+if test x$am_cv_sysio_asm_weakext_directive = xyes; then
        AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
 fi