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)
11 AC_USE_SYSTEM_EXTENSIONS
15 dnl Checks for programs.
28 if test "$GCC" = yes; then
29 CFLAGS="$CFLAGS -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wno-char-subscripts"
30 # XXX disabled for now due to noise from NSPR headers
31 # CFLAGS="$CFLAGS -Wstrict-prototypes"
32 cflags_to_try="-fno-strict-aliasing"
33 AC_MSG_CHECKING([supported compiler flags])
36 for flag in $cflags_to_try; do
37 CFLAGS="$CFLAGS $flag"
38 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[
40 RPMCFLAGS="$RPMCFLAGS $flag"
44 CFLAGS="$CFLAGS $RPMCFLAGS"
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)
176 dnl AM_DISABLE_SHARED
179 AC_CHECK_TOOL(AR, ar, :)
182 dnl use defaults if cross-compiling, otherwise use the default path.
184 if test "$cross_compiling" = "yes"; then
191 dnl Find some common programs
193 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
194 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
195 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
196 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
197 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
198 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
199 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
200 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
201 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
202 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
203 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
204 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
205 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
207 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
208 AC_MSG_CHECKING(checking whether id supports -u)
209 if ${__ID} -u 2>&1 > /dev/null ; then
213 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
218 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
219 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
220 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
221 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
222 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
223 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
224 AC_MSG_CHECKING(old version of patch)
225 PATCHVERSION=`patch --version 2>&1`
227 if test "$PATCHVERSION" = "Patch version 2.1"; then
228 AC_DEFINE(HAVE_OLDPATCH_21, 1,
229 [Define if the patch call you'll be using is 2.1 or older])
230 AC_MSG_RESULT(patch older then 2.2 found)
232 AC_MSG_RESULT(patch later then 2.2 found)
235 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
236 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
237 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
238 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
239 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
240 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
241 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
242 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
244 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
245 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
246 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
247 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
248 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
251 # Check for zlib library.
256 AC_CHECK_HEADERS([zlib.h],[
257 AS_IF([test -z "${WITH_ZLIB_LIB}"],[
258 for zlib in z gz ; do
259 AC_CHECK_LIB(${zlib}, gzread,
260 [WITH_ZLIB_LIB="-l${zlib}"; break])
263 dnl zlib-1.0.4 has not gzseek
264 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
268 AC_SUBST(WITH_ZLIB_INCLUDE)
269 AC_SUBST(WITH_ZLIB_LIB)
272 # Check for bzip2 library.
274 AC_CHECK_HEADERS([bzlib.h],[
275 AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
277 AC_CHECK_LIB(bz2, BZ2_bzread,[
279 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
283 AC_SUBST(WITH_BZ2_LIB)
288 dnl Check for features
291 dnl Checks for libraries.
293 AC_CHECK_FUNC(setreuid, [], [
294 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
297 AC_CHECK_FUNC(rand, [], [
298 AC_CHECK_LIB(rand, rand, [])
301 AC_CHECK_FUNC(getdomainname, [], [
302 AC_CHECK_LIB(nsl, getdomainname)
304 AC_CHECK_FUNC(socket, [], [
305 AC_CHECK_LIB(socket, socket)
308 AC_CHECK_HEADERS(error.h)
309 AC_CHECK_FUNCS(error)
311 AC_CHECK_HEADERS(poll.h)
313 AC_CHECK_HEADERS(pthread.h)
315 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
316 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
317 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
318 AC_CHECK_LIB(thread, mutex_lock)
322 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
324 AC_CHECK_FUNCS(vsnprintf snprintf)
326 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
327 dnl not in the libc but in libport (for political reasons). This check
328 dnl can hopefully be removed soon. Please use the default action
329 dnl for this macro (not LIBS=...), otherwise the check for dbopen
331 AC_CHECK_LIB(port, writev)
334 # Check for libelf library. Prefer external, otherwise none.
337 AC_CHECK_HEADER([libelf.h])
338 AC_CHECK_HEADERS([gelf.h], [
339 AC_CHECK_LIB(elf, gelf_getvernaux, [
340 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
341 WITH_LIBELF_LIB="-lelf"
345 AC_SUBST(WITH_LIBELF_INCLUDE)
346 AC_SUBST(WITH_LIBELF_LIB)
347 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
349 AC_CHECK_HEADERS([dwarf.h], [
352 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
355 # Check for NSS library.
358 check=`pkg-config --version 2>/dev/null`
359 if test -n "$check"; then
360 addlib=$(pkg-config --libs nss | sed 's/-lsmime3//;s/-lssl3//')
361 addcppflags=$(pkg-config --cflags nss)
363 # Without pkg-config, we'll kludge in some defaults
364 addlib="-lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
365 addcppflags="-I/usr/include/nss3 -I/usr/include/nspr4"
367 save_CPPFLAGS="$CPPFLAGS"
368 CPPFLAGS="$save_CPPFLAGS $addcppflags"
369 AC_CHECK_HEADER([nss3/nss.h], [
370 AC_CHECK_LIB(nss3, NSS_NoDB_Init, [
371 AC_DEFINE(HAVE_LIBNSS, 1, [Define to 1 if you have the 'NSS' library (-lnss3).])
372 WITH_NSS_INCLUDE="$addcppflags"
373 WITH_NSS_LIB="$addlib"
376 AC_MSG_ERROR([missing required header nss3/nss.h])
378 CPPFLAGS="$save_CPPFLAGS"
379 AC_SUBST(WITH_NSS_INCLUDE)
380 AC_SUBST(WITH_NSS_LIB)
383 # Check for magic library.
387 AC_CHECK_HEADER([magic.h], [
388 AC_CHECK_LIB(magic, magic_open, [
390 WITH_MAGIC_LIB="-lmagic"
392 AC_MSG_ERROR([missing required library 'libmagic'])
395 AC_MSG_ERROR([missing required header magic.h])
398 AC_SUBST(WITH_MAGIC_INCLUDE)
399 AC_SUBST(WITH_MAGIC_LIB)
402 # Check for popt library.
406 AC_CHECK_HEADER([popt.h], [
407 AC_CHECK_LIB(popt, poptGetContext, [
409 WITH_POPT_LIB="-lpopt"
411 AC_MSG_ERROR([missing required library popt])
414 AC_MSG_ERROR([missing required header popt.h])
417 AC_SUBST(WITH_POPT_INCLUDE)
418 AC_SUBST(WITH_POPT_LIB)
421 # Process --with/without-external-db
422 AC_ARG_WITH(external_db, [ --with-external-db build against an external Berkeley db],
423 [case "$with_external_db" in
425 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
427 [with_external_db=no])
429 case "$with_external_db" in
431 AC_CHECK_HEADERS([db.h],[
432 AC_CHECK_TYPE([db_threadid_t],[],
433 [AC_MSG_WARN([missing type db_threadid_t])],
436 AC_CHECK_LIB([db],[db_create],[],[
437 AC_MSG_ERROR([missing db_create in libdb])
439 AC_CHECK_LIB([db],[db_env_create],[],[
440 AC_MSG_ERROR([missing db_env_create in libdb])
442 AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
443 AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
445 AC_CHECK_LIB([db],[db_strerror],[],[
446 AC_MSG_ERROR([missing db_strerror in libdb])
451 AC_MSG_ERROR([missing required header db.h])
454 * ) # Fall back to internal db
455 # XXX for now we always have in-tree BDB available...
456 AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
460 AC_SUBST([WITH_DB_LIB])
463 # Check for sqlite3 library.
464 AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 enable sqlite3 support],
465 [case "$enable_sqlite3" in
467 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
472 WITH_SQLITE3_INCLUDE=
475 AS_IF([test "$enable_sqlite3" = yes],[
476 AC_CHECK_HEADERS([sqlite3.h],
477 [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
478 WITH_SQLITE3_INCLUDE=
479 WITH_SQLITE3_LIB="-lsqlite3"
482 AC_MSG_ERROR([missing libsqlite3])
485 AC_MSG_ERROR([missing sqlite3.h])
489 AC_SUBST(WITH_SQLITE3_INCLUDE)
490 AC_SUBST(WITH_SQLITE3_LIB)
491 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
495 dnl AmigaOS and IXEmul have a fork() dummy
498 echo "Building for AmigaOS: using vfork() instead of fork()";
499 CFLAGS="$CFLAGS -Dfork=vfork"
503 AM_GNU_GETTEXT_VERSION([0.16.1])
504 AM_GNU_GETTEXT([external])
506 dnl Checks for header files we can live without.
512 AC_CHECK_HEADERS(locale.h)
514 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
516 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
517 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
518 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
520 AC_CHECK_HEADERS(netinet/in_systm.h)
521 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
522 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
523 AC_CHECK_HEADERS(libio.h)
524 AC_CHECK_HEADERS(err.h mcheck.h)
526 AC_CHECK_HEADERS(glob.h)
527 AC_CHECK_HEADERS(locale.h)
529 dnl statfs portability fiddles.
531 dnl We should really emulate/steal sections of the statfs and struct statfs
532 dnl checks from GNU fileutils.
534 AC_MSG_CHECKING(for struct statfs)
537 dnl this is easier than nesting AC_TRY_COMPILEs...
539 found_struct_statfs=no
541 if test X$found_struct_statfs = Xno ; then
542 dnl Solaris 2.6+ wants to use statvfs
543 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
544 #ifdef HAVE_SYS_TYPES_H
545 #include <sys/types.h>
547 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
548 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
549 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
550 found_struct_statfs=yes],[])
553 if test X$found_struct_statfs = Xno ; then
554 dnl first try including sys/vfs.h
555 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
556 #ifdef HAVE_SYS_TYPES_H
557 #include <sys/types.h>
559 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
560 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
561 found_struct_statfs=yes],[])
564 if test X$found_struct_statfs = Xno ; then
565 dnl ...next try including sys/mount.h
566 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
567 #ifdef HAVE_SYS_TYPES_H
568 #include <sys/types.h>
570 #ifdef HAVE_SYS_PARAM_H
571 #include <sys/param.h>
573 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
574 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
575 found_struct_statfs=yes],[])
578 if test X$found_struct_statfs = Xno ; then
579 dnl ...still no joy. Try sys/statfs.h
580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
581 #ifdef HAVE_SYS_TYPES_H
582 #include <sys/types.h>
584 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
585 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
586 found_struct_statfs=yes],[])
589 if test X$found_struct_statfs = Xno ; then
590 dnl ...no luck. Warn the user of impending doom.
591 AC_MSG_WARN(not found)
595 dnl if we found the struct, see if it has the f_bavail member. Some OSes
596 dnl don't, including IRIX 6.5+
598 if test X$found_struct_statfs = Xyes ; then
599 AC_MSG_CHECKING(for f_bavail member in struct statfs)
600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
601 #ifdef HAVE_SYS_TYPES_H
602 #include <sys/types.h>
604 #if STATFS_IN_SYS_STATVFS
605 # include <sys/statvfs.h>
606 typedef struct statvfs STATFS_t;
608 typedef struct statfs STATFS_t;
609 # if STATFS_IN_SYS_VFS
610 # include <sys/vfs.h>
611 # elif STATFS_IN_SYS_MOUNT
612 # include <sys/mount.h>
613 # elif STATFS_IN_SYS_STATFS
614 # include <sys/statfs.h>
616 #endif ]], [[STATFS_t sfs;
617 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
618 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
622 if test X$found_struct_statfs = Xyes ; then
624 dnl now check to see if we have the 4-argument variant of statfs()
625 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
627 AC_MSG_CHECKING([if statfs() requires 4 arguments])
628 AC_RUN_IFELSE([AC_LANG_SOURCE([[
629 #ifdef HAVE_SYS_TYPES_H
630 #include <sys/types.h>
632 #ifdef STATFS_IN_SYS_VFS
634 #elif STATFS_IN_SYS_MOUNT
635 #include <sys/mouht.h>
636 #elif STATFS_IN_SYS_STATFS
637 #include <sys/statfs.h>
641 exit (statfs(".", &sfs, sizeof(sfs), 0));
643 ]])],[AC_MSG_RESULT(yes)
644 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
650 dnl look for libc features
652 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
653 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
654 AC_MSG_RESULT($PROVIDES_ERRNO)
655 if test $PROVIDES_ERRNO = yes; then
656 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
659 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
660 dnl make S_ISSOCK always return false (nice, eh?)
661 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
662 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
663 AC_MSG_RESULT($HAS_S_IFSOCK)
664 if test $HAS_S_IFSOCK = yes; then
665 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
668 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
669 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
670 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
671 AC_MSG_RESULT($HAS_S_ISLNK)
672 if test $HAS_S_ISLNK = yes; then
673 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
676 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
677 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
678 AC_MSG_RESULT($HAS_S_ISSOCK)
679 if test $HAS_S_ISSOCK = yes; then
680 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
683 AC_MSG_CHECKING(if timezone is defined)
684 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
685 AC_MSG_RESULT($HAS_TIMEZONE)
687 dnl Check for missing typedefs
693 dnl Checks for library functions.
696 dnl XXX don't want to re-enable code that's been unused for years at this
697 dnl point, but should offer good performance improvements, check after
701 AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton)
702 AC_CHECK_FUNCS(mtrace)
703 AC_CHECK_FUNCS(strndup strerror)
705 AC_REPLACE_FUNCS(basename getcwd getwd)
706 AC_REPLACE_FUNCS(putenv realpath setenv)
707 AC_REPLACE_FUNCS(stpcpy stpncpy strcspn)
708 AC_REPLACE_FUNCS(strdup strtol strtoul strspn strstr)
710 AC_CHECK_FUNCS(__secure_getenv)
712 AC_CHECK_FUNCS(regcomp)
716 AC_CHECK_FUNCS(mkstemp)
718 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
719 dnl %files gets something like
720 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
721 dnl (Note: more than one asterisk in glob pattern.)
723 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
724 dnl dangling symlinks are no longer globbed. Always use the internal glob.
725 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
729 dnl check if python is requested
730 AC_ARG_ENABLE(python, [ --enable-python build rpm python bindings ],
731 [case "$enable_python" in
733 *) AC_MSG_ERROR([invalid argument to --enable-python])
738 AS_IF([test "$enable_python" = yes],[
739 # rpm-python is based on python-2.5,
740 # with legacy hacks to allow building against python >= 2.3
741 AM_PATH_PYTHON([2.3],[
742 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
743 WITH_PYTHON_SUBPACKAGE=1
744 save_CPPFLAGS="$CPPFLAGS"
745 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
746 AC_CHECK_HEADER([Python.h],[],
747 [AC_MSG_ERROR([missing Python.h])
749 CPPFLAGS="$save_CPPFLAGS"
751 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
752 WITH_PYTHON_LIB="$ac_res"
753 ],[AC_MSG_ERROR([missing python library])
760 WITH_PYTHON_SUBPACKAGE=0
763 AC_SUBST(WITH_PYTHON_INCLUDE)
764 AC_SUBST(WITH_PYTHON_LIB)
766 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
768 AC_PATH_PROG(DOXYGEN, doxygen, no)
770 dnl Auto-detect whether doxygen generated API docs should be included.
772 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ],,[with_apidocs=auto])
774 case "$with_apidocs" in
776 AS_IF([test "$DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes])
779 AS_IF([test "$DOXYGEN" = no],
780 [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])])
783 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
786 AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],
787 [case "$with_selinux" in
789 *) AC_MSG_ERROR([invalid argument to --with-selinux])
794 AS_IF([test "$with_selinux" = yes],[
795 AC_CHECK_HEADER([selinux/selinux.h],[
796 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
797 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
799 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
803 AS_IF([test "$with_selinux" = yes],[
804 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
805 WITH_SELINUX_LIB="-lselinux"
807 AC_SUBST(WITH_SELINUX_LIB)
808 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
812 AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes])
813 AS_IF([test "$with_lua" = yes],[
814 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
815 WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
816 WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
818 AC_SUBST(WITH_LUA_LIB)
819 AC_SUBST(WITH_LUA_INCLUDE)
822 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
823 if test "$with_dmalloc" = yes ; then
824 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
825 LIBS="$LIBS -ldmalloc"
828 AC_CHECK_FUNCS(setlocale)
830 AC_CHECK_FUNCS(getpassphrase)
832 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
833 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
834 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
835 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
836 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
837 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
838 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
839 AC_LIBOBJ(getmntent)])
845 AC_CHECK_FUNC(lchown,
846 [__CHOWN_RHF="%{__chown} -Rhf"
847 __CHGRP_RHF="%{__chgrp} -Rhf"
848 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
849 [__CHOWN_RHF="%{__chown} -Rf"
850 __CHGRP_RHF="%{__chgrp} -Rf"
851 dnl Does chown() follow symlinks? This should be a good enough test.
852 AC_MSG_CHECKING(whether chown() follows symlinks)
853 AC_ARG_ENABLE([broken-chown],
854 [ --enable-broken-chown this system's chown follows symbolic links],
855 result=$enableval, result=unknown)
856 if echo "$build" | ${EGREP} "(aix)|(hpux)|(linux)" > /dev/null ; then
858 elif echo "$build" | ${EGREP} "(nextstep)" > /dev/null ; then
861 if test $result = unknown; then
862 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
867 if test `ls -l foo | awk '{print $3}'` != "root"; then
874 AC_MSG_CHECKING((cannot check by non-root user))
879 AC_MSG_RESULT($result)
880 if test $result = yes; then
881 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
883 AC_SUBST(__CHOWN_RHF)
884 AC_SUBST(__CHGRP_RHF)
887 dnl figure out what root's primary group is
889 AC_MSG_CHECKING(root's primary group)
890 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
891 #include <sys/types.h>
897 struct passwd *root = NULL;
898 struct group *roots_group = NULL;
899 FILE * tempfile = NULL;
901 root = getpwuid( (uid_t) 0 );
903 roots_group = getgrgid(root->pw_gid);
904 if (roots_group != NULL) {
905 tempfile = fopen("conftest_rootg", "w");
906 if (tempfile != NULL) {
907 fprintf(tempfile, "%s\n", roots_group->gr_name);
915 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
917 AC_MSG_RESULT($ROOT_GROUP)
920 if echo "$host_os" | grep sco > /dev/null; then
921 echo "hacking things up for sco"
922 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
923 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
924 [Define as 1 if you have "struct mnttab" (only sco?)])
925 elif echo "$host_os" | grep sunos > /dev/null; then
926 echo "hacking things up for sunos"
927 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
928 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
929 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
934 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
937 if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
938 host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
940 if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
941 host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
944 if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
945 host_os=`echo "${host_os}" | sed 's/-gnu$//'`
949 host_os_exact="${host_os}"
950 host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
951 host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
954 rm -f ./find-provides
955 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ; then
956 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov for automatic provides generation"
957 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ./find-provides
958 elif test -f ${srcdir}/autodeps/${host_os_exact}.prov ; then
959 echo "using ${srcdir}/autodeps/${host_os_exact}.prov for automatic provides generation"
960 ln -s ${srcdir}/autodeps/${host_os_exact}.prov ./find-provides
961 elif test -f ${srcdir}/autodeps/${host_os_major}.prov ; then
962 echo "using ${srcdir}/autodeps/${host_os_major}.prov for automatic provides generation"
963 ln -s ${srcdir}/autodeps/${host_os_major}.prov ./find-provides
964 elif test -f ${srcdir}/autodeps/${host_os_noversion}.prov ; then
965 echo "using ${srcdir}/autodeps/${host_os_noversion}.prov for automatic provides generation"
966 ln -s ${srcdir}/autodeps/${host_os_noversion}.prov ./find-provides
968 echo "*** no default provides information is available for ${host_os_noversion}"
969 ln -s ${srcdir}/autodeps/none ./find-provides
972 rm -f ./find-requires
973 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ; then
974 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req for automatic requires generation"
975 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ./find-requires
976 elif test -f ${srcdir}/autodeps/${host_os_exact}.req ; then
977 echo "using ${srcdir}/autodeps/${host_os_exact}.req for automatic requires generation"
978 ln -s ${srcdir}/autodeps/${host_os_exact}.req ./find-requires
979 elif test -f ${srcdir}/autodeps/${host_os_major}.req ; then
980 echo "using ${srcdir}/autodeps/${host_os_major}.req for automatic requires generation"
981 ln -s ${srcdir}/autodeps/${host_os_major}.req ./find-requires
982 elif test -f ${srcdir}/autodeps/${host_os_noversion}.req ; then
983 echo "using ${srcdir}/autodeps/${host_os_noversion}.req for automatic requires generation"
984 ln -s ${srcdir}/autodeps/${host_os_noversion}.req ./find-requires
986 echo "*** no default requires information is available for ${host_os_noversion}"
987 ln -s ${srcdir}/autodeps/none ./find-requires
990 dnl Determine the canonical arch-vendor-os for the host machine
991 autorelocate_path='%{nil}'
992 autorelocate_dcolor='0'
993 case "${host_cpu}" in
994 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
995 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
996 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
997 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
998 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
999 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
1000 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
1001 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64;
1002 autorelocate_path='/emul/%%{ARCH}-%%{OS}'
1003 autorelocate_dcolor='1' ;;
1004 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
1005 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
1006 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
1007 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
1008 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
1009 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
1010 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
1011 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
1012 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1014 case "${host_os_noversion}" in
1015 mint) RPMCANONARCH=m68kmint ;;
1017 RPMCANONVENDOR="$build_vendor"
1018 case "${build_vendor}" in
1019 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
1020 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1021 test -f /etc/pld-release && RPMCANONVENDOR=pld
1022 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1023 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1024 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1025 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
1026 test -f /etc/caos-release && RPMCANONVENDOR=caos
1029 RPMCANONOS="$host_os_noversion"
1030 RPMCANONGNU="$host_os_gnu"
1031 AC_SUBST(RPMCANONCOLOR)
1032 AC_SUBST(autorelocate_path)
1033 AC_SUBST(autorelocate_dcolor)
1034 AC_SUBST(RPMCANONARCH)
1035 AC_SUBST(RPMCANONVENDOR)
1036 AC_SUBST(RPMCANONOS)
1037 AC_SUBST(RPMCANONGNU)
1038 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
1040 if test X"$prefix" = XNONE ; then
1041 usrprefix="$ac_default_prefix"
1046 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1047 AC_SUBST(RPMCONFIGDIR)
1051 AC_CONFIG_SUBDIRS(db3)
1053 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
1054 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
1055 AM_CONDITIONAL([APIDOCS],[test "$with_apidocs" == yes])
1057 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1059 AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
1060 AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
1063 AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
1065 AC_CONFIG_HEADERS([rpmdb/rpmints.h])
1067 AC_CONFIG_FILES([Makefile
1068 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1069 po/Makefile.in scripts/Makefile