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