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