Remove AC_PROG_GCC_TRADITIONAL (Obsolete).
[platform/upstream/rpm.git] / configure.ac
1 AC_PREREQ(2.61)
2 AC_INIT(rpm, 4.4.90, rpm-maint@lists.rpm.org)
3
4 AC_CONFIG_SRCDIR([rpmqv.c])
5 AC_CONFIG_HEADERS([config.h])
6
7 AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects nostdinc])
8
9 AC_CONFIG_TESTDIR(tests)
10
11 AC_DISABLE_STATIC
12
13 AC_AIX
14 AC_MINIX
15
16 dnl Checks for programs.
17 AC_PROG_CXX
18 AC_PROG_AWK
19 AC_PROG_CC
20 AC_PROG_CPP
21 AC_PROG_INSTALL
22 AC_PROG_LN_S
23 AC_PROG_MAKE_SET
24 AC_PROG_LIBTOOL
25 AC_PROG_YACC
26
27 AS=${AS-as}
28 AC_SUBST(AS)
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])
33     old_cflags=$CFLAGS
34     echo
35     for flag in $cflags_to_try; do
36         CFLAGS="$CFLAGS $flag"
37         AC_TRY_COMPILE(, [return 0;], [
38                 echo "   $flag"
39                 RPMCFLAGS="$RPMCFLAGS $flag"
40         ])
41         CFLAGS=$old_cflags
42     done
43     CFLAGS="$CFLAGS $RPMCFLAGS"
44 fi
45 export CFLAGS
46
47 AC_SYS_LARGEFILE
48
49 AC_CHECK_HEADER([stdarg.h])
50 AC_MSG_CHECKING([for va_copy])
51 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
52 #include <stdarg.h>
53 void foo(int i, ...) {
54   va_list ap, aq;
55   va_start(ap, i);
56   va_copy(aq,ap);
57   va_end(aq);
58 }]], [[
59   foo(1,2,3,4);
60 ]])],[ac_cv_va_copy=yes],[ac_cv_va_copy=no])
61 AC_MSG_RESULT([$ac_cv_va_copy])
62
63 RPMUSER=rpm
64 RPMUID=37
65 RPMGROUP=rpm
66 RPMGID=37
67 export RPMUSER RPMUID RPMGROUP RPMGID
68 AC_SUBST(RPMUSER)
69 AC_SUBST(RPMUID)
70 AC_SUBST(RPMGROUP)
71 AC_SUBST(RPMGID)
72
73 dnl
74 dnl This now uses libtool. Put
75 dnl     LDFLAGS_STATIC="-all"
76 dnl to attempt static executables using libtool. Otherwise
77 dnl     LDFLAGS_STATIC=""
78 dnl
79 AC_MSG_CHECKING(flag used by libtool to link rpm)
80 if test X"$GCC" = Xyes ; then
81         case "$host" in
82                 *-*-linux*)     LDFLAGS_STATIC="-all-static" ;;
83                 *-*-solaris*)   LDFLAGS_STATIC="-static";;
84                 *-*-hpux*)      LDFLAGS_STATIC="-static";;
85                 *-*-darwin*)    LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
86                 *-*-sysv5uw*)   LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
87                 *-*-*)          LDFLAGS_STATIC="";;
88         esac
89 elif test X"$CC" = Xcc ; then
90         case "$host" in
91                 *-*-linux*)     LDFLAGS_STATIC="-all-static";;
92                 *-*-freebsd*)   LDFLAGS_STATIC="-all-static";;
93                 *-*-osf*)       LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
94                 *-*-aix*)       LDFLAGS_STATIC="-static";;  # -Wl,-bnso doesn't seem to work...
95                 *-*-hpux*)      LDFLAGS_STATIC="-static";;
96                 *-*-solaris*)   LDFLAGS_STATIC="-static";;
97                 *-*-irix*)      LDFLAGS_STATIC="-static";;  #should be -non_shared, but can't
98                                                                                         # link because of crt1.o then.
99                 *-*-ultrix*)    LDFLAGS_STATIC="-all-static";;  #ultrix doesn't have shared libs.
100                 *-*-*)          LDFLAGS_STATIC=""
101 AC_MSG_WARN([
102
103 Unable to guess what option to pass to $CC to generate a static
104 executable.  You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
105 the appropriate argument(s) if you want to build a static rpm executable.
106
107 ])
108                 ;;
109         esac
110 else
111         # just link it dynamically
112         LDFLAGS_STATIC=""
113 fi
114 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}"   # libtool format
115 AC_MSG_RESULT($LDFLAGS_STATIC)
116 AC_SUBST(LDFLAGS_STATIC)
117
118 dnl
119 dnl look for POSIX chmod attributes
120 dnl
121 AC_MSG_CHECKING(POSIX chmod)
122 touch foo.chmodtest
123 chmod 744 foo.chmodtest
124 chmod +X foo.chmodtest 2>/dev/null
125 a=`ls -l foo.chmodtest | awk '{print $1}'`
126 rm -f foo.chmodtest
127 if test "$a" = "-rwxr-xr-x"; then
128     AC_MSG_RESULT(yes)
129     FIXPERMS=a+rX,u+w,g-w,o-w 
130 else
131     AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
132     FIXPERMS=a+r,u+w,g-w,o-w 
133 fi
134 AC_SUBST(FIXPERMS)
135
136 dnl
137 dnl see if we have a mkdir that supports `-p'.
138 dnl
139 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
140 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
141 rm -rf conftest
142 $RPM_MKDIR -p conftest/a 2>/dev/null
143 if test $? = 0 ; then
144         rmdir conftest/a 2>/dev/null
145         if test $? = 0  ; then
146                 :
147         else
148                 RPM_MKDIR_P=0
149         fi
150
151         rmdir conftest 2>/dev/null
152         if test $? = 0 ; then
153                 RPM_MKDIR_P="$RPM_MKDIR -p"
154         else
155                 RPM_MKDIR_P=0
156         fi
157 else
158         RPM_MKDIR_P=0
159 fi
160
161 if test X"$RPM_MKDIR_P" = X0 ; then
162         AC_MSG_RESULT(no)
163         RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
164 else
165         AC_MSG_RESULT(yes)
166 fi
167 dnl
168 dnl substitute this into config.h, so the C source picks it up.
169 dnl
170 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
171 [A full path to a program, possibly with arguments, that will create a
172    directory and all necessary parent directories, ala 'mkdir -p'])
173 AC_SUBST(RPM_MKDIR_P)
174
175 dnl This test must precede tests of compiler characteristics like
176 dnl that for the inline keyword, since it may change the degree to
177 dnl which the compiler supports such features.
178 AM_C_PROTOTYPES
179
180 dnl AM_DISABLE_SHARED
181 AM_PROG_LIBTOOL
182
183 AC_CHECK_TOOL(AR, ar, :)
184
185 dnl
186 dnl use defaults if cross-compiling, otherwise use the default path.
187 dnl
188 if test "$cross_compiling" = "yes"; then
189     MYPATH=":"
190 else
191     MYPATH=$PATH
192 fi
193
194 dnl
195 dnl Find some common programs
196 dnl
197 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
198 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
199 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
200 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
201 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
202 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
203 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
204 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
205 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
206 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
207 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
208 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
209 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
210
211 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
212 AC_MSG_CHECKING(checking whether id supports -u)
213     if ${__ID} -u 2>&1 > /dev/null ; then
214         __ID_U="%{__id} -u"
215         AC_MSG_RESULT(yes)
216     else
217         __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
218         AC_MSG_RESULT(no)
219     fi
220 AC_SUBST(__ID_U)
221
222 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
223 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
224 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
225 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
226 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
227 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
228 AC_MSG_CHECKING(old version of patch)
229     PATCHVERSION=`patch --version 2>&1`
230
231     if test "$PATCHVERSION" = "Patch version 2.1"; then
232         AC_DEFINE(HAVE_OLDPATCH_21, 1,
233                 [Define if the patch call you'll be using is 2.1 or older])
234         AC_MSG_RESULT(patch older then 2.2 found)
235     else
236         AC_MSG_RESULT(patch later then 2.2 found)
237     fi
238
239 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
240 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
241 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH) 
242 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
243 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
244 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
245 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
246 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
247
248 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
249 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
250 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
251 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
252 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
253
254 addlib() {
255   l=$1
256   shift
257   case "$host" in 
258     *-*-solaris*)       LIBS="$LIBS -L$l -R$l $*";;
259     *)          LIBS="$LIBS -L$l $*";;
260   esac
261 }
262
263 #=================
264 # Check for zlib library. 
265
266 WITH_ZLIB_INCLUDE=
267 WITH_ZLIB_LIB=
268
269 AC_CHECK_HEADERS([zlib.h],[
270   AS_IF([test -z "${WITH_ZLIB_LIB}"],[
271     for zlib in z gz ; do
272       AC_CHECK_LIB(${zlib}, gzread, 
273         [WITH_ZLIB_LIB="-l${zlib}"; break])
274     done
275
276 dnl zlib-1.0.4 has not gzseek
277     AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
278   ])
279 ])
280
281 AC_SUBST(WITH_ZLIB_INCLUDE)
282 AC_SUBST(WITH_ZLIB_LIB)
283
284 #=================
285 # Check for bzip2 library.
286
287 AC_CHECK_HEADERS([bzlib.h],[
288   AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
289   [
290     AC_CHECK_LIB(bz2, BZ2_bzread,[ 
291       WITH_BZ2_LIB="-lbz2"
292       AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
293     ]) 
294   ])
295 ])
296 AC_SUBST(WITH_BZ2_LIB)
297
298 #=================
299
300 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
301 if test -d /usr/ucblib ; then
302         if test "$build" = "mips-sni-sysv4" ; then
303                 addlib /usr/ccs/lib -lc
304         fi
305
306         addlib /usr/ucblib
307         
308         AC_MSG_RESULT(yes)
309 else
310         AC_MSG_RESULT(no)
311 fi
312
313 dnl
314 dnl Check for features
315 dnl
316
317 dnl Checks for libraries.
318
319 AC_CHECK_FUNC(setreuid, [], [
320     AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
321 ])
322
323 AC_CHECK_FUNC(rand, [], [
324     AC_CHECK_LIB(rand, rand, [])
325 ])
326
327 AC_CHECK_FUNC(getdomainname, [], [
328     AC_CHECK_LIB(nsl, getdomainname)
329 ])
330 AC_CHECK_FUNC(socket, [], [
331     AC_CHECK_LIB(socket, socket)
332 ])
333
334 AC_CHECK_HEADERS(error.h)
335 AC_CHECK_FUNCS(error)
336
337 AC_CHECK_HEADERS(poll.h)
338
339 AC_CHECK_HEADERS(pthread.h)
340
341 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
342   dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
343   AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
344     AC_CHECK_LIB(thread, mutex_lock)
345   ])
346 ])
347
348 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
349
350 AC_CHECK_FUNCS(vsnprintf snprintf)
351
352 dnl Temporary hack for MiNT.  Some functions (writev, snprintf) are
353 dnl not in the libc but in libport (for political reasons).  This check
354 dnl can hopefully be removed soon.  Please use the default action
355 dnl for this macro (not LIBS=...), otherwise the check for dbopen
356 dnl will fail.
357 AC_CHECK_LIB(port, writev)
358
359 #=================
360 # Check for libelf library. Prefer external, otherwise none.
361 WITH_LIBELF_INCLUDE=
362 WITH_LIBELF_LIB=
363 AC_CHECK_HEADER([libelf.h])
364 AC_CHECK_HEADERS([gelf.h], [
365         AC_CHECK_LIB(elf, gelf_getvernaux, [
366             AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
367             WITH_LIBELF_LIB="-lelf"
368             WITH_LIBELF=yes
369         ])
370 ])
371 AC_SUBST(WITH_LIBELF_INCLUDE)
372 AC_SUBST(WITH_LIBELF_LIB)
373 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
374
375 AC_CHECK_HEADERS([dwarf.h], [
376   WITH_LIBDWARF=yes
377 ])
378 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
379
380 #=================
381 # Check for beecrypt library.
382 WITH_BEECRYPT_INCLUDE=
383 WITH_BEECRYPT_LIB=
384 AC_CHECK_HEADERS([beecrypt/beecrypt.h], [
385   AC_CHECK_LIB(beecrypt, mpfprintln, [
386     AC_CHECK_HEADERS([beecrypt/api.h])
387     WITH_BEECRYPT_INCLUDE=
388     WITH_BEECRYPT_LIB="-lbeecrypt"
389   ],[
390     AC_MSG_ERROR([missing required library beecrypt])
391   ])
392 ],[
393   AC_MSG_ERROR([missing required header beecrypt/beecrypt.h])
394 ])
395 AC_SUBST(WITH_BEECRYPT_INCLUDE)
396 AC_SUBST(WITH_BEECRYPT_LIB)
397
398 #=================
399 # Check for magic library.
400 WITH_MAGIC_INCLUDE=
401 WITH_MAGIC_LIB=
402
403 AC_CHECK_HEADER([magic.h], [
404     AC_CHECK_LIB(magic, magic_open, [
405       WITH_MAGIC_INCLUDE=
406       WITH_MAGIC_LIB="-lmagic"
407     ],[
408       AC_MSG_ERROR([missing required library 'libmagic']) 
409     ])
410 ],[
411       AC_MSG_ERROR([missing required header magic.h]) 
412 ])
413
414 AC_SUBST(WITH_MAGIC_INCLUDE)
415 AC_SUBST(WITH_MAGIC_LIB)
416
417 #=================
418 # Check for popt library.
419 WITH_POPT_INCLUDE=
420 WITH_POPT_LIB=
421
422 AC_CHECK_HEADER([popt.h], [
423   AC_CHECK_LIB(popt, poptGetContext, [
424       WITH_POPT_INCLUDE=
425       WITH_POPT_LIB="-lpopt"
426   ],[
427     AC_MSG_ERROR([missing required library popt])
428   ])
429 ],[
430   AC_MSG_ERROR([missing required header popt.h])
431 ])
432
433 AC_SUBST(WITH_POPT_INCLUDE)
434 AC_SUBST(WITH_POPT_LIB)
435
436 #=================
437 # Process --with/without-external-db
438 AC_ARG_WITH(external_db, [  --with-external-db      build against an external Berkeley db],
439 [case "$with_external_db" in
440 yes|no) ;;
441 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
442 esac],
443 [with_external_db=no])
444
445 case "$with_external_db" in
446 yes )
447   AC_CHECK_HEADERS([db.h],[
448     AC_CHECK_TYPE([db_threadid_t],[],
449       [AC_MSG_WARN([missing type db_threadid_t])],
450       [#include <db.h>])
451     save_LIBS="$LIBS"
452     AC_CHECK_LIB([db],[db_create],[],[
453       AC_MSG_ERROR([missing db_create in libdb])
454       ])
455     AC_CHECK_LIB([db],[db_env_create],[],[
456       AC_MSG_ERROR([missing db_env_create in libdb])
457       ])
458     AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
459       AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
460       ])
461     AC_CHECK_LIB([db],[db_strerror],[],[
462       AC_MSG_ERROR([missing db_strerror in libdb])
463       ])
464     WITH_DB_LIB=-ldb
465     LIBS="$save_LIBS"
466   ],[
467     AC_MSG_ERROR([missing required header db.h])
468   ])
469   ;;
470 * ) # Fall back to internal db
471   # XXX for now we always have in-tree BDB available...
472   AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
473   ;;
474 esac
475
476 AC_SUBST([WITH_DB_LIB])
477
478 #=================
479 # Check for sqlite3 library.
480 AC_ARG_ENABLE(sqlite3, [  --enable-sqlite3        enable sqlite3 support],
481 [case "$enable_sqlite3" in
482 yes|no) ;;
483 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
484   ;;
485 esac],
486 [enable_sqlite3=no])
487
488 WITH_SQLITE3_INCLUDE=
489 WITH_SQLITE3_LIB=
490 WITH_SQLITE3=no
491 AS_IF([test "$enable_sqlite3" = yes],[
492   AC_CHECK_HEADERS([sqlite3.h],
493   [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
494       WITH_SQLITE3_INCLUDE=
495       WITH_SQLITE3_LIB="-lsqlite3"
496       WITH_SQLITE3=yes
497     ],[
498       AC_MSG_ERROR([missing libsqlite3])
499     ])
500   ],[
501     AC_MSG_ERROR([missing sqlite3.h])
502   ])
503 ])
504
505 AC_SUBST(WITH_SQLITE3_INCLUDE)
506 AC_SUBST(WITH_SQLITE3_LIB)
507 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
508
509 #=================
510
511 dnl AmigaOS and IXEmul have a fork() dummy
512   case "$host" in
513     m68k-*-amigaos ) 
514         echo "Building for AmigaOS: using vfork() instead of fork()"; 
515         CFLAGS="$CFLAGS -Dfork=vfork" 
516         ;;
517   esac
518
519 AM_GNU_GETTEXT_VERSION([0.16.1])
520 AM_GNU_GETTEXT([external])
521
522 dnl Checks for header files we can live without.
523 AC_HEADER_STDC
524 AC_HEADER_MAJOR
525 AC_HEADER_DIRENT
526 AC_HEADER_TIME
527
528 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
529
530 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
531 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
532 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
533
534 AC_CHECK_HEADERS(netinet/in_systm.h)
535 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
536 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
537 AC_CHECK_HEADERS(libio.h)
538 AC_CHECK_HEADERS(err.h mcheck.h)
539
540 AC_CHECK_HEADERS(glob.h)
541 AC_CHECK_HEADERS(locale.h)
542
543 dnl statfs portability fiddles.
544 dnl
545 dnl We should really emulate/steal sections of the statfs and struct statfs
546 dnl checks from GNU fileutils.
547 dnl
548 AC_MSG_CHECKING(for struct statfs)
549
550 dnl
551 dnl this is easier than nesting AC_TRY_COMPILEs...
552 dnl
553 found_struct_statfs=no
554
555 if test X$found_struct_statfs = Xno ; then
556 dnl Solaris 2.6+ wants to use statvfs
557 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
558 #ifdef HAVE_SYS_TYPES_H
559 #include <sys/types.h>
560 #endif
561 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
562         AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
563                 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
564         found_struct_statfs=yes],[])
565 fi
566
567 if test X$found_struct_statfs = Xno ; then
568 dnl first try including sys/vfs.h
569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
570 #ifdef HAVE_SYS_TYPES_H
571 #include <sys/types.h>
572 #endif
573 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
574         AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
575         found_struct_statfs=yes],[])
576 fi
577
578 if test X$found_struct_statfs = Xno ; then
579 dnl ...next try including sys/mount.h
580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
581 #ifdef HAVE_SYS_TYPES_H
582 #include <sys/types.h>
583 #endif
584 #ifdef HAVE_SYS_PARAM_H
585 #include <sys/param.h>
586 #endif
587 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
588         AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
589         found_struct_statfs=yes],[])
590 fi
591
592 if test X$found_struct_statfs = Xno ; then
593 dnl ...still no joy.  Try sys/statfs.h
594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
595 #ifdef HAVE_SYS_TYPES_H
596 #include <sys/types.h>
597 #endif
598 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
599         AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
600         found_struct_statfs=yes],[])
601 fi
602
603 if test X$found_struct_statfs = Xno ; then
604 dnl ...no luck.  Warn the user of impending doom.
605 AC_MSG_WARN(not found)
606 fi
607
608 dnl
609 dnl if we found the struct, see if it has the f_bavail member.  Some OSes
610 dnl don't, including IRIX 6.5+
611 dnl
612 if test X$found_struct_statfs = Xyes ; then
613 AC_MSG_CHECKING(for f_bavail member in struct statfs)
614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
615 #ifdef HAVE_SYS_TYPES_H
616 #include <sys/types.h>
617 #endif
618 #if STATFS_IN_SYS_STATVFS
619 # include <sys/statvfs.h>
620   typedef struct statvfs STATFS_t;
621 #else
622   typedef struct statfs STATFS_t;
623 # if STATFS_IN_SYS_VFS
624 #  include <sys/vfs.h>
625 # elif STATFS_IN_SYS_MOUNT
626 #  include <sys/mount.h>
627 # elif STATFS_IN_SYS_STATFS
628 #  include <sys/statfs.h>
629 # endif
630 #endif ]], [[STATFS_t sfs;
631         sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
632         AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
633 ])
634 fi
635
636 if test X$found_struct_statfs = Xyes ; then
637 dnl
638 dnl now check to see if we have the 4-argument variant of statfs()
639 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
640 dnl
641 AC_MSG_CHECKING([if statfs() requires 4 arguments])
642 AC_RUN_IFELSE([AC_LANG_SOURCE([[
643 #ifdef HAVE_SYS_TYPES_H
644 #include <sys/types.h>
645 #endif
646 #ifdef STATFS_IN_SYS_VFS
647 #include <sys/vfs.h>
648 #elif STATFS_IN_SYS_MOUNT
649 #include <sys/mouht.h>
650 #elif STATFS_IN_SYS_STATFS
651 #include <sys/statfs.h>
652 #endif
653 main() {
654         struct statfs sfs;
655         exit (statfs(".", &sfs, sizeof(sfs), 0));
656 }
657 ]])],[AC_MSG_RESULT(yes)
658         AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
659 ])
660 fi
661
662 AC_C_INLINE
663
664 dnl look for libc features
665 PROVIDES_ERRNO=no
666 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
667 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
668 AC_MSG_RESULT($PROVIDES_ERRNO)
669 if test $PROVIDES_ERRNO = yes; then
670         AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
671 fi
672
673 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
674 dnl make S_ISSOCK always return false (nice, eh?)
675 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
676 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
677 AC_MSG_RESULT($HAS_S_IFSOCK)
678 if test $HAS_S_IFSOCK = yes; then
679         AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
680 fi
681
682 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
683 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
684 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
685 AC_MSG_RESULT($HAS_S_ISLNK)
686 if test $HAS_S_ISLNK = yes; then
687         AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
688 fi
689
690 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
691 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
692 AC_MSG_RESULT($HAS_S_ISSOCK)
693 if test $HAS_S_ISSOCK = yes; then
694         AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
695 fi
696
697 AC_MSG_CHECKING(if timezone is defined)
698 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[printf("%ld", timezone)]])],[HAS_TIMEZONE=yes],[HAS_TIMEZONE=no])
699 AC_MSG_RESULT($HAS_TIMEZONE)
700
701 dnl Check for missing typedefs
702 AC_TYPE_MODE_T
703 AC_TYPE_OFF_T
704 AC_TYPE_PID_T
705 AC_TYPE_SIZE_T
706
707 dnl Checks for library functions.
708 AC_FUNC_ALLOCA
709 AC_FUNC_VPRINTF
710 dnl XXX don't want to re-enable code that's been unused for years at this
711 dnl point, but should offer good performance improvements, check after
712 dnl 4.4.2.1...
713 dnl AC_FUNC_MMAP
714
715 AC_CHECK_FUNCS(basename getaddrinfo getcwd getnameinfo getwd inet_aton)
716 AC_CHECK_FUNCS(mtrace putenv realpath setenv)
717 AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
718 AC_CHECK_FUNCS(strdup strndup strerror strtol strtoul strspn strstr)
719
720 AC_CHECK_FUNCS(__secure_getenv)
721
722 AC_CHECK_FUNCS(regcomp)
723
724 AC_CHECK_FUNCS(ftok)
725
726 AC_CHECK_FUNCS(mkstemp)
727
728 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
729 dnl %files gets something like
730 dnl     /usr/*/locale/*/LC_MESSAGES/*.mo
731 dnl (Note: more than one asterisk in glob pattern.)
732 dnl
733 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
734 dnl dangling symlinks are no longer globbed. Always use the internal glob.
735 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
736 AC_LIBOBJ(glob)
737 AC_LIBOBJ(fnmatch)
738
739 dnl check if python is requested
740 AC_ARG_ENABLE(python, [  --enable-python         build rpm python bindings ],
741 [case "$enable_python" in
742 yes|no) ;;
743 *) AC_MSG_ERROR([invalid argument to --enable-python])
744   ;;
745 esac],
746 [enable_python=no])
747
748 AS_IF([test "$enable_python" = yes],[
749 # rpm-python is based on python-2.5, 
750 # with legacy hacks to allow building against python >= 2.3
751   AM_PATH_PYTHON([2.3],[
752     WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
753     WITH_PYTHON_SUBPACKAGE=1
754     save_CPPFLAGS="$CPPFLAGS"
755     CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
756     AC_CHECK_HEADER([Python.h],[],
757       [AC_MSG_ERROR([missing Python.h])
758       ])
759     CPPFLAGS="$save_CPPFLAGS"
760     save_LIBS="$LIBS"
761     AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
762       WITH_PYTHON_LIB="$ac_res"
763     ],[AC_MSG_ERROR([missing python library])
764     ])
765     LIBS="$save_LIBS"
766   ])
767 ],[
768     WITH_PYTHON_INCLUDE=
769     WITH_PYTHON_LIB=
770     WITH_PYTHON_SUBPACKAGE=0
771 ])
772
773 AC_SUBST(WITH_PYTHON_INCLUDE)
774 AC_SUBST(WITH_PYTHON_LIB)
775
776 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
777
778 AC_PATH_PROG(DOXYGEN, doxygen, no)
779 dnl
780 dnl Auto-detect whether doxygen generated API docs should be included.
781 dnl
782 AC_ARG_WITH(apidocs, [  --with-apidocs          build rpm API docs ],,[with_apidocs=auto])
783
784 case "$with_apidocs" in
785 auto)
786   AS_IF([test "$DOXYGEN" = no],[with_apidocs=no],[with_apidocs=yes])
787   ;;
788 yes)
789   AS_IF([test "$DOXYGEN" = no],
790     [AC_MSG_ERROR([rpm API docs needs doxygen in PATH])])
791   ;;
792 esac
793 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
794
795 WITH_SELINUX_LIB=
796 AC_ARG_WITH(selinux, [  --with-selinux          build with selinux support ],
797 [case "$with_selinux" in
798 yes|no) ;;
799 *) AC_MSG_ERROR([invalid argument to --with-selinux])
800   ;;
801 esac],
802 [with_selinux=no])
803
804 AS_IF([test "$with_selinux" = yes],[
805   AC_CHECK_HEADER([selinux/selinux.h],[
806     AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
807       AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
808   ],[
809     AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
810   ])
811 ])
812
813 AS_IF([test "$with_selinux" = yes],[
814   AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
815   WITH_SELINUX_LIB="-lselinux"
816 ])
817 AC_SUBST(WITH_SELINUX_LIB)
818 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
819
820 WITH_LUA_LIB=
821 WITH_LUA_INCLUDE=
822 AC_ARG_WITH(lua, [  --with-lua              build with lua support ],,[with_lua=yes])
823 AS_IF([test "$with_lua" = yes],[
824   AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
825   WITH_LUA_INCLUDE="-I\${top_srcdir}/lua/include -I\${top_srcdir}/lua/local"
826   WITH_LUA_LIB="\$(top_builddir)/lua/liblua.la"
827 ])
828 AC_SUBST(WITH_LUA_LIB)
829 AC_SUBST(WITH_LUA_INCLUDE)
830
831 with_dmalloc=no
832 AC_ARG_WITH(dmalloc, [  --with-dmalloc          build with dmalloc debugging support ])
833 if test "$with_dmalloc" = yes ; then
834   AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
835   LIBS="$LIBS -ldmalloc"
836 fi
837
838 AC_CHECK_FUNCS(setlocale)
839
840 AC_CHECK_FUNCS(getpassphrase)
841
842 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
843   AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
844     AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
845       AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
846         AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r"; 
847                                         AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
848                  AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
849                  AC_LIBOBJ(getmntent)])
850       ])
851     ])
852   ])
853 ])
854
855 AC_CHECK_FUNC(lchown,
856    [__CHOWN_RHF="%{__chown} -Rhf"
857     __CHGRP_RHF="%{__chgrp} -Rhf"
858     AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
859    [__CHOWN_RHF="%{__chown} -Rf"
860     __CHGRP_RHF="%{__chgrp} -Rf"
861     dnl Does chown() follow symlinks? This should be a good enough test.
862     AC_MSG_CHECKING(whether chown() follows symlinks)
863     AC_ARG_ENABLE([broken-chown],
864     [  --enable-broken-chown   this system's chown follows symbolic links], 
865             result=$enableval, result=unknown)
866     if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
867         result=yes
868     elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
869         result=no
870     fi
871     if test $result = unknown; then
872         if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
873             rm -f foo bar
874             touch foo
875             ln -s foo bar
876             ${__CHOWN} 10 bar
877             if test `ls -l foo | awk '{print $3}'` != "root"; then
878                 result=yes
879             else
880                 result=no
881             fi
882             ${__RM} -f foo bar
883         else
884             AC_MSG_CHECKING((cannot check by non-root user))
885             result=no
886         fi
887     fi
888
889     AC_MSG_RESULT($result)
890     if test $result = yes; then
891             AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
892     fi])
893 AC_SUBST(__CHOWN_RHF)
894 AC_SUBST(__CHGRP_RHF)
895
896 dnl
897 dnl figure out what root's primary group is
898 dnl
899 AC_MSG_CHECKING(root's primary group)
900 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
901 #include <sys/types.h>
902 #include <pwd.h>
903 #include <grp.h>
904
905 int main()
906 {
907         struct passwd *root = NULL;
908         struct group *roots_group = NULL;
909         FILE * tempfile = NULL;
910
911         root = getpwuid( (uid_t) 0 );
912         if (root != NULL) {
913                 roots_group = getgrgid(root->pw_gid);
914                 if (roots_group != NULL) {
915                         tempfile = fopen("conftest_rootg", "w");
916                         if (tempfile != NULL) {
917                                 fprintf(tempfile, "%s\n", roots_group->gr_name);
918                                 fclose(tempfile);
919                                 exit(0);
920                         }
921                 }
922         }
923
924         exit(1);
925 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
926 ])
927 AC_MSG_RESULT($ROOT_GROUP)
928 AC_SUBST(ROOT_GROUP)
929
930 if echo "$build_os" | grep sco > /dev/null; then
931         echo "hacking things up for sco"
932         AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
933         AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
934         [Define as 1 if you have "struct mnttab" (only sco?)])
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, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
939         AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
940         AC_LIBOBJ(myrealloc)
941 fi
942
943 #
944 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
945 #
946 build_os_gnu=-gnu
947 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
948         build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
949 fi
950 if echo "$build_os" | grep '.*-gnueabi' > /dev/null ; then
951         build_os=`echo "${build_os}" | sed 's/-gnueabi$//'`
952         build_os_gnu=-gnueabi
953 fi
954 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
955         build_os=`echo "${build_os}" | sed 's/-gnu$//'`
956 fi
957
958 changequote(<, >)
959 build_os_exact="${build_os}"
960 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
961 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
962 changequote([, ])
963
964 rm -f ./find-provides
965 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
966         echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
967     ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
968 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
969         echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
970     ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
971 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
972         echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
973     ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
974 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
975         echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
976     ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
977 else
978     echo "*** no default provides information is available for ${build_os_noversion}"
979     ln -s ${srcdir}/autodeps/none ./find-provides
980 fi
981
982 rm -f ./find-requires
983 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
984         echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
985     ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
986 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
987         echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
988     ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
989 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
990         echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
991     ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
992 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
993         echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
994     ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
995 else
996     echo "*** no default requires information is available for ${build_os_noversion}"
997     ln -s ${srcdir}/autodeps/none ./find-requires
998 fi
999
1000 dnl Determine the canonical arch-vendor-os for the build machine
1001 autorelocate_path='%{nil}'
1002 autorelocate_dcolor='0'
1003 case "${build_cpu}" in
1004 *86)            RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
1005 ia32e*)         RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
1006 amd64*)         RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
1007 x86_64*)        RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
1008 alpha*)         RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
1009 sparc64*)       RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
1010 sparc*)         RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
1011 ia64*)          RPMCANONCOLOR=2; RPMCANONARCH=ia64;
1012                 autorelocate_path='/emul/%%{ARCH}-%%{OS}'
1013                 autorelocate_dcolor='1' ;;
1014 s390x*)         RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
1015 s390*)          RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
1016 powerpc64*|ppc64*)      RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
1017 powerpc*|ppc*)  RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
1018 arm*)           RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
1019 mipsel*)        RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
1020 mips*)          RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
1021 m68k*)          RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
1022 *)              RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1023 esac
1024 case "${build_os_noversion}" in
1025 mint)           RPMCANONARCH=m68kmint ;;
1026 esac
1027 RPMCANONVENDOR="$build_vendor"
1028 case "${build_vendor}" in
1029 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos)
1030         test -f /etc/redhat-release &&          RPMCANONVENDOR=redhat
1031         test -f /etc/pld-release &&             RPMCANONVENDOR=pld
1032         test -f /etc/mandrake-release &&        RPMCANONVENDOR=mandrake
1033         test -f /etc/conectiva-release &&       RPMCANONVENDOR=conectiva
1034         test -f /etc/lvr-release &&             RPMCANONVENDOR=lvr
1035         test -f /etc/yellowdog-release &&       RPMCANONVENDOR=yellowdog
1036         test -f /etc/caos-release &&            RPMCANONVENDOR=caos
1037         ;;
1038 esac
1039 RPMCANONOS="$build_os_noversion"
1040 RPMCANONGNU="$build_os_gnu"
1041 AC_SUBST(RPMCANONCOLOR)
1042 AC_SUBST(autorelocate_path)
1043 AC_SUBST(autorelocate_dcolor)
1044 AC_SUBST(RPMCANONARCH)
1045 AC_SUBST(RPMCANONVENDOR)
1046 AC_SUBST(RPMCANONOS)
1047 AC_SUBST(RPMCANONGNU)
1048 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
1049
1050 if test X"$prefix" = XNONE ; then
1051     usrprefix="$ac_default_prefix"
1052 else
1053     usrprefix=$prefix
1054 fi
1055
1056 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1057 AC_SUBST(RPMCONFIGDIR)
1058
1059 AC_SUBST(OBJDUMP)
1060
1061 AC_CONFIG_SUBDIRS(db3)
1062
1063 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
1064 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
1065 AM_CONDITIONAL([APIDOCS],[test "$with_apidocs" == yes])
1066
1067 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1068
1069 AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
1070 AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
1071 ])
1072
1073 AC_CONFIG_HEADERS([rpmdb/rpmints.h])
1074
1075 AC_CONFIG_FILES([Makefile
1076         rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1077         po/Makefile.in scripts/Makefile 
1078         misc/Makefile 
1079         doc/Makefile
1080         python/Makefile
1081         lua/Makefile
1082         tests/Makefile
1083   ])
1084 AC_OUTPUT