1 dnl configure.in for RPM
3 dnl Don't add checks for things we can't work around, unless those checks
4 dnl failing causes the script to bomb out with a message. If we can't fix
9 AC_PREREQ(2.12) dnl Minimum Autoconf version required.
11 AM_INIT_AUTOMAKE(rpm, 4.1)
12 AM_CONFIG_HEADER(config.h)
14 dnl XXX AM_MAINTAINER_MODE
16 dnl Set of available languages.
17 ALL_LINGUAS="cs da de en_RN es eu_ES fi fr gl hu id is it ja ko no pl pt pt_BR ro ru sk sl sr sv tr uk wa zh zh_CN.GB2312"
20 # ****************************************************************************
22 # * *** WARNING WARNING WARNING *** *
24 # * This is source code from the development branch of rpm-4.1. *
26 # * If you want the "production" rpm-4.0.4 code, then you should either use *
27 # * an rpm-4.0.4 src.rpm, or, if using a CVS checkout, do the following: *
29 # * cvs -d :pserver:anonymous@cvs.rpm.org:/cvs/devel login *
30 # * (no password, just carriage return) *
31 # * cvs -d :pserver:anonymous@cvs.rpm.org:/cvs/devel get rpm *
33 # * cvs up -r rpm-4_0 *
35 # ****************************************************************************
40 dnl Checks for programs.
47 if test "$ac_cv_prog_gcc" = yes; then
48 CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
53 AC_PROG_GCC_TRADITIONAL
55 dnl Does this platform require array notation to assign to a va_list?
56 dnl If cross-compiling, we assume va_list is "normal". If this breaks
57 dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
58 dnl also just to be sure.
59 AC_MSG_CHECKING(whether va_list assignments need array notation)
60 AC_CACHE_VAL(ac_cv_valistisarray,
61 [AC_TRY_RUN([#include <stdlib.h>
63 void foo(int i, ...) {
67 if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123)
69 va_end(ap1); va_end(ap2);
71 int main() { foo(0, 123); return(0); }],
72 [ac_cv_valistisarray=false],
73 [ac_cv_valistisarray=true],
74 [ac_cv_valistisarray=false])])
76 if test "$ac_cv_valistisarray" = true ; then
77 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1,
78 [Define as 1 if your va_list type is an array])
88 export RPMUSER RPMUID RPMGROUP RPMGID
94 AC_PATH_PROG(CTAGS, ctags, /bin/true)
95 AC_PATH_PROG(CSCOPE, cscope, /bin/true)
98 dnl This now uses libtool. Put
99 dnl LDFLAGS_STATIC="-all"
100 dnl to attempt static executables using libtool. Otherwise
101 dnl LDFLAGS_STATIC=""
103 AC_MSG_CHECKING(flag used by libtool to link rpm)
104 if test X"$GCC" = Xyes ; then
106 *-*-solaris*) LDFLAGS_STATIC="-static";;
107 *-*-hpux*) LDFLAGS_STATIC="-static";;
108 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
109 *-*-*) LDFLAGS_STATIC="-all-static";;
111 elif test X"$CC" = Xcc ; then
113 *-*-linux*) LDFLAGS_STATIC="-all-static";;
114 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
115 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
116 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
117 *-*-hpux*) LDFLAGS_STATIC="-static";;
118 *-*-solaris*) LDFLAGS_STATIC="-static";;
119 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
120 # link because of crt1.o then.
121 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
122 *-*-*) LDFLAGS_STATIC="-static"
125 Unable to guess what option to pass to $CC to generate a static
126 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
127 the appropriate argument(s) if you want to build a static rpm executable.
133 # just link it dynamically
136 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
137 AC_MSG_RESULT($LDFLAGS_STATIC)
138 AC_SUBST(LDFLAGS_STATIC)
141 dnl look for POSIX chmod attributes
143 AC_MSG_CHECKING(POSIX chmod)
145 chmod 744 foo.chmodtest
146 chmod +X foo.chmodtest 2>/dev/null
147 a=`ls -l foo.chmodtest | awk '{print $1}'`
149 if test "$a" = "-rwxr-xr-x"; then
151 FIXPERMS=a+rX,g-w,o-w
153 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
159 dnl see if we have a mkdir that supports `-p'.
161 AC_PATH_PROGS(MKDIR, mkdir, mkdir)
162 AC_MSG_CHECKING(if $MKDIR supports -p)
164 $MKDIR -p conftest/a 2>/dev/null
165 if test $? = 0 ; then
166 rmdir conftest/a 2>/dev/null
167 if test $? = 0 ; then
173 rmdir conftest 2>/dev/null
174 if test $? = 0 ; then
183 if test X"$MKDIR_P" = X0 ; then
185 MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
190 dnl substitute this into config.h, so the C source picks it up.
192 AC_DEFINE_UNQUOTED(MKDIR_P, "${MKDIR_P}",
193 [A full path to a program, possibly with arguments, that will create a
194 directory and all necessary parent directories, ala `mkdir -p'])
199 dnl This test must precede tests of compiler characteristics like
200 dnl that for the inline keyword, since it may change the degree to
201 dnl which the compiler supports such features.
208 dnl AM_DISABLE_SHARED
211 AC_CHECK_TOOL(AR, ar, :)
214 dnl use defaults if cross-compiling, otherwise use the default path.
216 if test "$cross_compiling" = "yes"; then
219 # MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/sbin:/usr/sbin:/usr/local/sbin:/opt/gnu/bin"
224 dnl Find some common programs
226 AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
227 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
228 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
229 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
230 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
231 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
232 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
233 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
234 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
235 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
236 AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
237 AC_PATH_PROG(UNZIPBIN, unzip, /usr/bin/unzip, $MYPATH)
239 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
240 AC_MSG_CHECKING(checking whether id supports -u)
241 if ${__ID} -u 2>&1 > /dev/null ; then
245 dnl XXX Watchout for square brackets fed to m4.
246 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
251 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
252 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
253 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
254 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
255 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
256 AC_MSG_CHECKING(old version of patch)
257 PATCHVERSION=`patch --version 2>&1`
259 if test "$PATCHVERSION" = "Patch version 2.1"; then
260 AC_DEFINE(HAVE_OLDPATCH_21, 1,
261 [Define if the patch call you'll be using is 2.1 or older])
262 AC_MSG_RESULT(patch older then 2.2 found)
264 AC_MSG_RESULT(patch later then 2.2 found)
267 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
268 AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
269 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
270 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
271 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
272 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
273 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
274 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
276 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
277 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
278 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
279 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
280 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
286 *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
287 *) LIBS="$LIBS -L$l $*";;
294 if test -d zlib ; then
295 WITH_ZLIB_SUBDIR=zlib
296 addlib \${top_builddir}/zlib
297 WITH_ZLIB_INCLUDE="-I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
298 INCPATH="$INCPATH -I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
299 WITH_ZLIB_LIB="\${top_builddir}/${WITH_ZLIB_SUBDIR}/libz.la"
300 AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])
302 AC_SUBST(WITH_ZLIB_SUBDIR)
303 AC_SUBST(WITH_ZLIB_INCLUDE)
304 AC_SUBST(WITH_ZLIB_LIB)
309 if test "$cross_compiling" != "yes"; then
310 dirs="$dirs /usr/local"
315 NONE|/usr) continue;;
317 if test X$localdone != X ; then continue; fi
322 AC_MSG_CHECKING(for $dir/lib in LIBS)
323 if test -d $dir/lib 2> /dev/null ; then
330 AC_MSG_CHECKING(for $dir/include in INCPATH)
331 if test -d $dir/include 2>/dev/null ; then
332 if [ "$dir" != "/usr/local" ] ; then
333 INCPATH="$INCPATH -I$dir/include"
341 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
342 if test -d /usr/ucblib ; then
343 if test "$build" = "mips-sni-sysv4" ; then
344 addlib /usr/ccs/lib -lc
355 dnl Check for features
358 dnl Checks for libraries.
364 AC_CHECK_HEADER([libelf/gelf.h], [
365 AC_DEFINE(HAVE_LIBELF_GELF_H, 1, [Define to 1 if you have the <libelf/gelf.h> header file.])
366 WITH_LIBELF_INCLUDE="-I/usr/include/libelf"
367 AC_CHECK_FUNC(gelf_getdyn, [],
368 AC_CHECK_LIB(elf, gelf_getdyn)
371 if test -d libelf ; then
372 AC_DEFINE(HAVE_LIBELF_GELF_H, 1, [Define to 1 if you have the <libelf/gelf.h> header file.])
373 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the `elf' library (-lelf).])
374 WITH_LIBELF_SUBDIR=libelf
375 WITH_LIBELF_INCLUDE="-I\${top_srcdir}/${WITH_LIBELF_SUBDIR}/lib"
376 WITH_LIBELF_LIB="\${top_builddir}/${WITH_LIBELF_SUBDIR}/lib/libelf.la"
377 WITH_LIBELF_ARCHIVE="\${top_builddir}/${WITH_LIBELF_SUBDIR}/lib/.libs/libelf.a"
380 AC_SUBST(WITH_LIBELF_SUBDIR)
381 AC_SUBST(WITH_LIBELF_INCLUDE)
382 AC_SUBST(WITH_LIBELF_LIB)
383 AC_SUBST(WITH_LIBELF_ARCHIVE)
385 AC_CHECK_FUNC(setreuid, [], [
386 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
389 AC_CHECK_FUNC(rand, [], [
390 AC_CHECK_LIB(rand, rand, [])
393 AC_CHECK_FUNC(getdomainname, [], [
394 AC_CHECK_LIB(nsl, getdomainname)
396 AC_CHECK_FUNC(socket, [], [
397 AC_CHECK_LIB(socket, socket)
400 AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
402 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
403 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
404 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
405 AC_CHECK_LIB(thread, mutex_lock)
409 AC_CHECK_HEADERS(aio.h)
410 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
412 dnl Better not use fchmod at all.
413 AC_CHECK_FUNC(fchmod)
415 AC_CHECK_FUNCS(vsnprintf snprintf)
417 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
418 dnl not in the libc but in libport (for political reasons). This check
419 dnl can hopefully be removed soon. Please use the default action
420 dnl for this macro (not LIBS=...), otherwise the check for dbopen
422 AC_CHECK_LIB(port, writev)
431 dnl Detect whether internal Berkeley DB should be built.
434 AC_ARG_WITH(db, [ --without-db do not use internal Berkeley db])
436 if test $withval = no ; then
437 dnl ------------------ without internal db
439 AC_CHECK_HEADERS(db3/db.h)
441 dnl Check for Berkeley db3 API.
442 AC_CHECK_FUNC(db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"],
443 AC_CHECK_LIB(db-3.2, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.2"],
444 AC_CHECK_LIB(db-3.1, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.1"],
445 AC_CHECK_LIB(db-3.0, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.0"],
446 AC_CHECK_LIB(db, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb"],
453 if test X"$DBLIBSRCS" = X; then
454 AC_MSG_ERROR([sorry rpm requires libdb-3.x.a (from the Berkeley db package)])
457 if test -n "$libdb3" -a -n "$libthread" ; then
458 AC_MSG_CHECKING(whether $libdb3 needs $libthread)
461 AC_TRY_LINK_FUNC(db_create, AC_MSG_RESULT(no),
462 [libdb3="$libdb3 $libthread"; AC_MSG_RESULT(yes)])
467 dnl ------------------ with internal db
468 AC_DEFINE(HAVE_DB3_DB_H, 1, [Define if you have the <db3/db.h> header file])
472 libdb3="# \$(top_builddir)/db3/libdb.la"
473 libdb3a="\$(top_builddir)/db3/libdb.a"
474 dnl INCPATH="-I\$(top_builddir)/$(WITH_DB_SUBDIR) $INCPATH"
477 AC_SUBST(WITH_DB_SUBDIR)
478 AC_SUBST(WITH_INTERNAL_DB)
480 DBLIBSRCS="$DBLIBSRCS"
481 DBLIBOBJS=`echo $DBLIBSRCS | sed -e "s/\.c/\.lo/g"`
488 for dbi in $DBLIBSRCS; do
490 db3.c) AC_DEFINE(USE_DB3, 1, [Use the Berkeley db3 API?]) ;;
491 db1.c) AC_DEFINE(USE_DB1, 1, [Use the Berkeley db1 retrofit to db3 API?]) ;;
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 if test -z "${WITH_ZLIB_LIB}" ; then
504 for zlib in z gz ; do
505 AC_CHECK_LIB(${zlib}, gzread,
506 [LIBS="$LIBS -l${zlib}"; break],
507 [if test ${zlib} = gz; then
508 AC_MSG_ERROR([sorry rpm requires libz.a or libgz.a (from the zlib package)])
513 dnl zlib-1.0.4 has not gzseek
514 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
517 AC_CHECK_LIB(bz2, bzread, [LIBS="$LIBS -lbz2"],
518 AC_CHECK_LIB(bz2, BZ2_bzread, [
521 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0]) ],
527 dnl horrible *temporary* hack to make sure that if we found gettext() in
528 dnl -lintl that we add -lintl *back* to $LIBS.
530 if test X$gt_cv_func_gettext_libintl = Xyes ; then
534 dnl Checks for header files we can live without.
540 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
542 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
543 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
544 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
546 AC_CHECK_HEADERS(netinet/in_systm.h)
547 AC_CHECK_HEADERS(machine/types.h)
548 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
549 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
550 AC_CHECK_HEADERS(bzlib.h libio.h zlib.h)
551 AC_CHECK_HEADERS(err.h mcheck.h)
552 AC_CHECK_HEADERS(pthread.h)
554 dnl popt w float/double needs.
555 AC_CHECK_HEADERS(float.h)
557 AC_CHECK_HEADERS(glob.h)
559 dnl statfs portability fiddles.
561 dnl We should really emulate/steal sections of the statfs and struct statfs
562 dnl checks from GNU fileutils.
564 AC_MSG_CHECKING(for struct statfs)
566 dnl this is easier than nesting AC_TRY_COMPILEs...
568 found_struct_statfs=no
570 if test X$found_struct_statfs = Xno ; then
571 dnl Solaris 2.6+ wants to use statvfs
573 #ifdef HAVE_SYS_TYPES_H
574 #include <sys/types.h>
576 #include <sys/statvfs.h> ],
577 [struct statvfs sfs;],
578 [AC_MSG_RESULT(in sys/statvfs.h)
579 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
580 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
581 found_struct_statfs=yes],
585 if test X$found_struct_statfs = Xno ; then
586 dnl first try including sys/vfs.h
588 #ifdef HAVE_SYS_TYPES_H
589 #include <sys/types.h>
591 #include <sys/vfs.h> ],
592 [struct statfs sfs;],
593 [AC_MSG_RESULT(in sys/vfs.h)
594 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
595 found_struct_statfs=yes],
599 if test X$found_struct_statfs = Xno ; then
600 dnl ...next try including sys/mount.h
602 #ifdef HAVE_SYS_TYPES_H
603 #include <sys/types.h>
605 #ifdef HAVE_SYS_PARAM_H
606 #include <sys/param.h>
608 #include <sys/mount.h> ],
609 [struct statfs sfs;],
610 [AC_MSG_RESULT(in sys/mount.h)
611 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
612 found_struct_statfs=yes],
616 if test X$found_struct_statfs = Xno ; then
617 dnl ...still no joy. Try sys/statfs.h
619 #ifdef HAVE_SYS_TYPES_H
620 #include <sys/types.h>
622 #include <sys/statfs.h> ],
623 [struct statfs sfs;],
624 [AC_MSG_RESULT(in sys/statfs.h)
625 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
626 found_struct_statfs=yes],
630 if test X$found_struct_statfs = Xno ; then
631 dnl ...no luck. Warn the user of impending doom.
632 AC_MSG_WARN(not found)
636 dnl if we found the struct, see if it has the f_bavail member. Some OSes
637 dnl don't, including IRIX 6.5+
639 if test X$found_struct_statfs = Xyes ; then
640 AC_MSG_CHECKING(for f_bavail member in struct statfs)
642 #ifdef HAVE_SYS_TYPES_H
643 #include <sys/types.h>
645 #if STATFS_IN_SYS_STATVFS
646 # include <sys/statvfs.h>
647 typedef struct statvfs STATFS_t;
649 typedef struct statfs STATFS_t;
650 # if STATFS_IN_SYS_VFS
651 # include <sys/vfs.h>
652 # elif STATFS_IN_SYS_MOUNT
653 # include <sys/mouht.h>
654 # elif STATFS_IN_SYS_STATFS
655 # include <sys/statfs.h>
661 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],
666 if test X$found_struct_statfs = Xyes ; then
668 dnl now check to see if we have the 4-argument variant of statfs()
669 dnl this pretty much requires AC_TRY_RUN
671 AC_MSG_CHECKING([if statfs() requires 4 arguments])
673 #ifdef HAVE_SYS_TYPES_H
674 #include <sys/types.h>
676 #ifdef STATFS_IN_SYS_VFS
678 #elif STATFS_IN_SYS_MOUNT
679 #include <sys/mouht.h>
680 #elif STATFS_IN_SYS_STATFS
681 #include <sys/statfs.h>
685 exit (statfs(".", &sfs, sizeof(sfs), 0));
689 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],
697 dnl look for libc features
699 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
700 AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
701 AC_MSG_RESULT($PROVIDES_ERRNO)
702 if test $PROVIDES_ERRNO = yes; then
703 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
706 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
707 dnl make S_ISSOCK always return false (nice, eh?)
708 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
709 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
710 HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
711 AC_MSG_RESULT($HAS_S_IFSOCK)
712 if test $HAS_S_IFSOCK = yes; then
713 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
716 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
717 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
718 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
719 HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
720 AC_MSG_RESULT($HAS_S_ISLNK)
721 if test $HAS_S_ISLNK = yes; then
722 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
725 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
726 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
727 HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
728 AC_MSG_RESULT($HAS_S_ISSOCK)
729 if test $HAS_S_ISSOCK = yes; then
730 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
733 AC_MSG_CHECKING(if timezone is defined)
734 AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
735 HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
736 AC_MSG_RESULT($HAS_TIMEZONE)
738 dnl Check for missing typedefs
742 dnl Checks for library functions.
746 dnl XXX AC_FUNC_MEMCMP
748 dnl XXX AC_TYPE_SIGNAL
749 dnl XXX AC_FUNC_STRCOLL
750 dnl XXX AC_FUNC_STRFTIME
751 dnl XXX AC_FUNC_UTIME_NULL
752 dnl XXX AC_FUNC_VFORK
753 dnl XXX AC_CHECK_FUNCS(gethostname mkdir mkfifo rmdir select uname)
755 AC_CHECK_FUNCS(basename getcwd getwd inet_aton mtrace putenv realpath setenv)
756 AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
757 AC_CHECK_FUNCS(strdup strerror strtol strtoul strspn strstr)
759 AC_CHECK_FUNCS(regcomp)
764 dnl XXX Regex replacement isn't known to be needed yet.
766 dnl AC_ARG_WITH(regex, [ --with-regex use the GNU regex library ],
767 dnl [rpm_cv_regex=yes],
768 dnl [AC_CHECK_FUNCS(regcomp, rpm_cv_regex=no, rpm_cv_regex=yes)])
770 dnl if test $rpm_cv_regex = no ; then
771 dnl AC_MSG_CHECKING(whether the regexp library is broken)
773 dnl #include <unistd.h>
774 dnl #include <regex.h>
775 dnl main() { regex_t blah ; exit(regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0)); }],
776 dnl rpm_cv_regex_broken=no, rpm_cv_regex_broken=yes, rpm_cv_regex_broken=yes)
777 dnl AC_MSG_RESULT([$rpm_cv_regex_broken])
778 dnl if test $rpm_cv_regex_broken = yes ; then
779 dnl echo " --> using the included GNU regex instead." >&AC_FD_MSG
784 dnl if test $rpm_cv_regex = yes; then
785 dnl AC_DEFINE(USE_GNU_REGEX, 1)
790 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
791 dnl %files gets something like
792 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
793 dnl (Note: more than one asterisk in glob pattern.)
795 AC_ARG_WITH(glob, [ --with-glob use the internal GNU glob ],
797 [AC_CHECK_FUNCS(glob, rpm_cv_glob=no, rpm_cv_glob=yes)])
799 if test $rpm_cv_glob = no ; then
800 AC_CACHE_CHECK([for GNU extensions to glob], rpm_cv_glob_ext, [
807 #include <sys/stat.h>
812 exit(glob("t/*/*.8", GLOB_PERIOD, NULL, &gl) || gl.gl_pathc < 1);
814 rpm_cv_glob_ext=yes, rpm_cv_glob_ext=no, rpm_cv_glob_ext=no)
817 if test "$rpm_cv_glob_ext" = no ; then
818 echo " --> using the included GNU glob instead." >&AC_FD_MSG
823 if test "$rpm_cv_glob" = yes; then
824 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
829 dnl Auto-detect which python bindings should be built.
832 AC_ARG_WITH(python, [ --with-python build rpm python bindings ])
834 WITH_PYTHON_VERSION=$withval
835 if test $withval = auto ; then
837 AC_MSG_CHECKING(for python 2.2)
839 #include <python2.2/Python.h>
841 exit(strncmp("2.2", PY_VERSION, 3));
843 withval=yes, withval=no, withval=yes)
844 AC_MSG_RESULT($withval)
845 if test $withval = yes ; then
846 WITH_PYTHON_VERSION="2.2"
849 AC_MSG_CHECKING(for python 1.5.2)
851 #include <python1.5/Python.h>
853 exit(strcmp("1.5.2", PY_VERSION));
855 withval=yes, withval=no, withval=yes)
856 AC_MSG_RESULT($withval)
857 if test $withval = yes ; then
858 WITH_PYTHON_VERSION="1.5"
864 if test "$WITH_PYTHON_VERSION" != no ; then
865 WITH_PYTHON_SUBDIR=python
866 WITH_PYTHON_SUBPACKAGE=1
869 WITH_PYTHON_SUBPACKAGE=0
871 AC_SUBST(WITH_PYTHON_SUBDIR)
872 AC_SUBST(WITH_PYTHON_SUBPACKAGE)
873 AC_SUBST(WITH_PYTHON_VERSION)
875 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
877 dnl Auto-detect whether doxygen generated API docs should be included.
880 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ])
882 if test $withval = auto -a $__DOXYGEN != no ; then
884 elif test $withval = yes -a $__DOXYGEN = no ; then
885 AC_MSG_ERROR(--> rpm API docs needs doxygen in PATH)
888 if test $withval = yes; then
889 WITH_APIDOCS_TARGET=apidocs
894 AC_SUBST(WITH_APIDOCS_TARGET)
895 AC_SUBST(WITH_APIDOCS)
898 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
899 if test $withval = yes ; then
900 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
901 LIBS="$LIBS -ldmalloc"
904 AC_CHECK_FUNCS(setlocale)
906 dnl XXX Solaris <= 2.6 only permits 8 chars in password.
907 AC_CHECK_FUNCS(getpassphrase)
909 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
910 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
911 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
912 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
913 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
914 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
915 AC_LIBOBJ(getmntent)])])])])
917 AC_CHECK_FUNC(lchown,
918 [__CHOWN_RHF="%{__chown} -Rhf"
919 __CHGRP_RHF="%{__chgrp} -Rhf"
920 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
921 [__CHOWN_RHF="%{__chown} -Rf"
922 __CHGRP_RHF="%{__chgrp} -Rf"
923 dnl Does chown() follow symlinks? This should be a good enough test.
924 AC_MSG_CHECKING(whether chown() follows symlinks)
925 AC_ARG_ENABLE([broken-chown],
926 [ --enable-broken-chown this system's chown follows symbolic links],
927 result=$enableval, result=unknown)
928 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
930 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
933 if test $result = unknown; then
934 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
939 if test `ls -l foo | awk '{print $3}'` != "root"; then
946 AC_MSG_CHECKING((cannot check by non-root user))
951 AC_MSG_RESULT($result)
952 if test $result = yes; then
953 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
955 AC_SUBST(__CHOWN_RHF)
956 AC_SUBST(__CHGRP_RHF)
959 dnl figure out what root's primary group is
961 AC_MSG_CHECKING(root's primary group)
962 AC_TRY_RUN([#include <stdio.h>
963 #include <sys/types.h>
969 struct passwd *root = NULL;
970 struct group *roots_group = NULL;
971 FILE * tempfile = NULL;
973 root = getpwuid( (uid_t) 0 );
975 roots_group = getgrgid(root->pw_gid);
976 if (roots_group != NULL) {
977 tempfile = fopen("conftest_rootg", "w");
978 if (tempfile != NULL) {
979 fprintf(tempfile, "%s\n", roots_group->gr_name);
987 }], ROOT_GROUP=`cat conftest_rootg`,
988 ROOT_GROUP="root",ROOT_GROUP="root"
990 AC_MSG_RESULT($ROOT_GROUP)
993 if test "x$varprefix" = "x"; then
994 # For /usr and /usr/local, we want the 'var' directory to go
995 # in /var and /var/local respectively. For everything else,
996 # just put the 'var' directory in prefix/var.
999 varprefix=`echo $prefix | sed 's/usr/var/'` ;;
1001 varprefix=`echo $ac_default_prefix | sed 's/usr/var/'` ;;
1003 varprefix=$prefix/var ;;
1008 if test "x$tmpdir" = "x"; then
1009 if test -d $varprefix/tmp; then
1010 tmpdir=$varprefix/tmp
1012 if test -d /var/tmp; then
1021 if echo "$build_os" | grep sco > /dev/null; then
1022 echo "hacking things up for sco"
1023 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
1024 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
1025 [Define as 1 if you have "struct mnttab" (only sco?)])
1026 elif echo "$build_os" | grep sunos > /dev/null; then
1027 echo "hacking things up for sunos"
1028 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
1029 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
1030 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
1031 AC_LIBOBJ(myrealloc)
1035 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
1037 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
1038 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
1040 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
1041 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
1045 build_os_exact="${build_os}"
1046 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
1047 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
1050 rm -f ./find-provides
1051 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
1052 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
1053 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
1054 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
1055 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
1056 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
1057 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
1058 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
1059 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
1060 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
1061 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
1062 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
1064 echo "*** no default provides information is available for ${build_os_noversion}"
1065 ln -s ${srcdir}/autodeps/none ./find-provides
1068 rm -f ./find-requires
1069 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
1070 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
1071 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
1072 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
1073 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
1074 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
1075 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
1076 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
1077 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
1078 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
1079 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
1080 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
1082 echo "*** no default requires information is available for ${build_os_noversion}"
1083 ln -s ${srcdir}/autodeps/none ./find-requires
1086 dnl Determine the canonical arch-vendor-os for the build machine
1087 case "${build_cpu}" in
1088 *86) RPMCANONARCH=i386 ;;
1089 alpha*) RPMCANONARCH=alpha ;;
1090 sparc*) RPMCANONARCH=sparc ;;
1091 ia64*) RPMCANONARCH=ia64 ;;
1092 s390*) RPMCANONARCH=s390 ;;
1093 powerpc*) RPMCANONARCH=ppc ;;
1094 armv3l*) RPMCANONARCH=armv3l ;;
1095 armv4l*) RPMCANONARCH=armv4l ;;
1096 armv4b*) RPMCANONARCH=armv4b ;;
1097 arm*) RPMCANONARCH="${build_cpu}" ;;
1098 mipsel*) RPMCANONARCH=mipsel ;;
1099 mips*) RPMCANONARCH=mips ;;
1100 m68k*) RPMCANONARCH=m68k ;;
1101 *) RPMCANONARCH=unknown ;;
1103 case "${build_os_noversion}" in
1104 mint) RPMCANONARCH=m68kmint ;;
1106 RPMCANONVENDOR="$build_vendor"
1107 case "${build_vendor}" in
1108 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr)
1109 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1110 test -f /etc/pld-release && RPMCANONVENDOR=pld
1111 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1112 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1113 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1116 RPMCANONOS="$build_os_noversion"
1117 AC_SUBST(RPMCANONARCH)
1118 AC_SUBST(RPMCANONVENDOR)
1119 AC_SUBST(RPMCANONOS)
1121 if test X"$prefix" = XNONE ; then
1122 usrprefix="$ac_default_prefix"
1126 LOCALEDIR="`echo ${usrprefix}/share/locale`"
1127 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR",
1128 [Full path to rpm locale directory (usually /usr/share/locale)])
1130 LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
1132 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1133 AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR",
1134 [Full path to rpm global configuration directory (usually /usr/lib/rpm)])
1135 AC_SUBST(RPMCONFIGDIR)
1137 SYSCONFIGDIR="`echo /etc/rpm`"
1138 AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR",
1139 [Full path to rpm system configuration directory (usually /etc/rpm)])
1140 AC_SUBST(SYSCONFIGDIR)
1142 MACROFILES="${RPMCONFIGDIR}/macros:${RPMCONFIGDIR}/%{_target_platform}/macros:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/macros.specspo:${SYSCONFIGDIR}/macros.db1:${SYSCONFIGDIR}/%{_target_platform}/macros:~/.rpmmacros"
1143 AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES",
1144 [Colon separated paths of macro files to read.])
1145 AC_SUBST(MACROFILES)
1147 LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
1148 AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME",
1149 [Full path to rpmrc configuration file (usually /usr/lib/rpm/rpmrc)])
1150 AC_SUBST(LIBRPMRC_FILENAME)
1152 VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
1153 AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME",
1154 [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)])
1155 AC_SUBST(VENDORRPMRC_FILENAME)
1157 LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
1158 AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME",
1159 [Full path to rpmpopt configuration file (usually /usr/lib/rpm/rpmpopt)])
1160 AC_SUBST(LIBRPMALIAS_FILENAME)
1161 FINDREQUIRES="${RPMCONFIGDIR}/find-requires"
1162 AC_DEFINE_UNQUOTED(FINDREQUIRES, "$FINDREQUIRES",
1163 [Full path to find-requires script (usually /usr/lib/rpm/find-requires)])
1164 AC_SUBST(FINDREQUIRES)
1165 FINDPROVIDES="${RPMCONFIGDIR}/find-provides"
1166 AC_DEFINE_UNQUOTED(FINDPROVIDES, "$FINDPROVIDES",
1167 [Full path to find-provides script (usually /usr/lib/rpm/find-provides)])
1168 AC_SUBST(FINDPROVIDES)
1170 testdir="`pwd`/tests"
1171 dnl AC_DEFINE_UNQUOTED(testdir, "$testdir")
1181 dnl XXX this causes popt to depend on zlib et al
1182 dnl # XXX Propagate -lucb to popt ...
1183 dnl export LIBS INCPATH CONFIG_SITE
1185 AC_CONFIG_SUBDIRS(popt beecrypt zlib libelf db3)
1187 AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
1188 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1189 scripts/Makefile scripts/brp-redhat tools/Makefile
1190 tests/Makefile tests/rpmrc tests/macros tests/hello-test/Makefile
1191 misc/Makefile intl/Makefile po/Makefile.in
1201 python/rpmdb/Makefile
1202 python/test/Makefile
1203 ], [ echo timestamp > popt/stamp-h.in
1204 echo timestamp > beecrypt/stamp-h.in
1205 echo timestamp > stamp-h.in