2 AC_INIT(rpm, 4.4.90, rpm-maint@lists.rpm.org)
4 AC_CONFIG_SRCDIR([rpmqv.c])
5 AM_CONFIG_HEADER([config.h])
7 AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2])
9 AC_CONFIG_TESTDIR(tests)
14 dnl Checks for programs.
27 if test "$GCC" = yes; then
28 CFLAGS="$CFLAGS -fPIC -DPIC -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
29 cflags_to_try="-fno-strict-aliasing"
30 AC_MSG_CHECKING([supported compiler flags])
33 for flag in $cflags_to_try; do
34 CFLAGS="$CFLAGS $flag"
35 AC_TRY_COMPILE(, [return 0;], [
37 RPMCFLAGS="$RPMCFLAGS $flag"
41 CFLAGS="$CFLAGS $RPMCFLAGS"
45 AC_PROG_GCC_TRADITIONAL
48 dnl Does this platform require array notation to assign to a va_list?
49 dnl If cross-compiling, we assume va_list is "normal". If this breaks
50 dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
51 dnl also just to be sure.
52 AC_MSG_CHECKING(whether va_list assignments need array notation)
53 AC_CACHE_VAL(ac_cv_valistisarray,
54 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
56 void foo(int i, ...) {
60 if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123)
62 va_end(ap1); va_end(ap2);
64 int main() { foo(0, 123); return(0); }]])],[ac_cv_valistisarray=false],[ac_cv_valistisarray=true],[ac_cv_valistisarray=false])])
66 if test "$ac_cv_valistisarray" = true ; then
67 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1,
68 [Define as 1 if your va_list type is an array])
78 export RPMUSER RPMUID RPMGROUP RPMGID
85 dnl This now uses libtool. Put
86 dnl LDFLAGS_STATIC="-all"
87 dnl to attempt static executables using libtool. Otherwise
90 AC_MSG_CHECKING(flag used by libtool to link rpm)
91 if test X"$GCC" = Xyes ; then
93 *-*-linux*) LDFLAGS_STATIC="-all-static" ;;
94 *-*-solaris*) LDFLAGS_STATIC="-static";;
95 *-*-hpux*) LDFLAGS_STATIC="-static";;
96 *-*-darwin*) LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
97 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
98 *-*-*) LDFLAGS_STATIC="";;
100 elif test X"$CC" = Xcc ; then
102 *-*-linux*) LDFLAGS_STATIC="-all-static";;
103 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
104 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
105 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
106 *-*-hpux*) LDFLAGS_STATIC="-static";;
107 *-*-solaris*) LDFLAGS_STATIC="-static";;
108 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
109 # link because of crt1.o then.
110 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
111 *-*-*) LDFLAGS_STATIC=""
114 Unable to guess what option to pass to $CC to generate a static
115 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
116 the appropriate argument(s) if you want to build a static rpm executable.
122 # just link it dynamically
125 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
126 AC_MSG_RESULT($LDFLAGS_STATIC)
127 AC_SUBST(LDFLAGS_STATIC)
130 dnl XXX Test for libpthread.a that is NPTL aware (static link only).
133 if test -f /usr/lib/nptl/libpthread.a ; then
134 LDFLAGS_NPTL="-L/usr/lib/nptl"
135 # INCPATH="$INCPATH -I/usr/include/nptl"
137 AC_SUBST(LDFLAGS_NPTL)
140 dnl look for POSIX chmod attributes
142 AC_MSG_CHECKING(POSIX chmod)
144 chmod 744 foo.chmodtest
145 chmod +X foo.chmodtest 2>/dev/null
146 a=`ls -l foo.chmodtest | awk '{print $1}'`
148 if test "$a" = "-rwxr-xr-x"; then
150 FIXPERMS=a+rX,u+w,g-w,o-w
152 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
153 FIXPERMS=a+r,u+w,g-w,o-w
158 dnl see if we have a mkdir that supports `-p'.
160 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
161 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
163 $RPM_MKDIR -p conftest/a 2>/dev/null
164 if test $? = 0 ; then
165 rmdir conftest/a 2>/dev/null
166 if test $? = 0 ; then
172 rmdir conftest 2>/dev/null
173 if test $? = 0 ; then
174 RPM_MKDIR_P="$RPM_MKDIR -p"
182 if test X"$RPM_MKDIR_P" = X0 ; then
184 RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
189 dnl substitute this into config.h, so the C source picks it up.
191 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
192 [A full path to a program, possibly with arguments, that will create a
193 directory and all necessary parent directories, ala 'mkdir -p'])
194 AC_SUBST(RPM_MKDIR_P)
198 dnl This test must precede tests of compiler characteristics like
199 dnl that for the inline keyword, since it may change the degree to
200 dnl which the compiler supports such features.
203 dnl AM_DISABLE_SHARED
206 AC_CHECK_TOOL(AR, ar, :)
209 dnl use defaults if cross-compiling, otherwise use the default path.
211 if test "$cross_compiling" = "yes"; then
218 dnl Find some common programs
220 AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
221 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
222 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
223 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
224 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
225 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
226 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
227 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
228 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
229 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
230 AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
231 AC_PATH_PROG(UNZIPBIN, unzip, /usr/bin/unzip, $MYPATH)
233 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
234 AC_MSG_CHECKING(checking whether id supports -u)
235 if ${__ID} -u 2>&1 > /dev/null ; then
239 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
244 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
245 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
246 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
247 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
248 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
249 AC_MSG_CHECKING(old version of patch)
250 PATCHVERSION=`patch --version 2>&1`
252 if test "$PATCHVERSION" = "Patch version 2.1"; then
253 AC_DEFINE(HAVE_OLDPATCH_21, 1,
254 [Define if the patch call you'll be using is 2.1 or older])
255 AC_MSG_RESULT(patch older then 2.2 found)
257 AC_MSG_RESULT(patch later then 2.2 found)
260 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
261 AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
262 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
263 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
264 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
265 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
266 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
268 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
269 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
270 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
271 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
272 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
278 *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
279 *) LIBS="$LIBS -L$l $*";;
284 # Check for zlib library.
289 if test -z "${WITH_ZLIB_LIB}" ; then
290 for zlib in z gz ; do
291 AC_CHECK_LIB(${zlib}, gzread,
292 [WITH_ZLIB_LIB="-l${zlib}"; break],
293 [if test ${zlib} = gz; then
294 AC_MSG_ERROR([sorry rpm requires libz.a or libgz.a (from the zlib package)])
299 dnl zlib-1.0.4 has not gzseek
300 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
303 AC_SUBST(WITH_ZLIB_INCLUDE)
304 AC_SUBST(WITH_ZLIB_LIB)
307 # Check for bzip2 library.
309 AC_CHECK_LIB(bz2, bzread, [LIBS="$LIBS -lbz2"],
310 AC_CHECK_LIB(bz2, BZ2_bzread, [
313 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0]) ],
320 PKG_CHECK_MODULES(libxml2,libxml-2.0,
323 AM_CONDITIONAL(LIBXML2,[test "$WITH_LIBXML2" = yes])
328 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
329 if test -d /usr/ucblib ; then
330 if test "$build" = "mips-sni-sysv4" ; then
331 addlib /usr/ccs/lib -lc
342 dnl Check for features
345 dnl Checks for libraries.
347 AC_CHECK_FUNC(setreuid, [], [
348 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
351 AC_CHECK_FUNC(rand, [], [
352 AC_CHECK_LIB(rand, rand, [])
355 AC_CHECK_FUNC(getdomainname, [], [
356 AC_CHECK_LIB(nsl, getdomainname)
358 AC_CHECK_FUNC(socket, [], [
359 AC_CHECK_LIB(socket, socket)
362 AC_CHECK_HEADERS(error.h)
363 AC_CHECK_FUNCS(error)
365 AC_CHECK_HEADERS(poll.h)
367 AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
369 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
370 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
371 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
372 AC_CHECK_LIB(thread, mutex_lock)
376 AC_CHECK_HEADERS(aio.h)
377 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
379 dnl Better not use fchmod at all.
380 AC_CHECK_FUNC(fchmod)
382 AC_CHECK_FUNCS(vsnprintf snprintf)
384 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
385 dnl not in the libc but in libport (for political reasons). This check
386 dnl can hopefully be removed soon. Please use the default action
387 dnl for this macro (not LIBS=...), otherwise the check for dbopen
389 AC_CHECK_LIB(port, writev)
392 # Check for libelf library. Prefer external, otherwise none.
395 AC_CHECK_HEADER([libelf.h])
396 AC_CHECK_HEADERS([gelf.h], [
397 AC_CHECK_LIB(elf, gelf_getvernaux, [
398 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
399 WITH_LIBELF_LIB="-lelf"
403 AC_SUBST(WITH_LIBELF_INCLUDE)
404 AC_SUBST(WITH_LIBELF_LIB)
405 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
407 AC_CHECK_HEADERS([dwarf.h], [
410 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
413 # Check for beecrypt library.
414 WITH_BEECRYPT_INCLUDE=
416 AC_CHECK_HEADERS([beecrypt/beecrypt.h], [
417 AC_CHECK_LIB(beecrypt, mpfprintln, [
418 AC_CHECK_HEADERS([beecrypt/api.h])
419 WITH_BEECRYPT_INCLUDE=
420 WITH_BEECRYPT_LIB="-lbeecrypt"
422 AC_MSG_ERROR([missing required library beecrypt])
425 AC_MSG_ERROR([missing required header beecrypt/beecrypt.h])
427 AC_SUBST(WITH_BEECRYPT_INCLUDE)
428 AC_SUBST(WITH_BEECRYPT_LIB)
431 # Check for neon library. Prefer external, otherwise none.
432 AC_ARG_WITH(neon, [ --with-neon enable neon support],
433 [case "$with_neon" in
435 *) AC_MSG_ERROR([invalid argument to --with-neon])
442 AS_IF([test "$with_neon" = yes],[
443 AC_CHECK_HEADER([neon/ne_session.h], [
444 AC_CHECK_LIB(neon, ne_session_create, [
445 AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if you have the 'neon' library (-lneon).])
446 AC_CHECK_LIB(neon, ne_get_response_header, [
447 AC_DEFINE(HAVE_NEON_NE_GET_RESPONSE_HEADER, 1, [Define to 1 if you have ne_get_response_header() in libneon.])
449 AC_CHECK_LIB(neon, ne_send_request_chunk, [
450 AC_DEFINE(HAVE_NEON_NE_SEND_REQUEST_CHUNK, 1, [Define to 1 if you have ne_send_request_chunk() in libneon.])
453 WITH_NEON_LIB="-lneon"
454 AC_DEFINE(WITH_NEON,1,[Build with neon support?])
458 AC_SUBST(WITH_NEON_INCLUDE)
459 AC_SUBST(WITH_NEON_LIB)
462 # Check for magic library.
466 AC_CHECK_HEADER([magic.h], [
467 AC_CHECK_LIB(magic, magic_open, [
469 WITH_MAGIC_LIB="-lmagic"
471 AC_MSG_ERROR([missing required libary 'libmagic'])
474 AC_MSG_ERROR([missing required header magic.h])
477 AC_SUBST(WITH_MAGIC_INCLUDE)
478 AC_SUBST(WITH_MAGIC_LIB)
481 # Check for popt library.
485 AC_CHECK_HEADER([popt.h], [
486 AC_CHECK_LIB(popt, poptGetContext, [
488 WITH_POPT_LIB="-lpopt"
491 AC_MSG_ERROR([missing required library popt])
494 AC_MSG_ERROR([missing required header popt.h])
497 AC_SUBST(WITH_POPT_INCLUDE)
498 AC_SUBST(WITH_POPT_LIB)
502 dnl ------------------ with internal db
503 AC_DEFINE(HAVE_DB3_DB_H, 1, [Define if you have the <db3/db.h> header file])
506 AC_SUBST(WITH_DB_SUBDIR)
509 # Check for sqlite3 library.
510 AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 enable sqlite3 support],
511 [case "$enable_sqlite3" in
513 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
518 WITH_SQLITE3_INCLUDE=
521 AS_IF([test "$enable_sqlite3" = yes],[
522 AC_CHECK_HEADERS([sqlite3.h],
523 [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
524 WITH_SQLITE3_INCLUDE=
525 WITH_SQLITE3_LIB="-lsqlite3"
528 AC_MSG_ERROR([missing libsqlite3])
531 AC_MSG_ERROR([missing sqlite3.h])
535 AC_SUBST(WITH_SQLITE3_INCLUDE)
536 AC_SUBST(WITH_SQLITE3_LIB)
537 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
541 dnl AmigaOS and IXEmul have a fork() dummy
544 echo "Building for AmigaOS: using vfork() instead of fork()";
545 CFLAGS="$CFLAGS -Dfork=vfork"
549 AM_GNU_GETTEXT_VERSION([0.16.1])
550 AM_GNU_GETTEXT([external])
552 dnl Checks for header files we can live without.
558 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
560 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
561 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
562 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
564 AC_CHECK_HEADERS(netinet/in_systm.h)
565 AC_CHECK_HEADERS(machine/types.h)
566 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
567 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
568 AC_CHECK_HEADERS(bzlib.h libio.h zlib.h)
569 AC_CHECK_HEADERS(err.h mcheck.h)
570 AC_CHECK_HEADERS(pthread.h)
572 AC_CHECK_HEADERS(glob.h)
573 AC_CHECK_HEADERS(locale.h)
575 dnl statfs portability fiddles.
577 dnl We should really emulate/steal sections of the statfs and struct statfs
578 dnl checks from GNU fileutils.
580 AC_MSG_CHECKING(for struct statfs)
583 dnl this is easier than nesting AC_TRY_COMPILEs...
585 found_struct_statfs=no
587 if test X$found_struct_statfs = Xno ; then
588 dnl Solaris 2.6+ wants to use statvfs
589 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
590 #ifdef HAVE_SYS_TYPES_H
591 #include <sys/types.h>
593 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
594 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
595 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
596 found_struct_statfs=yes],[])
599 if test X$found_struct_statfs = Xno ; then
600 dnl first try including sys/vfs.h
601 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
602 #ifdef HAVE_SYS_TYPES_H
603 #include <sys/types.h>
605 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
606 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
607 found_struct_statfs=yes],[])
610 if test X$found_struct_statfs = Xno ; then
611 dnl ...next try including sys/mount.h
612 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
613 #ifdef HAVE_SYS_TYPES_H
614 #include <sys/types.h>
616 #ifdef HAVE_SYS_PARAM_H
617 #include <sys/param.h>
619 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
620 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
621 found_struct_statfs=yes],[])
624 if test X$found_struct_statfs = Xno ; then
625 dnl ...still no joy. Try sys/statfs.h
626 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
627 #ifdef HAVE_SYS_TYPES_H
628 #include <sys/types.h>
630 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
631 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
632 found_struct_statfs=yes],[])
635 if test X$found_struct_statfs = Xno ; then
636 dnl ...no luck. Warn the user of impending doom.
637 AC_MSG_WARN(not found)
641 dnl if we found the struct, see if it has the f_bavail member. Some OSes
642 dnl don't, including IRIX 6.5+
644 if test X$found_struct_statfs = Xyes ; then
645 AC_MSG_CHECKING(for f_bavail member in struct statfs)
646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
647 #ifdef HAVE_SYS_TYPES_H
648 #include <sys/types.h>
650 #if STATFS_IN_SYS_STATVFS
651 # include <sys/statvfs.h>
652 typedef struct statvfs STATFS_t;
654 typedef struct statfs STATFS_t;
655 # if STATFS_IN_SYS_VFS
656 # include <sys/vfs.h>
657 # elif STATFS_IN_SYS_MOUNT
658 # include <sys/mouht.h>
659 # elif STATFS_IN_SYS_STATFS
660 # include <sys/statfs.h>
662 #endif ]], [[STATFS_t sfs;
663 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
664 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
668 if test X$found_struct_statfs = Xyes ; then
670 dnl now check to see if we have the 4-argument variant of statfs()
671 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
673 AC_MSG_CHECKING([if statfs() requires 4 arguments])
674 AC_RUN_IFELSE([AC_LANG_SOURCE([[
675 #ifdef HAVE_SYS_TYPES_H
676 #include <sys/types.h>
678 #ifdef STATFS_IN_SYS_VFS
680 #elif STATFS_IN_SYS_MOUNT
681 #include <sys/mouht.h>
682 #elif STATFS_IN_SYS_STATFS
683 #include <sys/statfs.h>
687 exit (statfs(".", &sfs, sizeof(sfs), 0));
689 ]])],[AC_MSG_RESULT(yes)
690 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
696 dnl look for libc features
698 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
699 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
700 AC_MSG_RESULT($PROVIDES_ERRNO)
701 if test $PROVIDES_ERRNO = yes; then
702 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
705 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
706 dnl make S_ISSOCK always return false (nice, eh?)
707 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
708 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
709 AC_MSG_RESULT($HAS_S_IFSOCK)
710 if test $HAS_S_IFSOCK = yes; then
711 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
714 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
715 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
716 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
717 AC_MSG_RESULT($HAS_S_ISLNK)
718 if test $HAS_S_ISLNK = yes; then
719 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
722 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
723 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
724 AC_MSG_RESULT($HAS_S_ISSOCK)
725 if test $HAS_S_ISSOCK = yes; then
726 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
729 AC_MSG_CHECKING(if timezone is defined)
730 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
731 AC_MSG_RESULT($HAS_TIMEZONE)
733 dnl Check for missing typedefs
739 dnl Checks for library functions.
742 dnl XXX don't want to re-enable code that's been unused for years at this
743 dnl point, but should offer good performance improvements, check after
747 AC_CHECK_FUNCS(basename getaddrinfo getcwd getnameinfo getwd inet_aton)
748 AC_CHECK_FUNCS(mtrace putenv realpath setenv)
749 AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
750 AC_CHECK_FUNCS(strdup strndup strerror strtol strtoul strspn strstr)
752 AC_CHECK_FUNCS(__secure_getenv)
754 AC_CHECK_FUNCS(regcomp)
758 AC_CHECK_FUNCS(mkstemp)
760 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
761 dnl %files gets something like
762 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
763 dnl (Note: more than one asterisk in glob pattern.)
765 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
766 dnl dangling symlinks are no longer globbed. Always use the internal glob.
767 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
772 dnl Auto-detect which python bindings should be built.
774 AC_ARG_WITH(python, [ --with-python build rpm python bindings ])
776 if test "{$with_python}" = "no"; then
778 elif test "${with_python}" = "yes"; then
781 pythonbin="python$with_python"
783 AC_PATH_PROG(__PYTHON, "${pythonbin}")
785 if test -z "${__PYTHON}"; then
788 WITH_PYTHON_SUBPACKAGE=0
790 WITH_PYTHON_INCLUDE=`${__PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
791 WITH_PYTHON_LIB=`${__PYTHON} -c 'from distutils.sysconfig import *; print get_python_lib(1)'`
792 WITH_PYTHON_SUBPACKAGE=1
793 save_CPPFLAGS="$CPPFLAGS"
794 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
795 AC_CHECK_HEADER([Python.h],
796 [WITH_PYTHON_SUBPACKAGE=1],
797 [WITH_PYTHON_SUBPACKAGE=0])
798 CPPFLAGS="$save_CPPFLAGS"
801 AC_SUBST(WITH_PYTHON_INCLUDE)
802 AC_SUBST(WITH_PYTHON_LIB)
804 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = "1"])
806 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
808 dnl Auto-detect whether doxygen generated API docs should be included.
810 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ],,[with_apidocs=auto])
812 case "$with_apidocs" in
814 AS_IF([test "$__DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes])
817 AS_IF([test "$__DOXYGEN" = no],
818 [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])])
823 AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],,[with_selinux=auto])
825 case "$with_selinux" in
827 AC_CHECK_HEADER([selinux/selinux.h],[
828 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
829 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
831 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
835 AC_CHECK_HEADER([selinux/selinux.h],[
836 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],
846 AS_IF([test "$with_selinux" = yes],[
847 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
848 WITH_SELINUX_LIB="-lselinux"
850 AC_SUBST(WITH_SELINUX_LIB)
851 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
855 AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes])
856 AS_IF([test "$with_lua" = yes],[
857 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
858 WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
859 WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
861 AC_SUBST(WITH_LUA_LIB)
862 AC_SUBST(WITH_LUA_INCLUDE)
864 AS_IF([test "$with_apidocs" = yes],[
865 WITH_APIDOCS_TARGET=apidocs
870 AC_SUBST(WITH_APIDOCS_TARGET)
871 AC_SUBST(WITH_APIDOCS)
874 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
875 if test "$with_dmalloc" = yes ; then
876 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
877 LIBS="$LIBS -ldmalloc"
880 AC_CHECK_FUNCS(setlocale)
882 AC_CHECK_FUNCS(getpassphrase)
884 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
885 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
886 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
887 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
888 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
889 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
890 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
891 AC_LIBOBJ(getmntent)])
897 AC_CHECK_FUNC(lchown,
898 [__CHOWN_RHF="%{__chown} -Rhf"
899 __CHGRP_RHF="%{__chgrp} -Rhf"
900 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
901 [__CHOWN_RHF="%{__chown} -Rf"
902 __CHGRP_RHF="%{__chgrp} -Rf"
903 dnl Does chown() follow symlinks? This should be a good enough test.
904 AC_MSG_CHECKING(whether chown() follows symlinks)
905 AC_ARG_ENABLE([broken-chown],
906 [ --enable-broken-chown this system's chown follows symbolic links],
907 result=$enableval, result=unknown)
908 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
910 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
913 if test $result = unknown; then
914 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
919 if test `ls -l foo | awk '{print $3}'` != "root"; then
926 AC_MSG_CHECKING((cannot check by non-root user))
931 AC_MSG_RESULT($result)
932 if test $result = yes; then
933 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
935 AC_SUBST(__CHOWN_RHF)
936 AC_SUBST(__CHGRP_RHF)
939 dnl figure out what root's primary group is
941 AC_MSG_CHECKING(root's primary group)
942 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
943 #include <sys/types.h>
949 struct passwd *root = NULL;
950 struct group *roots_group = NULL;
951 FILE * tempfile = NULL;
953 root = getpwuid( (uid_t) 0 );
955 roots_group = getgrgid(root->pw_gid);
956 if (roots_group != NULL) {
957 tempfile = fopen("conftest_rootg", "w");
958 if (tempfile != NULL) {
959 fprintf(tempfile, "%s\n", roots_group->gr_name);
967 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
969 AC_MSG_RESULT($ROOT_GROUP)
972 if echo "$build_os" | grep sco > /dev/null; then
973 echo "hacking things up for sco"
974 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
975 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
976 [Define as 1 if you have "struct mnttab" (only sco?)])
977 elif echo "$build_os" | grep sunos > /dev/null; then
978 echo "hacking things up for sunos"
979 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
980 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
981 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
986 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
989 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
990 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
992 if echo "$build_os" | grep '.*-gnueabi' > /dev/null ; then
993 build_os=`echo "${build_os}" | sed 's/-gnueabi$//'`
994 build_os_gnu=-gnueabi
996 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
997 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
1001 build_os_exact="${build_os}"
1002 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
1003 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
1006 rm -f ./find-provides
1007 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
1008 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
1009 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
1010 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
1011 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
1012 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
1013 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
1014 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
1015 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
1016 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
1017 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
1018 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
1020 echo "*** no default provides information is available for ${build_os_noversion}"
1021 ln -s ${srcdir}/autodeps/none ./find-provides
1024 rm -f ./find-requires
1025 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
1026 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
1027 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
1028 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
1029 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
1030 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
1031 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
1032 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
1033 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
1034 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
1035 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
1036 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
1038 echo "*** no default requires information is available for ${build_os_noversion}"
1039 ln -s ${srcdir}/autodeps/none ./find-requires
1042 dnl Determine the canonical arch-vendor-os for the build machine
1043 autorelocate_path='%{nil}'
1044 autorelocate_dcolor='0'
1045 case "${build_cpu}" in
1046 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
1047 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
1048 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
1049 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
1050 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
1051 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
1052 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
1053 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64;
1054 autorelocate_path='/emul/%%{ARCH}-%%{OS}'
1055 autorelocate_dcolor='1' ;;
1056 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
1057 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
1058 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
1059 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
1060 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
1061 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
1062 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
1063 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
1064 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1066 case "${build_os_noversion}" in
1067 mint) RPMCANONARCH=m68kmint ;;
1069 RPMCANONVENDOR="$build_vendor"
1070 case "${build_vendor}" in
1071 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
1072 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1073 test -f /etc/pld-release && RPMCANONVENDOR=pld
1074 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1075 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1076 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1077 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
1078 test -f /etc/caos-release && RPMCANONVENDOR=caos
1081 RPMCANONOS="$build_os_noversion"
1082 RPMCANONGNU="$build_os_gnu"
1083 AC_SUBST(RPMCANONCOLOR)
1084 AC_SUBST(autorelocate_path)
1085 AC_SUBST(autorelocate_dcolor)
1086 AC_SUBST(RPMCANONARCH)
1087 AC_SUBST(RPMCANONVENDOR)
1088 AC_SUBST(RPMCANONOS)
1089 AC_SUBST(RPMCANONGNU)
1091 if test X"$prefix" = XNONE ; then
1092 usrprefix="$ac_default_prefix"
1097 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1098 AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR",
1099 [Full path to rpm global configuration directory (usually /usr/lib/rpm)])
1100 AC_SUBST(RPMCONFIGDIR)
1102 VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
1103 AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME",
1104 [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)])
1105 AC_SUBST(VENDORRPMRC_FILENAME)
1109 AC_CONFIG_SUBDIRS(db3)
1111 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1113 AC_CONFIG_FILES([ Doxyfile Makefile platform rpm.pc
1114 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1115 po/Makefile.in scripts/Makefile
1116 scripts/macros.perl scripts/macros.php scripts/macros.python
1124 AC_CONFIG_FILES([rpmpopt-${VERSION}:rpmpopt.in],,[VERSION=${VERSION}])