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])
65 dnl This now uses libtool. Put
66 dnl LDFLAGS_STATIC="-all"
67 dnl to attempt static executables using libtool. Otherwise
70 AC_MSG_CHECKING(flag used by libtool to link rpm)
71 if test X"$GCC" = Xyes ; then
73 *-*-linux*) LDFLAGS_STATIC="-all-static" ;;
74 *-*-solaris*) LDFLAGS_STATIC="-static";;
75 *-*-hpux*) LDFLAGS_STATIC="-static";;
76 *-*-darwin*) LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
77 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
78 *-*-*) LDFLAGS_STATIC="";;
80 elif test X"$CC" = Xcc ; then
82 *-*-linux*) LDFLAGS_STATIC="-all-static";;
83 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
84 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
85 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
86 *-*-hpux*) LDFLAGS_STATIC="-static";;
87 *-*-solaris*) LDFLAGS_STATIC="-static";;
88 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
89 # link because of crt1.o then.
90 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
91 *-*-*) LDFLAGS_STATIC=""
94 Unable to guess what option to pass to $CC to generate a static
95 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
96 the appropriate argument(s) if you want to build a static rpm executable.
102 # just link it dynamically
105 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
106 AC_MSG_RESULT($LDFLAGS_STATIC)
107 AC_SUBST(LDFLAGS_STATIC)
110 dnl look for POSIX chmod attributes
112 AC_MSG_CHECKING(POSIX chmod)
114 chmod 744 foo.chmodtest
115 chmod +X foo.chmodtest 2>/dev/null
116 a=`ls -l foo.chmodtest | awk '{print $1}'`
118 if test "$a" = "-rwxr-xr-x"; then
120 FIXPERMS=a+rX,u+w,g-w,o-w
122 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
123 FIXPERMS=a+r,u+w,g-w,o-w
128 dnl see if we have a mkdir that supports `-p'.
130 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
131 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
133 $RPM_MKDIR -p conftest/a 2>/dev/null
134 if test $? = 0 ; then
135 rmdir conftest/a 2>/dev/null
136 if test $? = 0 ; then
142 rmdir conftest 2>/dev/null
143 if test $? = 0 ; then
144 RPM_MKDIR_P="$RPM_MKDIR -p"
152 if test X"$RPM_MKDIR_P" = X0 ; then
154 RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
159 dnl substitute this into config.h, so the C source picks it up.
161 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
162 [A full path to a program, possibly with arguments, that will create a
163 directory and all necessary parent directories, ala 'mkdir -p'])
164 AC_SUBST(RPM_MKDIR_P)
166 dnl AM_DISABLE_SHARED
169 AC_CHECK_TOOL(AR, ar, :)
172 dnl use defaults if cross-compiling, otherwise use the default path.
174 if test "$cross_compiling" = "yes"; then
181 dnl Find some common programs
183 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
184 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
185 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
186 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
187 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
188 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
189 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
190 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
191 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
192 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
193 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
194 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
195 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
197 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
198 AC_MSG_CHECKING(checking whether id supports -u)
199 if ${__ID} -u 2>&1 > /dev/null ; then
203 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
208 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
209 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
210 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
211 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
212 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
213 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
214 AC_MSG_CHECKING(old version of patch)
215 PATCHVERSION=`patch --version 2>&1`
217 if test "$PATCHVERSION" = "Patch version 2.1"; then
218 AC_DEFINE(HAVE_OLDPATCH_21, 1,
219 [Define if the patch call you'll be using is 2.1 or older])
220 AC_MSG_RESULT(patch older then 2.2 found)
222 AC_MSG_RESULT(patch later then 2.2 found)
225 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
226 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
227 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
228 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
229 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
230 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
231 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
232 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
234 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
235 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
236 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
237 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
238 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
241 # Check for zlib library.
246 AC_CHECK_HEADERS([zlib.h],[
247 AS_IF([test -z "${WITH_ZLIB_LIB}"],[
248 for zlib in z gz ; do
249 AC_CHECK_LIB(${zlib}, gzread,
250 [WITH_ZLIB_LIB="-l${zlib}"; break])
253 dnl zlib-1.0.4 has not gzseek
254 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
258 AC_SUBST(WITH_ZLIB_INCLUDE)
259 AC_SUBST(WITH_ZLIB_LIB)
262 # Check for bzip2 library.
264 AC_CHECK_HEADERS([bzlib.h],[
265 AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
267 AC_CHECK_LIB(bz2, BZ2_bzread,[
269 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
273 AC_SUBST(WITH_BZ2_LIB)
278 dnl Check for features
281 dnl Checks for libraries.
283 AC_CHECK_FUNC(setreuid, [], [
284 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
287 AC_CHECK_FUNC(rand, [], [
288 AC_CHECK_LIB(rand, rand, [])
291 AC_CHECK_FUNC(getdomainname, [], [
292 AC_CHECK_LIB(nsl, getdomainname)
294 AC_CHECK_FUNC(socket, [], [
295 AC_CHECK_LIB(socket, socket)
298 AC_CHECK_HEADERS(error.h)
299 AC_CHECK_FUNCS(error)
301 AC_CHECK_HEADERS(poll.h)
303 AC_CHECK_HEADERS(pthread.h)
305 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
306 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
307 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
308 AC_CHECK_LIB(thread, mutex_lock)
312 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
314 AC_CHECK_FUNCS(vsnprintf snprintf)
316 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
317 dnl not in the libc but in libport (for political reasons). This check
318 dnl can hopefully be removed soon. Please use the default action
319 dnl for this macro (not LIBS=...), otherwise the check for dbopen
321 AC_CHECK_LIB(port, writev)
324 # Check for libelf library. Prefer external, otherwise none.
327 AC_CHECK_HEADER([libelf.h])
328 AC_CHECK_HEADERS([gelf.h], [
329 AC_CHECK_LIB(elf, gelf_getvernaux, [
330 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
331 WITH_LIBELF_LIB="-lelf"
335 AC_SUBST(WITH_LIBELF_INCLUDE)
336 AC_SUBST(WITH_LIBELF_LIB)
337 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
339 AC_CHECK_HEADERS([dwarf.h], [
342 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
345 # Check for NSS library.
348 check=`pkg-config --version 2>/dev/null`
349 if test -n "$check"; then
350 addlib=$(pkg-config --libs nss | sed 's/-lsmime3//;s/-lssl3//')
351 addcppflags=$(pkg-config --cflags nss)
353 # Without pkg-config, we'll kludge in some defaults
354 addlib="-lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
355 addcppflags="-I/usr/include/nss3 -I/usr/include/nspr4"
357 save_CPPFLAGS="$CPPFLAGS"
358 CPPFLAGS="$save_CPPFLAGS $addcppflags"
359 AC_CHECK_HEADER([nss3/nss.h], [
360 AC_CHECK_LIB(nss3, NSS_NoDB_Init, [
361 AC_DEFINE(HAVE_LIBNSS, 1, [Define to 1 if you have the 'NSS' library (-lnss3).])
362 WITH_NSS_INCLUDE="$addcppflags"
363 WITH_NSS_LIB="$addlib"
366 AC_MSG_ERROR([missing required header nss3/nss.h])
368 CPPFLAGS="$save_CPPFLAGS"
369 AC_SUBST(WITH_NSS_INCLUDE)
370 AC_SUBST(WITH_NSS_LIB)
373 # Check for magic library.
377 AC_CHECK_HEADER([magic.h], [
378 AC_CHECK_LIB(magic, magic_open, [
380 WITH_MAGIC_LIB="-lmagic"
382 AC_MSG_ERROR([missing required library 'libmagic'])
385 AC_MSG_ERROR([missing required header magic.h])
388 AC_SUBST(WITH_MAGIC_INCLUDE)
389 AC_SUBST(WITH_MAGIC_LIB)
392 # Check for popt library.
396 AC_CHECK_HEADER([popt.h], [
397 AC_CHECK_LIB(popt, poptGetContext, [
399 WITH_POPT_LIB="-lpopt"
401 AC_MSG_ERROR([missing required library popt])
404 AC_MSG_ERROR([missing required header popt.h])
407 AC_SUBST(WITH_POPT_INCLUDE)
408 AC_SUBST(WITH_POPT_LIB)
411 # Process --with/without-external-db
412 AC_ARG_WITH(external_db, [ --with-external-db build against an external Berkeley db],
413 [case "$with_external_db" in
415 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
417 [with_external_db=no])
419 case "$with_external_db" in
421 AC_CHECK_HEADERS([db.h],[
422 AC_CHECK_TYPE([db_threadid_t],[],
423 [AC_MSG_WARN([missing type db_threadid_t])],
426 AC_CHECK_LIB([db],[db_create],[],[
427 AC_MSG_ERROR([missing db_create in libdb])
429 AC_CHECK_LIB([db],[db_env_create],[],[
430 AC_MSG_ERROR([missing db_env_create in libdb])
432 AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
433 AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
435 AC_CHECK_LIB([db],[db_strerror],[],[
436 AC_MSG_ERROR([missing db_strerror in libdb])
441 AC_MSG_ERROR([missing required header db.h])
444 * ) # Fall back to internal db if available
445 if [ test -x db/dist/configure ]; then
446 AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
448 AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL])
453 AC_SUBST([WITH_DB_LIB])
456 # Check for sqlite3 library.
457 AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 enable sqlite3 support],
458 [case "$enable_sqlite3" in
460 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
465 WITH_SQLITE3_INCLUDE=
468 AS_IF([test "$enable_sqlite3" = yes],[
469 AC_CHECK_HEADERS([sqlite3.h],
470 [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
471 WITH_SQLITE3_INCLUDE=
472 WITH_SQLITE3_LIB="-lsqlite3"
475 AC_MSG_ERROR([missing libsqlite3])
478 AC_MSG_ERROR([missing sqlite3.h])
482 AC_SUBST(WITH_SQLITE3_INCLUDE)
483 AC_SUBST(WITH_SQLITE3_LIB)
484 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
488 dnl AmigaOS and IXEmul have a fork() dummy
491 echo "Building for AmigaOS: using vfork() instead of fork()";
492 CFLAGS="$CFLAGS -Dfork=vfork"
496 AM_GNU_GETTEXT_VERSION([0.16.1])
497 AM_GNU_GETTEXT([external])
499 dnl Checks for header files we can live without.
505 AC_CHECK_HEADERS(locale.h)
507 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
509 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
510 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
511 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
513 AC_CHECK_HEADERS(netinet/in_systm.h)
514 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
515 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
516 AC_CHECK_HEADERS(libio.h)
517 AC_CHECK_HEADERS(err.h mcheck.h)
519 AC_CHECK_HEADERS(glob.h)
521 dnl statfs portability fiddles.
523 dnl We should really emulate/steal sections of the statfs and struct statfs
524 dnl checks from GNU fileutils.
526 AC_MSG_CHECKING(for struct statfs)
529 dnl this is easier than nesting AC_TRY_COMPILEs...
531 found_struct_statfs=no
533 if test X$found_struct_statfs = Xno ; then
534 dnl Solaris 2.6+ wants to use statvfs
535 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
536 #ifdef HAVE_SYS_TYPES_H
537 #include <sys/types.h>
539 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
540 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
541 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
542 found_struct_statfs=yes],[])
545 if test X$found_struct_statfs = Xno ; then
546 dnl first try including sys/vfs.h
547 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
548 #ifdef HAVE_SYS_TYPES_H
549 #include <sys/types.h>
551 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
552 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
553 found_struct_statfs=yes],[])
556 if test X$found_struct_statfs = Xno ; then
557 dnl ...next try including sys/mount.h
558 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
559 #ifdef HAVE_SYS_TYPES_H
560 #include <sys/types.h>
562 #ifdef HAVE_SYS_PARAM_H
563 #include <sys/param.h>
565 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
566 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
567 found_struct_statfs=yes],[])
570 if test X$found_struct_statfs = Xno ; then
571 dnl ...still no joy. Try sys/statfs.h
572 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
573 #ifdef HAVE_SYS_TYPES_H
574 #include <sys/types.h>
576 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
577 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
578 found_struct_statfs=yes],[])
581 if test X$found_struct_statfs = Xno ; then
582 dnl ...no luck. Warn the user of impending doom.
583 AC_MSG_WARN(not found)
587 dnl if we found the struct, see if it has the f_bavail member. Some OSes
588 dnl don't, including IRIX 6.5+
590 if test X$found_struct_statfs = Xyes ; then
591 AC_MSG_CHECKING(for f_bavail member in struct statfs)
592 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
593 #ifdef HAVE_SYS_TYPES_H
594 #include <sys/types.h>
596 #if STATFS_IN_SYS_STATVFS
597 # include <sys/statvfs.h>
598 typedef struct statvfs STATFS_t;
600 typedef struct statfs STATFS_t;
601 # if STATFS_IN_SYS_VFS
602 # include <sys/vfs.h>
603 # elif STATFS_IN_SYS_MOUNT
604 # include <sys/mount.h>
605 # elif STATFS_IN_SYS_STATFS
606 # include <sys/statfs.h>
608 #endif ]], [[STATFS_t sfs;
609 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
610 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
614 if test X$found_struct_statfs = Xyes ; then
616 dnl now check to see if we have the 4-argument variant of statfs()
617 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
619 AC_MSG_CHECKING([if statfs() requires 4 arguments])
620 AC_RUN_IFELSE([AC_LANG_SOURCE([[
621 #ifdef HAVE_SYS_TYPES_H
622 #include <sys/types.h>
624 #ifdef STATFS_IN_SYS_VFS
626 #elif STATFS_IN_SYS_MOUNT
627 #include <sys/mouht.h>
628 #elif STATFS_IN_SYS_STATFS
629 #include <sys/statfs.h>
633 exit (statfs(".", &sfs, sizeof(sfs), 0));
635 ]])],[AC_MSG_RESULT(yes)
636 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
642 dnl look for libc features
644 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
645 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
646 AC_MSG_RESULT($PROVIDES_ERRNO)
647 if test $PROVIDES_ERRNO = yes; then
648 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
651 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
652 dnl make S_ISSOCK always return false (nice, eh?)
653 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
654 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
655 AC_MSG_RESULT($HAS_S_IFSOCK)
656 if test $HAS_S_IFSOCK = yes; then
657 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
660 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
661 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
662 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
663 AC_MSG_RESULT($HAS_S_ISLNK)
664 if test $HAS_S_ISLNK = yes; then
665 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
668 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
669 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
670 AC_MSG_RESULT($HAS_S_ISSOCK)
671 if test $HAS_S_ISSOCK = yes; then
672 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
675 AC_MSG_CHECKING(if timezone is defined)
676 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
677 AC_MSG_RESULT($HAS_TIMEZONE)
679 dnl Check for missing typedefs
685 dnl Checks for library functions.
688 dnl XXX don't want to re-enable code that's been unused for years at this
689 dnl point, but should offer good performance improvements, check after
693 AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton)
694 AC_CHECK_FUNCS(mtrace)
695 AC_CHECK_FUNCS(strndup strerror)
697 AC_REPLACE_FUNCS(basename getcwd getwd)
698 AC_REPLACE_FUNCS(putenv realpath setenv)
699 AC_REPLACE_FUNCS(stpcpy stpncpy strcspn)
700 AC_REPLACE_FUNCS(strdup strtol strtoul strspn strstr)
702 AC_CHECK_FUNCS(__secure_getenv)
704 AC_CHECK_FUNCS(regcomp)
708 AC_CHECK_FUNCS(mkstemp)
710 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
711 dnl %files gets something like
712 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
713 dnl (Note: more than one asterisk in glob pattern.)
715 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
716 dnl dangling symlinks are no longer globbed. Always use the internal glob.
717 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
721 dnl check if python is requested
722 AC_ARG_ENABLE(python, [ --enable-python build rpm python bindings ],
723 [case "$enable_python" in
725 *) AC_MSG_ERROR([invalid argument to --enable-python])
730 AS_IF([test "$enable_python" = yes],[
731 # rpm-python is based on python-2.5,
732 # with legacy hacks to allow building against python >= 2.3
733 AM_PATH_PYTHON([2.3],[
734 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
735 WITH_PYTHON_SUBPACKAGE=1
736 save_CPPFLAGS="$CPPFLAGS"
737 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
738 AC_CHECK_HEADER([Python.h],[],
739 [AC_MSG_ERROR([missing Python.h])
741 CPPFLAGS="$save_CPPFLAGS"
743 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
744 WITH_PYTHON_LIB="$ac_res"
745 ],[AC_MSG_ERROR([missing python library])
752 WITH_PYTHON_SUBPACKAGE=0
755 AC_SUBST(WITH_PYTHON_INCLUDE)
756 AC_SUBST(WITH_PYTHON_LIB)
758 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
760 AC_PATH_PROG(DOXYGEN, doxygen, no)
762 dnl Only build internal API + source hacking docs on request
764 AC_ARG_WITH(hackingdocs, [ --with-hackingdocs build rpm hacking docs ],,[with_hackingdocs=no])
766 case "$with_hackingdocs" in
768 AS_IF([test "$DOXYGEN" = no],[with_hackingdocs=no],[with_hackingdocs=no])
771 AS_IF([test "$DOXYGEN" = no],
772 [AC_MSG_ERROR([rpm hacking docs eeds doxygen in PATH])])
775 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
778 AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],
779 [case "$with_selinux" in
781 *) AC_MSG_ERROR([invalid argument to --with-selinux])
786 AS_IF([test "$with_selinux" = yes],[
787 AC_CHECK_HEADER([selinux/selinux.h],[
788 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
789 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
791 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
795 AS_IF([test "$with_selinux" = yes],[
796 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
797 WITH_SELINUX_LIB="-lselinux"
799 AC_SUBST(WITH_SELINUX_LIB)
800 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
804 AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes])
805 AS_IF([test "$with_lua" = yes],[
806 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
807 WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
808 WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
810 AC_SUBST(WITH_LUA_LIB)
811 AC_SUBST(WITH_LUA_INCLUDE)
814 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
815 if test "$with_dmalloc" = yes ; then
816 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
817 LIBS="$LIBS -ldmalloc"
820 AC_CHECK_FUNCS(setlocale)
822 AC_CHECK_FUNCS(getpassphrase)
824 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
825 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
826 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
827 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
828 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
829 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
830 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
831 AC_LIBOBJ(getmntent)])
837 AC_CHECK_FUNC(lchown,
838 [__CHOWN_RHF="%{__chown} -Rhf"
839 __CHGRP_RHF="%{__chgrp} -Rhf"
840 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
841 [__CHOWN_RHF="%{__chown} -Rf"
842 __CHGRP_RHF="%{__chgrp} -Rf"
843 dnl Does chown() follow symlinks? This should be a good enough test.
844 AC_MSG_CHECKING(whether chown() follows symlinks)
845 AC_ARG_ENABLE([broken-chown],
846 [ --enable-broken-chown this system's chown follows symbolic links],
847 result=$enableval, result=unknown)
848 if echo "$build" | ${EGREP} "(aix)|(hpux)|(linux)" > /dev/null ; then
850 elif echo "$build" | ${EGREP} "(nextstep)" > /dev/null ; then
853 if test $result = unknown; then
854 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
859 if test `ls -l foo | awk '{print $3}'` != "root"; then
866 AC_MSG_CHECKING((cannot check by non-root user))
871 AC_MSG_RESULT($result)
872 if test $result = yes; then
873 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
875 AC_SUBST(__CHOWN_RHF)
876 AC_SUBST(__CHGRP_RHF)
879 dnl figure out what root's primary group is
881 AC_MSG_CHECKING(root's primary group)
882 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
883 #include <sys/types.h>
889 struct passwd *root = NULL;
890 struct group *roots_group = NULL;
891 FILE * tempfile = NULL;
893 root = getpwuid( (uid_t) 0 );
895 roots_group = getgrgid(root->pw_gid);
896 if (roots_group != NULL) {
897 tempfile = fopen("conftest_rootg", "w");
898 if (tempfile != NULL) {
899 fprintf(tempfile, "%s\n", roots_group->gr_name);
907 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
909 AC_MSG_RESULT($ROOT_GROUP)
912 if echo "$host_os" | grep sco > /dev/null; then
913 echo "hacking things up for sco"
914 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
915 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
916 [Define as 1 if you have "struct mnttab" (only sco?)])
917 elif echo "$host_os" | grep sunos > /dev/null; then
918 echo "hacking things up for sunos"
919 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
920 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
921 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
926 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
929 if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
930 host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
932 if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
933 host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
936 if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
937 host_os=`echo "${host_os}" | sed 's/-gnu$//'`
941 host_os_exact="${host_os}"
942 host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
943 host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
946 rm -f ./find-provides
947 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ; then
948 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov for automatic provides generation"
949 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ./find-provides
950 elif test -f ${srcdir}/autodeps/${host_os_exact}.prov ; then
951 echo "using ${srcdir}/autodeps/${host_os_exact}.prov for automatic provides generation"
952 ln -s ${srcdir}/autodeps/${host_os_exact}.prov ./find-provides
953 elif test -f ${srcdir}/autodeps/${host_os_major}.prov ; then
954 echo "using ${srcdir}/autodeps/${host_os_major}.prov for automatic provides generation"
955 ln -s ${srcdir}/autodeps/${host_os_major}.prov ./find-provides
956 elif test -f ${srcdir}/autodeps/${host_os_noversion}.prov ; then
957 echo "using ${srcdir}/autodeps/${host_os_noversion}.prov for automatic provides generation"
958 ln -s ${srcdir}/autodeps/${host_os_noversion}.prov ./find-provides
960 echo "*** no default provides information is available for ${host_os_noversion}"
961 ln -s ${srcdir}/autodeps/none ./find-provides
964 rm -f ./find-requires
965 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ; then
966 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req for automatic requires generation"
967 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ./find-requires
968 elif test -f ${srcdir}/autodeps/${host_os_exact}.req ; then
969 echo "using ${srcdir}/autodeps/${host_os_exact}.req for automatic requires generation"
970 ln -s ${srcdir}/autodeps/${host_os_exact}.req ./find-requires
971 elif test -f ${srcdir}/autodeps/${host_os_major}.req ; then
972 echo "using ${srcdir}/autodeps/${host_os_major}.req for automatic requires generation"
973 ln -s ${srcdir}/autodeps/${host_os_major}.req ./find-requires
974 elif test -f ${srcdir}/autodeps/${host_os_noversion}.req ; then
975 echo "using ${srcdir}/autodeps/${host_os_noversion}.req for automatic requires generation"
976 ln -s ${srcdir}/autodeps/${host_os_noversion}.req ./find-requires
978 echo "*** no default requires information is available for ${host_os_noversion}"
979 ln -s ${srcdir}/autodeps/none ./find-requires
982 dnl Determine the canonical arch-vendor-os for the host machine
983 case "${host_cpu}" in
984 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
985 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
986 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
987 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
988 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
989 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
990 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
991 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64 ;;
992 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
993 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
994 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
995 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
996 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
997 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
998 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
999 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
1000 sh3*) RPMCANONCOLOR=0; RPMCANONARCH=sh3 ;;
1001 sh4*) RPMCANONCOLOR=0; RPMCANONARCH=sh4 ;;
1002 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1004 case "${host_os_noversion}" in
1005 mint) RPMCANONARCH=m68kmint ;;
1007 RPMCANONVENDOR="$build_vendor"
1008 case "${build_vendor}" in
1009 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
1010 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1011 test -f /etc/pld-release && RPMCANONVENDOR=pld
1012 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1013 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1014 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1015 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
1016 test -f /etc/caos-release && RPMCANONVENDOR=caos
1019 RPMCANONOS="$host_os_noversion"
1020 RPMCANONGNU="$host_os_gnu"
1021 AC_SUBST(RPMCANONCOLOR)
1022 AC_SUBST(RPMCANONARCH)
1023 AC_SUBST(RPMCANONVENDOR)
1024 AC_SUBST(RPMCANONOS)
1025 AC_SUBST(RPMCANONGNU)
1026 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
1028 if test X"$prefix" = XNONE ; then
1029 usrprefix="$ac_default_prefix"
1034 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1035 AC_SUBST(RPMCONFIGDIR)
1039 if test "$with_external_db" = no; then
1040 AC_CONFIG_SUBDIRS(db3)
1043 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
1044 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
1045 AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes])
1047 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1049 AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
1050 AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
1053 AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
1055 AC_CONFIG_HEADERS([rpmdb/rpmints.h])
1057 AC_CONFIG_FILES([Makefile
1058 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1059 po/Makefile.in scripts/Makefile