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, 3.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 de fi fr ja pl pt_BR ru sk sl sr sv tr"
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"
30 AC_PROG_GCC_TRADITIONAL
34 dnl This now uses libtool. Put
35 dnl LDFLAGS_STATIC="-all"
36 dnl to attempt static executables using libtool. Otherwise
39 AC_MSG_CHECKING(flag used by libtool to link rpm)
40 if test X"$GCC" = Xyes ; then
42 *-*-solaris*) LDFLAGS_STATIC="";;
43 *-*-hpux*) LDFLAGS_STATIC="";;
44 *-*-*) LDFLAGS_STATIC="-all";;
46 elif test X"$CC" = Xcc ; then
48 *-*-linux*) LDFLAGS_STATIC="-all";;
49 *-*-freebsd*) LDFLAGS_STATIC="-all";;
50 *-*-osf*) LDFLAGS_STATIC="-all";;
51 *-*-aix*) LDFLAGS_STATIC="";; # -Wl,-bnso doesn't seem to work...
52 *-*-hpux*) LDFLAGS_STATIC="";;
53 *-*-solaris*) LDFLAGS_STATIC="";;
54 *-*-irix*) LDFLAGS_STATIC="";; #should be -non_shared, but can't
55 # link because of crt1.o then.
56 *-*-ultrix*) LDFLAGS_STATIC="-all";; #ultrix doesn't have shared libs.
57 *-*-*) LDFLAGS_STATIC=""
60 Unable to guess what option to pass to $CC to generate a static
61 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
62 the appropriate argument(s) if you want to build a static rpm executable.
68 # just link it dynamically
71 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}-static" # libtool format
72 AC_MSG_RESULT($LDFLAGS_STATIC)
73 AC_SUBST(LDFLAGS_STATIC)
76 dnl look for POSIX chmod attributes
78 AC_MSG_CHECKING(POSIX chmod)
80 chmod 744 foo.chmodtest
81 chmod +X foo.chmodtest 2>/dev/null
82 a=`ls -l foo.chmodtest | awk '{print $1}'`
84 if test "$a" = "-rwxr-xr-x"; then
88 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
94 dnl see if we have a mkdir that supports `-p'.
96 AC_PATH_PROGS(MKDIR, mkdir, mkdir)
97 AC_MSG_CHECKING(if $MKDIR supports -p)
99 $MKDIR -p conftest/a 2>/dev/null
100 if test $? = 0 ; then
101 rmdir conftest/a 2>/dev/null
102 if test $? = 0 ; then
108 rmdir conftest 2>/dev/null
109 if test $? = 0 ; then
118 if test X"$MKDIR_P" = X0 ; then
120 MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
125 dnl substitute this into config.h, so the C source picks it up.
127 AC_DEFINE_UNQUOTED(MKDIR_P, "${MKDIR_P}")
134 dnl This test must precede tests of compiler characteristics like
135 dnl that for the inline keyword, since it may change the degree to
136 dnl which the compiler supports such features.
143 dnl AM_DISABLE_SHARED
146 AC_CHECK_TOOL(AR, ar, :)
148 if test "$cross_compiling" != "yes"; then
150 dnl Set search path for common programs
152 MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/sbin:/usr/sbin:/usr/local/sbin:/opt/gnu/bin"
155 dnl Find some common programs
157 AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
158 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
159 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
160 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
161 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
162 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
163 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
164 AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
165 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
167 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
168 AC_MSG_CHECKING(checking whether id supports -u)
169 if `${__ID} -u 2>&1 > /dev/null` ; then
173 dnl XXX Watchout for square brackets fed to m4.
174 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
179 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
180 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
181 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
182 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
183 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
184 AC_MSG_CHECKING(old version of patch)
185 PATCHVERSION=`patch --version 2>&1`
187 if test "$PATCHVERSION" = "Patch version 2.1"; then
188 AC_DEFINE(HAVE_OLDPATCH_21)
189 AC_MSG_RESULT(patch older then 2.2 found)
191 AC_MSG_RESULT(patch later then 2.2 found)
194 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
195 AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
196 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
197 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
198 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
199 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
200 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
202 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
203 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
204 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
205 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
206 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
213 *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
214 *) LIBS="$LIBS -L$l $*";;
219 for dir in $prefix /usr/local
222 NONE|/usr) continue;;
224 if test X$localdone != X ; then continue; fi
229 AC_MSG_CHECKING(for $dir/lib in LIBS)
230 if test -d $dir/lib ; then
237 AC_MSG_CHECKING(for $dir/include in INCPATH)
238 if test -d $dir/include ; then
239 INCPATH="$INCPATH -I$dir/include"
246 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
247 if test -d /usr/ucblib ; then
248 if test "$build" = "mips-sni-sysv4" ; then
249 addlib /usr/ccs/lib -lc
260 dnl Check for features
263 ### use option --disable-v1-packages to turn off support for rpm-1.x packages
264 AC_MSG_CHECKING(if you want support for rpm-1.0 packages)
265 AC_ARG_ENABLE(v1-packages,
266 [ --disable-v1-packages[=no] disable support for rpm-1.x packages],
267 [with_v1_packages=$enableval],
268 [with_v1_packages=yes])
269 AC_MSG_RESULT($with_v1_packages)
270 test "$with_v1_packages" = yes && AC_DEFINE(ENABLE_V1_PACKAGES)
272 ### use option --enable-v4-packages to turn on support for rpm-4.x packages
273 AC_MSG_CHECKING(if you want experimental rpm-4.0 packages)
274 AC_ARG_ENABLE(v4-packages,
275 [ --enable-v4-packages[=no] [experimental] support for rpm-4.x packages],
276 [with_v4_packages=$enableval],
277 [with_v4_packages=no])
278 AC_MSG_RESULT($with_v4_packages)
279 test "$with_v4_packages" = yes && AC_DEFINE(ENABLE_V4_PACKAGES)
281 dnl Checks for libraries.
283 AC_CHECK_FUNC(strcasecmp, [], [
284 AC_CHECK_LIB(ucb, strcasecmp, [LIBS="$LIBS -lc -lucb" USEUCB=y])
286 AC_CHECK_FUNC(setreuid, [], [
287 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
290 AC_CHECK_FUNC(rand, [], [
291 AC_CHECK_LIB(rand, rand, [LIBS="$LIBS -lm"])
294 AC_CHECK_FUNC(getdomainname, [], [
295 AC_CHECK_LIB(nsl, getdomainname, [LIBS="$LIBS -lnsl"])
297 AC_CHECK_FUNC(socket, [], [
298 AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
301 dnl Better not use fchmod at all.
302 AC_CHECK_FUNC(fchmod)
304 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
305 dnl not in the libc but in libport (for political reasons). This check
306 dnl can hopefully be removed soon. Please use the default action
307 dnl for this macro (not LIBS=...), otherwise the check for dbopen
309 AC_CHECK_LIB(port, writev)
312 dnl Check for Berkeley db3 API.
313 AC_CHECK_FUNC(db_create, [DBLIBOBJS="$DBLIBOBJS db3.c"],
314 AC_CHECK_LIB(db, db_create, [LIBS="$LIBS -ldb"; DBLIBOBJS="$DBLIBOBJS db3.c"],
315 AC_CHECK_LIB(db-3.0, db_create, [DBLIBOBJS="$DBLIBOBJS db3.c"]))
317 dnl Check for Berkeley db2 API.
318 dnl AC_CHECK_FUNC(db_open, [DBLIBOBJS="$DBLIBOBJS db2.c"],
319 dnl AC_CHECK_LIB(db, db_open, [LIBS="$LIBS -ldb"; DBLIBOBJS="$DBLIBOBJS db2.c"])
321 dnl Check for Berkeley db1 API retrofit to db2/db3 database.
322 dnl AC_CHECK_FUNC(dbopen, [DBLIBOBJS="$DBLIBOBJS db1.c"],
323 dnl AC_CHECK_LIB(db, dbopen, [DBLIBOBJS="$DBLIBOBJS db1.c"])
325 dnl Check for Berkeley db1 API in glibc.
326 AC_CHECK_LIB(db1, dbopen, [DBLIBOBJS="$DBLIBOBJS db0.c"])
328 if test X"$DBLIBOBJS" = X; then
329 AC_MSG_ERROR([sorry rpm requires libdb.a or libdb1.a (from the Berkeley db package)])
331 dnl AC_DEFINE_UNQUOTED(DBLIBOBJS, "$DBLIBOBJS")
334 for dbi in $DBLIBOBJS; do
336 db3.c) AC_DEFINE(USE_DB3) ;;
337 db2.c) AC_DEFINE(USE_DB2) ;;
338 db1.c) AC_DEFINE(USE_DB1) ;;
339 db0.c) AC_DEFINE(USE_DB0) ;;
343 AC_CHECK_FUNC(fork, [], [echo "using vfork() instead of fork()";
346 dnl AmigaOS and IXEmul have a fork() dummy
349 echo "Building for AmigaOS: using vfork() instead of fork()";
350 CFLAGS="$CFLAGS -Dfork=vfork"
355 for zlib in z gz ; do
356 AC_CHECK_LIB(${zlib}, gzread,
357 [LIBS="$LIBS -l${zlib}"; break],
358 [if test ${zlib} = gz; then
359 AC_MSG_ERROR([sorry rpm requires libz.a or libgz.a (from the zlib package)])
364 dnl zlib-1.0.4 has not gzseek
365 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK)])
367 for bz2lib in bz2 ; do
368 AC_CHECK_LIB(${bz2lib}, bzread,
369 [LIBS="$LIBS -l${bz2lib}"; break],
370 [if test ${bz2lib} = bz2; then
371 AC_MSG_WARN([rpm needs libbz2.a (from the bzip2 package)])
376 dnl Red Hat 4.x has not personality
377 AC_CHECK_FUNCS(personality)
379 dnl XXX these are needed only by rpmgettext right now
380 AM_FUNC_ERROR_AT_LINE
382 dnl ==> AM_GNU_GETTEXT does this (and more)
383 dnl AC_CHECK_HEADERS(unistd.h limits.h locale.h malloc.h string.h sys/param.h)
387 dnl horrible *temporary* hack to make sure that if we found gettext() in
388 dnl -lintl that we add -lintl *back* to $LIBS.
390 if test X$gt_cv_func_gettext_libintl = Xyes ; then
394 dnl Checks for header files we can live without.
400 AC_CHECK_HEADERS(db_185.h db1/db.h db3/db.h)
401 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
403 AC_CHECK_HEADERS(sys/socket.h sys/select.h)
404 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
405 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
407 AC_CHECK_HEADERS(netinet/in_systm.h)
408 AC_CHECK_HEADERS(machine/types.h)
409 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
410 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
411 AC_CHECK_HEADERS(bzlib.h libio.h zlib.h)
412 AC_CHECK_HEADERS(err.h mcheck.h)
414 dnl whether or not we should try build rpmconvert, which is used to convert
415 dnl rpm databases from rpm 1.x to rpm 2.x or later. It requires the gdbm
416 dnl library and header file.
418 AC_CHECK_HEADERS(gdbm.h,BUILD_RPMCONVERT=yes,BUILD_RPMCONVERT=no)
419 AC_MSG_CHECKING(if rpmconvert should be built)
420 if test X"$BUILD_RPMCONVERT" = X"yes"; then
421 BUILD_RPMCONVERT=rpmconvert
427 AC_SUBST(BUILD_RPMCONVERT)
429 dnl whether or not we should try to build rpmgettext/rpmputtext.
430 if test X"$USE_NLS" = Xyes; then
431 BUILD_RPMNLSTOOLS="rpmgettext rpmputtext"
432 if test X"$USE_INCLUDED_LIBINTL" = Xyes; then
433 INCPATH="-I\$(top_builddir)/intl $INCPATH"
438 AC_SUBST(BUILD_RPMNLSTOOLS)
440 AC_CHECK_HEADERS(glob.h)
442 dnl statfs portability fiddles.
444 dnl We should really emulate/steal sections of the statfs and struct statfs
445 dnl checks from GNU fileutils.
447 AC_MSG_CHECKING(for struct statfs)
449 dnl this is easier than nesting AC_TRY_COMPILEs...
451 found_struct_statfs=no
453 if test X$found_struct_statfs = Xno ; then
454 dnl Solaris 2.6+ wants to use statvfs
456 #ifdef HAVE_SYS_TYPES_H
457 #include <sys/types.h>
459 #include <sys/statvfs.h> ],
460 [struct statvfs sfs;],
461 [AC_MSG_RESULT(in sys/statvfs.h)
462 AC_DEFINE(STATFS_IN_SYS_STATVFS)
463 found_struct_statfs=yes],
467 if test X$found_struct_statfs = Xno ; then
468 dnl first try including sys/vfs.h
470 #ifdef HAVE_SYS_TYPES_H
471 #include <sys/types.h>
473 #include <sys/vfs.h> ],
474 [struct statfs sfs;],
475 [AC_MSG_RESULT(in sys/vfs.h)
476 AC_DEFINE(STATFS_IN_SYS_VFS)
477 found_struct_statfs=yes],
481 if test X$found_struct_statfs = Xno ; then
482 dnl ...next try including sys/mount.h
484 #ifdef HAVE_SYS_TYPES_H
485 #include <sys/types.h>
487 #ifdef HAVE_SYS_PARAM_H
488 #include <sys/param.h>
490 #include <sys/mount.h> ],
491 [struct statfs sfs;],
492 [AC_MSG_RESULT(in sys/mount.h)
493 AC_DEFINE(STATFS_IN_SYS_MOUNT)
494 found_struct_statfs=yes],
498 if test X$found_struct_statfs = Xno ; then
499 dnl ...still no joy. Try sys/statfs.h
501 #ifdef HAVE_SYS_TYPES_H
502 #include <sys/types.h>
504 #include <sys/statfs.h> ],
505 [struct statfs sfs;],
506 [AC_MSG_RESULT(in sys/statfs.h)
507 AC_DEFINE(STATFS_IN_SYS_STATFS)
508 found_struct_statfs=yes],
512 if test X$found_struct_statfs = Xno ; then
513 dnl ...no luck. Warn the user of impending doom.
514 AC_MSG_WARN(not found)
518 dnl if we found the struct, see if it has the f_bavail member. Some OSes
519 dnl don't, including IRIX 6.5+
521 if test X$found_struct_statfs = Xyes ; then
522 AC_MSG_CHECKING(for f_bavail member in struct statfs)
524 #ifdef HAVE_SYS_TYPES_H
525 #include <sys/types.h>
527 #if STATFS_IN_SYS_STATVFS
528 # include <sys/statvfs.h>
529 typedef struct statvfs STATFS_t;
531 typedef struct statfs STATFS_t;
532 # if STATFS_IN_SYS_VFS
533 # include <sys/vfs.h>
534 # elif STATFS_IN_SYS_MOUNT
535 # include <sys/mouht.h>
536 # elif STATFS_IN_SYS_STATFS
537 # include <sys/statfs.h>
543 AC_DEFINE(STATFS_HAS_F_BAVAIL)],
548 if test X$found_struct_statfs = Xyes ; then
550 dnl now check to see if we have the 4-argument variant of statfs()
551 dnl this pretty much requires AC_TRY_RUN
553 AC_MSG_CHECKING([if statfs() requires 4 arguments])
555 #ifdef HAVE_SYS_TYPES_H
556 #include <sys/types.h>
558 #ifdef STATFS_IN_SYS_VFS
560 #elif STATFS_IN_SYS_MOUNT
561 #include <sys/mouht.h>
562 #elif STATFS_IN_SYS_STATFS
563 #include <sys/statfs.h>
567 exit (statfs(".", &sfs, sizeof(sfs), 0));
571 AC_DEFINE(STAT_STATFS4)],
579 dnl look for libc features
581 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
582 AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
583 AC_MSG_RESULT($PROVIDES_ERRNO)
584 if test $PROVIDES_ERRNO = yes; then
585 AC_DEFINE(HAVE_HERRNO)
588 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
589 dnl make S_ISSOCK always return false (nice, eh?)
590 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
591 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
592 HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
593 AC_MSG_RESULT($HAS_S_IFSOCK)
594 if test $HAS_S_IFSOCK = yes; then
595 AC_DEFINE(HAVE_S_IFSOCK)
598 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
599 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
600 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
601 HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
602 AC_MSG_RESULT($HAS_S_ISLNK)
603 if test $HAS_S_ISLNK = yes; then
604 AC_DEFINE(HAVE_S_ISLNK)
607 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
608 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
609 HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
610 AC_MSG_RESULT($HAS_S_ISSOCK)
611 if test $HAS_S_ISSOCK = yes; then
612 AC_DEFINE(HAVE_S_ISSOCK)
615 AC_MSG_CHECKING(if timezone is defined)
616 AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
617 HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
618 AC_MSG_RESULT($HAS_TIMEZONE)
620 dnl Check for missing typedefs
624 dnl Checks for library functions.
629 if test $ac_cv_func_fnmatch_works = no; then
630 LIBOBJS="$LIBOBJS fnmatch.o"
631 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch)
634 dnl XXX AC_FUNC_MEMCMP
636 dnl XXX AC_TYPE_SIGNAL
637 dnl XXX AC_FUNC_STRCOLL
638 dnl XXX AC_FUNC_STRFTIME
639 dnl XXX AC_FUNC_UTIME_NULL
640 dnl XXX AC_FUNC_VFORK
641 dnl XXX AC_CHECK_FUNCS(gethostname mkdir mkfifo rmdir select uname)
643 AC_CHECK_FUNCS(basename getcwd getwd inet_aton mtrace putenv realpath setenv)
644 AC_CHECK_FUNCS(stpcpy stpncpy strcasecmp strncasecmp strcspn)
645 AC_CHECK_FUNCS(strdup strerror strtol strtoul strspn strstr)
647 AC_CHECK_FUNCS(regcomp)
650 dnl XXX Regex replacement isn't known to be needed yet.
652 dnl AC_ARG_WITH(regex, [ --with-regex use the GNU regex library ],
653 dnl [rpm_cv_regex=yes],
654 dnl [AC_CHECK_FUNCS(regcomp, rpm_cv_regex=no, rpm_cv_regex=yes)])
656 dnl if test $rpm_cv_regex = no ; then
657 dnl AC_MSG_CHECKING(whether the regexp library is broken)
659 dnl #include <unistd.h>
660 dnl #include <regex.h>
661 dnl main() { regex_t blah ; exit(regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0)); }],
662 dnl rpm_cv_regex_broken=no, rpm_cv_regex_broken=yes, rpm_cv_regex_broken=yes)
663 dnl AC_MSG_RESULT([$rpm_cv_regex_broken])
664 dnl if test $rpm_cv_regex_broken = yes ; then
665 dnl echo " --> using the included GNU regex instead." >&AC_FD_MSG
670 dnl if test $rpm_cv_regex = yes; then
671 dnl AC_DEFINE(USE_GNU_REGEX)
672 dnl LIBOBJS="$LIBOBJS regex.o"
676 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
677 dnl %files gets something like
678 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
679 dnl (Note: more than one asterisk in glob pattern.)
680 dnl The next version of rpm is going to need GNU extensions anyways, so ...
682 AC_ARG_WITH(glob, [ --with-glob use the internal GNU glob ],
684 [AC_CHECK_FUNCS(glob, rpm_cv_glob=no, rpm_cv_glob=yes)])
686 if test $rpm_cv_glob = no ; then
687 AC_MSG_CHECKING(for GNU extensions to glob)
690 #include <sys/stat.h>
695 exit(glob("doc/*/*.8", 0, NULL, &gl) || gl.gl_pathc < 1);
697 rpm_cv_glob_ext=yes, rpm_cv_glob_ext=no, rpm_cv_glob_ext=no)
698 AC_MSG_RESULT([$rpm_cv_glob_ext])
699 if test $rpm_cv_glob_ext = no ; then
700 echo " --> using the included GNU glob instead." >&AC_FD_MSG
705 if test $rpm_cv_glob = yes; then
706 AC_DEFINE(USE_GNU_GLOB)
707 LIBOBJS="$LIBOBJS glob.o fnmatch.o"
710 AC_CHECK_FUNCS(setlocale)
712 dnl XXX Solaris <= 2.6 only permits 8 chars in password.
713 AC_CHECK_FUNCS(getpassphrase)
715 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), [
716 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL),[
717 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R), [
718 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
719 AC_DEFINE(HAVE_GETMNTINFO_R)],
720 LIBOBJS="$LIBOBJS getmntent.o")])])])
722 AC_CHECK_FUNC(lchown,
723 [__CHOWN_RHF="%{__chown} -Rhf"
724 __CHGRP_RHF="%{__chgrp} -Rhf"
725 AC_DEFINE(HAVE_LCHOWN)],
726 [__CHOWN_RHF="%{__chown} -Rf"
727 __CHGRP_RHF="%{__chgrp} -Rf"
728 dnl Does chown() follow symlinks? This should be a good enough test.
729 AC_MSG_CHECKING(whether chown() follows symlinks)
730 AC_ARG_ENABLE([broken-chown],
731 [ --enable-broken-chown this system's chown follows symbolic links],
732 result=$enableval, result=unknown)
733 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
735 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
738 if test $result = unknown; then
739 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
744 if test `ls -l foo | awk '{print $3}'` != "root"; then
751 AC_MSG_CHECKING((cannot check by non-root user))
756 AC_MSG_RESULT($result)
757 if test $result = yes; then
758 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK)
760 AC_SUBST(__CHOWN_RHF)
761 AC_SUBST(__CHGRP_RHF)
764 dnl figure out what root's primary group is
766 AC_MSG_CHECKING(root's primary group)
767 AC_TRY_RUN([#include <stdio.h>
768 #include <sys/types.h>
774 struct passwd *root = NULL;
775 struct group *roots_group = NULL;
776 FILE * tempfile = NULL;
778 root = getpwuid( (uid_t) 0 );
780 roots_group = getgrgid(root->pw_gid);
781 if (roots_group != NULL) {
782 tempfile = fopen("conftest_rootg", "w");
783 if (tempfile != NULL) {
784 fprintf(tempfile, "%s\n", roots_group->gr_name);
792 }], ROOT_GROUP=`cat conftest_rootg`,
793 ROOT_GROUP="root",ROOT_GROUP="root"
795 AC_MSG_RESULT($ROOT_GROUP)
798 if test "x$varprefix" = "x"; then
799 varprefix=`echo $prefix | sed 's/usr/var/'`
800 test "x$prefix" = xNONE && varprefix=`echo $ac_default_prefix | sed 's/usr/var/'`
804 if test "x$tmpdir" = "x"; then
805 if test -d $varprefix/tmp; then
806 tmpdir=$varprefix/tmp
808 if test -d /var/tmp; then
817 if echo "$build_os" | grep sco > /dev/null; then
818 echo "hacking things up for sco"
819 AC_DEFINE(NEED_STRINGS_H)
820 AC_DEFINE(HAVE_STRUCT_MNTTAB)
821 elif echo "$build_os" | grep sunos > /dev/null; then
822 echo "hacking things up for sunos"
823 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
824 AC_DEFINE(NEED_STRINGS_H)
825 AC_DEFINE(NEED_MYREALLOC)
826 LIBOBJS="$LIBOBJS myrealloc.o"
830 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
832 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
833 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
835 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
836 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
840 build_os_exact="${build_os}"
841 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
842 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
845 rm -f ./find-provides
846 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
847 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
848 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
849 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
850 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
851 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
852 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
853 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
854 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
855 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
856 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
857 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
859 echo "*** no default provides information is available for ${build_os_noversion}"
860 ln -s ${srcdir}/autodeps/none ./find-provides
863 rm -f ./find-requires
864 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
865 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
866 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
867 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
868 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
869 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
870 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
871 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
872 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
873 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
874 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
875 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
877 echo "*** no default requires information is available for ${build_os_noversion}"
878 ln -s ${srcdir}/autodeps/none ./find-requires
881 dnl Determine the canonical arch-vendor-os for the build machine
882 case "${build_cpu}" in
883 i386|i486|i586|i686|ix86) RPMCANONARCH=i386 ;;
884 alpha*) RPMCANONARCH=alpha ;;
885 sparc*) RPMCANONARCH=sparc ;;
886 powerpc*) RPMCANONARCH=ppc ;;
887 armv4l*) RPMCANONARCH=armv4l ;;
888 armv4b*) RPMCANONARCH=armv4b ;;
889 arm*) RPMCANONARCH=arm ;;
890 *) RPMCANONARCH=unknown ;;
892 case "${build_os_noversion}" in
893 mint) RPMCANONARCH=m68kmint ;;
895 RPMCANONVENDOR="$build_vendor"
896 case "${build_vendor}" in
897 unknown|pc|redhat|pld)
898 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
899 test -f /etc/pld-release && RPMCANONVENDOR=pld
902 RPMCANONOS="$build_os_noversion"
903 AC_SUBST(RPMCANONARCH)
904 AC_SUBST(RPMCANONVENDOR)
907 if test -n "$LIBOBJS" ; then
908 LIBMISC='$(top_builddir)/misc/libmisc.a'
913 if test X"$prefix" = XNONE ; then
914 usrprefix="$ac_default_prefix"
918 LOCALEDIR="`echo ${usrprefix}/share/locale`"
919 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")
921 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
922 AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR")
923 AC_SUBST(RPMCONFIGDIR)
924 SYSCONFIGDIR="`echo /etc/rpm`"
925 AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR")
926 AC_SUBST(SYSCONFIGDIR)
927 LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
928 AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME")
929 AC_SUBST(LIBRPMRC_FILENAME)
930 LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt"
931 AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME")
932 AC_SUBST(LIBRPMALIAS_FILENAME)
933 FINDREQUIRES="${RPMCONFIGDIR}/find-requires"
934 AC_DEFINE_UNQUOTED(FINDREQUIRES, "$FINDREQUIRES")
935 AC_SUBST(FINDREQUIRES)
936 FINDPROVIDES="${RPMCONFIGDIR}/find-provides"
937 AC_DEFINE_UNQUOTED(FINDPROVIDES, "$FINDPROVIDES")
938 AC_SUBST(FINDPROVIDES)
939 MACROFILES="${RPMCONFIGDIR}/macros"
940 AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES")
942 TOP_SOURCEDIR="`pwd`"
943 AC_DEFINE_UNQUOTED(TOP_SOURCEDIR, "$TOP_SOURCEDIR")
944 AC_SUBST(TOP_SOURCEDIR)
946 testdir="`pwd`/tests"
947 dnl AC_DEFINE_UNQUOTED(testdir, "$testdir")
950 if test -n "$LIBOBJS"; then
951 INCPATH="-I\$(top_builddir)/misc $INCPATH"
959 dnl XXX this causes popt to depend on zlib et al
960 dnl # XXX Propagate -lucb to popt ...
961 dnl export LIBS INCPATH CONFIG_SITE
963 AC_CONFIG_SUBDIRS(popt)
964 AC_OUTPUT([Doxyfile Makefile rpmrc macros platform rpmpopt scripts/brp-redhat
965 lib/Makefile build/Makefile tools/Makefile scripts/Makefile
966 tests/Makefile tests/rpmrc tests/macros tests/hello-test/Makefile
967 misc/Makefile po/Makefile.in intl/Makefile
968 doc/Makefile doc/manual/Makefile
969 doc/ja/Makefile doc/pl/Makefile doc/ru/Makefile
970 python/Makefile perl/Makefile perl/Makefile.PL],
971 [echo timestamp > popt/stamp-h.in
972 echo timestamp > stamp-h.in])
973 dnl touch Makefile.in
974 dnl sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])