2 AC_INIT(rpm, 4.4.90, rpm-maint@lists.rpm.org)
4 AC_CONFIG_SRCDIR([rpmqv.c])
5 AC_CONFIG_HEADERS([config.h])
7 AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects nostdinc])
9 AC_CONFIG_TESTDIR(tests)
16 dnl Checks for programs.
29 if test "$GCC" = yes; then
30 CFLAGS="$CFLAGS -fPIC -DPIC -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
31 cflags_to_try="-fno-strict-aliasing"
32 AC_MSG_CHECKING([supported compiler flags])
35 for flag in $cflags_to_try; do
36 CFLAGS="$CFLAGS $flag"
37 AC_TRY_COMPILE(, [return 0;], [
39 RPMCFLAGS="$RPMCFLAGS $flag"
43 CFLAGS="$CFLAGS $RPMCFLAGS"
47 AC_PROG_GCC_TRADITIONAL
50 AC_CHECK_HEADER([stdarg.h])
51 AC_MSG_CHECKING([for va_copy])
52 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
54 void foo(int i, ...) {
61 ]])],[ac_cv_va_copy=yes],[ac_cv_va_copy=no])
62 AC_MSG_RESULT([$ac_cv_va_copy])
68 export RPMUSER RPMUID RPMGROUP RPMGID
75 dnl This now uses libtool. Put
76 dnl LDFLAGS_STATIC="-all"
77 dnl to attempt static executables using libtool. Otherwise
80 AC_MSG_CHECKING(flag used by libtool to link rpm)
81 if test X"$GCC" = Xyes ; then
83 *-*-linux*) LDFLAGS_STATIC="-all-static" ;;
84 *-*-solaris*) LDFLAGS_STATIC="-static";;
85 *-*-hpux*) LDFLAGS_STATIC="-static";;
86 *-*-darwin*) LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
87 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
88 *-*-*) LDFLAGS_STATIC="";;
90 elif test X"$CC" = Xcc ; then
92 *-*-linux*) LDFLAGS_STATIC="-all-static";;
93 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
94 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
95 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
96 *-*-hpux*) LDFLAGS_STATIC="-static";;
97 *-*-solaris*) LDFLAGS_STATIC="-static";;
98 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
99 # link because of crt1.o then.
100 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
101 *-*-*) LDFLAGS_STATIC=""
104 Unable to guess what option to pass to $CC to generate a static
105 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
106 the appropriate argument(s) if you want to build a static rpm executable.
112 # just link it dynamically
115 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
116 AC_MSG_RESULT($LDFLAGS_STATIC)
117 AC_SUBST(LDFLAGS_STATIC)
120 dnl look for POSIX chmod attributes
122 AC_MSG_CHECKING(POSIX chmod)
124 chmod 744 foo.chmodtest
125 chmod +X foo.chmodtest 2>/dev/null
126 a=`ls -l foo.chmodtest | awk '{print $1}'`
128 if test "$a" = "-rwxr-xr-x"; then
130 FIXPERMS=a+rX,u+w,g-w,o-w
132 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
133 FIXPERMS=a+r,u+w,g-w,o-w
138 dnl see if we have a mkdir that supports `-p'.
140 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
141 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
143 $RPM_MKDIR -p conftest/a 2>/dev/null
144 if test $? = 0 ; then
145 rmdir conftest/a 2>/dev/null
146 if test $? = 0 ; then
152 rmdir conftest 2>/dev/null
153 if test $? = 0 ; then
154 RPM_MKDIR_P="$RPM_MKDIR -p"
162 if test X"$RPM_MKDIR_P" = X0 ; then
164 RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
169 dnl substitute this into config.h, so the C source picks it up.
171 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
172 [A full path to a program, possibly with arguments, that will create a
173 directory and all necessary parent directories, ala 'mkdir -p'])
174 AC_SUBST(RPM_MKDIR_P)
178 dnl This test must precede tests of compiler characteristics like
179 dnl that for the inline keyword, since it may change the degree to
180 dnl which the compiler supports such features.
183 dnl AM_DISABLE_SHARED
186 AC_CHECK_TOOL(AR, ar, :)
189 dnl use defaults if cross-compiling, otherwise use the default path.
191 if test "$cross_compiling" = "yes"; then
198 dnl Find some common programs
200 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
201 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
202 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
203 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
204 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
205 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
206 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
207 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
208 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
209 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
210 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
211 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
212 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
214 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
215 AC_MSG_CHECKING(checking whether id supports -u)
216 if ${__ID} -u 2>&1 > /dev/null ; then
220 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
225 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
226 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
227 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
228 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
229 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
230 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
231 AC_MSG_CHECKING(old version of patch)
232 PATCHVERSION=`patch --version 2>&1`
234 if test "$PATCHVERSION" = "Patch version 2.1"; then
235 AC_DEFINE(HAVE_OLDPATCH_21, 1,
236 [Define if the patch call you'll be using is 2.1 or older])
237 AC_MSG_RESULT(patch older then 2.2 found)
239 AC_MSG_RESULT(patch later then 2.2 found)
242 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
243 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
244 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
245 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
246 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
247 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
248 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
249 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
251 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
252 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
253 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
254 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
255 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
261 *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
262 *) LIBS="$LIBS -L$l $*";;
267 # Check for zlib library.
272 AC_CHECK_HEADERS([zlib.h],[
273 AS_IF([test -z "${WITH_ZLIB_LIB}"],[
274 for zlib in z gz ; do
275 AC_CHECK_LIB(${zlib}, gzread,
276 [WITH_ZLIB_LIB="-l${zlib}"; break])
279 dnl zlib-1.0.4 has not gzseek
280 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
284 AC_SUBST(WITH_ZLIB_INCLUDE)
285 AC_SUBST(WITH_ZLIB_LIB)
288 # Check for bzip2 library.
290 AC_CHECK_HEADERS([bzlib.h],[
291 AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
293 AC_CHECK_LIB(bz2, BZ2_bzread,[
295 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
299 AC_SUBST(WITH_BZ2_LIB)
303 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
304 if test -d /usr/ucblib ; then
305 if test "$build" = "mips-sni-sysv4" ; then
306 addlib /usr/ccs/lib -lc
317 dnl Check for features
320 dnl Checks for libraries.
322 AC_CHECK_FUNC(setreuid, [], [
323 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
326 AC_CHECK_FUNC(rand, [], [
327 AC_CHECK_LIB(rand, rand, [])
330 AC_CHECK_FUNC(getdomainname, [], [
331 AC_CHECK_LIB(nsl, getdomainname)
333 AC_CHECK_FUNC(socket, [], [
334 AC_CHECK_LIB(socket, socket)
337 AC_CHECK_HEADERS(error.h)
338 AC_CHECK_FUNCS(error)
340 AC_CHECK_HEADERS(poll.h)
342 AC_CHECK_HEADERS(pthread.h)
344 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
345 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
346 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
347 AC_CHECK_LIB(thread, mutex_lock)
351 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
353 AC_CHECK_FUNCS(vsnprintf snprintf)
355 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
356 dnl not in the libc but in libport (for political reasons). This check
357 dnl can hopefully be removed soon. Please use the default action
358 dnl for this macro (not LIBS=...), otherwise the check for dbopen
360 AC_CHECK_LIB(port, writev)
363 # Check for libelf library. Prefer external, otherwise none.
366 AC_CHECK_HEADER([libelf.h])
367 AC_CHECK_HEADERS([gelf.h], [
368 AC_CHECK_LIB(elf, gelf_getvernaux, [
369 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
370 WITH_LIBELF_LIB="-lelf"
374 AC_SUBST(WITH_LIBELF_INCLUDE)
375 AC_SUBST(WITH_LIBELF_LIB)
376 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
378 AC_CHECK_HEADERS([dwarf.h], [
381 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
384 # Check for beecrypt library.
385 WITH_BEECRYPT_INCLUDE=
387 AC_CHECK_HEADERS([beecrypt/beecrypt.h], [
388 AC_CHECK_LIB(beecrypt, mpfprintln, [
389 AC_CHECK_HEADERS([beecrypt/api.h])
390 WITH_BEECRYPT_INCLUDE=
391 WITH_BEECRYPT_LIB="-lbeecrypt"
393 AC_MSG_ERROR([missing required library beecrypt])
396 AC_MSG_ERROR([missing required header beecrypt/beecrypt.h])
398 AC_SUBST(WITH_BEECRYPT_INCLUDE)
399 AC_SUBST(WITH_BEECRYPT_LIB)
402 # Check for magic library.
406 AC_CHECK_HEADER([magic.h], [
407 AC_CHECK_LIB(magic, magic_open, [
409 WITH_MAGIC_LIB="-lmagic"
411 AC_MSG_ERROR([missing required library 'libmagic'])
414 AC_MSG_ERROR([missing required header magic.h])
417 AC_SUBST(WITH_MAGIC_INCLUDE)
418 AC_SUBST(WITH_MAGIC_LIB)
421 # Check for popt library.
425 AC_CHECK_HEADER([popt.h], [
426 AC_CHECK_LIB(popt, poptGetContext, [
428 WITH_POPT_LIB="-lpopt"
430 AC_MSG_ERROR([missing required library popt])
433 AC_MSG_ERROR([missing required header popt.h])
436 AC_SUBST(WITH_POPT_INCLUDE)
437 AC_SUBST(WITH_POPT_LIB)
440 # Process --with/without-external-db
441 AC_ARG_WITH(external_db, [ --with-external-db build against an external Berkeley db],
442 [case "$with_external_db" in
444 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
446 [with_external_db=no])
448 case "$with_external_db" in
450 AC_CHECK_HEADERS([db.h],[
451 AC_CHECK_TYPE([db_threadid_t],[],
452 [AC_MSG_WARN([missing type db_threadid_t])],
455 AC_CHECK_LIB([db],[db_create],[],[
456 AC_MSG_ERROR([missing db_create in libdb])
458 AC_CHECK_LIB([db],[db_env_create],[],[
459 AC_MSG_ERROR([missing db_env_create in libdb])
461 AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
462 AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
464 AC_CHECK_LIB([db],[db_strerror],[],[
465 AC_MSG_ERROR([missing db_strerror in libdb])
470 AC_MSG_ERROR([missing required header db.h])
473 * ) # Fall back to internal db
474 # XXX for now we always have in-tree BDB available...
475 AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
479 AC_SUBST([WITH_DB_LIB])
482 # Check for sqlite3 library.
483 AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 enable sqlite3 support],
484 [case "$enable_sqlite3" in
486 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
491 WITH_SQLITE3_INCLUDE=
494 AS_IF([test "$enable_sqlite3" = yes],[
495 AC_CHECK_HEADERS([sqlite3.h],
496 [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
497 WITH_SQLITE3_INCLUDE=
498 WITH_SQLITE3_LIB="-lsqlite3"
501 AC_MSG_ERROR([missing libsqlite3])
504 AC_MSG_ERROR([missing sqlite3.h])
508 AC_SUBST(WITH_SQLITE3_INCLUDE)
509 AC_SUBST(WITH_SQLITE3_LIB)
510 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
514 dnl AmigaOS and IXEmul have a fork() dummy
517 echo "Building for AmigaOS: using vfork() instead of fork()";
518 CFLAGS="$CFLAGS -Dfork=vfork"
522 AM_GNU_GETTEXT_VERSION([0.16.1])
523 AM_GNU_GETTEXT([external])
525 dnl Checks for header files we can live without.
531 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
533 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
534 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
535 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
537 AC_CHECK_HEADERS(netinet/in_systm.h)
538 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
539 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
540 AC_CHECK_HEADERS(libio.h)
541 AC_CHECK_HEADERS(err.h mcheck.h)
543 AC_CHECK_HEADERS(glob.h)
544 AC_CHECK_HEADERS(locale.h)
546 dnl statfs portability fiddles.
548 dnl We should really emulate/steal sections of the statfs and struct statfs
549 dnl checks from GNU fileutils.
551 AC_MSG_CHECKING(for struct statfs)
554 dnl this is easier than nesting AC_TRY_COMPILEs...
556 found_struct_statfs=no
558 if test X$found_struct_statfs = Xno ; then
559 dnl Solaris 2.6+ wants to use statvfs
560 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
561 #ifdef HAVE_SYS_TYPES_H
562 #include <sys/types.h>
564 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
565 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
566 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
567 found_struct_statfs=yes],[])
570 if test X$found_struct_statfs = Xno ; then
571 dnl first try including sys/vfs.h
572 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
573 #ifdef HAVE_SYS_TYPES_H
574 #include <sys/types.h>
576 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
577 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
578 found_struct_statfs=yes],[])
581 if test X$found_struct_statfs = Xno ; then
582 dnl ...next try including sys/mount.h
583 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
584 #ifdef HAVE_SYS_TYPES_H
585 #include <sys/types.h>
587 #ifdef HAVE_SYS_PARAM_H
588 #include <sys/param.h>
590 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
591 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
592 found_struct_statfs=yes],[])
595 if test X$found_struct_statfs = Xno ; then
596 dnl ...still no joy. Try sys/statfs.h
597 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
598 #ifdef HAVE_SYS_TYPES_H
599 #include <sys/types.h>
601 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
602 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
603 found_struct_statfs=yes],[])
606 if test X$found_struct_statfs = Xno ; then
607 dnl ...no luck. Warn the user of impending doom.
608 AC_MSG_WARN(not found)
612 dnl if we found the struct, see if it has the f_bavail member. Some OSes
613 dnl don't, including IRIX 6.5+
615 if test X$found_struct_statfs = Xyes ; then
616 AC_MSG_CHECKING(for f_bavail member in struct statfs)
617 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
618 #ifdef HAVE_SYS_TYPES_H
619 #include <sys/types.h>
621 #if STATFS_IN_SYS_STATVFS
622 # include <sys/statvfs.h>
623 typedef struct statvfs STATFS_t;
625 typedef struct statfs STATFS_t;
626 # if STATFS_IN_SYS_VFS
627 # include <sys/vfs.h>
628 # elif STATFS_IN_SYS_MOUNT
629 # include <sys/mount.h>
630 # elif STATFS_IN_SYS_STATFS
631 # include <sys/statfs.h>
633 #endif ]], [[STATFS_t sfs;
634 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
635 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
639 if test X$found_struct_statfs = Xyes ; then
641 dnl now check to see if we have the 4-argument variant of statfs()
642 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
644 AC_MSG_CHECKING([if statfs() requires 4 arguments])
645 AC_RUN_IFELSE([AC_LANG_SOURCE([[
646 #ifdef HAVE_SYS_TYPES_H
647 #include <sys/types.h>
649 #ifdef STATFS_IN_SYS_VFS
651 #elif STATFS_IN_SYS_MOUNT
652 #include <sys/mouht.h>
653 #elif STATFS_IN_SYS_STATFS
654 #include <sys/statfs.h>
658 exit (statfs(".", &sfs, sizeof(sfs), 0));
660 ]])],[AC_MSG_RESULT(yes)
661 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
667 dnl look for libc features
669 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
670 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
671 AC_MSG_RESULT($PROVIDES_ERRNO)
672 if test $PROVIDES_ERRNO = yes; then
673 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
676 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
677 dnl make S_ISSOCK always return false (nice, eh?)
678 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
679 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
680 AC_MSG_RESULT($HAS_S_IFSOCK)
681 if test $HAS_S_IFSOCK = yes; then
682 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
685 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
686 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
687 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
688 AC_MSG_RESULT($HAS_S_ISLNK)
689 if test $HAS_S_ISLNK = yes; then
690 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
693 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
694 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
695 AC_MSG_RESULT($HAS_S_ISSOCK)
696 if test $HAS_S_ISSOCK = yes; then
697 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
700 AC_MSG_CHECKING(if timezone is defined)
701 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
702 AC_MSG_RESULT($HAS_TIMEZONE)
704 dnl Check for missing typedefs
710 dnl Checks for library functions.
713 dnl XXX don't want to re-enable code that's been unused for years at this
714 dnl point, but should offer good performance improvements, check after
718 AC_CHECK_FUNCS(basename getaddrinfo getcwd getnameinfo getwd inet_aton)
719 AC_CHECK_FUNCS(mtrace putenv realpath setenv)
720 AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
721 AC_CHECK_FUNCS(strdup strndup strerror strtol strtoul strspn strstr)
723 AC_CHECK_FUNCS(__secure_getenv)
725 AC_CHECK_FUNCS(regcomp)
729 AC_CHECK_FUNCS(mkstemp)
731 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
732 dnl %files gets something like
733 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
734 dnl (Note: more than one asterisk in glob pattern.)
736 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
737 dnl dangling symlinks are no longer globbed. Always use the internal glob.
738 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
742 dnl check if python is requested
743 AC_ARG_ENABLE(python, [ --enable-python build rpm python bindings ],
744 [case "$enable_python" in
746 *) AC_MSG_ERROR([invalid argument to --enable-python])
751 AS_IF([test "$enable_python" = yes],[
752 # rpm-python is based on python-2.5,
753 # with legacy hacks to allow building against python >= 2.3
754 AM_PATH_PYTHON([2.3],[
755 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
756 WITH_PYTHON_SUBPACKAGE=1
757 save_CPPFLAGS="$CPPFLAGS"
758 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
759 AC_CHECK_HEADER([Python.h],[],
760 [AC_MSG_ERROR([missing Python.h])
762 CPPFLAGS="$save_CPPFLAGS"
764 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
765 WITH_PYTHON_LIB="$ac_res"
766 ],[AC_MSG_ERROR([missing python library])
773 WITH_PYTHON_SUBPACKAGE=0
776 AC_SUBST(WITH_PYTHON_INCLUDE)
777 AC_SUBST(WITH_PYTHON_LIB)
779 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
781 AC_PATH_PROG(DOXYGEN, doxygen, no)
783 dnl Auto-detect whether doxygen generated API docs should be included.
785 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ],,[with_apidocs=auto])
787 case "$with_apidocs" in
789 AS_IF([test "$DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes])
792 AS_IF([test "$DOXYGEN" = no],
793 [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])])
796 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
799 AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],
800 [case "$with_selinux" in
802 *) AC_MSG_ERROR([invalid argument to --with-selinux])
807 AS_IF([test "$with_selinux" = yes],[
808 AC_CHECK_HEADER([selinux/selinux.h],[
809 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
810 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
812 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
816 AS_IF([test "$with_selinux" = yes],[
817 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
818 WITH_SELINUX_LIB="-lselinux"
820 AC_SUBST(WITH_SELINUX_LIB)
821 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
825 AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes])
826 AS_IF([test "$with_lua" = yes],[
827 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
828 WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
829 WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
831 AC_SUBST(WITH_LUA_LIB)
832 AC_SUBST(WITH_LUA_INCLUDE)
835 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
836 if test "$with_dmalloc" = yes ; then
837 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
838 LIBS="$LIBS -ldmalloc"
841 AC_CHECK_FUNCS(setlocale)
843 AC_CHECK_FUNCS(getpassphrase)
845 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
846 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
847 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
848 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
849 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
850 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
851 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
852 AC_LIBOBJ(getmntent)])
858 AC_CHECK_FUNC(lchown,
859 [__CHOWN_RHF="%{__chown} -Rhf"
860 __CHGRP_RHF="%{__chgrp} -Rhf"
861 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
862 [__CHOWN_RHF="%{__chown} -Rf"
863 __CHGRP_RHF="%{__chgrp} -Rf"
864 dnl Does chown() follow symlinks? This should be a good enough test.
865 AC_MSG_CHECKING(whether chown() follows symlinks)
866 AC_ARG_ENABLE([broken-chown],
867 [ --enable-broken-chown this system's chown follows symbolic links],
868 result=$enableval, result=unknown)
869 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
871 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
874 if test $result = unknown; then
875 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
880 if test `ls -l foo | awk '{print $3}'` != "root"; then
887 AC_MSG_CHECKING((cannot check by non-root user))
892 AC_MSG_RESULT($result)
893 if test $result = yes; then
894 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
896 AC_SUBST(__CHOWN_RHF)
897 AC_SUBST(__CHGRP_RHF)
900 dnl figure out what root's primary group is
902 AC_MSG_CHECKING(root's primary group)
903 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
904 #include <sys/types.h>
910 struct passwd *root = NULL;
911 struct group *roots_group = NULL;
912 FILE * tempfile = NULL;
914 root = getpwuid( (uid_t) 0 );
916 roots_group = getgrgid(root->pw_gid);
917 if (roots_group != NULL) {
918 tempfile = fopen("conftest_rootg", "w");
919 if (tempfile != NULL) {
920 fprintf(tempfile, "%s\n", roots_group->gr_name);
928 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
930 AC_MSG_RESULT($ROOT_GROUP)
933 if echo "$build_os" | grep sco > /dev/null; then
934 echo "hacking things up for sco"
935 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
936 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
937 [Define as 1 if you have "struct mnttab" (only sco?)])
938 elif echo "$build_os" | grep sunos > /dev/null; then
939 echo "hacking things up for sunos"
940 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
941 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
942 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
947 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
950 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
951 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
953 if echo "$build_os" | grep '.*-gnueabi' > /dev/null ; then
954 build_os=`echo "${build_os}" | sed 's/-gnueabi$//'`
955 build_os_gnu=-gnueabi
957 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
958 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
962 build_os_exact="${build_os}"
963 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
964 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
967 rm -f ./find-provides
968 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
969 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
970 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
971 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
972 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
973 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
974 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
975 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
976 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
977 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
978 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
979 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
981 echo "*** no default provides information is available for ${build_os_noversion}"
982 ln -s ${srcdir}/autodeps/none ./find-provides
985 rm -f ./find-requires
986 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
987 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
988 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
989 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
990 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
991 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
992 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
993 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
994 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
995 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
996 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
997 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
999 echo "*** no default requires information is available for ${build_os_noversion}"
1000 ln -s ${srcdir}/autodeps/none ./find-requires
1003 dnl Determine the canonical arch-vendor-os for the build machine
1004 autorelocate_path='%{nil}'
1005 autorelocate_dcolor='0'
1006 case "${build_cpu}" in
1007 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
1008 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
1009 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
1010 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
1011 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
1012 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
1013 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
1014 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64;
1015 autorelocate_path='/emul/%%{ARCH}-%%{OS}'
1016 autorelocate_dcolor='1' ;;
1017 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
1018 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
1019 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
1020 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
1021 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
1022 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
1023 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
1024 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
1025 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1027 case "${build_os_noversion}" in
1028 mint) RPMCANONARCH=m68kmint ;;
1030 RPMCANONVENDOR="$build_vendor"
1031 case "${build_vendor}" in
1032 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
1033 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1034 test -f /etc/pld-release && RPMCANONVENDOR=pld
1035 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1036 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1037 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1038 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
1039 test -f /etc/caos-release && RPMCANONVENDOR=caos
1042 RPMCANONOS="$build_os_noversion"
1043 RPMCANONGNU="$build_os_gnu"
1044 AC_SUBST(RPMCANONCOLOR)
1045 AC_SUBST(autorelocate_path)
1046 AC_SUBST(autorelocate_dcolor)
1047 AC_SUBST(RPMCANONARCH)
1048 AC_SUBST(RPMCANONVENDOR)
1049 AC_SUBST(RPMCANONOS)
1050 AC_SUBST(RPMCANONGNU)
1051 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
1053 if test X"$prefix" = XNONE ; then
1054 usrprefix="$ac_default_prefix"
1059 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1060 AC_SUBST(RPMCONFIGDIR)
1064 AC_CONFIG_SUBDIRS(db3)
1066 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
1067 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
1068 AM_CONDITIONAL([APIDOCS],[test "$with_apidocs" == yes])
1070 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1072 AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
1073 AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
1076 AC_CONFIG_HEADERS([rpmdb/rpmints.h])
1078 AC_CONFIG_FILES([Makefile
1079 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1080 po/Makefile.in scripts/Makefile