2 AC_INIT(rpm, 4.4.90, rpm-maint@lists.rpm.org)
4 AC_CONFIG_SRCDIR([rpmqv.c])
5 AM_CONFIG_HEADER([config.h])
7 AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects])
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 dnl Does this platform require array notation to assign to a va_list?
51 dnl If cross-compiling, we assume va_list is "normal". If this breaks
52 dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
53 dnl also just to be sure.
54 AC_MSG_CHECKING(whether va_list assignments need array notation)
55 AC_CACHE_VAL(ac_cv_valistisarray,
56 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
58 void foo(int i, ...) {
62 if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123)
64 va_end(ap1); va_end(ap2);
66 int main() { foo(0, 123); return(0); }]])],[ac_cv_valistisarray=false],[ac_cv_valistisarray=true],[ac_cv_valistisarray=false])])
68 if test "$ac_cv_valistisarray" = true ; then
69 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1,
70 [Define as 1 if your va_list type is an array])
80 export RPMUSER RPMUID RPMGROUP RPMGID
87 dnl This now uses libtool. Put
88 dnl LDFLAGS_STATIC="-all"
89 dnl to attempt static executables using libtool. Otherwise
92 AC_MSG_CHECKING(flag used by libtool to link rpm)
93 if test X"$GCC" = Xyes ; then
95 *-*-linux*) LDFLAGS_STATIC="-all-static" ;;
96 *-*-solaris*) LDFLAGS_STATIC="-static";;
97 *-*-hpux*) LDFLAGS_STATIC="-static";;
98 *-*-darwin*) LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
99 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
100 *-*-*) LDFLAGS_STATIC="";;
102 elif test X"$CC" = Xcc ; then
104 *-*-linux*) LDFLAGS_STATIC="-all-static";;
105 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
106 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
107 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
108 *-*-hpux*) LDFLAGS_STATIC="-static";;
109 *-*-solaris*) LDFLAGS_STATIC="-static";;
110 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
111 # link because of crt1.o then.
112 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
113 *-*-*) LDFLAGS_STATIC=""
116 Unable to guess what option to pass to $CC to generate a static
117 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
118 the appropriate argument(s) if you want to build a static rpm executable.
124 # just link it dynamically
127 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
128 AC_MSG_RESULT($LDFLAGS_STATIC)
129 AC_SUBST(LDFLAGS_STATIC)
132 dnl XXX Test for libpthread.a that is NPTL aware (static link only).
135 if test -f /usr/lib/nptl/libpthread.a ; then
136 LDFLAGS_NPTL="-L/usr/lib/nptl"
137 # INCPATH="$INCPATH -I/usr/include/nptl"
139 AC_SUBST(LDFLAGS_NPTL)
142 dnl look for POSIX chmod attributes
144 AC_MSG_CHECKING(POSIX chmod)
146 chmod 744 foo.chmodtest
147 chmod +X foo.chmodtest 2>/dev/null
148 a=`ls -l foo.chmodtest | awk '{print $1}'`
150 if test "$a" = "-rwxr-xr-x"; then
152 FIXPERMS=a+rX,u+w,g-w,o-w
154 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
155 FIXPERMS=a+r,u+w,g-w,o-w
160 dnl see if we have a mkdir that supports `-p'.
162 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
163 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
165 $RPM_MKDIR -p conftest/a 2>/dev/null
166 if test $? = 0 ; then
167 rmdir conftest/a 2>/dev/null
168 if test $? = 0 ; then
174 rmdir conftest 2>/dev/null
175 if test $? = 0 ; then
176 RPM_MKDIR_P="$RPM_MKDIR -p"
184 if test X"$RPM_MKDIR_P" = X0 ; then
186 RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
191 dnl substitute this into config.h, so the C source picks it up.
193 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
194 [A full path to a program, possibly with arguments, that will create a
195 directory and all necessary parent directories, ala 'mkdir -p'])
196 AC_SUBST(RPM_MKDIR_P)
200 dnl This test must precede tests of compiler characteristics like
201 dnl that for the inline keyword, since it may change the degree to
202 dnl which the compiler supports such features.
205 dnl AM_DISABLE_SHARED
208 AC_CHECK_TOOL(AR, ar, :)
211 dnl use defaults if cross-compiling, otherwise use the default path.
213 if test "$cross_compiling" = "yes"; then
220 dnl Find some common programs
222 AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
223 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
224 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
225 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
226 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
227 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
228 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
229 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
230 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
231 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
232 AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
233 AC_PATH_PROG(UNZIPBIN, unzip, /usr/bin/unzip, $MYPATH)
235 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
236 AC_MSG_CHECKING(checking whether id supports -u)
237 if ${__ID} -u 2>&1 > /dev/null ; then
241 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
246 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
247 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
248 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
249 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
250 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
251 AC_MSG_CHECKING(old version of patch)
252 PATCHVERSION=`patch --version 2>&1`
254 if test "$PATCHVERSION" = "Patch version 2.1"; then
255 AC_DEFINE(HAVE_OLDPATCH_21, 1,
256 [Define if the patch call you'll be using is 2.1 or older])
257 AC_MSG_RESULT(patch older then 2.2 found)
259 AC_MSG_RESULT(patch later then 2.2 found)
262 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
263 AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
264 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
265 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
266 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
267 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
268 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
269 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
271 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
272 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
273 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
274 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
275 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
281 *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
282 *) LIBS="$LIBS -L$l $*";;
287 # Check for zlib library.
292 if test -z "${WITH_ZLIB_LIB}" ; then
293 for zlib in z gz ; do
294 AC_CHECK_LIB(${zlib}, gzread,
295 [WITH_ZLIB_LIB="-l${zlib}"; break],
296 [if test ${zlib} = gz; then
297 AC_MSG_ERROR([sorry rpm requires libz.a or libgz.a (from the zlib package)])
302 dnl zlib-1.0.4 has not gzseek
303 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
306 AC_SUBST(WITH_ZLIB_INCLUDE)
307 AC_SUBST(WITH_ZLIB_LIB)
310 # Check for bzip2 library.
312 AC_CHECK_LIB(bz2, bzread, [LIBS="$LIBS -lbz2"],
313 AC_CHECK_LIB(bz2, BZ2_bzread, [
316 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0]) ],
323 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
324 if test -d /usr/ucblib ; then
325 if test "$build" = "mips-sni-sysv4" ; then
326 addlib /usr/ccs/lib -lc
337 dnl Check for features
340 dnl Checks for libraries.
342 AC_CHECK_FUNC(setreuid, [], [
343 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
346 AC_CHECK_FUNC(rand, [], [
347 AC_CHECK_LIB(rand, rand, [])
350 AC_CHECK_FUNC(getdomainname, [], [
351 AC_CHECK_LIB(nsl, getdomainname)
353 AC_CHECK_FUNC(socket, [], [
354 AC_CHECK_LIB(socket, socket)
357 AC_CHECK_HEADERS(error.h)
358 AC_CHECK_FUNCS(error)
360 AC_CHECK_HEADERS(poll.h)
362 AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
364 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
365 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
366 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
367 AC_CHECK_LIB(thread, mutex_lock)
371 AC_CHECK_HEADERS(aio.h)
372 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
374 dnl Better not use fchmod at all.
375 AC_CHECK_FUNC(fchmod)
377 AC_CHECK_FUNCS(vsnprintf snprintf)
379 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
380 dnl not in the libc but in libport (for political reasons). This check
381 dnl can hopefully be removed soon. Please use the default action
382 dnl for this macro (not LIBS=...), otherwise the check for dbopen
384 AC_CHECK_LIB(port, writev)
387 # Check for libelf library. Prefer external, otherwise none.
390 AC_CHECK_HEADER([libelf.h])
391 AC_CHECK_HEADERS([gelf.h], [
392 AC_CHECK_LIB(elf, gelf_getvernaux, [
393 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
394 WITH_LIBELF_LIB="-lelf"
398 AC_SUBST(WITH_LIBELF_INCLUDE)
399 AC_SUBST(WITH_LIBELF_LIB)
400 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
402 AC_CHECK_HEADERS([dwarf.h], [
405 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
408 # Check for beecrypt library.
409 WITH_BEECRYPT_INCLUDE=
411 AC_CHECK_HEADERS([beecrypt/beecrypt.h], [
412 AC_CHECK_LIB(beecrypt, mpfprintln, [
413 AC_CHECK_HEADERS([beecrypt/api.h])
414 WITH_BEECRYPT_INCLUDE=
415 WITH_BEECRYPT_LIB="-lbeecrypt"
417 AC_MSG_ERROR([missing required library beecrypt])
420 AC_MSG_ERROR([missing required header beecrypt/beecrypt.h])
422 AC_SUBST(WITH_BEECRYPT_INCLUDE)
423 AC_SUBST(WITH_BEECRYPT_LIB)
426 # Check for magic library.
430 AC_CHECK_HEADER([magic.h], [
431 AC_CHECK_LIB(magic, magic_open, [
433 WITH_MAGIC_LIB="-lmagic"
435 AC_MSG_ERROR([missing required libary 'libmagic'])
438 AC_MSG_ERROR([missing required header magic.h])
441 AC_SUBST(WITH_MAGIC_INCLUDE)
442 AC_SUBST(WITH_MAGIC_LIB)
445 # Check for popt library.
449 AC_CHECK_HEADER([popt.h], [
450 AC_CHECK_LIB(popt, poptGetContext, [
452 WITH_POPT_LIB="-lpopt"
455 AC_MSG_ERROR([missing required library popt])
458 AC_MSG_ERROR([missing required header popt.h])
461 AC_SUBST(WITH_POPT_INCLUDE)
462 AC_SUBST(WITH_POPT_LIB)
466 dnl ------------------ with internal db
467 AC_DEFINE(HAVE_DB3_DB_H, 1, [Define if you have the <db3/db.h> header file])
470 AC_SUBST(WITH_DB_SUBDIR)
473 # Check for sqlite3 library.
474 AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 enable sqlite3 support],
475 [case "$enable_sqlite3" in
477 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
482 WITH_SQLITE3_INCLUDE=
485 AS_IF([test "$enable_sqlite3" = yes],[
486 AC_CHECK_HEADERS([sqlite3.h],
487 [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
488 WITH_SQLITE3_INCLUDE=
489 WITH_SQLITE3_LIB="-lsqlite3"
492 AC_MSG_ERROR([missing libsqlite3])
495 AC_MSG_ERROR([missing sqlite3.h])
499 AC_SUBST(WITH_SQLITE3_INCLUDE)
500 AC_SUBST(WITH_SQLITE3_LIB)
501 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
505 dnl AmigaOS and IXEmul have a fork() dummy
508 echo "Building for AmigaOS: using vfork() instead of fork()";
509 CFLAGS="$CFLAGS -Dfork=vfork"
513 AM_GNU_GETTEXT_VERSION([0.16.1])
514 AM_GNU_GETTEXT([external])
516 dnl Checks for header files we can live without.
522 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
524 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
525 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
526 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
528 AC_CHECK_HEADERS(netinet/in_systm.h)
529 AC_CHECK_HEADERS(machine/types.h)
530 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
531 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
532 AC_CHECK_HEADERS(bzlib.h libio.h zlib.h)
533 AC_CHECK_HEADERS(err.h mcheck.h)
534 AC_CHECK_HEADERS(pthread.h)
536 AC_CHECK_HEADERS(glob.h)
537 AC_CHECK_HEADERS(locale.h)
539 dnl statfs portability fiddles.
541 dnl We should really emulate/steal sections of the statfs and struct statfs
542 dnl checks from GNU fileutils.
544 AC_MSG_CHECKING(for struct statfs)
547 dnl this is easier than nesting AC_TRY_COMPILEs...
549 found_struct_statfs=no
551 if test X$found_struct_statfs = Xno ; then
552 dnl Solaris 2.6+ wants to use statvfs
553 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
554 #ifdef HAVE_SYS_TYPES_H
555 #include <sys/types.h>
557 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
558 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
559 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
560 found_struct_statfs=yes],[])
563 if test X$found_struct_statfs = Xno ; then
564 dnl first try including sys/vfs.h
565 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
566 #ifdef HAVE_SYS_TYPES_H
567 #include <sys/types.h>
569 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
570 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
571 found_struct_statfs=yes],[])
574 if test X$found_struct_statfs = Xno ; then
575 dnl ...next try including sys/mount.h
576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
577 #ifdef HAVE_SYS_TYPES_H
578 #include <sys/types.h>
580 #ifdef HAVE_SYS_PARAM_H
581 #include <sys/param.h>
583 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
584 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
585 found_struct_statfs=yes],[])
588 if test X$found_struct_statfs = Xno ; then
589 dnl ...still no joy. Try sys/statfs.h
590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
591 #ifdef HAVE_SYS_TYPES_H
592 #include <sys/types.h>
594 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
595 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
596 found_struct_statfs=yes],[])
599 if test X$found_struct_statfs = Xno ; then
600 dnl ...no luck. Warn the user of impending doom.
601 AC_MSG_WARN(not found)
605 dnl if we found the struct, see if it has the f_bavail member. Some OSes
606 dnl don't, including IRIX 6.5+
608 if test X$found_struct_statfs = Xyes ; then
609 AC_MSG_CHECKING(for f_bavail member in struct statfs)
610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
611 #ifdef HAVE_SYS_TYPES_H
612 #include <sys/types.h>
614 #if STATFS_IN_SYS_STATVFS
615 # include <sys/statvfs.h>
616 typedef struct statvfs STATFS_t;
618 typedef struct statfs STATFS_t;
619 # if STATFS_IN_SYS_VFS
620 # include <sys/vfs.h>
621 # elif STATFS_IN_SYS_MOUNT
622 # include <sys/mouht.h>
623 # elif STATFS_IN_SYS_STATFS
624 # include <sys/statfs.h>
626 #endif ]], [[STATFS_t sfs;
627 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
628 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
632 if test X$found_struct_statfs = Xyes ; then
634 dnl now check to see if we have the 4-argument variant of statfs()
635 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
637 AC_MSG_CHECKING([if statfs() requires 4 arguments])
638 AC_RUN_IFELSE([AC_LANG_SOURCE([[
639 #ifdef HAVE_SYS_TYPES_H
640 #include <sys/types.h>
642 #ifdef STATFS_IN_SYS_VFS
644 #elif STATFS_IN_SYS_MOUNT
645 #include <sys/mouht.h>
646 #elif STATFS_IN_SYS_STATFS
647 #include <sys/statfs.h>
651 exit (statfs(".", &sfs, sizeof(sfs), 0));
653 ]])],[AC_MSG_RESULT(yes)
654 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
660 dnl look for libc features
662 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
663 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
664 AC_MSG_RESULT($PROVIDES_ERRNO)
665 if test $PROVIDES_ERRNO = yes; then
666 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
669 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
670 dnl make S_ISSOCK always return false (nice, eh?)
671 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
672 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
673 AC_MSG_RESULT($HAS_S_IFSOCK)
674 if test $HAS_S_IFSOCK = yes; then
675 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
678 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
679 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
680 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
681 AC_MSG_RESULT($HAS_S_ISLNK)
682 if test $HAS_S_ISLNK = yes; then
683 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
686 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
687 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
688 AC_MSG_RESULT($HAS_S_ISSOCK)
689 if test $HAS_S_ISSOCK = yes; then
690 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
693 AC_MSG_CHECKING(if timezone is defined)
694 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
695 AC_MSG_RESULT($HAS_TIMEZONE)
697 dnl Check for missing typedefs
703 dnl Checks for library functions.
706 dnl XXX don't want to re-enable code that's been unused for years at this
707 dnl point, but should offer good performance improvements, check after
711 AC_CHECK_FUNCS(basename getaddrinfo getcwd getnameinfo getwd inet_aton)
712 AC_CHECK_FUNCS(mtrace putenv realpath setenv)
713 AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
714 AC_CHECK_FUNCS(strdup strndup strerror strtol strtoul strspn strstr)
716 AC_CHECK_FUNCS(__secure_getenv)
718 AC_CHECK_FUNCS(regcomp)
722 AC_CHECK_FUNCS(mkstemp)
724 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
725 dnl %files gets something like
726 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
727 dnl (Note: more than one asterisk in glob pattern.)
729 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
730 dnl dangling symlinks are no longer globbed. Always use the internal glob.
731 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
735 dnl check if python is requested
736 AC_ARG_ENABLE(python, [ --enable-python build rpm python bindings ],
737 [case "$enable_python" in
739 *) AC_MSG_ERROR([invalid argument to --enable-python])
744 AS_IF([test "$enable_python" = yes],[
745 # rpm-python is based on python-2.5,
746 # with legacy hacks to allow building against python >= 2.3
747 AM_PATH_PYTHON([2.3],[
748 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
749 WITH_PYTHON_SUBPACKAGE=1
750 save_CPPFLAGS="$CPPFLAGS"
751 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
752 AC_CHECK_HEADER([Python.h],[],
753 [AC_MSG_ERROR([missing Python.h])
755 CPPFLAGS="$save_CPPFLAGS"
757 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
758 WITH_PYTHON_LIB="$ac_res"
759 ],[AC_MSG_ERROR([missing python library])
766 WITH_PYTHON_SUBPACKAGE=0
769 AC_SUBST(WITH_PYTHON_INCLUDE)
770 AC_SUBST(WITH_PYTHON_LIB)
772 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
774 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
776 dnl Auto-detect whether doxygen generated API docs should be included.
778 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ],,[with_apidocs=auto])
780 case "$with_apidocs" in
782 AS_IF([test "$__DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes])
785 AS_IF([test "$__DOXYGEN" = no],
786 [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])])
791 AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],
792 [case "$with_selinux" in
794 *) AC_MSG_ERROR([invalid argument to --with-selinux])
799 AS_IF([test "$with_selinux" = yes],[
800 AC_CHECK_HEADER([selinux/selinux.h],[
801 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
802 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
804 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
808 AS_IF([test "$with_selinux" = yes],[
809 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
810 WITH_SELINUX_LIB="-lselinux"
812 AC_SUBST(WITH_SELINUX_LIB)
813 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
817 AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes])
818 AS_IF([test "$with_lua" = yes],[
819 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
820 WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
821 WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
823 AC_SUBST(WITH_LUA_LIB)
824 AC_SUBST(WITH_LUA_INCLUDE)
826 AS_IF([test "$with_apidocs" = yes],[
827 WITH_APIDOCS_TARGET=apidocs
832 AC_SUBST(WITH_APIDOCS_TARGET)
833 AC_SUBST(WITH_APIDOCS)
836 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
837 if test "$with_dmalloc" = yes ; then
838 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
839 LIBS="$LIBS -ldmalloc"
842 AC_CHECK_FUNCS(setlocale)
844 AC_CHECK_FUNCS(getpassphrase)
846 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
847 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
848 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
849 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
850 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
851 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
852 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
853 AC_LIBOBJ(getmntent)])
859 AC_CHECK_FUNC(lchown,
860 [__CHOWN_RHF="%{__chown} -Rhf"
861 __CHGRP_RHF="%{__chgrp} -Rhf"
862 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
863 [__CHOWN_RHF="%{__chown} -Rf"
864 __CHGRP_RHF="%{__chgrp} -Rf"
865 dnl Does chown() follow symlinks? This should be a good enough test.
866 AC_MSG_CHECKING(whether chown() follows symlinks)
867 AC_ARG_ENABLE([broken-chown],
868 [ --enable-broken-chown this system's chown follows symbolic links],
869 result=$enableval, result=unknown)
870 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
872 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
875 if test $result = unknown; then
876 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
881 if test `ls -l foo | awk '{print $3}'` != "root"; then
888 AC_MSG_CHECKING((cannot check by non-root user))
893 AC_MSG_RESULT($result)
894 if test $result = yes; then
895 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
897 AC_SUBST(__CHOWN_RHF)
898 AC_SUBST(__CHGRP_RHF)
901 dnl figure out what root's primary group is
903 AC_MSG_CHECKING(root's primary group)
904 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
905 #include <sys/types.h>
911 struct passwd *root = NULL;
912 struct group *roots_group = NULL;
913 FILE * tempfile = NULL;
915 root = getpwuid( (uid_t) 0 );
917 roots_group = getgrgid(root->pw_gid);
918 if (roots_group != NULL) {
919 tempfile = fopen("conftest_rootg", "w");
920 if (tempfile != NULL) {
921 fprintf(tempfile, "%s\n", roots_group->gr_name);
929 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
931 AC_MSG_RESULT($ROOT_GROUP)
934 if echo "$build_os" | grep sco > /dev/null; then
935 echo "hacking things up for sco"
936 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
937 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
938 [Define as 1 if you have "struct mnttab" (only sco?)])
939 elif echo "$build_os" | grep sunos > /dev/null; then
940 echo "hacking things up for sunos"
941 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
942 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
943 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
948 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
951 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
952 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
954 if echo "$build_os" | grep '.*-gnueabi' > /dev/null ; then
955 build_os=`echo "${build_os}" | sed 's/-gnueabi$//'`
956 build_os_gnu=-gnueabi
958 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
959 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
963 build_os_exact="${build_os}"
964 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
965 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
968 rm -f ./find-provides
969 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
970 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
971 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
972 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
973 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
974 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
975 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
976 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
977 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
978 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
979 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
980 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
982 echo "*** no default provides information is available for ${build_os_noversion}"
983 ln -s ${srcdir}/autodeps/none ./find-provides
986 rm -f ./find-requires
987 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
988 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
989 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
990 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
991 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
992 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
993 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
994 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
995 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
996 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
997 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
998 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
1000 echo "*** no default requires information is available for ${build_os_noversion}"
1001 ln -s ${srcdir}/autodeps/none ./find-requires
1004 dnl Determine the canonical arch-vendor-os for the build machine
1005 autorelocate_path='%{nil}'
1006 autorelocate_dcolor='0'
1007 case "${build_cpu}" in
1008 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
1009 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
1010 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
1011 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
1012 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
1013 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
1014 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
1015 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64;
1016 autorelocate_path='/emul/%%{ARCH}-%%{OS}'
1017 autorelocate_dcolor='1' ;;
1018 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
1019 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
1020 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
1021 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
1022 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
1023 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
1024 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
1025 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
1026 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1028 case "${build_os_noversion}" in
1029 mint) RPMCANONARCH=m68kmint ;;
1031 RPMCANONVENDOR="$build_vendor"
1032 case "${build_vendor}" in
1033 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
1034 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1035 test -f /etc/pld-release && RPMCANONVENDOR=pld
1036 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1037 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1038 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1039 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
1040 test -f /etc/caos-release && RPMCANONVENDOR=caos
1043 RPMCANONOS="$build_os_noversion"
1044 RPMCANONGNU="$build_os_gnu"
1045 AC_SUBST(RPMCANONCOLOR)
1046 AC_SUBST(autorelocate_path)
1047 AC_SUBST(autorelocate_dcolor)
1048 AC_SUBST(RPMCANONARCH)
1049 AC_SUBST(RPMCANONVENDOR)
1050 AC_SUBST(RPMCANONOS)
1051 AC_SUBST(RPMCANONGNU)
1052 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
1054 if test X"$prefix" = XNONE ; then
1055 usrprefix="$ac_default_prefix"
1060 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1061 AC_SUBST(RPMCONFIGDIR)
1065 AC_CONFIG_SUBDIRS(db3)
1067 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1069 AC_CONFIG_FILES([ Doxyfile Makefile platform rpm.pc
1070 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1071 po/Makefile.in scripts/Makefile
1079 AC_CONFIG_FILES([rpmpopt-${VERSION}:rpmpopt.in],,[VERSION=${VERSION}])