19 kx dnl Process this file with autoconf to produce a configure script.
19 kx AC_INIT([fakeroot],[1.31],[clint@debian.org],[fakeroot])
19 kx AC_PREREQ([2.71])
19 kx AC_CONFIG_MACRO_DIR([build-aux])
19 kx LT_PREREQ(2.1a)
19 kx AC_CANONICAL_TARGET
19 kx AM_INIT_AUTOMAKE
19 kx AM_MAINTAINER_MODE
19 kx AC_CONFIG_HEADERS([config.h])
19 kx AC_PROG_CPP
19 kx AC_PROG_MAKE_SET
19 kx LT_INIT
19 kx LT_LANG(C)
19 kx
19 kx AH_BOTTOM([#if ! HAVE_BUILTIN_EXPECT
19 kx #define __builtin_expect(x, expected_value) (x)
19 kx #endif])
19 kx
19 kx AC_ARG_WITH([ipc],
19 kx AS_HELP_STRING([--with-ipc@<:@=IPCTYPE@:>@],
19 kx [method of IPC to use: either sysv (default) or tcp]),
19 kx [ac_cv_use_ipc=$withval],
19 kx [ac_cv_use_ipc=sysv])
19 kx
19 kx AC_CACHE_CHECK([which IPC method to use],
19 kx [ac_cv_use_ipc],
19 kx [ac_cv_use_ipc=sysv])
19 kx
19 kx if test $ac_cv_use_ipc = "sysv"; then
19 kx AC_MSG_CHECKING([whether SysV IPC message queues are actually working on the host])
19 kx
19 kx AC_LANG_PUSH(C)
19 kx AC_RUN_IFELSE([AC_LANG_SOURCE([[
19 kx #include <stdlib.h>
19 kx #include <sys/types.h>
19 kx #include <sys/ipc.h>
19 kx #include <sys/msg.h>
19 kx #include <time.h>
19 kx #include <unistd.h>
19 kx
19 kx int main() {
19 kx
19 kx srandom(time(NULL)+getpid()*33151);
19 kx key_t msg_key = random();
19 kx int msg_get = msgget(msg_key, IPC_CREAT|0600);
19 kx
19 kx if (msg_get==-1) {
19 kx return 1;
19 kx } else {
19 kx msgctl(msg_get, IPC_RMID, NULL);
19 kx return 0;
19 kx }
19 kx
19 kx }]])],[ac_cv_use_ipc=sysv],[ac_cv_use_ipc=tcp],[ac_cv_use_ipc=cross])
19 kx
19 kx if test $ac_cv_use_ipc = cross; then
19 kx approved=
19 kx case $host_os in
19 kx linux-gnu*)
19 kx approved=yes
19 kx ;;
19 kx *)
19 kx approved=no
19 kx ;;
19 kx esac
19 kx if test "$approved" = "yes"; then
19 kx ac_cv_use_ipc=sysv
19 kx AC_MSG_RESULT([cross, guessing yes])
19 kx else
19 kx (set -o posix; set)
19 kx AC_MSG_ERROR([cross compiling, unknown result for $host_os])
19 kx fi
19 kx elif test $ac_cv_use_ipc = "tcp"; then
19 kx AC_MSG_RESULT([No, using TCP])
19 kx else
19 kx AC_MSG_RESULT([Yes])
19 kx fi
19 kx
19 kx AC_LANG_POP(C)
19 kx fi
19 kx
19 kx AC_ARG_WITH([dbformat],
19 kx AS_HELP_STRING([--with-dbformat@<:@=DBFORMAT@:>@],
19 kx [database format to use: either inode (default) or path]),
19 kx [ac_cv_dbformat=$withval],
19 kx [ac_cv_dbformat=inode])
19 kx
19 kx AC_CACHE_CHECK([which database format to use],
19 kx [ac_cv_dbformat],
19 kx [ac_cv_dbformat=inode])
19 kx
19 kx AH_TEMPLATE([FAKEROOT_DB_PATH], [store path in the database instead of inode and device])
19 kx if test $ac_cv_dbformat = "path"; then
19 kx AC_DEFINE_UNQUOTED(FAKEROOT_DB_PATH, [1])
19 kx fi
19 kx
19 kx dnl Checks for programs.
19 kx
19 kx dnl Checks for libraries.
19 kx dnl Replace `main' with a function in -ldl:
19 kx AC_CHECK_LIB(dl, dlopen)
19 kx AH_TEMPLATE([FAKEROOT_FAKENET], [use TCP instead of SysV IPC])
19 kx if test $ac_cv_use_ipc = "tcp"; then
19 kx AC_DEFINE_UNQUOTED(FAKEROOT_FAKENET, [TCP])
19 kx AC_CHECK_LIB(pthread, pthread_self)
19 kx AC_CHECK_LIB(socket, connect)
19 kx signal=HUP
19 kx else
19 kx signal=TERM
19 kx fi
19 kx
19 kx AC_SUBST(signal)
19 kx
19 kx dnl Checks for header files.
19 kx AC_HEADER_DIRENT
19 kx AC_CHECK_HEADERS(fcntl.h unistd.h features.h sys/feature_tests.h pthread.h stdint.h inttypes.h grp.h endian.h sys/sysmacros.h sys/socket.h sys/acl.h sys/capability.h sys/xattr.h fts.h)
19 kx
19 kx dnl Checks for typedefs, structures, and compiler characteristics.
19 kx AC_C_CONST
19 kx AC_CHECK_TYPE(mode_t, int)
19 kx AC_CHECK_TYPE(off_t, long)
19 kx AC_CHECK_TYPE(size_t, unsigned)
19 kx
19 kx AH_TEMPLATE([FAKEROOT_ATTR], [for packed])
19 kx if test -n "$GCC";
19 kx then
19 kx AC_DEFINE_UNQUOTED(FAKEROOT_ATTR(x), [__attribute__ ((x))])
19 kx else
19 kx AC_DEFINE_UNQUOTED(FAKEROOT_ATTR(x), [])
19 kx fi
19 kx
19 kx dnl The parameters to the wrapped functions have to match
19 kx dnl those in the system header files. I don't know how to
19 kx dnl really get the names of the paramters, but this seems to work.
19 kx AC_MSG_CHECKING([for return value and second and third argument of readlink])
19 kx readlink_buf_arg=unknown
19 kx readlink_bufsize_arg=unknown
19 kx for zeroth in ssize_t int; do
19 kx for second in void char; do
19 kx for third in size_t int; do
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
19 kx #include <stdio.h>
19 kx $zeroth readlink(const char *path, $second *buf, $third bufsiz);]], [[puts("hello, world");]])],
19 kx [readlink_retval=$zeroth
19 kx readlink_buf_arg=$second
19 kx readlink_bufsize_arg=$third
19 kx ],[])
19 kx done
19 kx done
19 kx done
19 kx AC_MSG_RESULT([$readlink_retval, $readlink_buf_arg, $readlink_bufsize_arg])
19 kx AH_TEMPLATE([READLINK_RETVAL_TYPE], [type of readlink return value])
19 kx AH_TEMPLATE([READLINK_BUF_TYPE], [type of readlink buf])
19 kx AH_TEMPLATE([READLINK_BUFSIZE_TYPE], [type of readlink bufsize])
19 kx AC_DEFINE_UNQUOTED(READLINK_RETVAL_TYPE, $readlink_retval)
19 kx AC_DEFINE_UNQUOTED(READLINK_BUF_TYPE, $readlink_buf_arg)
19 kx AC_DEFINE_UNQUOTED(READLINK_BUFSIZE_TYPE, $readlink_bufsize_arg)
19 kx
19 kx AC_MSG_CHECKING([for first argument of setgroups])
19 kx setgroups_size_arg=unknown
19 kx for first in size_t int; do
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _BSD_SOURCE
19 kx #ifdef HAVE_SYS_TYPES_H
19 kx #include <sys/types.h>
19 kx #endif
19 kx #include <unistd.h>
19 kx #include <stdio.h>
19 kx #ifdef HAVE_GRP_H
19 kx #include <grp.h>
19 kx #endif
19 kx int setgroups($first size, const gid_t *list);]], [[puts("hello, world");]])],[setgroups_size_arg=$first],[])
19 kx done
19 kx AC_MSG_RESULT([$setgroups_size_arg])
19 kx AH_TEMPLATE([SETGROUPS_SIZE_TYPE], [type of setgroups size])
19 kx AC_DEFINE_UNQUOTED(SETGROUPS_SIZE_TYPE, $setgroups_size_arg)
19 kx
19 kx
19 kx AH_TEMPLATE([HAVE_SEMUN_DEF], [have the semun union])
19 kx AC_MSG_CHECKING([for union semun])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx # include <sys/types.h>
19 kx # include <sys/ipc.h>
19 kx # include <sys/sem.h>
19 kx ]], [[
19 kx union semun s;
19 kx ]])],[AC_DEFINE(HAVE_SEMUN_DEF)
19 kx AC_MSG_RESULT([yes])
19 kx ],[ AC_MSG_RESULT([no])
19 kx ])
19 kx
19 kx AH_TEMPLATE([XMKNOD_FRTH_ARG], [fourth argument of __xmknod])
19 kx dnl glibc uses `* dev' as fourth argument of __xmknod.
19 kx dnl Although the test below should probably be more general
19 kx dnl (not just __xmknod, but also mknod etc), at the moment this
19 kx dnl seems enough, as probably glibc is the only that does this.
19 kx AC_MSG_CHECKING([for type of arg of __xmknod])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/types.h>
19 kx #include <sys/stat.h>
19 kx #include <fcntl.h>
19 kx #include <unistd.h>
19 kx ]], [[
19 kx #ifndef __GLIBC__
19 kx #error no extra *
19 kx #endif
19 kx int __xmknod ( int ver,
19 kx const char *pathname ,
19 kx mode_t mode , dev_t *dev);
19 kx ]])],[
19 kx AC_DEFINE(XMKNOD_FRTH_ARG,[*])
19 kx AC_MSG_RESULT([needs *])
19 kx ],[
19 kx AC_DEFINE(XMKNOD_FRTH_ARG,)
19 kx AC_MSG_RESULT([no extra *])
19 kx
19 kx ])
19 kx
19 kx dnl Possibly this should only be done if we actually have mknodat
19 kx dnl on the system. Nothing breaks by running the test itself though.
19 kx AH_TEMPLATE([XMKNODAT_FIFTH_ARG], [fifth argument of __xmknodat])
19 kx dnl glibc uses `* dev' as fifth argument of __xmknodat.
19 kx dnl Although the test below should probably be more general
19 kx dnl (not just __xmknodat, but also mknod etc), at the moment this
19 kx dnl seems enough, as probably glibc is the only that does this.
19 kx AC_MSG_CHECKING([for type of arg of __xmknodat])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/types.h>
19 kx #include <sys/stat.h>
19 kx #include <fcntl.h>
19 kx #include <unistd.h>
19 kx ]], [[
19 kx #ifndef __GLIBC__
19 kx #error no extra *
19 kx #endif
19 kx int __xmknodat ( int ver,
19 kx int dirfd,
19 kx const char *pathname ,
19 kx mode_t mode , dev_t *dev);
19 kx ]])],[
19 kx AC_DEFINE(XMKNODAT_FIFTH_ARG,[*])
19 kx AC_MSG_RESULT([needs *])
19 kx ],[
19 kx AC_DEFINE(XMKNODAT_FIFTH_ARG,)
19 kx AC_MSG_RESULT([no extra *])
19 kx
19 kx ])
19 kx
19 kx AH_TEMPLATE([INITGROUPS_SECOND_ARG], [second argument of initgroups])
19 kx dnl FreeBSD 4.7 uses int instead of gid_t
19 kx AC_MSG_CHECKING([for type of arg of initgroups])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/types.h>
19 kx #include <unistd.h>
19 kx ]], [[
19 kx int initgroups ( const char *user, gid_t group );
19 kx ]])],[
19 kx AC_DEFINE(INITGROUPS_SECOND_ARG, gid_t)
19 kx AC_MSG_RESULT([gid_t])
19 kx ],[
19 kx AC_DEFINE(INITGROUPS_SECOND_ARG, int)
19 kx AC_MSG_RESULT([not gid_t; will assume int])
19 kx ])
19 kx
19 kx AH_TEMPLATE([SETREUID_ARG], [argument of setreuid])
19 kx dnl OpenBSD 2.8 uses int instead of uid_t
19 kx AC_MSG_CHECKING([for type of arg of setreuid])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/types.h>
19 kx #include <unistd.h>
19 kx ]], [[
19 kx int setreuid ( uid_t ruid, uid_t euid );
19 kx ]])],[
19 kx AC_DEFINE(SETREUID_ARG, gid_t)
19 kx AC_MSG_RESULT([gid_t])
19 kx ],[
19 kx AC_DEFINE(SETREUID_ARG, int)
19 kx AC_MSG_RESULT([not uid_t; will assume int])
19 kx ])
19 kx
19 kx AH_TEMPLATE([SETREGID_ARG], [argument of setregid])
19 kx dnl OpenBSD 2.8 uses int instead of gid_t
19 kx AC_MSG_CHECKING([for type of arg of setregid])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/types.h>
19 kx #include <unistd.h>
19 kx ]], [[
19 kx int setreuid ( gid_t rgid, gid_t egid );
19 kx ]])],[
19 kx AC_DEFINE(SETREGID_ARG, gid_t)
19 kx AC_MSG_RESULT([gid_t])
19 kx ],[
19 kx AC_DEFINE(SETREGID_ARG, int)
19 kx AC_MSG_RESULT([not gid_t; will assume int])
19 kx ])
19 kx
19 kx AH_TEMPLATE([STAT_SECOND_ARG], [second argument of stat])
19 kx dnl Tru64 or something uses stat * instead of struct stat *
19 kx AC_MSG_CHECKING([for type of second arg to stat])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/stat.h>
19 kx #include <sys/types.h>
19 kx #include <unistd.h>
19 kx ]], [[
19 kx int stat ( const char *file_name, struct stat *buf);
19 kx ]])],[
19 kx AC_DEFINE(STAT_SECOND_ARG, struct stat *)
19 kx AC_MSG_RESULT([struct stat *])
19 kx ],[
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/stat.h>
19 kx #include <sys/types.h>
19 kx #include <unistd.h>
19 kx ]], [[
19 kx int stat ( const char *file_name, stat *buf);
19 kx ]])],[
19 kx AC_DEFINE(STAT_SECOND_ARG, stat *)
19 kx AC_MSG_RESULT([stat *])
19 kx ],[
19 kx AC_MSG_ERROR(cannot determine second stat argument)
19 kx ])
19 kx ])
19 kx
19 kx for field in d_off d_type; do
19 kx AC_MSG_CHECKING([for ${field} in struct dirent])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/types.h>
19 kx #include <dirent.h>
19 kx ]], [[
19 kx
19 kx struct dirent d;
19 kx d.${field}=0
19 kx ]])],[AC_DEFINE_UNQUOTED(STAT_HAS_${field},1)
19 kx AC_MSG_RESULT([yes])
19 kx ],[ AC_MSG_RESULT([no])
19 kx ])
19 kx done
19 kx
19 kx AH_TEMPLATE([HAVE_ACL_T], [acl_t data type and associated functions are provided by OS])
19 kx AC_MSG_CHECKING([for acl_t struct])
19 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
19 kx #include <sys/types.h>
19 kx #include <sys/acl.h>
19 kx ]], [[
19 kx acl_t t;
19 kx ]])],[AC_DEFINE_UNQUOTED(HAVE_ACL_T,1)
19 kx AC_MSG_RESULT([yes])
19 kx ],[ AC_MSG_RESULT([no])
19 kx ])
19 kx
19 kx AC_CHECK_FUNCS(fchmodat fchownat fstatat mkdirat mknodat openat renameat unlinkat lchmod fgetattrlist fchown32)
19 kx
19 kx save_LIBS="$LIBS"
19 kx # Linux
19 kx AC_SEARCH_LIBS(acl_get_fd, acl)
19 kx AC_CHECK_FUNCS(acl_get_fd)
19 kx
19 kx # Illumos
19 kx AC_SEARCH_LIBS(acl_trivial, sec)
19 kx AC_CHECK_FUNCS(acl_trivial)
19 kx LIBS="$save_LIBS"
19 kx
19 kx AC_CHECK_FUNCS(capset listxattr llistxattr flistxattr getxattr lgetxattr fgetxattr setxattr lsetxattr fsetxattr removexattr lremovexattr fremovexattr)
19 kx
19 kx AC_CHECK_FUNCS(statx)
19 kx
19 kx dnl find out how stat() etc are called. On linux systems, we really
19 kx dnl need to wrap (IIRC):
19 kx dnl Linux : __xstat
19 kx dnl Solaris <=9 : _stat
19 kx dnl Solaris 10 : _xstat
19 kx dnl Digital Unix: stat
19 kx
19 kx time64_hack=no
19 kx AH_TEMPLATE([TIME64_HACK], [time64 shuffle])
19 kx AC_MSG_CHECKING([if we need to cope with time64])
19 kx AC_EGREP_CPP([time64],[
19 kx #include <bits/wordsize.h>
19 kx #if __WORDSIZE == 32
19 kx #define __USE_TIME_BITS64 1
19 kx #include <sys/stat.h>
19 kx stat
19 kx #else
19 kx NO
19 kx #endif
19 kx ],
19 kx [AC_MSG_RESULT([yes]); AC_DEFINE(TIME64_HACK)
19 kx time64_hack=yes
19 kx ],
19 kx [AC_MSG_RESULT([no]);])
19 kx
19 kx :>fakerootconfig.h.tmp
19 kx
19 kx for SEARCH in %stat f%stat l%stat f%statat %stat64 f%stat64 l%stat64 f%statat64 %mknod %mknodat; do
19 kx FUNC=`echo $SEARCH|sed -e 's/.*%//'`
19 kx PRE=`echo $SEARCH|sed -e 's/%.*//'`
19 kx FOUND=
19 kx for WRAPPED in __${PRE}x${FUNC} _${PRE}x${FUNC} __${PRE}${FUNC}13 ${PRE}${FUNC} __${PRE}${FUNC}; do
19 kx AC_CHECK_FUNCS($WRAPPED,FOUND=$WRAPPED)
19 kx dnl
19 kx dnl to unconditionally define only the _* functions, comment out the 2 lines above,
19 kx dnl and uncomment the 2 lines below.
19 kx dnl
19 kx dnl for WRAPPED in _${PRE}${FUNC}; do
19 kx dnl FOUND=$WRAPPED
19 kx if test -n "$FOUND"; then
19 kx PF=[`echo ${PRE}${FUNC}| tr '[a-z]' '[A-Z]'`]
19 kx DEFINE_WRAP=[`echo wrap_${PRE}${FUNC}| tr '[a-z]' '[A-Z]'`]
19 kx DEFINE_NEXT=[`echo wrap_${FOUND}| tr '[a-z]' '[A-Z]'`]
19 kx DEFINE_ARG=[`echo wrap_${FOUND}| tr '[a-z]' '[A-Z]'`]
19 kx AC_DEFINE_UNQUOTED(WRAP_${PF}, $FOUND)
19 kx AC_DEFINE_UNQUOTED(WRAP_${PF}_RAW, $FOUND)
19 kx AC_DEFINE_UNQUOTED(WRAP_${PF}_QUOTE, "$FOUND")
19 kx AC_DEFINE_UNQUOTED(TMP_${PF}, tmp_$FOUND)
19 kx AC_DEFINE_UNQUOTED(NEXT_${PF}_NOARG, next_$FOUND)
19 kx if test __"${PRE}x${FUNC}" != "${WRAPPED}" && test _"${PRE}x${FUNC}" != "${WRAPPED}" ; then
19 kx DEF_BEGIN=""
19 kx else
19 kx DEF_BEGIN="a,"
19 kx fi
19 kx if test "${FUNC}" = "mknod"; then
19 kx DEF_END=",d"
19 kx elif test "${FUNC}" = "mknodat"; then
19 kx DEF_END=",d,e"
19 kx elif test "${FUNC}" = "statat"; then
19 kx DEF_END=",d,e"
19 kx elif test "${FUNC}" = "statat64"; then
19 kx DEF_END=",d,e"
19 kx else
19 kx DEF_END=""
19 kx fi
19 kx dnl no matter what I do, the resulting define looks like
19 kx dnl #define macro (a,b,c) (a,b,c)
19 kx dnl with a space in between "macro" and "(". To prevent this,
19 kx dnl I leave the space here, and remove it later with sed
19 kx dnl at (end of configure.in)
19 kx dnl AC_DEFINE_UNQUOTED(NEXT_${PF}(a,b,c${DEF_END}),
19 kx dnl next_$FOUND(${DEF_BEGIN}b,c${DEF_END}))
19 kx dnl AC_DEFINE_UNQUOTED(${PF}[_ARG(a,b,c${DEF_END})],
19 kx dnl (${DEF_BEGIN}b,c${DEF_END}))
19 kx
19 kx dnl Anyway the trickery above also leads to automake problems
19 kx dnl (tries to remake config.h.in, but fails). So, as a way
19 kx dnl out, Yann DIRSON wrote this:
19 kx {
19 kx echo "#define NEXT_${PF}(a,b,c${DEF_END}) next_$FOUND(${DEF_BEGIN}b,c${DEF_END})"
19 kx echo "#define ${PF}_ARG(a,b,c${DEF_END}) (${DEF_BEGIN}b,c${DEF_END})"
19 kx } >>fakerootconfig.h.tmp
19 kx
19 kx break
19 kx fi
19 kx done
19 kx done
19 kx
19 kx if test "x$time64_hack" = "xyes"; then
19 kx for SEARCH in stat64_time64 fstat64_time64 lstat64_time64 fstatat64_time64; do
19 kx FOUND=
19 kx for WRAPPED in __${SEARCH} ${SEARCH}; do
19 kx AC_CHECK_FUNCS($WRAPPED,FOUND=$WRAPPED)
19 kx if test -n "$FOUND"; then
19 kx PF=[`echo ${SEARCH}| tr '[a-z]' '[A-Z]'`]
19 kx DEFINE_WRAP=[`echo wrap_${SEARCH}| tr '[a-z]' '[A-Z]'`]
19 kx DEFINE_NEXT=[`echo wrap_${FOUND}| tr '[a-z]' '[A-Z]'`]
19 kx DEFINE_ARG=[`echo wrap_${FOUND}| tr '[a-z]' '[A-Z]'`]
19 kx AC_DEFINE_UNQUOTED(WRAP_${PF}, $FOUND)
19 kx AC_DEFINE_UNQUOTED(WRAP_${PF}_RAW, $FOUND)
19 kx AC_DEFINE_UNQUOTED(WRAP_${PF}_QUOTE, "$FOUND")
19 kx AC_DEFINE_UNQUOTED(TMP_${PF}, tmp_$FOUND)
19 kx AC_DEFINE_UNQUOTED(NEXT_${PF}_NOARG, next_$FOUND)
19 kx DEF_BEGIN=""
19 kx case "$SEARCH" in
19 kx (*statat64_time64)
19 kx DEF_END=",d,e"
19 kx ;;
19 kx (*)
19 kx DEF_END=""
19 kx ;;
19 kx esac
19 kx {
19 kx echo "#define NEXT_${PF}(a,b,c${DEF_END}) next_$FOUND(${DEF_BEGIN}b,c${DEF_END})"
19 kx echo "#define ${PF}_ARG(a,b,c${DEF_END}) (${DEF_BEGIN}b,c${DEF_END})"
19 kx } >>fakerootconfig.h.tmp
19 kx
19 kx break
19 kx fi
19 kx done
19 kx done
19 kx fi
19 kx
19 kx if test -r fakerootconfig.h
19 kx then
19 kx if test "`diff fakerootconfig.h fakerootconfig.h.tmp`" = ""
19 kx then
19 kx AC_MSG_RESULT([fakerootconfig.h not changed])
19 kx rm fakerootconfig.h.tmp
19 kx else
19 kx AC_MSG_RESULT([recreated fakerootconfig.h])
19 kx rm fakerootconfig.h ; mv fakerootconfig.h.tmp fakerootconfig.h
19 kx fi
19 kx else
19 kx AC_MSG_RESULT([created fakerootconfig.h])
19 kx mv fakerootconfig.h.tmp fakerootconfig.h
19 kx fi
19 kx
19 kx dnl This should really be done intelligently.
19 kx DLSUFFIX=".so"
19 kx LDLIBPATHVAR="LD_LIBRARY_PATH"
19 kx LDPRELOADVAR="LD_PRELOAD"
19 kx LDPRELOADABS=0
19 kx LDEXTRAVAR=""
19 kx case $target_cpu:$target_os in
19 kx (alpha*:linux*|ia64*:linux*)
19 kx libcpath="/lib/libc.so.6.1"
19 kx ;;
19 kx (*:linux*)
19 kx libcpath="/lib/libc.so.6"
19 kx ;;
19 kx (*:k*bsd*-gnu)
19 kx libcpath="/lib/libc.so.0.1"
19 kx ;;
19 kx (*:freebsd*)
19 kx libcpath="/usr/lib/libc.so.4"
19 kx ;;
19 kx (*:netbsd*)
19 kx libcpath="/usr/lib/libc.so.12"
19 kx ;;
19 kx (*:openbsd*|*:mirbsd*)
19 kx libcpath=$(/bin/ls -1 /usr/lib/libc.so.* | \
19 kx sort -nt. -k3 | tail -1)
19 kx ;;
19 kx (*:midnightbsd*)
19 kx libcpath=$(/bin/ls -1 /lib/libc.so.* | \
19 kx sort -nt. -k3 | tail -1)
19 kx ;;
19 kx (*:hpux*)
19 kx libcpath="/usr/lib/hpux32/libc.so.1"
19 kx ;;
19 kx (*:osf*)
19 kx libcpath="/shlib/libc.so"
19 kx ;;
19 kx (*:solaris*)
19 kx libcpath="/lib/libc.so.1"
19 kx ;;
19 kx (*:darwin*)
19 kx libcpath="/usr/lib/libSystem.dylib"
19 kx DLSUFFIX=".dylib"
19 kx LDLIBPATHVAR="DYLD_LIBRARY_PATH"
19 kx LDPRELOADVAR="DYLD_INSERT_LIBRARIES"
19 kx LDPRELOADABS=1
19 kx ;;
19 kx (*)
19 kx AC_MSG_WARN([don't know where libc is for $target_os on
19 kx $target_cpu, setting to /lib/libc.so])
19 kx libcpath="/lib/libc.so"
19 kx ;;
19 kx esac
19 kx
19 kx AC_DEFINE_UNQUOTED([LIBCPATH], "$libcpath", [path to libc shared object])
19 kx AC_SUBST(DLSUFFIX)
19 kx AC_SUBST(LDLIBPATHVAR)
19 kx AC_SUBST(LDPRELOADVAR)
19 kx AC_SUBST(LDPRELOADABS)
19 kx AC_SUBST(LDEXTRAVAR)
19 kx
19 kx dnl Checks for library functions.
19 kx AC_CHECK_FUNCS(strdup strstr getresuid setresuid getresgid setresgid setfsuid setfsgid fts_read fts_children)
19 kx
19 kx AC_CHECK_DECLS([setenv, unsetenv])
19 kx AC_REPLACE_FUNCS([setenv])
19 kx
19 kx dnl Checks for __builtin_expect
19 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]],
19 kx [[]])],[AC_DEFINE([HAVE_BUILTIN_EXPECT], 1,
19 kx [Define to 1 if the compiler understands __builtin_expect.])],[])
19 kx
19 kx dnl kludge
19 kx AH_VERBATIM([WRAP_STAT],
19 kx [/* Stuff. */
19 kx #define WRAP_STAT __astat
19 kx #define WRAP_STAT_QUOTE __astat
19 kx #define WRAP_STAT_RAW __astat
19 kx #define TMP_STAT __astat
19 kx #define NEXT_STAT_NOARG next___astat
19 kx
19 kx #define WRAP_LSTAT_QUOTE __astat
19 kx #define WRAP_LSTAT __astat
19 kx #define WRAP_LSTAT_RAW __astat
19 kx #define TMP_LSTAT __astat
19 kx #define NEXT_LSTAT_NOARG next___astat
19 kx
19 kx #define WRAP_FSTAT_QUOTE __astat
19 kx #define WRAP_FSTAT __astat
19 kx #define WRAP_FSTAT_RAW __astat
19 kx #define TMP_FSTAT __astat
19 kx #define NEXT_FSTAT_NOARG next___astat
19 kx
19 kx #define WRAP_FSTATAT_QUOTE __astatat
19 kx #define WRAP_FSTATAT __astatat
19 kx #define WRAP_FSTATAT_RAW __astatat
19 kx #define TMP_FSTATAT __astatat
19 kx #define NEXT_FSTATAT_NOARG next___astatat
19 kx
19 kx #define WRAP_STAT64_QUOTE __astat64
19 kx #define WRAP_STAT64 __astat64
19 kx #define WRAP_STAT64_RAW __astat64
19 kx #define TMP_STAT64 __astat64
19 kx #define NEXT_STAT64_NOARG next___astat64
19 kx
19 kx #define WRAP_LSTAT64_QUOTE __astat64
19 kx #define WRAP_LSTAT64 __astat64
19 kx #define WRAP_LSTAT64_RAW __astat64
19 kx #define TMP_LSTAT64 __astat64
19 kx #define NEXT_LSTAT64_NOARG next___astat64
19 kx
19 kx #define WRAP_FSTAT64_QUOTE __astat64
19 kx #define WRAP_FSTAT64 __astat64
19 kx #define WRAP_FSTAT64_RAW __astat64
19 kx #define TMP_FSTAT64 __astat64
19 kx #define NEXT_FSTAT64_NOARG next___astat64
19 kx
19 kx #define WRAP_FSTATAT64_QUOTE __astatat64
19 kx #define WRAP_FSTATAT64 __astatat64
19 kx #define WRAP_FSTATAT64_RAW __astatat64
19 kx #define TMP_FSTATAT64 __astatat64
19 kx #define NEXT_FSTATAT64_NOARG next___astatat64
19 kx
19 kx #define WRAP_MKNOD_QUOTE __amknod
19 kx #define WRAP_MKNOD __amknod
19 kx #define WRAP_MKNOD_RAW __amknod
19 kx #define TMP_MKNOD __amknod
19 kx #define NEXT_MKNOD_NOARG next___amknod
19 kx
19 kx #define WRAP_MKNODAT_QUOTE __amknodat
19 kx #define WRAP_MKNODAT __amknodat
19 kx #define WRAP_MKNODAT_RAW __amknodat
19 kx #define TMP_MKNODAT __amknodat
19 kx #define NEXT_MKNODAT_NOARG next___amknodat
19 kx
19 kx #define WRAP_STAT64_TIME64_QUOTE __astat64_time64
19 kx #define WRAP_STAT64_TIME64 __astat64_time64
19 kx #define WRAP_STAT64_TIME64_RAW __astat64_time64
19 kx #define TMP_STAT64_TIME64 __astat64_time64
19 kx #define NEXT_STAT64_TIME64_NOARG next___astat64_time64
19 kx
19 kx #define WRAP_LSTAT64_TIME64_QUOTE __astat64_time64
19 kx #define WRAP_LSTAT64_TIME64 __astat64_time64
19 kx #define WRAP_LSTAT64_TIME64_RAW __astat64_time64
19 kx #define TMP_LSTAT64_TIME64 __astat64_time64
19 kx #define NEXT_LSTAT64_TIME64_NOARG next___astat64_time64
19 kx
19 kx #define WRAP_FSTAT64_TIME64_QUOTE __astat64_time64
19 kx #define WRAP_FSTAT64_TIME64 __astat64_time64
19 kx #define WRAP_FSTAT64_TIME64_RAW __astat64_time64
19 kx #define TMP_FSTAT64_TIME64 __astat64_time64
19 kx #define NEXT_FSTAT64_TIME64_NOARG next___astat64_time64
19 kx
19 kx #define WRAP_FSTATAT64_TIME64_QUOTE __astatat64_time64
19 kx #define WRAP_FSTATAT64_TIME64 __astat64_time64
19 kx #define WRAP_FSTATAT64_TIME64_RAW __astat64_time64
19 kx #define TMP_FSTATAT64_TIME64 __astat64_time64
19 kx #define NEXT_FSTATAT64_TIME64_NOARG next___astat64_time64
19 kx
19 kx ])
19 kx dnl kludge end
19 kx
19 kx case "$target_cpu:$target_os" in
19 kx (alpha*:linux*)
19 kx AH_TEMPLATE([STUPID_ALPHA_HACK], [stat-struct conversion hackery])
19 kx AC_MSG_CHECKING([if we need to do stat-struct conversion hackery])
19 kx AC_EGREP_CPP([3:3],[
19 kx #include <sys/stat.h>
19 kx _STAT_VER:_STAT_VER_GLIBC2_3_4
19 kx ],
19 kx [AC_MSG_RESULT([yes]); AC_DEFINE(STUPID_ALPHA_HACK)
19 kx CPPFLAGS="$CPPFLAGS -I\$(srcdir)/statconv/glibc/linux/alpha"
19 kx ],
19 kx [AC_MSG_RESULT([no]);])
19 kx ;;
19 kx esac
19 kx
19 kx dnl AH_TEMPLATE([MACOSX], [is __APPLE__ defined by the compiler])
19 kx AC_MSG_CHECKING([for macOS/Darwin])
19 kx AC_PREPROC_IFELSE(
19 kx [AC_LANG_PROGRAM([[
19 kx #ifndef __APPLE__
19 kx #error Not Apple
19 kx #endif
19 kx ]])],
19 kx [macosx=true
19 kx AC_MSG_RESULT([yes])],
19 kx [AC_MSG_RESULT([no])
19 kx macosx=false]
19 kx )
19 kx AM_CONDITIONAL([MACOSX], [test x$macosx = xtrue])
19 kx
19 kx AC_CONFIG_FILES([
19 kx Makefile
19 kx scripts/Makefile
19 kx doc/Makefile
19 kx doc/de/Makefile doc/es/Makefile doc/fr/Makefile doc/nl/Makefile doc/pt/Makefile doc/sv/Makefile
19 kx test/Makefile test/defs])
19 kx AC_OUTPUT
19 kx
19 kx dnl Local variables:
19 kx dnl mode: m4
19 kx dnl End: