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
10 AM_INIT_AUTOMAKE(rpm, 4.1)
11 AM_CONFIG_HEADER(config.h)
13 AC_PREREQ(2.12) dnl Minimum Autoconf version required.
15 dnl XXX AM_MAINTAINER_MODE
17 dnl Set of available languages.
18 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"
22 dnl Checks for programs.
25 if test "$ac_cv_prog_gcc" = yes; then
26 CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
31 AC_PROG_GCC_TRADITIONAL
37 export RPMUSER RPMUID RPMGROUP RPMGID
43 AC_PATH_PROG(CTAGS, ctags, /bin/true)
44 AC_PATH_PROG(CSCOPE, cscope, /bin/true)
47 dnl This now uses libtool. Put
48 dnl LDFLAGS_STATIC="-all"
49 dnl to attempt static executables using libtool. Otherwise
52 AC_MSG_CHECKING(flag used by libtool to link rpm)
53 if test X"$GCC" = Xyes ; then
55 *-*-solaris*) LDFLAGS_STATIC="-static";;
56 *-*-hpux*) LDFLAGS_STATIC="-static";;
57 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
58 *-*-*) LDFLAGS_STATIC="-all-static";;
60 elif test X"$CC" = Xcc ; then
62 *-*-linux*) LDFLAGS_STATIC="-all-static";;
63 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
64 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
65 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
66 *-*-hpux*) LDFLAGS_STATIC="-static";;
67 *-*-solaris*) LDFLAGS_STATIC="-static";;
68 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
69 # link because of crt1.o then.
70 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
71 *-*-*) LDFLAGS_STATIC="-static"
74 Unable to guess what option to pass to $CC to generate a static
75 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
76 the appropriate argument(s) if you want to build a static rpm executable.
82 # just link it dynamically
85 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
86 AC_MSG_RESULT($LDFLAGS_STATIC)
87 AC_SUBST(LDFLAGS_STATIC)
90 dnl look for POSIX chmod attributes
92 AC_MSG_CHECKING(POSIX chmod)
94 chmod 744 foo.chmodtest
95 chmod +X foo.chmodtest 2>/dev/null
96 a=`ls -l foo.chmodtest | awk '{print $1}'`
98 if test "$a" = "-rwxr-xr-x"; then
100 FIXPERMS=a+rX,g-w,o-w
102 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
108 dnl see if we have a mkdir that supports `-p'.
110 AC_PATH_PROGS(MKDIR, mkdir, mkdir)
111 AC_MSG_CHECKING(if $MKDIR supports -p)
113 $MKDIR -p conftest/a 2>/dev/null
114 if test $? = 0 ; then
115 rmdir conftest/a 2>/dev/null
116 if test $? = 0 ; then
122 rmdir conftest 2>/dev/null
123 if test $? = 0 ; then
132 if test X"$MKDIR_P" = X0 ; then
134 MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
139 dnl substitute this into config.h, so the C source picks it up.
141 AC_DEFINE_UNQUOTED(MKDIR_P, "${MKDIR_P}")
148 dnl This test must precede tests of compiler characteristics like
149 dnl that for the inline keyword, since it may change the degree to
150 dnl which the compiler supports such features.
157 dnl AM_DISABLE_SHARED
160 AC_CHECK_TOOL(AR, ar, :)
162 if test "$cross_compiling" != "yes"; then
164 dnl Set search path for common programs
166 MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/sbin:/usr/sbin:/usr/local/sbin:/opt/gnu/bin"
169 dnl Find some common programs
171 AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
172 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
173 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
174 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
175 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
176 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
177 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
178 AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
179 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
180 AC_PATH_PROG(UNZIPBIN, unzip, /usr/bin/unzip, $MYPATH)
182 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
183 AC_MSG_CHECKING(checking whether id supports -u)
184 if `${__ID} -u 2>&1 > /dev/null` ; then
188 dnl XXX Watchout for square brackets fed to m4.
189 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
194 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
195 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
196 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
197 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
198 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
199 AC_MSG_CHECKING(old version of patch)
200 PATCHVERSION=`patch --version 2>&1`
202 if test "$PATCHVERSION" = "Patch version 2.1"; then
203 AC_DEFINE(HAVE_OLDPATCH_21)
204 AC_MSG_RESULT(patch older then 2.2 found)
206 AC_MSG_RESULT(patch later then 2.2 found)
209 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
210 AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
211 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
212 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
213 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
214 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
215 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
216 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
218 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
219 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
220 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
221 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
222 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
229 *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
230 *) LIBS="$LIBS -L$l $*";;
235 for dir in $prefix /usr/local
238 NONE|/usr) continue;;
240 if test X$localdone != X ; then continue; fi
245 AC_MSG_CHECKING(for $dir/lib in LIBS)
246 if test -d $dir/lib ; then
253 AC_MSG_CHECKING(for $dir/include in INCPATH)
254 if test -d $dir/include ; then
255 INCPATH="$INCPATH -I$dir/include"
262 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
263 if test -d /usr/ucblib ; then
264 if test "$build" = "mips-sni-sysv4" ; then
265 addlib /usr/ccs/lib -lc
276 dnl Check for features
279 dnl ### use option --enable-v5-packages to turn on support for rpm-5.x packages
280 dnl AC_MSG_CHECKING(if you want experimental rpm-5.0 packages)
281 dnl AC_ARG_ENABLE(v5-packages,
282 dnl [ --enable-v5-packages[=no] [experimental] support for rpm-5.x packages],
283 dnl [with_v5_packages=$enableval],
284 dnl [with_v5_packages=no])
285 dnl AC_MSG_RESULT($with_v5_packages)
286 dnl test "$with_v5_packages" = yes && AC_DEFINE(ENABLE_V5_PACKAGES)
288 dnl Checks for libraries.
290 AC_CHECK_FUNC(setreuid, [], [
291 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
294 AC_CHECK_FUNC(rand, [], [
295 AC_CHECK_LIB(rand, rand, [LIBS="$LIBS -lm"])
298 AC_CHECK_FUNC(getdomainname, [], [
299 AC_CHECK_LIB(nsl, getdomainname, [LIBS="$LIBS -lnsl"])
301 AC_CHECK_FUNC(socket, [], [
302 AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
305 dnl Better not use fchmod at all.
306 AC_CHECK_FUNC(fchmod)
308 AC_CHECK_FUNCS(vsnprintf snprintf)
310 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
311 dnl not in the libc but in libport (for political reasons). This check
312 dnl can hopefully be removed soon. Please use the default action
313 dnl for this macro (not LIBS=...), otherwise the check for dbopen
315 AC_CHECK_LIB(port, writev)
318 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [libthread="-lpthread"], [
319 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
320 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [libthread="-lpthread"])
323 if test "x$libthread" = "x"; then
324 # Try in libthread too.
325 AC_CHECK_LIB(thread, mutex_lock, [libthread="-lthread"])
335 dnl Detect whether internal Berkeley DB should be built.
338 AC_ARG_WITH(db, [ --without-db do not use internal Berkeley db])
340 if test $withval = no ; then
341 dnl ------------------ without internal db
343 AC_CHECK_HEADERS(db3/db.h)
345 dnl Check for Berkeley db3 API.
346 AC_CHECK_FUNC(db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"],
347 AC_CHECK_LIB(db-3.2, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.2"],
348 AC_CHECK_LIB(db-3.1, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.1"],
349 AC_CHECK_LIB(db-3.0, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.0"],
350 AC_CHECK_LIB(db, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb"],
357 if test X"$DBLIBSRCS" = X; then
358 AC_MSG_ERROR([sorry rpm requires libdb-3.x.a (from the Berkeley db package)])
361 if test -n "$libdb3" -a -n "$libthread" ; then
362 AC_MSG_CHECKING(whether $libdb3 needs $libthread)
365 AC_TRY_LINK_FUNC(db_create, AC_MSG_RESULT(no),
366 [libdb3="$libdb3 $libthread"; AC_MSG_RESULT(yes)])
371 dnl ------------------ with internal db
372 AC_DEFINE(HAVE_DB3_DB_H)
376 libdb3="# \$(top_builddir)/db3/libdb.la"
377 libdb3a="\$(top_builddir)/db3/libdb.a"
378 dnl INCPATH="-I\$(top_builddir)/$(WITH_DB_SUBDIR) $INCPATH"
381 AC_SUBST(WITH_DB_SUBDIR)
382 AC_SUBST(WITH_INTERNAL_DB)
384 DBLIBSRCS="$DBLIBSRCS db1.c falloc.c"
385 DBLIBOBJS=`echo $DBLIBSRCS | sed -e "s/\.c/\.lo/g"`
392 for dbi in $DBLIBSRCS; do
394 db3.c) AC_DEFINE(USE_DB3) ;;
395 db1.c) AC_DEFINE(USE_DB1) ;;
399 AC_CHECK_FUNC(fork, [], [echo "using vfork() instead of fork()";
402 dnl AmigaOS and IXEmul have a fork() dummy
405 echo "Building for AmigaOS: using vfork() instead of fork()";
406 CFLAGS="$CFLAGS -Dfork=vfork"
411 for zlib in z gz ; do
412 AC_CHECK_LIB(${zlib}, gzread,
413 [LIBS="$LIBS -l${zlib}"; break],
414 [if test ${zlib} = gz; then
415 AC_MSG_ERROR([sorry rpm requires libz.a or libgz.a (from the zlib package)])
420 dnl zlib-1.0.4 has not gzseek
421 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK)])
423 AC_CHECK_LIB(bz2, bzread, [LIBS="$LIBS -lbz2"],
424 AC_CHECK_LIB(bz2, BZ2_bzread, [
427 AC_DEFINE(HAVE_BZ2_1_0) ],
431 dnl Red Hat 4.x has not personality
432 AC_CHECK_FUNCS(personality)
434 dnl XXX these are needed only by rpmgettext right now
435 AM_FUNC_ERROR_AT_LINE
437 dnl ==> AM_GNU_GETTEXT does this (and more)
438 dnl AC_CHECK_HEADERS(unistd.h limits.h locale.h malloc.h string.h sys/param.h)
442 dnl horrible *temporary* hack to make sure that if we found gettext() in
443 dnl -lintl that we add -lintl *back* to $LIBS.
445 if test X$gt_cv_func_gettext_libintl = Xyes ; then
449 dnl Checks for header files we can live without.
455 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
457 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
458 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
459 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
461 AC_CHECK_HEADERS(netinet/in_systm.h)
462 AC_CHECK_HEADERS(machine/types.h)
463 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
464 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
465 AC_CHECK_HEADERS(bzlib.h libio.h zlib.h)
466 AC_CHECK_HEADERS(err.h mcheck.h)
468 dnl popt w float/double needs.
469 AC_CHECK_HEADERS(float.h)
471 dnl whether or not we should try to build rpmgettext/rpmputtext.
472 if test X"$USE_NLS" = Xyes; then
473 BUILD_RPMNLSTOOLS="rpmgettext rpmputtext"
474 if test X"$USE_INCLUDED_LIBINTL" = Xyes; then
475 INCPATH="-I\$(top_builddir)/intl $INCPATH"
480 AC_SUBST(BUILD_RPMNLSTOOLS)
482 AC_CHECK_HEADERS(glob.h)
484 dnl statfs portability fiddles.
486 dnl We should really emulate/steal sections of the statfs and struct statfs
487 dnl checks from GNU fileutils.
489 AC_MSG_CHECKING(for struct statfs)
491 dnl this is easier than nesting AC_TRY_COMPILEs...
493 found_struct_statfs=no
495 if test X$found_struct_statfs = Xno ; then
496 dnl Solaris 2.6+ wants to use statvfs
498 #ifdef HAVE_SYS_TYPES_H
499 #include <sys/types.h>
501 #include <sys/statvfs.h> ],
502 [struct statvfs sfs;],
503 [AC_MSG_RESULT(in sys/statvfs.h)
504 AC_DEFINE(STATFS_IN_SYS_STATVFS)
505 found_struct_statfs=yes],
509 if test X$found_struct_statfs = Xno ; then
510 dnl first try including sys/vfs.h
512 #ifdef HAVE_SYS_TYPES_H
513 #include <sys/types.h>
515 #include <sys/vfs.h> ],
516 [struct statfs sfs;],
517 [AC_MSG_RESULT(in sys/vfs.h)
518 AC_DEFINE(STATFS_IN_SYS_VFS)
519 found_struct_statfs=yes],
523 if test X$found_struct_statfs = Xno ; then
524 dnl ...next try including sys/mount.h
526 #ifdef HAVE_SYS_TYPES_H
527 #include <sys/types.h>
529 #ifdef HAVE_SYS_PARAM_H
530 #include <sys/param.h>
532 #include <sys/mount.h> ],
533 [struct statfs sfs;],
534 [AC_MSG_RESULT(in sys/mount.h)
535 AC_DEFINE(STATFS_IN_SYS_MOUNT)
536 found_struct_statfs=yes],
540 if test X$found_struct_statfs = Xno ; then
541 dnl ...still no joy. Try sys/statfs.h
543 #ifdef HAVE_SYS_TYPES_H
544 #include <sys/types.h>
546 #include <sys/statfs.h> ],
547 [struct statfs sfs;],
548 [AC_MSG_RESULT(in sys/statfs.h)
549 AC_DEFINE(STATFS_IN_SYS_STATFS)
550 found_struct_statfs=yes],
554 if test X$found_struct_statfs = Xno ; then
555 dnl ...no luck. Warn the user of impending doom.
556 AC_MSG_WARN(not found)
560 dnl if we found the struct, see if it has the f_bavail member. Some OSes
561 dnl don't, including IRIX 6.5+
563 if test X$found_struct_statfs = Xyes ; then
564 AC_MSG_CHECKING(for f_bavail member in struct statfs)
566 #ifdef HAVE_SYS_TYPES_H
567 #include <sys/types.h>
569 #if STATFS_IN_SYS_STATVFS
570 # include <sys/statvfs.h>
571 typedef struct statvfs STATFS_t;
573 typedef struct statfs STATFS_t;
574 # if STATFS_IN_SYS_VFS
575 # include <sys/vfs.h>
576 # elif STATFS_IN_SYS_MOUNT
577 # include <sys/mouht.h>
578 # elif STATFS_IN_SYS_STATFS
579 # include <sys/statfs.h>
585 AC_DEFINE(STATFS_HAS_F_BAVAIL)],
590 if test X$found_struct_statfs = Xyes ; then
592 dnl now check to see if we have the 4-argument variant of statfs()
593 dnl this pretty much requires AC_TRY_RUN
595 AC_MSG_CHECKING([if statfs() requires 4 arguments])
597 #ifdef HAVE_SYS_TYPES_H
598 #include <sys/types.h>
600 #ifdef STATFS_IN_SYS_VFS
602 #elif STATFS_IN_SYS_MOUNT
603 #include <sys/mouht.h>
604 #elif STATFS_IN_SYS_STATFS
605 #include <sys/statfs.h>
609 exit (statfs(".", &sfs, sizeof(sfs), 0));
613 AC_DEFINE(STAT_STATFS4)],
621 dnl look for libc features
623 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
624 AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
625 AC_MSG_RESULT($PROVIDES_ERRNO)
626 if test $PROVIDES_ERRNO = yes; then
627 AC_DEFINE(HAVE_HERRNO)
630 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
631 dnl make S_ISSOCK always return false (nice, eh?)
632 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
633 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
634 HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
635 AC_MSG_RESULT($HAS_S_IFSOCK)
636 if test $HAS_S_IFSOCK = yes; then
637 AC_DEFINE(HAVE_S_IFSOCK)
640 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
641 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
642 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
643 HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
644 AC_MSG_RESULT($HAS_S_ISLNK)
645 if test $HAS_S_ISLNK = yes; then
646 AC_DEFINE(HAVE_S_ISLNK)
649 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
650 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
651 HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
652 AC_MSG_RESULT($HAS_S_ISSOCK)
653 if test $HAS_S_ISSOCK = yes; then
654 AC_DEFINE(HAVE_S_ISSOCK)
657 AC_MSG_CHECKING(if timezone is defined)
658 AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
659 HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
660 AC_MSG_RESULT($HAS_TIMEZONE)
662 dnl Check for missing typedefs
666 dnl Checks for library functions.
671 if test $ac_cv_func_fnmatch_works = no; then
672 LIBOBJS="$LIBOBJS fnmatch.o"
673 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch)
676 dnl XXX AC_FUNC_MEMCMP
678 dnl XXX AC_TYPE_SIGNAL
679 dnl XXX AC_FUNC_STRCOLL
680 dnl XXX AC_FUNC_STRFTIME
681 dnl XXX AC_FUNC_UTIME_NULL
682 dnl XXX AC_FUNC_VFORK
683 dnl XXX AC_CHECK_FUNCS(gethostname mkdir mkfifo rmdir select uname)
685 AC_CHECK_FUNCS(basename getcwd getwd inet_aton mtrace putenv realpath setenv)
686 AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
687 AC_CHECK_FUNCS(strdup strerror strtol strtoul strspn strstr)
689 AC_CHECK_FUNCS(regcomp)
694 dnl XXX Regex replacement isn't known to be needed yet.
696 dnl AC_ARG_WITH(regex, [ --with-regex use the GNU regex library ],
697 dnl [rpm_cv_regex=yes],
698 dnl [AC_CHECK_FUNCS(regcomp, rpm_cv_regex=no, rpm_cv_regex=yes)])
700 dnl if test $rpm_cv_regex = no ; then
701 dnl AC_MSG_CHECKING(whether the regexp library is broken)
703 dnl #include <unistd.h>
704 dnl #include <regex.h>
705 dnl main() { regex_t blah ; exit(regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0)); }],
706 dnl rpm_cv_regex_broken=no, rpm_cv_regex_broken=yes, rpm_cv_regex_broken=yes)
707 dnl AC_MSG_RESULT([$rpm_cv_regex_broken])
708 dnl if test $rpm_cv_regex_broken = yes ; then
709 dnl echo " --> using the included GNU regex instead." >&AC_FD_MSG
714 dnl if test $rpm_cv_regex = yes; then
715 dnl AC_DEFINE(USE_GNU_REGEX)
716 dnl LIBOBJS="$LIBOBJS regex.o"
720 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
721 dnl %files gets something like
722 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
723 dnl (Note: more than one asterisk in glob pattern.)
725 AC_ARG_WITH(glob, [ --with-glob use the internal GNU glob ],
727 [AC_CHECK_FUNCS(glob, rpm_cv_glob=no, rpm_cv_glob=yes)])
729 if test $rpm_cv_glob = no ; then
730 AC_MSG_CHECKING(for GNU extensions to glob)
737 #include <sys/stat.h>
742 exit(glob("t/*/*.8", GLOB_PERIOD, NULL, &gl) || gl.gl_pathc < 1);
744 rpm_cv_glob_ext=yes, rpm_cv_glob_ext=no, rpm_cv_glob_ext=no)
746 AC_MSG_RESULT([$rpm_cv_glob_ext])
747 if test $rpm_cv_glob_ext = no ; then
748 echo " --> using the included GNU glob instead." >&AC_FD_MSG
753 if test $rpm_cv_glob = yes; then
754 AC_DEFINE(USE_GNU_GLOB)
755 LIBOBJS="$LIBOBJS glob.o fnmatch.o"
759 dnl Auto-detect whether python bindings should be built.
762 AC_ARG_WITH(python, [ --with-python build rpm python bindings ])
764 if test $withval = auto ; then
765 AC_MSG_CHECKING(for python 1.5.2)
767 #include <python1.5/Python.h>
769 exit(strcmp("1.5.2", PY_VERSION));
771 withval=yes, withval=no, withval=no)
772 AC_MSG_RESULT($withval)
775 if test $withval = yes ; then
776 WITH_PYTHON_SUBDIR=python
777 WITH_PYTHON_SUBPACKAGE=1
780 WITH_PYTHON_SUBPACKAGE=0
782 AC_SUBST(WITH_PYTHON_SUBDIR)
783 AC_SUBST(WITH_PYTHON_SUBPACKAGE)
785 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
787 dnl Auto-detect whether doxygen generated API docs should be included.
790 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ])
792 if test $withval = auto -a $__DOXYGEN != no ; then
794 elif test $withval = yes -a $__DOXYGEN = no ; then
795 AC_MSG_ERROR(--> rpm API docs needs doxygen in PATH)
798 if test $withval = yes; then
799 WITH_APIDOCS_TARGET=apidocs
804 AC_SUBST(WITH_APIDOCS_TARGET)
805 AC_SUBST(WITH_APIDOCS)
808 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
809 if test $withval = yes ; then
811 LIBS="$LIBS -ldmalloc"
814 AC_CHECK_FUNCS(setlocale)
816 dnl XXX Solaris <= 2.6 only permits 8 chars in password.
817 AC_CHECK_FUNCS(getpassphrase)
819 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), [
820 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL),[
821 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R), [
822 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
823 AC_DEFINE(HAVE_GETMNTINFO_R)], [
824 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
825 LIBOBJS="$LIBOBJS getmntent.o"])])])])
827 AC_CHECK_FUNC(lchown,
828 [__CHOWN_RHF="%{__chown} -Rhf"
829 __CHGRP_RHF="%{__chgrp} -Rhf"
830 AC_DEFINE(HAVE_LCHOWN)],
831 [__CHOWN_RHF="%{__chown} -Rf"
832 __CHGRP_RHF="%{__chgrp} -Rf"
833 dnl Does chown() follow symlinks? This should be a good enough test.
834 AC_MSG_CHECKING(whether chown() follows symlinks)
835 AC_ARG_ENABLE([broken-chown],
836 [ --enable-broken-chown this system's chown follows symbolic links],
837 result=$enableval, result=unknown)
838 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
840 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
843 if test $result = unknown; then
844 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
849 if test `ls -l foo | awk '{print $3}'` != "root"; then
856 AC_MSG_CHECKING((cannot check by non-root user))
861 AC_MSG_RESULT($result)
862 if test $result = yes; then
863 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK)
865 AC_SUBST(__CHOWN_RHF)
866 AC_SUBST(__CHGRP_RHF)
869 dnl figure out what root's primary group is
871 AC_MSG_CHECKING(root's primary group)
872 AC_TRY_RUN([#include <stdio.h>
873 #include <sys/types.h>
879 struct passwd *root = NULL;
880 struct group *roots_group = NULL;
881 FILE * tempfile = NULL;
883 root = getpwuid( (uid_t) 0 );
885 roots_group = getgrgid(root->pw_gid);
886 if (roots_group != NULL) {
887 tempfile = fopen("conftest_rootg", "w");
888 if (tempfile != NULL) {
889 fprintf(tempfile, "%s\n", roots_group->gr_name);
897 }], ROOT_GROUP=`cat conftest_rootg`,
898 ROOT_GROUP="root",ROOT_GROUP="root"
900 AC_MSG_RESULT($ROOT_GROUP)
903 if test "x$varprefix" = "x"; then
904 # For /usr and /usr/local, we want the 'var' directory to go
905 # in /var and /var/local respectively. For everything else,
906 # just put the 'var' directory in prefix/var.
909 varprefix=`echo $prefix | sed 's/usr/var/'` ;;
911 varprefix=`echo $ac_default_prefix | sed 's/usr/var/'` ;;
913 varprefix=$prefix/var ;;
918 if test "x$tmpdir" = "x"; then
919 if test -d $varprefix/tmp; then
920 tmpdir=$varprefix/tmp
922 if test -d /var/tmp; then
931 if echo "$build_os" | grep sco > /dev/null; then
932 echo "hacking things up for sco"
933 AC_DEFINE(NEED_STRINGS_H)
934 AC_DEFINE(HAVE_STRUCT_MNTTAB)
935 elif echo "$build_os" | grep sunos > /dev/null; then
936 echo "hacking things up for sunos"
937 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
938 AC_DEFINE(NEED_STRINGS_H)
939 AC_DEFINE(NEED_MYREALLOC)
940 LIBOBJS="$LIBOBJS myrealloc.o"
944 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
946 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
947 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
949 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
950 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
954 build_os_exact="${build_os}"
955 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
956 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
959 rm -f ./find-provides
960 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
961 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
962 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
963 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
964 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
965 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
966 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
967 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
968 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
969 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
970 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
971 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
973 echo "*** no default provides information is available for ${build_os_noversion}"
974 ln -s ${srcdir}/autodeps/none ./find-provides
977 rm -f ./find-requires
978 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
979 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
980 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
981 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
982 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
983 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
984 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
985 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
986 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
987 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
988 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
989 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
991 echo "*** no default requires information is available for ${build_os_noversion}"
992 ln -s ${srcdir}/autodeps/none ./find-requires
995 dnl Determine the canonical arch-vendor-os for the build machine
996 case "${build_cpu}" in
997 *86) RPMCANONARCH=i386 ;;
998 alpha*) RPMCANONARCH=alpha ;;
999 sparc*) RPMCANONARCH=sparc ;;
1000 ia64*) RPMCANONARCH=ia64 ;;
1001 s390*) RPMCANONARCH=s390 ;;
1002 powerpc*) RPMCANONARCH=ppc ;;
1003 armv3l*) RPMCANONARCH=armv3l ;;
1004 armv4l*) RPMCANONARCH=armv4l ;;
1005 armv4b*) RPMCANONARCH=armv4b ;;
1006 arm*) RPMCANONARCH="${build_cpu}" ;;
1007 m68k*) RPMCANONARCH=m68k ;;
1008 *) RPMCANONARCH=unknown ;;
1010 case "${build_os_noversion}" in
1011 mint) RPMCANONARCH=m68kmint ;;
1013 RPMCANONVENDOR="$build_vendor"
1014 case "${build_vendor}" in
1015 unknown|pc|redhat|pld|mandrake|conectiva)
1016 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1017 test -f /etc/pld-release && RPMCANONVENDOR=pld
1018 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1019 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1022 RPMCANONOS="$build_os_noversion"
1023 AC_SUBST(RPMCANONARCH)
1024 AC_SUBST(RPMCANONVENDOR)
1025 AC_SUBST(RPMCANONOS)
1027 if test -n "$LIBOBJS" ; then
1028 LIBMISC='$(top_builddir)/misc/libmisc.a'
1033 if test X"$prefix" = XNONE ; then
1034 usrprefix="$ac_default_prefix"
1038 LOCALEDIR="`echo ${usrprefix}/share/locale`"
1039 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")
1041 LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
1043 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1044 AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR")
1045 AC_SUBST(RPMCONFIGDIR)
1047 SYSCONFIGDIR="`echo /etc/rpm`"
1048 AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR")
1049 AC_SUBST(SYSCONFIGDIR)
1051 MACROFILES="${RPMCONFIGDIR}/macros:${RPMCONFIGDIR}/%{_target_platform}/macros:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/macros.specspo:${SYSCONFIGDIR}/macros.db1:${SYSCONFIGDIR}/%{_target_platform}/macros:~/.rpmmacros"
1052 AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES")
1053 AC_SUBST(MACROFILES)
1055 LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
1056 AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME")
1057 AC_SUBST(LIBRPMRC_FILENAME)
1059 LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
1060 AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME")
1061 AC_SUBST(LIBRPMALIAS_FILENAME)
1062 FINDREQUIRES="${RPMCONFIGDIR}/find-requires"
1063 AC_DEFINE_UNQUOTED(FINDREQUIRES, "$FINDREQUIRES")
1064 AC_SUBST(FINDREQUIRES)
1065 FINDPROVIDES="${RPMCONFIGDIR}/find-provides"
1066 AC_DEFINE_UNQUOTED(FINDPROVIDES, "$FINDPROVIDES")
1067 AC_SUBST(FINDPROVIDES)
1069 testdir="`pwd`/tests"
1070 dnl AC_DEFINE_UNQUOTED(testdir, "$testdir")
1073 if test -n "$LIBOBJS"; then
1074 INCPATH="-I\$(top_builddir)/misc $INCPATH"
1084 dnl XXX this causes popt to depend on zlib et al
1085 dnl # XXX Propagate -lucb to popt ...
1086 dnl export LIBS INCPATH CONFIG_SITE
1088 AC_CONFIG_SUBDIRS(popt $WITH_DB_SUBDIR)
1090 AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
1091 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1092 scripts/Makefile scripts/brp-redhat tools/Makefile
1093 tests/Makefile tests/rpmrc tests/macros tests/hello-test/Makefile
1094 misc/Makefile po/Makefile.in intl/Makefile
1095 doc/Makefile doc/manual/Makefile
1096 doc/ja/Makefile doc/pl/Makefile doc/ru/Makefile doc/sk/Makefile
1097 python/Makefile perl/Makefile perl/Makefile.PL ],
1098 [ echo timestamp > popt/stamp-h.in
1099 echo timestamp > stamp-h.in