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_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[
39 RPMCFLAGS="$RPMCFLAGS $flag"
43 CFLAGS="$CFLAGS $RPMCFLAGS"
49 AC_CHECK_HEADER([stdarg.h])
50 AC_MSG_CHECKING([for va_copy])
51 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
53 void foo(int i, ...) {
60 ]])],[ac_cv_va_copy=yes],[ac_cv_va_copy=no])
61 AC_MSG_RESULT([$ac_cv_va_copy])
67 export RPMUSER RPMUID RPMGROUP RPMGID
74 dnl This now uses libtool. Put
75 dnl LDFLAGS_STATIC="-all"
76 dnl to attempt static executables using libtool. Otherwise
79 AC_MSG_CHECKING(flag used by libtool to link rpm)
80 if test X"$GCC" = Xyes ; then
82 *-*-linux*) LDFLAGS_STATIC="-all-static" ;;
83 *-*-solaris*) LDFLAGS_STATIC="-static";;
84 *-*-hpux*) LDFLAGS_STATIC="-static";;
85 *-*-darwin*) LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
86 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
87 *-*-*) LDFLAGS_STATIC="";;
89 elif test X"$CC" = Xcc ; then
91 *-*-linux*) LDFLAGS_STATIC="-all-static";;
92 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
93 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
94 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
95 *-*-hpux*) LDFLAGS_STATIC="-static";;
96 *-*-solaris*) LDFLAGS_STATIC="-static";;
97 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
98 # link because of crt1.o then.
99 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
100 *-*-*) LDFLAGS_STATIC=""
103 Unable to guess what option to pass to $CC to generate a static
104 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
105 the appropriate argument(s) if you want to build a static rpm executable.
111 # just link it dynamically
114 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
115 AC_MSG_RESULT($LDFLAGS_STATIC)
116 AC_SUBST(LDFLAGS_STATIC)
119 dnl look for POSIX chmod attributes
121 AC_MSG_CHECKING(POSIX chmod)
123 chmod 744 foo.chmodtest
124 chmod +X foo.chmodtest 2>/dev/null
125 a=`ls -l foo.chmodtest | awk '{print $1}'`
127 if test "$a" = "-rwxr-xr-x"; then
129 FIXPERMS=a+rX,u+w,g-w,o-w
131 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
132 FIXPERMS=a+r,u+w,g-w,o-w
137 dnl see if we have a mkdir that supports `-p'.
139 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
140 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
142 $RPM_MKDIR -p conftest/a 2>/dev/null
143 if test $? = 0 ; then
144 rmdir conftest/a 2>/dev/null
145 if test $? = 0 ; then
151 rmdir conftest 2>/dev/null
152 if test $? = 0 ; then
153 RPM_MKDIR_P="$RPM_MKDIR -p"
161 if test X"$RPM_MKDIR_P" = X0 ; then
163 RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
168 dnl substitute this into config.h, so the C source picks it up.
170 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
171 [A full path to a program, possibly with arguments, that will create a
172 directory and all necessary parent directories, ala 'mkdir -p'])
173 AC_SUBST(RPM_MKDIR_P)
175 dnl AM_DISABLE_SHARED
178 AC_CHECK_TOOL(AR, ar, :)
181 dnl use defaults if cross-compiling, otherwise use the default path.
183 if test "$cross_compiling" = "yes"; then
190 dnl Find some common programs
192 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
193 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
194 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
195 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
196 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
197 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
198 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
199 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
200 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
201 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
202 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
203 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
204 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
206 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
207 AC_MSG_CHECKING(checking whether id supports -u)
208 if ${__ID} -u 2>&1 > /dev/null ; then
212 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
217 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
218 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
219 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
220 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
221 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
222 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
223 AC_MSG_CHECKING(old version of patch)
224 PATCHVERSION=`patch --version 2>&1`
226 if test "$PATCHVERSION" = "Patch version 2.1"; then
227 AC_DEFINE(HAVE_OLDPATCH_21, 1,
228 [Define if the patch call you'll be using is 2.1 or older])
229 AC_MSG_RESULT(patch older then 2.2 found)
231 AC_MSG_RESULT(patch later then 2.2 found)
234 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
235 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
236 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
237 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
238 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
239 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
240 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
241 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
243 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
244 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
245 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
246 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
247 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
250 # Check for zlib library.
255 AC_CHECK_HEADERS([zlib.h],[
256 AS_IF([test -z "${WITH_ZLIB_LIB}"],[
257 for zlib in z gz ; do
258 AC_CHECK_LIB(${zlib}, gzread,
259 [WITH_ZLIB_LIB="-l${zlib}"; break])
262 dnl zlib-1.0.4 has not gzseek
263 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
267 AC_SUBST(WITH_ZLIB_INCLUDE)
268 AC_SUBST(WITH_ZLIB_LIB)
271 # Check for bzip2 library.
273 AC_CHECK_HEADERS([bzlib.h],[
274 AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
276 AC_CHECK_LIB(bz2, BZ2_bzread,[
278 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
282 AC_SUBST(WITH_BZ2_LIB)
287 dnl Check for features
290 dnl Checks for libraries.
292 AC_CHECK_FUNC(setreuid, [], [
293 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
296 AC_CHECK_FUNC(rand, [], [
297 AC_CHECK_LIB(rand, rand, [])
300 AC_CHECK_FUNC(getdomainname, [], [
301 AC_CHECK_LIB(nsl, getdomainname)
303 AC_CHECK_FUNC(socket, [], [
304 AC_CHECK_LIB(socket, socket)
307 AC_CHECK_HEADERS(error.h)
308 AC_CHECK_FUNCS(error)
310 AC_CHECK_HEADERS(poll.h)
312 AC_CHECK_HEADERS(pthread.h)
314 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
315 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
316 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
317 AC_CHECK_LIB(thread, mutex_lock)
321 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
323 AC_CHECK_FUNCS(vsnprintf snprintf)
325 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
326 dnl not in the libc but in libport (for political reasons). This check
327 dnl can hopefully be removed soon. Please use the default action
328 dnl for this macro (not LIBS=...), otherwise the check for dbopen
330 AC_CHECK_LIB(port, writev)
333 # Check for libelf library. Prefer external, otherwise none.
336 AC_CHECK_HEADER([libelf.h])
337 AC_CHECK_HEADERS([gelf.h], [
338 AC_CHECK_LIB(elf, gelf_getvernaux, [
339 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
340 WITH_LIBELF_LIB="-lelf"
344 AC_SUBST(WITH_LIBELF_INCLUDE)
345 AC_SUBST(WITH_LIBELF_LIB)
346 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
348 AC_CHECK_HEADERS([dwarf.h], [
351 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
354 # Check for beecrypt library.
355 WITH_BEECRYPT_INCLUDE=
357 AC_CHECK_HEADERS([beecrypt/beecrypt.h], [
358 AC_CHECK_LIB(beecrypt, mpfprintln, [
359 AC_CHECK_HEADERS([beecrypt/api.h])
360 WITH_BEECRYPT_INCLUDE=
361 WITH_BEECRYPT_LIB="-lbeecrypt"
363 AC_MSG_ERROR([missing required library beecrypt])
366 AC_MSG_ERROR([missing required header beecrypt/beecrypt.h])
368 AC_SUBST(WITH_BEECRYPT_INCLUDE)
369 AC_SUBST(WITH_BEECRYPT_LIB)
372 # Check for magic library.
376 AC_CHECK_HEADER([magic.h], [
377 AC_CHECK_LIB(magic, magic_open, [
379 WITH_MAGIC_LIB="-lmagic"
381 AC_MSG_ERROR([missing required library 'libmagic'])
384 AC_MSG_ERROR([missing required header magic.h])
387 AC_SUBST(WITH_MAGIC_INCLUDE)
388 AC_SUBST(WITH_MAGIC_LIB)
391 # Check for popt library.
395 AC_CHECK_HEADER([popt.h], [
396 AC_CHECK_LIB(popt, poptGetContext, [
398 WITH_POPT_LIB="-lpopt"
400 AC_MSG_ERROR([missing required library popt])
403 AC_MSG_ERROR([missing required header popt.h])
406 AC_SUBST(WITH_POPT_INCLUDE)
407 AC_SUBST(WITH_POPT_LIB)
410 # Process --with/without-external-db
411 AC_ARG_WITH(external_db, [ --with-external-db build against an external Berkeley db],
412 [case "$with_external_db" in
414 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
416 [with_external_db=no])
418 case "$with_external_db" in
420 AC_CHECK_HEADERS([db.h],[
421 AC_CHECK_TYPE([db_threadid_t],[],
422 [AC_MSG_WARN([missing type db_threadid_t])],
425 AC_CHECK_LIB([db],[db_create],[],[
426 AC_MSG_ERROR([missing db_create in libdb])
428 AC_CHECK_LIB([db],[db_env_create],[],[
429 AC_MSG_ERROR([missing db_env_create in libdb])
431 AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
432 AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
434 AC_CHECK_LIB([db],[db_strerror],[],[
435 AC_MSG_ERROR([missing db_strerror in libdb])
440 AC_MSG_ERROR([missing required header db.h])
443 * ) # Fall back to internal db
444 # XXX for now we always have in-tree BDB available...
445 AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
449 AC_SUBST([WITH_DB_LIB])
452 # Check for sqlite3 library.
453 AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 enable sqlite3 support],
454 [case "$enable_sqlite3" in
456 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
461 WITH_SQLITE3_INCLUDE=
464 AS_IF([test "$enable_sqlite3" = yes],[
465 AC_CHECK_HEADERS([sqlite3.h],
466 [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
467 WITH_SQLITE3_INCLUDE=
468 WITH_SQLITE3_LIB="-lsqlite3"
471 AC_MSG_ERROR([missing libsqlite3])
474 AC_MSG_ERROR([missing sqlite3.h])
478 AC_SUBST(WITH_SQLITE3_INCLUDE)
479 AC_SUBST(WITH_SQLITE3_LIB)
480 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
484 dnl AmigaOS and IXEmul have a fork() dummy
487 echo "Building for AmigaOS: using vfork() instead of fork()";
488 CFLAGS="$CFLAGS -Dfork=vfork"
492 AM_GNU_GETTEXT_VERSION([0.16.1])
493 AM_GNU_GETTEXT([external])
495 dnl Checks for header files we can live without.
501 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
503 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
504 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
505 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
507 AC_CHECK_HEADERS(netinet/in_systm.h)
508 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
509 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
510 AC_CHECK_HEADERS(libio.h)
511 AC_CHECK_HEADERS(err.h mcheck.h)
513 AC_CHECK_HEADERS(glob.h)
514 AC_CHECK_HEADERS(locale.h)
516 dnl statfs portability fiddles.
518 dnl We should really emulate/steal sections of the statfs and struct statfs
519 dnl checks from GNU fileutils.
521 AC_MSG_CHECKING(for struct statfs)
524 dnl this is easier than nesting AC_TRY_COMPILEs...
526 found_struct_statfs=no
528 if test X$found_struct_statfs = Xno ; then
529 dnl Solaris 2.6+ wants to use statvfs
530 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
531 #ifdef HAVE_SYS_TYPES_H
532 #include <sys/types.h>
534 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
535 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
536 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
537 found_struct_statfs=yes],[])
540 if test X$found_struct_statfs = Xno ; then
541 dnl first try including sys/vfs.h
542 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
543 #ifdef HAVE_SYS_TYPES_H
544 #include <sys/types.h>
546 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
547 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
548 found_struct_statfs=yes],[])
551 if test X$found_struct_statfs = Xno ; then
552 dnl ...next try including sys/mount.h
553 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
554 #ifdef HAVE_SYS_TYPES_H
555 #include <sys/types.h>
557 #ifdef HAVE_SYS_PARAM_H
558 #include <sys/param.h>
560 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
561 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
562 found_struct_statfs=yes],[])
565 if test X$found_struct_statfs = Xno ; then
566 dnl ...still no joy. Try sys/statfs.h
567 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
568 #ifdef HAVE_SYS_TYPES_H
569 #include <sys/types.h>
571 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
572 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
573 found_struct_statfs=yes],[])
576 if test X$found_struct_statfs = Xno ; then
577 dnl ...no luck. Warn the user of impending doom.
578 AC_MSG_WARN(not found)
582 dnl if we found the struct, see if it has the f_bavail member. Some OSes
583 dnl don't, including IRIX 6.5+
585 if test X$found_struct_statfs = Xyes ; then
586 AC_MSG_CHECKING(for f_bavail member in struct statfs)
587 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
588 #ifdef HAVE_SYS_TYPES_H
589 #include <sys/types.h>
591 #if STATFS_IN_SYS_STATVFS
592 # include <sys/statvfs.h>
593 typedef struct statvfs STATFS_t;
595 typedef struct statfs STATFS_t;
596 # if STATFS_IN_SYS_VFS
597 # include <sys/vfs.h>
598 # elif STATFS_IN_SYS_MOUNT
599 # include <sys/mount.h>
600 # elif STATFS_IN_SYS_STATFS
601 # include <sys/statfs.h>
603 #endif ]], [[STATFS_t sfs;
604 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
605 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
609 if test X$found_struct_statfs = Xyes ; then
611 dnl now check to see if we have the 4-argument variant of statfs()
612 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
614 AC_MSG_CHECKING([if statfs() requires 4 arguments])
615 AC_RUN_IFELSE([AC_LANG_SOURCE([[
616 #ifdef HAVE_SYS_TYPES_H
617 #include <sys/types.h>
619 #ifdef STATFS_IN_SYS_VFS
621 #elif STATFS_IN_SYS_MOUNT
622 #include <sys/mouht.h>
623 #elif STATFS_IN_SYS_STATFS
624 #include <sys/statfs.h>
628 exit (statfs(".", &sfs, sizeof(sfs), 0));
630 ]])],[AC_MSG_RESULT(yes)
631 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
637 dnl look for libc features
639 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
640 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
641 AC_MSG_RESULT($PROVIDES_ERRNO)
642 if test $PROVIDES_ERRNO = yes; then
643 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
646 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
647 dnl make S_ISSOCK always return false (nice, eh?)
648 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
649 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
650 AC_MSG_RESULT($HAS_S_IFSOCK)
651 if test $HAS_S_IFSOCK = yes; then
652 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
655 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
656 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
657 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
658 AC_MSG_RESULT($HAS_S_ISLNK)
659 if test $HAS_S_ISLNK = yes; then
660 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
663 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
664 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
665 AC_MSG_RESULT($HAS_S_ISSOCK)
666 if test $HAS_S_ISSOCK = yes; then
667 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
670 AC_MSG_CHECKING(if timezone is defined)
671 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
672 AC_MSG_RESULT($HAS_TIMEZONE)
674 dnl Check for missing typedefs
680 dnl Checks for library functions.
683 dnl XXX don't want to re-enable code that's been unused for years at this
684 dnl point, but should offer good performance improvements, check after
688 AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton)
689 AC_CHECK_FUNCS(mtrace)
690 AC_CHECK_FUNCS(strndup strerror)
692 AC_REPLACE_FUNCS(basename getcwd getwd)
693 AC_REPLACE_FUNCS(putenv realpath setenv)
694 AC_REPLACE_FUNCS(stpcpy stpncpy strcspn)
695 AC_REPLACE_FUNCS(strdup strtol strtoul strspn strstr)
697 AC_CHECK_FUNCS(__secure_getenv)
699 AC_CHECK_FUNCS(regcomp)
703 AC_CHECK_FUNCS(mkstemp)
705 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
706 dnl %files gets something like
707 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
708 dnl (Note: more than one asterisk in glob pattern.)
710 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
711 dnl dangling symlinks are no longer globbed. Always use the internal glob.
712 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
716 dnl check if python is requested
717 AC_ARG_ENABLE(python, [ --enable-python build rpm python bindings ],
718 [case "$enable_python" in
720 *) AC_MSG_ERROR([invalid argument to --enable-python])
725 AS_IF([test "$enable_python" = yes],[
726 # rpm-python is based on python-2.5,
727 # with legacy hacks to allow building against python >= 2.3
728 AM_PATH_PYTHON([2.3],[
729 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
730 WITH_PYTHON_SUBPACKAGE=1
731 save_CPPFLAGS="$CPPFLAGS"
732 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
733 AC_CHECK_HEADER([Python.h],[],
734 [AC_MSG_ERROR([missing Python.h])
736 CPPFLAGS="$save_CPPFLAGS"
738 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
739 WITH_PYTHON_LIB="$ac_res"
740 ],[AC_MSG_ERROR([missing python library])
747 WITH_PYTHON_SUBPACKAGE=0
750 AC_SUBST(WITH_PYTHON_INCLUDE)
751 AC_SUBST(WITH_PYTHON_LIB)
753 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
755 AC_PATH_PROG(DOXYGEN, doxygen, no)
757 dnl Auto-detect whether doxygen generated API docs should be included.
759 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ],,[with_apidocs=auto])
761 case "$with_apidocs" in
763 AS_IF([test "$DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes])
766 AS_IF([test "$DOXYGEN" = no],
767 [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])])
770 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
773 AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],
774 [case "$with_selinux" in
776 *) AC_MSG_ERROR([invalid argument to --with-selinux])
781 AS_IF([test "$with_selinux" = yes],[
782 AC_CHECK_HEADER([selinux/selinux.h],[
783 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
784 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
786 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
790 AS_IF([test "$with_selinux" = yes],[
791 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
792 WITH_SELINUX_LIB="-lselinux"
794 AC_SUBST(WITH_SELINUX_LIB)
795 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
799 AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes])
800 AS_IF([test "$with_lua" = yes],[
801 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
802 WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
803 WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
805 AC_SUBST(WITH_LUA_LIB)
806 AC_SUBST(WITH_LUA_INCLUDE)
809 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
810 if test "$with_dmalloc" = yes ; then
811 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
812 LIBS="$LIBS -ldmalloc"
815 AC_CHECK_FUNCS(setlocale)
817 AC_CHECK_FUNCS(getpassphrase)
819 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
820 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
821 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
822 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
823 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
824 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
825 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
826 AC_LIBOBJ(getmntent)])
832 AC_CHECK_FUNC(lchown,
833 [__CHOWN_RHF="%{__chown} -Rhf"
834 __CHGRP_RHF="%{__chgrp} -Rhf"
835 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
836 [__CHOWN_RHF="%{__chown} -Rf"
837 __CHGRP_RHF="%{__chgrp} -Rf"
838 dnl Does chown() follow symlinks? This should be a good enough test.
839 AC_MSG_CHECKING(whether chown() follows symlinks)
840 AC_ARG_ENABLE([broken-chown],
841 [ --enable-broken-chown this system's chown follows symbolic links],
842 result=$enableval, result=unknown)
843 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
845 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
848 if test $result = unknown; then
849 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
854 if test `ls -l foo | awk '{print $3}'` != "root"; then
861 AC_MSG_CHECKING((cannot check by non-root user))
866 AC_MSG_RESULT($result)
867 if test $result = yes; then
868 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
870 AC_SUBST(__CHOWN_RHF)
871 AC_SUBST(__CHGRP_RHF)
874 dnl figure out what root's primary group is
876 AC_MSG_CHECKING(root's primary group)
877 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
878 #include <sys/types.h>
884 struct passwd *root = NULL;
885 struct group *roots_group = NULL;
886 FILE * tempfile = NULL;
888 root = getpwuid( (uid_t) 0 );
890 roots_group = getgrgid(root->pw_gid);
891 if (roots_group != NULL) {
892 tempfile = fopen("conftest_rootg", "w");
893 if (tempfile != NULL) {
894 fprintf(tempfile, "%s\n", roots_group->gr_name);
902 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
904 AC_MSG_RESULT($ROOT_GROUP)
907 if echo "$build_os" | grep sco > /dev/null; then
908 echo "hacking things up for sco"
909 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
910 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
911 [Define as 1 if you have "struct mnttab" (only sco?)])
912 elif echo "$build_os" | grep sunos > /dev/null; then
913 echo "hacking things up for sunos"
914 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
915 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
916 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
921 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
924 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
925 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
927 if echo "$build_os" | grep '.*-gnueabi' > /dev/null ; then
928 build_os=`echo "${build_os}" | sed 's/-gnueabi$//'`
929 build_os_gnu=-gnueabi
931 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
932 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
936 build_os_exact="${build_os}"
937 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
938 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
941 rm -f ./find-provides
942 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
943 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
944 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
945 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
946 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
947 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
948 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
949 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
950 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
951 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
952 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
953 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
955 echo "*** no default provides information is available for ${build_os_noversion}"
956 ln -s ${srcdir}/autodeps/none ./find-provides
959 rm -f ./find-requires
960 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
961 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
962 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
963 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
964 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
965 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
966 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
967 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
968 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
969 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
970 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
971 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
973 echo "*** no default requires information is available for ${build_os_noversion}"
974 ln -s ${srcdir}/autodeps/none ./find-requires
977 dnl Determine the canonical arch-vendor-os for the build machine
978 autorelocate_path='%{nil}'
979 autorelocate_dcolor='0'
980 case "${build_cpu}" in
981 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
982 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
983 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
984 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
985 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
986 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
987 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
988 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64;
989 autorelocate_path='/emul/%%{ARCH}-%%{OS}'
990 autorelocate_dcolor='1' ;;
991 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
992 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
993 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
994 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
995 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
996 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
997 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
998 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
999 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1001 case "${build_os_noversion}" in
1002 mint) RPMCANONARCH=m68kmint ;;
1004 RPMCANONVENDOR="$build_vendor"
1005 case "${build_vendor}" in
1006 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
1007 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1008 test -f /etc/pld-release && RPMCANONVENDOR=pld
1009 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1010 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1011 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1012 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
1013 test -f /etc/caos-release && RPMCANONVENDOR=caos
1016 RPMCANONOS="$build_os_noversion"
1017 RPMCANONGNU="$build_os_gnu"
1018 AC_SUBST(RPMCANONCOLOR)
1019 AC_SUBST(autorelocate_path)
1020 AC_SUBST(autorelocate_dcolor)
1021 AC_SUBST(RPMCANONARCH)
1022 AC_SUBST(RPMCANONVENDOR)
1023 AC_SUBST(RPMCANONOS)
1024 AC_SUBST(RPMCANONGNU)
1025 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
1027 if test X"$prefix" = XNONE ; then
1028 usrprefix="$ac_default_prefix"
1033 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1034 AC_SUBST(RPMCONFIGDIR)
1038 AC_CONFIG_SUBDIRS(db3)
1040 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
1041 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
1042 AM_CONDITIONAL([APIDOCS],[test "$with_apidocs" == yes])
1044 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1046 AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
1047 AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
1050 AC_CONFIG_HEADERS([rpmdb/rpmints.h])
1052 AC_CONFIG_FILES([Makefile
1053 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1054 po/Makefile.in scripts/Makefile