AC_PREREQ(2.61) AC_INIT(rpm, 4.4.90, rpm-maint@lists.rpm.org) AC_CONFIG_SRCDIR([rpmqv.c]) AM_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2]) AC_CONFIG_TESTDIR(tests) AC_AIX AC_MINIX dnl Checks for programs. AC_PROG_CXX AC_PROG_AWK AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL AC_PROG_YACC AS=${AS-as} AC_SUBST(AS) if test "$GCC" = yes; then CFLAGS="$CFLAGS -fPIC -DPIC -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts" cflags_to_try="-fno-strict-aliasing" AC_MSG_CHECKING([supported compiler flags]) old_cflags=$CFLAGS echo for flag in $cflags_to_try; do CFLAGS="$CFLAGS $flag" AC_TRY_COMPILE(, [return 0;], [ echo " $flag" RPMCFLAGS="$RPMCFLAGS $flag" ]) CFLAGS=$old_cflags done CFLAGS="$CFLAGS $RPMCFLAGS" fi export CFLAGS AC_PROG_GCC_TRADITIONAL AC_SYS_LARGEFILE dnl Does this platform require array notation to assign to a va_list? dnl If cross-compiling, we assume va_list is "normal". If this breaks dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY dnl also just to be sure. AC_MSG_CHECKING(whether va_list assignments need array notation) AC_CACHE_VAL(ac_cv_valistisarray, [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include void foo(int i, ...) { va_list ap1, ap2; va_start(ap1, i); ap2 = ap1; if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); } va_end(ap1); va_end(ap2); } int main() { foo(0, 123); return(0); }]])],[ac_cv_valistisarray=false],[ac_cv_valistisarray=true],[ac_cv_valistisarray=false])]) if test "$ac_cv_valistisarray" = true ; then AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1, [Define as 1 if your va_list type is an array]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi RPMUSER=rpm RPMUID=37 RPMGROUP=rpm RPMGID=37 export RPMUSER RPMUID RPMGROUP RPMGID AC_SUBST(RPMUSER) AC_SUBST(RPMUID) AC_SUBST(RPMGROUP) AC_SUBST(RPMGID) AC_PATH_PROG(CTAGS, ctags, /bin/true) AC_PATH_PROG(CSCOPE, cscope, /bin/true) dnl dnl This now uses libtool. Put dnl LDFLAGS_STATIC="-all" dnl to attempt static executables using libtool. Otherwise dnl LDFLAGS_STATIC="" dnl AC_MSG_CHECKING(flag used by libtool to link rpm) if test X"$GCC" = Xyes ; then case "$host" in *-*-linux*) LDFLAGS_STATIC="-all-static" ;; *-*-solaris*) LDFLAGS_STATIC="-static";; *-*-hpux*) LDFLAGS_STATIC="-static";; *-*-darwin*) LDFLAGS_STATIC="";; # Mac OS X does not do static binaries. *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread. *-*-*) LDFLAGS_STATIC="";; esac elif test X"$CC" = Xcc ; then case "$host" in *-*-linux*) LDFLAGS_STATIC="-all-static";; *-*-freebsd*) LDFLAGS_STATIC="-all-static";; *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work... *-*-hpux*) LDFLAGS_STATIC="-static";; *-*-solaris*) LDFLAGS_STATIC="-static";; *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't # link because of crt1.o then. *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs. *-*-*) LDFLAGS_STATIC="" AC_MSG_WARN([ Unable to guess what option to pass to $CC to generate a static executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to the appropriate argument(s) if you want to build a static rpm executable. ]) ;; esac else # just link it dynamically LDFLAGS_STATIC="" fi LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format AC_MSG_RESULT($LDFLAGS_STATIC) AC_SUBST(LDFLAGS_STATIC) dnl dnl XXX Test for libpthread.a that is NPTL aware (static link only). dnl LDFLAGS_NPTL= if test -f /usr/lib/nptl/libpthread.a ; then LDFLAGS_NPTL="-L/usr/lib/nptl" # INCPATH="$INCPATH -I/usr/include/nptl" fi AC_SUBST(LDFLAGS_NPTL) dnl dnl look for POSIX chmod attributes dnl AC_MSG_CHECKING(POSIX chmod) touch foo.chmodtest chmod 744 foo.chmodtest chmod +X foo.chmodtest 2>/dev/null a=`ls -l foo.chmodtest | awk '{print $1}'` rm -f foo.chmodtest if test "$a" = "-rwxr-xr-x"; then AC_MSG_RESULT(yes) FIXPERMS=a+rX,u+w,g-w,o-w else AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils)) FIXPERMS=a+r,u+w,g-w,o-w fi AC_SUBST(FIXPERMS) dnl dnl see if we have a mkdir that supports `-p'. dnl AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir) AC_MSG_CHECKING(if $RPM_MKDIR supports -p) rm -rf conftest $RPM_MKDIR -p conftest/a 2>/dev/null if test $? = 0 ; then rmdir conftest/a 2>/dev/null if test $? = 0 ; then : else RPM_MKDIR_P=0 fi rmdir conftest 2>/dev/null if test $? = 0 ; then RPM_MKDIR_P="$RPM_MKDIR -p" else RPM_MKDIR_P=0 fi else RPM_MKDIR_P=0 fi if test X"$RPM_MKDIR_P" = X0 ; then AC_MSG_RESULT(no) RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`" else AC_MSG_RESULT(yes) fi dnl dnl substitute this into config.h, so the C source picks it up. dnl AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}", [A full path to a program, possibly with arguments, that will create a directory and all necessary parent directories, ala 'mkdir -p']) AC_SUBST(RPM_MKDIR_P) AC_ISC_POSIX dnl This test must precede tests of compiler characteristics like dnl that for the inline keyword, since it may change the degree to dnl which the compiler supports such features. AM_C_PROTOTYPES dnl AM_DISABLE_SHARED AM_PROG_LIBTOOL AC_CHECK_TOOL(AR, ar, :) dnl dnl use defaults if cross-compiling, otherwise use the default path. dnl if test "$cross_compiling" = "yes"; then MYPATH=":" else MYPATH=$PATH fi dnl dnl Find some common programs dnl AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH) AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH) AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH) AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH) AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH) AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH) AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH) AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH) AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH) AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH) AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH) AC_PATH_PROG(UNZIPBIN, unzip, /usr/bin/unzip, $MYPATH) AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH) AC_MSG_CHECKING(checking whether id supports -u) if ${__ID} -u 2>&1 > /dev/null ; then __ID_U="%{__id} -u" AC_MSG_RESULT(yes) else __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'" AC_MSG_RESULT(no) fi AC_SUBST(__ID_U) AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH) AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH) AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH) AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH) AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH) AC_MSG_CHECKING(old version of patch) PATCHVERSION=`patch --version 2>&1` if test "$PATCHVERSION" = "Patch version 2.1"; then AC_DEFINE(HAVE_OLDPATCH_21, 1, [Define if the patch call you'll be using is 2.1 or older]) AC_MSG_RESULT(patch older then 2.2 found) else AC_MSG_RESULT(patch later then 2.2 found) fi AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH) AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH) AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH) AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH) AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH) AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH) AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH) AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH) AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH) AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH) AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH) AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH) addlib() { l=$1 shift case "$host" in *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";; *) LIBS="$LIBS -L$l $*";; esac } #================= # Check for zlib library. WITH_ZLIB_INCLUDE= WITH_ZLIB_LIB= if test -z "${WITH_ZLIB_LIB}" ; then for zlib in z gz ; do AC_CHECK_LIB(${zlib}, gzread, [WITH_ZLIB_LIB="-l${zlib}"; break], [if test ${zlib} = gz; then AC_MSG_ERROR([sorry rpm requires libz.a or libgz.a (from the zlib package)]) fi] ) done dnl zlib-1.0.4 has not gzseek AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])]) fi AC_SUBST(WITH_ZLIB_INCLUDE) AC_SUBST(WITH_ZLIB_LIB) #================= # Check for bzip2 library. AC_CHECK_LIB(bz2, bzread, [LIBS="$LIBS -lbz2"], AC_CHECK_LIB(bz2, BZ2_bzread, [ WITH_BZIP2=1 LIBS="$LIBS -lbz2" AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0]) ], WITH_BZIP2=0)) AC_SUBST(WITH_BZIP2) #================= # Check for libxml2. PKG_CHECK_MODULES(libxml2,libxml-2.0, [WITH_LIBXML2=yes], [WITH_LIBXML2=no]) AM_CONDITIONAL(LIBXML2,[test "$WITH_LIBXML2" = yes]) #================= dirs=$prefix AC_MSG_CHECKING(for /usr/ucblib in LIBS) if test -d /usr/ucblib ; then if test "$build" = "mips-sni-sysv4" ; then addlib /usr/ccs/lib -lc fi addlib /usr/ucblib AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl dnl Check for features dnl dnl Checks for libraries. AC_CHECK_FUNC(setreuid, [], [ AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi]) ]) AC_CHECK_FUNC(rand, [], [ AC_CHECK_LIB(rand, rand, []) ]) AC_CHECK_FUNC(getdomainname, [], [ AC_CHECK_LIB(nsl, getdomainname) ]) AC_CHECK_FUNC(socket, [], [ AC_CHECK_LIB(socket, socket) ]) AC_CHECK_HEADERS(error.h) AC_CHECK_FUNCS(error) AC_CHECK_HEADERS(poll.h) AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h) AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [ dnl OSF 5.0 has the the symbols prefixed with __ in libpthread. AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [ AC_CHECK_LIB(thread, mutex_lock) ]) ]) AC_CHECK_HEADERS(aio.h) AC_SEARCH_LIBS(aio_read, [c rt aio posix4]) dnl Better not use fchmod at all. AC_CHECK_FUNC(fchmod) AC_CHECK_FUNCS(vsnprintf snprintf) dnl Temporary hack for MiNT. Some functions (writev, snprintf) are dnl not in the libc but in libport (for political reasons). This check dnl can hopefully be removed soon. Please use the default action dnl for this macro (not LIBS=...), otherwise the check for dbopen dnl will fail. AC_CHECK_LIB(port, writev) #================= # Check for libelf library. Prefer external, otherwise none. WITH_LIBELF_INCLUDE= WITH_LIBELF_LIB= AC_CHECK_HEADER([libelf.h]) AC_CHECK_HEADERS([gelf.h], [ AC_CHECK_LIB(elf, gelf_getvernaux, [ AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).]) WITH_LIBELF_LIB="-lelf" WITH_LIBELF=yes ]) ]) AC_SUBST(WITH_LIBELF_INCLUDE) AC_SUBST(WITH_LIBELF_LIB) AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes]) AC_CHECK_HEADERS([dwarf.h], [ WITH_LIBDWARF=yes ]) AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes]) #================= # Check for beecrypt library. WITH_BEECRYPT_INCLUDE= WITH_BEECRYPT_LIB= AC_CHECK_HEADERS([beecrypt/beecrypt.h], [ AC_CHECK_LIB(beecrypt, mpfprintln, [ AC_CHECK_HEADERS([beecrypt/api.h]) WITH_BEECRYPT_INCLUDE= WITH_BEECRYPT_LIB="-lbeecrypt" ],[ AC_MSG_ERROR([missing required library beecrypt]) ]) ],[ AC_MSG_ERROR([missing required header beecrypt/beecrypt.h]) ]) AC_SUBST(WITH_BEECRYPT_INCLUDE) AC_SUBST(WITH_BEECRYPT_LIB) #================= # Check for neon library. Prefer external, otherwise none. WITH_NEON_INCLUDE= WITH_NEON_LIB= AC_CHECK_HEADER([neon/ne_session.h], [ AC_CHECK_LIB(neon, ne_session_create, [ AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if you have the 'neon' library (-lneon).]) AC_CHECK_LIB(neon, ne_get_response_header, [ AC_DEFINE(HAVE_NEON_NE_GET_RESPONSE_HEADER, 1, [Define to 1 if you have ne_get_response_header() in libneon.]) ]) AC_CHECK_LIB(neon, ne_send_request_chunk, [ AC_DEFINE(HAVE_NEON_NE_SEND_REQUEST_CHUNK, 1, [Define to 1 if you have ne_send_request_chunk() in libneon.]) ]) WITH_NEON_INCLUDE= WITH_NEON_LIB="-lneon" ]) ]) AC_SUBST(WITH_NEON_INCLUDE) AC_SUBST(WITH_NEON_LIB) #================= # Check for magic library. WITH_MAGIC_INCLUDE= WITH_MAGIC_LIB= AC_CHECK_HEADER([magic.h], [ AC_CHECK_LIB(magic, magic_open, [ WITH_MAGIC_INCLUDE= WITH_MAGIC_LIB="-lmagic" ],[ AC_MSG_ERROR([missing required libary 'libmagic']) ]) ],[ AC_MSG_ERROR([missing required header magic.h]) ]) AC_SUBST(WITH_MAGIC_INCLUDE) AC_SUBST(WITH_MAGIC_LIB) #================= # Check for popt library. WITH_POPT_INCLUDE= WITH_POPT_LIB= AC_CHECK_HEADER([popt.h], [ AC_CHECK_LIB(popt, poptGetContext, [ WITH_POPT_INCLUDE= WITH_POPT_LIB="-lpopt" WITH_POPT=yes ],[ AC_MSG_ERROR([missing required library popt]) ]) ],[ AC_MSG_ERROR([missing required header popt.h]) ]) AC_SUBST(WITH_POPT_INCLUDE) AC_SUBST(WITH_POPT_LIB) #================= dnl ------------------ with internal db AC_DEFINE(HAVE_DB3_DB_H, 1, [Define if you have the header file]) WITH_DB_SUBDIR=db3 AC_SUBST(WITH_DB_SUBDIR) #================= # Check for sqlite3 library. AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 build in sqlite3 support], [case "$enable_sqlite3" in yes|no) ;; *) AC_MSG_ERROR([invalid argument to --enable-sqlite3]) ;; esac], [enable_sqlite3=no]) WITH_SQLITE3_INCLUDE= WITH_SQLITE3_LIB= WITH_SQLITE3=no AS_IF([test "$enable_sqlite3" = yes],[ AC_CHECK_HEADERS([sqlite3.h], [ AC_CHECK_LIB(sqlite3, sqlite3_open, [ WITH_SQLITE3_INCLUDE= WITH_SQLITE3_LIB="-lsqlite3" WITH_SQLITE3=yes ],[ AC_MSG_ERROR([missing libsqlite3]) ]) ],[ AC_MSG_ERROR([missing sqlite3.h]) ]) ]) AC_SUBST(WITH_SQLITE3_INCLUDE) AC_SUBST(WITH_SQLITE3_LIB) AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes]) #================= dnl AmigaOS and IXEmul have a fork() dummy case "$host" in m68k-*-amigaos ) echo "Building for AmigaOS: using vfork() instead of fork()"; CFLAGS="$CFLAGS -Dfork=vfork" ;; esac AM_GNU_GETTEXT_VERSION([0.16.1]) AM_GNU_GETTEXT([external]) dnl Checks for header files we can live without. AC_HEADER_STDC AC_HEADER_MAJOR AC_HEADER_DIRENT AC_HEADER_TIME AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h) AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h) AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h) AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h) AC_CHECK_HEADERS(netinet/in_systm.h) AC_CHECK_HEADERS(machine/types.h) AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h) AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h) AC_CHECK_HEADERS(bzlib.h libio.h zlib.h) AC_CHECK_HEADERS(err.h mcheck.h) AC_CHECK_HEADERS(pthread.h) AC_CHECK_HEADERS(glob.h) AC_CHECK_HEADERS(locale.h) dnl statfs portability fiddles. dnl dnl We should really emulate/steal sections of the statfs and struct statfs dnl checks from GNU fileutils. dnl AC_MSG_CHECKING(for struct statfs) dnl dnl this is easier than nesting AC_TRY_COMPILEs... dnl found_struct_statfs=no if test X$found_struct_statfs = Xno ; then dnl Solaris 2.6+ wants to use statvfs AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif #include ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h) AC_DEFINE(STATFS_IN_SYS_STATVFS, 1, [statfs in (for solaris 2.6+ systems)]) found_struct_statfs=yes],[]) fi if test X$found_struct_statfs = Xno ; then dnl first try including sys/vfs.h AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif #include ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h) AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in (for linux systems)]) found_struct_statfs=yes],[]) fi if test X$found_struct_statfs = Xno ; then dnl ...next try including sys/mount.h AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #include ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h) AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in (for Digital Unix 4.0D systems)]) found_struct_statfs=yes],[]) fi if test X$found_struct_statfs = Xno ; then dnl ...still no joy. Try sys/statfs.h AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif #include ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h) AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in (for Irix 6.4 systems)]) found_struct_statfs=yes],[]) fi if test X$found_struct_statfs = Xno ; then dnl ...no luck. Warn the user of impending doom. AC_MSG_WARN(not found) fi dnl dnl if we found the struct, see if it has the f_bavail member. Some OSes dnl don't, including IRIX 6.5+ dnl if test X$found_struct_statfs = Xyes ; then AC_MSG_CHECKING(for f_bavail member in struct statfs) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif #if STATFS_IN_SYS_STATVFS # include typedef struct statvfs STATFS_t; #else typedef struct statfs STATFS_t; # if STATFS_IN_SYS_VFS # include # elif STATFS_IN_SYS_MOUNT # include # elif STATFS_IN_SYS_STATFS # include # endif #endif ]], [[STATFS_t sfs; sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes) AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no) ]) fi if test X$found_struct_statfs = Xyes ; then dnl dnl now check to see if we have the 4-argument variant of statfs() dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[]) dnl AC_MSG_CHECKING([if statfs() requires 4 arguments]) AC_RUN_IFELSE([AC_LANG_SOURCE([[ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef STATFS_IN_SYS_VFS #include #elif STATFS_IN_SYS_MOUNT #include #elif STATFS_IN_SYS_STATFS #include #endif main() { struct statfs sfs; exit (statfs(".", &sfs, sizeof(sfs), 0)); } ]])],[AC_MSG_RESULT(yes) AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no) ]) fi AC_C_INLINE dnl look for libc features PROVIDES_ERRNO=no AC_MSG_CHECKING(if defines h_errno) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[]) AC_MSG_RESULT($PROVIDES_ERRNO) if test $PROVIDES_ERRNO = yes; then AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if defines h_errno]) fi dnl If a system doesn't have S_IFSOCK, define it as 0 which will dnl make S_ISSOCK always return false (nice, eh?) AC_MSG_CHECKING(if defines S_IFSOCK) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no]) AC_MSG_RESULT($HAS_S_IFSOCK) if test $HAS_S_IFSOCK = yes; then AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if defines S_IFSOCK]) fi dnl Some Unix's are missing S_ISLNK, S_ISSOCK AC_MSG_CHECKING(if defines S_ISLNK) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no]) AC_MSG_RESULT($HAS_S_ISLNK) if test $HAS_S_ISLNK = yes; then AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if defines S_ISLNK]) fi AC_MSG_CHECKING(if defines S_ISSOCK) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no]) AC_MSG_RESULT($HAS_S_ISSOCK) if test $HAS_S_ISSOCK = yes; then AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if defines S_ISSOCK]) fi AC_MSG_CHECKING(if timezone is defined) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no]) AC_MSG_RESULT($HAS_TIMEZONE) dnl Check for missing typedefs AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T dnl Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_VPRINTF dnl XXX don't want to re-enable code that's been unused for years at this dnl point, but should offer good performance improvements, check after dnl 4.4.2.1... dnl AC_FUNC_MMAP AC_CHECK_FUNCS(basename getaddrinfo getcwd getnameinfo getwd inet_aton) AC_CHECK_FUNCS(mtrace putenv realpath setenv) AC_CHECK_FUNCS(stpcpy stpncpy strcspn) AC_CHECK_FUNCS(strdup strndup strerror strtol strtoul strspn strstr) AC_CHECK_FUNCS(__secure_getenv) AC_CHECK_FUNCS(regcomp) AC_CHECK_FUNCS(ftok) AC_CHECK_FUNCS(mkstemp) dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when dnl %files gets something like dnl /usr/*/locale/*/LC_MESSAGES/*.mo dnl (Note: more than one asterisk in glob pattern.) dnl dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that dnl dangling symlinks are no longer globbed. Always use the internal glob. AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?]) AC_LIBOBJ(glob) AC_LIBOBJ(fnmatch) dnl dnl Auto-detect which python bindings should be built. dnl AC_ARG_WITH(python, [ --with-python build rpm python bindings ]) if test "{$with_python}" = "no"; then pythonbin="" elif test "${with_python}" = "yes"; then pythonbin="python" else pythonbin="python$with_python" fi AC_PATH_PROG(__PYTHON, "${pythonbin}") if test -z "${__PYTHON}"; then WITH_PYTHON_INCLUDE= WITH_PYTHON_LIB= WITH_PYTHON_SUBPACKAGE=0 else WITH_PYTHON_INCLUDE=`${__PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'` WITH_PYTHON_LIB=`${__PYTHON} -c 'from distutils.sysconfig import *; print get_python_lib(1)'` WITH_PYTHON_SUBPACKAGE=1 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE" AC_CHECK_HEADER([Python.h], [WITH_PYTHON_SUBPACKAGE=1], [WITH_PYTHON_SUBPACKAGE=0]) CPPFLAGS="$save_CPPFLAGS" fi AC_SUBST(WITH_PYTHON_INCLUDE) AC_SUBST(WITH_PYTHON_LIB) AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = "1"]) AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH) dnl dnl Auto-detect whether doxygen generated API docs should be included. dnl AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ],,[with_apidocs=auto]) case "$with_apidocs" in auto) AS_IF([test "$__DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes]) ;; yes) AS_IF([test "$__DOXYGEN" = no], [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])]) ;; esac WITH_SELINUX_LIB= AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],,[with_selinux=auto]) case "$with_selinux" in yes) AC_CHECK_HEADER([selinux/selinux.h],[ AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[ AC_MSG_ERROR([--with-selinux given, but libselinux not found])]) ],[ AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found]) ]) ;; auto) AC_CHECK_HEADER([selinux/selinux.h],[ AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes], [with_selinux=no]) ],[ with_selinux=no ]) ;; *) with_selinux=no ;; esac AS_IF([test "$with_selinux" = yes],[ AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?]) WITH_SELINUX_LIB="-lselinux" ]) AC_SUBST(WITH_SELINUX_LIB) AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes]) WITH_LUA_LIB= WITH_LUA_INCLUDE= AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes]) AS_IF([test "$with_lua" = yes],[ AC_DEFINE(WITH_LUA, 1, [Build with lua support?]) WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local" WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la" ]) AC_SUBST(WITH_LUA_LIB) AC_SUBST(WITH_LUA_INCLUDE) AS_IF([test "$with_apidocs" = yes],[ WITH_APIDOCS_TARGET=apidocs WITH_APIDOCS=1 ],[ WITH_APIDOCS=0 ]) AC_SUBST(WITH_APIDOCS_TARGET) AC_SUBST(WITH_APIDOCS) with_dmalloc=no AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ]) if test "$with_dmalloc" = yes ; then AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?]) LIBS="$LIBS -ldmalloc" fi AC_CHECK_FUNCS(setlocale) AC_CHECK_FUNCS(getpassphrase) AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [ AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[ AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [ AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [ AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r"; AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [ AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used]) AC_LIBOBJ(getmntent)]) ]) ]) ]) ]) AC_CHECK_FUNC(lchown, [__CHOWN_RHF="%{__chown} -Rhf" __CHGRP_RHF="%{__chgrp} -Rhf" AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])], [__CHOWN_RHF="%{__chown} -Rf" __CHGRP_RHF="%{__chgrp} -Rf" dnl Does chown() follow symlinks? This should be a good enough test. AC_MSG_CHECKING(whether chown() follows symlinks) AC_ARG_ENABLE([broken-chown], [ --enable-broken-chown this system's chown follows symbolic links], result=$enableval, result=unknown) if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then result=yes elif echo "$build" | egrep "(nextstep)" > /dev/null ; then result=no fi if test $result = unknown; then if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then rm -f foo bar touch foo ln -s foo bar ${__CHOWN} 10 bar if test `ls -l foo | awk '{print $3}'` != "root"; then result=yes else result=no fi ${__RM} -f foo bar else AC_MSG_CHECKING((cannot check by non-root user)) result=no fi fi AC_MSG_RESULT($result) if test $result = yes; then AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()]) fi]) AC_SUBST(__CHOWN_RHF) AC_SUBST(__CHGRP_RHF) dnl dnl figure out what root's primary group is dnl AC_MSG_CHECKING(root's primary group) AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include #include #include int main() { struct passwd *root = NULL; struct group *roots_group = NULL; FILE * tempfile = NULL; root = getpwuid( (uid_t) 0 ); if (root != NULL) { roots_group = getgrgid(root->pw_gid); if (roots_group != NULL) { tempfile = fopen("conftest_rootg", "w"); if (tempfile != NULL) { fprintf(tempfile, "%s\n", roots_group->gr_name); fclose(tempfile); exit(0); } } } exit(1); }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root" ]) AC_MSG_RESULT($ROOT_GROUP) AC_SUBST(ROOT_GROUP) if test "x$varprefix" = "x"; then # For /usr and /usr/local, we want the 'var' directory to go # in /var and /var/local respectively. For everything else, # just put the 'var' directory in prefix/var. case $prefix in /usr | /usr/local ) varprefix=`echo $prefix | sed 's/usr/var/'` ;; NONE) varprefix=`echo $ac_default_prefix | sed 's/usr/var/'` ;; *) varprefix=$prefix/var ;; esac fi AC_SUBST(varprefix) if test "x$tmpdir" = "x"; then if test -d $varprefix/tmp; then tmpdir=$varprefix/tmp else if test -d /var/tmp; then tmpdir=/var/tmp else tmpdir=/tmp fi fi fi AC_SUBST(tmpdir) if echo "$build_os" | grep sco > /dev/null; then echo "hacking things up for sco" AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include (along with )]) AC_DEFINE(HAVE_STRUCT_MNTTAB, 1, [Define as 1 if you have "struct mnttab" (only sco?)]) elif echo "$build_os" | grep sunos > /dev/null; then echo "hacking things up for sunos" CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__" AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include (along with )]) AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc]) AC_LIBOBJ(myrealloc) fi # # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os # build_os_gnu=-gnu if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'` fi if echo "$build_os" | grep '.*-gnueabi' > /dev/null ; then build_os=`echo "${build_os}" | sed 's/-gnueabi$//'` build_os_gnu=-gnueabi fi if echo "$build_os" | grep '.*-gnu' > /dev/null ; then build_os=`echo "${build_os}" | sed 's/-gnu$//'` fi changequote(<, >) build_os_exact="${build_os}" build_os_major=`echo "${build_os}" | sed 's/\..*$//'` build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'` changequote([, ]) rm -f ./find-provides if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation" ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation" ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation" ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation" ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides else echo "*** no default provides information is available for ${build_os_noversion}" ln -s ${srcdir}/autodeps/none ./find-provides fi rm -f ./find-requires if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation" ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation" ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation" ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation" ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires else echo "*** no default requires information is available for ${build_os_noversion}" ln -s ${srcdir}/autodeps/none ./find-requires fi dnl Determine the canonical arch-vendor-os for the build machine autorelocate_path='%{nil}' autorelocate_dcolor='0' case "${build_cpu}" in *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;; ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;; amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;; x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;; alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;; sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;; sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;; ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64; autorelocate_path='/emul/%%{ARCH}-%%{OS}' autorelocate_dcolor='1' ;; s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;; s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;; powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;; powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;; arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;; mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;; mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;; m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;; *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;; esac case "${build_os_noversion}" in mint) RPMCANONARCH=m68kmint ;; esac RPMCANONVENDOR="$build_vendor" case "${build_vendor}" in unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos) test -f /etc/redhat-release && RPMCANONVENDOR=redhat test -f /etc/pld-release && RPMCANONVENDOR=pld test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva test -f /etc/lvr-release && RPMCANONVENDOR=lvr test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog test -f /etc/caos-release && RPMCANONVENDOR=caos ;; esac RPMCANONOS="$build_os_noversion" RPMCANONGNU="$build_os_gnu" AC_SUBST(RPMCANONCOLOR) AC_SUBST(autorelocate_path) AC_SUBST(autorelocate_dcolor) AC_SUBST(RPMCANONARCH) AC_SUBST(RPMCANONVENDOR) AC_SUBST(RPMCANONOS) AC_SUBST(RPMCANONGNU) if test X"$prefix" = XNONE ; then usrprefix="$ac_default_prefix" else usrprefix=$prefix fi RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`" AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR", [Full path to rpm global configuration directory (usually /usr/lib/rpm)]) AC_SUBST(RPMCONFIGDIR) VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc" AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME", [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)]) AC_SUBST(VENDORRPMRC_FILENAME) LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}" AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME", [Full path to rpmpopt configuration file (usually /usr/lib/rpm/rpmpopt)]) AC_SUBST(LIBRPMALIAS_FILENAME) AC_SUBST(RPM) AC_SUBST(OBJDUMP) AC_CONFIG_SUBDIRS(db3) AC_PATH_PROG(AUTOM4TE,autom4te,:) AC_CONFIG_FILES([ Doxyfile Makefile macros platform rpm.pc rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile po/Makefile.in scripts/Makefile scripts/brp-redhat scripts/macros.perl scripts/macros.php scripts/macros.python tools/Makefile misc/Makefile doc/Makefile python/Makefile lua/Makefile tests/Makefile ]) AC_CONFIG_FILES([rpmpopt-${VERSION}:rpmpopt.in],,[VERSION=${VERSION}]) AC_OUTPUT