use-strerror-if-available-20030725
[openafs.git] / acinclude.m4
index 248751c..170c6f6 100644 (file)
@@ -39,6 +39,9 @@ AC_ARG_WITH(dux-kernel-headers,
 AC_ARG_WITH(linux-kernel-headers,
 [  --with-linux-kernel-headers=path            use the kernel headers found at path(optional, defaults to /usr/src/linux)]
 )
+AC_ARG_WITH(bsd-kernel-headers,
+[  --with-bsd-kernel-headers=path      use the kernel headers found at path(optional, defaults to /usr/src/sys)]
+)
 AC_ARG_ENABLE(kernel-module,
 [  --disable-kernel-module                     disable compilation of the kernel module (defaults to enabled)],, enable_kernel_module="yes"
 )
@@ -162,10 +165,12 @@ case $system in
                 LINUX_EXPORTS_TASKLIST_LOCK
                 LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
                 LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK
+                LINUX_FS_STRUCT_INODE_HAS_I_ALLOC_SEM
                 LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM
                 LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
                 LINUX_FS_STRUCT_INODE_HAS_I_DEVICES
                 LINUX_INODE_SETATTR_RETURN_TYPE
+                LINUX_KERNEL_LINUX_SYSCALL_H
                 LINUX_NEED_RHCONFIG
                 LINUX_RECALC_SIGPENDING_ARG_TYPE
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_PARENT
@@ -177,13 +182,18 @@ case $system in
                  if test "x$ac_cv_linux_config_modversions" = "xno"; then
                    AC_MSG_WARN([Cannot determine sys_call_table status. assuming it's exported])
                    ac_cv_linux_exports_sys_call_table=yes
+                  if test -f "$LINUX_KERNEL_PATH/include/asm/ia32_unistd.h"; then
+                    ac_cv_linux_exports_ia32_sys_call_table=yes
+                  fi
                  else
                    LINUX_EXPORTS_INIT_MM
                    LINUX_EXPORTS_KALLSYMS_ADDRESS
                    LINUX_EXPORTS_KALLSYMS_SYMBOL
                    LINUX_EXPORTS_SYS_CALL_TABLE
+                   LINUX_EXPORTS_IA32_SYS_CALL_TABLE
                    LINUX_EXPORTS_SYS_CHDIR
                    LINUX_EXPORTS_SYS_CLOSE
+                   LINUX_EXPORTS_SYS_WAIT4
                    if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
                          linux_syscall_method=none
                          if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
@@ -198,20 +208,26 @@ case $system in
                          if test "x$linux_syscall_method" = "xnone"; then
                         AC_MSG_ERROR([no available sys_call_table access method])
                          fi
-                        if test "x$ac_cv_linux_exports_sys_chdir" = "xyes" ; then
-                         AC_DEFINE(EXPORTED_SYS_CHDIR, 1, [define if your linux kernel exports sys_chdir])
-                        fi
-                        if test "x$ac_cv_linux_exports_sys_close" = "xyes" ; then
-                         AC_DEFINE(EXPORTED_SYS_CLOSE, 1, [define if your linux kernel exports sys_close])
-                        fi
                    fi
                  fi
+                if test "x$ac_cv_linux_exports_sys_chdir" = "xyes" ; then
+                 AC_DEFINE(EXPORTED_SYS_CHDIR, 1, [define if your linux kernel exports sys_chdir])
+                fi
+                if test "x$ac_cv_linux_exports_sys_close" = "xyes" ; then
+                 AC_DEFINE(EXPORTED_SYS_CLOSE, 1, [define if your linux kernel exports sys_close])
+                fi
+                if test "x$ac_cv_linux_exports_sys_wait4" = "xyes" ; then
+                 AC_DEFINE(EXPORTED_SYS_WAIT4, 1, [define if your linux kernel exports sys_wait4])
+                fi
                 if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then
                  AC_DEFINE(EXPORTED_TASKLIST_LOCK, 1, [define if your linux kernel exports tasklist_lock])
                 fi
                  if test "x$ac_cv_linux_exports_sys_call_table" = "xyes"; then
                   AC_DEFINE(EXPORTED_SYS_CALL_TABLE)
                  fi
+                 if test "x$ac_cv_linux_exports_ia32_sys_call_table" = "xyes"; then
+                  AC_DEFINE(EXPORTED_IA32_SYS_CALL_TABLE)
+                 fi
                  if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
                   AC_DEFINE(EXPORTED_KALLSYMS_SYMBOL)
                  fi
@@ -239,6 +255,9 @@ case $system in
                 if test "x$ac_cv_linux_fs_struct_inode_has_i_truncate_sem" = "xyes"; then 
                  AC_DEFINE(STRUCT_INODE_HAS_I_TRUNCATE_SEM, 1, [define if your struct inode has truncate_sem])
                 fi
+                if test "x$ac_cv_linux_fs_struct_inode_has_i_alloc_sem" = "xyes"; then 
+                 AC_DEFINE(STRUCT_INODE_HAS_I_ALLOC_SEM, 1, [define if your struct inode has alloc_sem])
+                fi
                 if test "x$ac_cv_linux_fs_struct_inode_has_i_devices" = "xyes"; then 
                  AC_DEFINE(STRUCT_INODE_HAS_I_DEVICES, 1, [define if you struct inode has i_devices])
                 fi
@@ -248,6 +267,9 @@ case $system in
                 if test "x$ac_cv_linux_func_recalc_sigpending_takes_void" = "xyes"; then 
                  AC_DEFINE(RECALC_SIGPENDING_TAKES_VOID, 1, [define if your recalc_sigpending takes void])
                 fi
+                if test "x$ac_linux_syscall" = "xyes" ; then
+                 AC_DEFINE(HAVE_KERNEL_LINUX_SYSCALL_H, 1, [define if your linux kernel has linux/syscall.h])
+                fi
                 if test "x$ac_cv_linux_sched_struct_task_struct_has_parent" = "xyes"; then 
                  AC_DEFINE(STRUCT_TASK_STRUCT_HAS_PARENT, 1, [define if your struct task_struct has parent])
                 fi
@@ -536,11 +558,33 @@ else
                        fi
                        _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
                        AFS_SYSNAME="$_AFS_SYSNAME"
+                       if test -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then
+                        AFS_ISUML=`awk '$[]2 == "CONFIG_USERMODE"{print $[]3}' $LINUX_KERNEL_PATH/include/linux/autoconf.h`
+                        if test "x${AFS_ISUML}" = "x1"; then
+                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
+                        fi
+                        AFS_SYSNAME="$_AFS_SYSNAME"
+                       fi
                        ;;
        esac
         AC_MSG_RESULT($AFS_SYSNAME)
 fi
 
+# KDUMP64 defaults to KDUMP for systems without a separate kdump64
+KDUMP64='${KDUMP}'
+KDUMP=kdump
+case $AFS_SYSNAME in
+       sgi_6?)
+               KDUMP=kdump.IP20;;
+       sun4x_5[789] | hp_ux11*)
+               KDUMP=kdump32
+               KDUMP64=kdump64;;
+       *linux*)
+               KDUMP='kdump-${LINUX_VERSION}';;
+esac
+AC_SUBST(KDUMP)
+AC_SUBST(KDUMP64)
+
 case $AFS_SYSNAME in
        *_darwin*)
                DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
@@ -619,17 +663,30 @@ else
         done    
   fi    
 
-  AC_CHECK_FUNCS(res_search)
+  openafs_save_libs="$LIBS"
+  AC_MSG_CHECKING([for res_search])
+  AC_FUNC_RES_SEARCH
+
   if test "$ac_cv_func_res_search" = no; then
-        for lib in dns nsl resolv; do
-          if test "$HAVE_RES_SEARCH" != 1; then
-            AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH, 1, [define if you have res_search]))
-          fi
-        done    
-       if test "$HAVE_RES_SEARCH" = 1; then
-         LIB_res_search="-l$lib"       
-       fi
-  fi    
+      for lib in dns nsl resolv; do
+        if test "$ac_cv_func_res_search" != yes; then
+         LIBS="-l$lib $LIBS"
+          AC_FUNC_RES_SEARCH
+          LIBS="$openafs_save_libs"
+        fi
+      done    
+      if test "$ac_cv_func_res_search" = yes; then
+        LIB_res_search="-l$lib"       
+       AC_DEFINE(HAVE_RES_SEARCH, 1, [])
+        AC_MSG_RESULT([yes, in lib$lib])
+      else
+        AC_MSG_RESULT(no)
+      fi
+  else
+    AC_DEFINE(HAVE_RES_SEARCH, 1, [])
+    AC_MSG_RESULT(yes)
+  fi
+  
 fi
 
 PTHREAD_LIBS=error
@@ -661,6 +718,12 @@ if test "$enable_insecure" = "yes"; then
        WITH_INSECURE=YES
 fi
 
+if test "x$with_bsd_kernel_headers" != "x"; then
+       BSD_KERNEL_PATH="$with_bsd_kernel_headers"
+else
+       BSD_KERNEL_PATH="/usr/src/sys"
+fi
+
 # Fast restart
 if test "$enable_supergroups" = "yes"; then
        AC_DEFINE(SUPERGROUPS, 1, [define if you want to have support for nested pts groups])
@@ -722,13 +785,20 @@ AC_HEADER_SYS_WAIT
 AC_HEADER_DIRENT
 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
-AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
+AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h)
 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h)
 
-AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
-AC_CHECK_FUNCS(setprogname getprogname sigaction)
+if test "$ac_cv_header_security_pam_modules_h" = "yes"; then
+       HAVE_PAM="yes"
+else
+       HAVE_PAM="no"
+fi
+AC_SUBST(HAVE_PAM)
+
+AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec)
+AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror)
 AC_CHECK_TYPE(ssize_t, int)
 AC_SIZEOF_TYPE(long)
 
@@ -781,6 +851,7 @@ AC_SUBST(AFS_PARAM_COMMON)
 AC_SUBST(ENABLE_KERNEL_MODULE)
 AC_SUBST(LIB_AFSDB)
 AC_SUBST(LINUX_KERNEL_PATH)
+AC_SUBST(BSD_KERNEL_PATH)
 AC_SUBST(LINUX_VERSION)
 AC_SUBST(MKAFS_OSTYPE)
 AC_SUBST(TOP_OBJDIR)
@@ -814,5 +885,10 @@ if test "${DEST}x" = "x"; then
         DEST="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest"
 fi
 
+HELPER_SPLINT="${TOP_SRCDIR}/helper-splint.sh"
+HELPER_SPLINTCFG="${TOP_SRCDIR}/splint.cfg"
+AC_SUBST(HELPER_SPLINT)
+AC_SUBST(HELPER_SPLINTCFG)
+
 
 ])