Check for lzma library in configure.ac and reference it in Makefile.am
[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 -fstack-protector"
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 dnl
65 dnl This now uses libtool. Put
66 dnl     LDFLAGS_STATIC="-all"
67 dnl to attempt static executables using libtool. Otherwise
68 dnl     LDFLAGS_STATIC=""
69 dnl
70 AC_MSG_CHECKING(flag used by libtool to link rpm)
71 if test X"$GCC" = Xyes ; then
72         case "$host" in
73                 *-*-linux*)     LDFLAGS_STATIC="-all-static" ;;
74                 *-*-solaris*)   LDFLAGS_STATIC="-static";;
75                 *-*-hpux*)      LDFLAGS_STATIC="-static";;
76                 *-*-darwin*)    LDFLAGS_STATIC="";; # Mac OS X does not do static binaries.
77                 *-*-sysv5uw*)   LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
78                 *-*-*)          LDFLAGS_STATIC="";;
79         esac
80 elif test X"$CC" = Xcc ; then
81         case "$host" in
82                 *-*-linux*)     LDFLAGS_STATIC="-all-static";;
83                 *-*-freebsd*)   LDFLAGS_STATIC="-all-static";;
84                 *-*-osf*)       LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
85                 *-*-aix*)       LDFLAGS_STATIC="-static";;  # -Wl,-bnso doesn't seem to work...
86                 *-*-hpux*)      LDFLAGS_STATIC="-static";;
87                 *-*-solaris*)   LDFLAGS_STATIC="-static";;
88                 *-*-irix*)      LDFLAGS_STATIC="-static";;  #should be -non_shared, but can't
89                                                                                         # link because of crt1.o then.
90                 *-*-ultrix*)    LDFLAGS_STATIC="-all-static";;  #ultrix doesn't have shared libs.
91                 *-*-*)          LDFLAGS_STATIC=""
92 AC_MSG_WARN([
93
94 Unable to guess what option to pass to $CC to generate a static
95 executable.  You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
96 the appropriate argument(s) if you want to build a static rpm executable.
97
98 ])
99                 ;;
100         esac
101 else
102         # just link it dynamically
103         LDFLAGS_STATIC=""
104 fi
105 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}"   # libtool format
106 AC_MSG_RESULT($LDFLAGS_STATIC)
107 AC_SUBST(LDFLAGS_STATIC)
108
109 dnl
110 dnl look for POSIX chmod attributes
111 dnl
112 AC_MSG_CHECKING(POSIX chmod)
113 touch foo.chmodtest
114 chmod 744 foo.chmodtest
115 chmod +X foo.chmodtest 2>/dev/null
116 a=`ls -l foo.chmodtest | awk '{print $1}'`
117 rm -f foo.chmodtest
118 if test "$a" = "-rwxr-xr-x"; then
119     AC_MSG_RESULT(yes)
120     FIXPERMS=a+rX,u+w,g-w,o-w 
121 else
122     AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
123     FIXPERMS=a+r,u+w,g-w,o-w 
124 fi
125 AC_SUBST(FIXPERMS)
126
127 dnl
128 dnl see if we have a mkdir that supports `-p'.
129 dnl
130 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
131 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
132 rm -rf conftest
133 $RPM_MKDIR -p conftest/a 2>/dev/null
134 if test $? = 0 ; then
135         rmdir conftest/a 2>/dev/null
136         if test $? = 0  ; then
137                 :
138         else
139                 RPM_MKDIR_P=0
140         fi
141
142         rmdir conftest 2>/dev/null
143         if test $? = 0 ; then
144                 RPM_MKDIR_P="$RPM_MKDIR -p"
145         else
146                 RPM_MKDIR_P=0
147         fi
148 else
149         RPM_MKDIR_P=0
150 fi
151
152 if test X"$RPM_MKDIR_P" = X0 ; then
153         AC_MSG_RESULT(no)
154         RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
155 else
156         AC_MSG_RESULT(yes)
157 fi
158 dnl
159 dnl substitute this into config.h, so the C source picks it up.
160 dnl
161 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
162 [A full path to a program, possibly with arguments, that will create a
163    directory and all necessary parent directories, ala 'mkdir -p'])
164 AC_SUBST(RPM_MKDIR_P)
165
166 dnl AM_DISABLE_SHARED
167 AM_PROG_LIBTOOL
168
169 AC_CHECK_TOOL(AR, ar, :)
170
171 dnl
172 dnl use defaults if cross-compiling, otherwise use the default path.
173 dnl
174 if test "$cross_compiling" = "yes"; then
175     MYPATH=":"
176 else
177     MYPATH=$PATH
178 fi
179
180 dnl
181 dnl Find some common programs
182 dnl
183 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
184 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
185 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
186 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
187 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
188 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
189 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
190 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
191 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
192 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
193 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
194 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
195 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
196
197 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
198 AC_MSG_CHECKING(checking whether id supports -u)
199     if ${__ID} -u 2>&1 > /dev/null ; then
200         __ID_U="%{__id} -u"
201         AC_MSG_RESULT(yes)
202     else
203         __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
204         AC_MSG_RESULT(no)
205     fi
206 AC_SUBST(__ID_U)
207
208 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
209 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
210 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
211 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
212 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
213 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
214 AC_MSG_CHECKING(old version of patch)
215     PATCHVERSION=`patch --version 2>&1`
216
217     if test "$PATCHVERSION" = "Patch version 2.1"; then
218         AC_DEFINE(HAVE_OLDPATCH_21, 1,
219                 [Define if the patch call you'll be using is 2.1 or older])
220         AC_MSG_RESULT(patch older then 2.2 found)
221     else
222         AC_MSG_RESULT(patch later then 2.2 found)
223     fi
224
225 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
226 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
227 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH) 
228 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
229 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
230 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
231 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
232 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
233
234 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
235 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
236 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
237 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
238 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
239
240 #=================
241 # Check for zlib library. 
242
243 WITH_ZLIB_INCLUDE=
244 WITH_ZLIB_LIB=
245
246 AC_CHECK_HEADERS([zlib.h],[
247   AS_IF([test -z "${WITH_ZLIB_LIB}"],[
248     for zlib in z gz ; do
249       AC_CHECK_LIB(${zlib}, gzread, 
250         [WITH_ZLIB_LIB="-l${zlib}"; break])
251     done
252
253 dnl zlib-1.0.4 has not gzseek
254     AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
255   ])
256 ])
257
258 AC_SUBST(WITH_ZLIB_INCLUDE)
259 AC_SUBST(WITH_ZLIB_LIB)
260
261 #=================
262 # Check for bzip2 library.
263
264 AC_CHECK_HEADERS([bzlib.h],[
265   AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
266   [
267     AC_CHECK_LIB(bz2, BZ2_bzread,[ 
268       WITH_BZ2_LIB="-lbz2"
269       AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
270     ]) 
271   ])
272 ])
273 AC_SUBST(WITH_BZ2_LIB)
274
275 #=================
276 # Check for lzma library.
277
278 AC_CHECK_HEADERS([lzma.h],[
279   AC_CHECK_LIB(lzma, lzma_auto_decoder, [WITH_LZMA_LIB=-llzma])
280 ])
281 AC_SUBST(WITH_LZMA_LIB)
282
283 #=================
284
285 dnl
286 dnl Check for features
287 dnl
288
289 dnl Checks for libraries.
290
291 AC_CHECK_FUNC(setreuid, [], [
292     AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
293 ])
294
295 AC_CHECK_FUNC(rand, [], [
296     AC_CHECK_LIB(rand, rand, [])
297 ])
298
299 AC_CHECK_FUNC(getdomainname, [], [
300     AC_CHECK_LIB(nsl, getdomainname)
301 ])
302 AC_CHECK_FUNC(socket, [], [
303     AC_CHECK_LIB(socket, socket)
304 ])
305
306 AC_CHECK_HEADERS(error.h)
307 AC_CHECK_FUNCS(error)
308
309 AC_CHECK_HEADERS(poll.h)
310
311 AC_CHECK_HEADERS(pthread.h)
312
313 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
314   dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
315   AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
316     AC_CHECK_LIB(thread, mutex_lock)
317   ])
318 ])
319
320 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
321
322 AC_CHECK_FUNCS(vsnprintf snprintf)
323
324 dnl Temporary hack for MiNT.  Some functions (writev, snprintf) are
325 dnl not in the libc but in libport (for political reasons).  This check
326 dnl can hopefully be removed soon.  Please use the default action
327 dnl for this macro (not LIBS=...), otherwise the check for dbopen
328 dnl will fail.
329 AC_CHECK_LIB(port, writev)
330
331 #=================
332 # Check for libelf library. Prefer external, otherwise none.
333 WITH_LIBELF_INCLUDE=
334 WITH_LIBELF_LIB=
335 AC_CHECK_HEADER([libelf.h])
336 AC_CHECK_HEADERS([gelf.h], [
337         AC_CHECK_LIB(elf, gelf_getvernaux, [
338             AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
339             WITH_LIBELF_LIB="-lelf"
340             WITH_LIBELF=yes
341         ])
342 ])
343 AC_SUBST(WITH_LIBELF_INCLUDE)
344 AC_SUBST(WITH_LIBELF_LIB)
345 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
346
347 AC_CHECK_HEADERS([dwarf.h], [
348   WITH_LIBDWARF=yes
349 ])
350 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
351
352 #=================
353 # Check for NSS library.
354 WITH_NSS_INCLUDE=
355 WITH_NSS_LIB=
356 check=`pkg-config --version 2>/dev/null`
357 if test -n "$check"; then
358   addlib=$(pkg-config --libs nss | sed 's/-lsmime3//;s/-lssl3//')
359   addcppflags=$(pkg-config --cflags nss)
360 else
361 # Without pkg-config, we'll kludge in some defaults
362   addlib="-lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
363   addcppflags="-I/usr/include/nss3 -I/usr/include/nspr4"
364 fi
365 save_CPPFLAGS="$CPPFLAGS"
366 CPPFLAGS="$save_CPPFLAGS $addcppflags"
367 AC_CHECK_HEADER([nss3/nss.h], [
368   AC_CHECK_LIB(nss3, NSS_NoDB_Init, [
369     AC_DEFINE(HAVE_LIBNSS, 1, [Define to 1 if you have the 'NSS' library (-lnss3).])
370     WITH_NSS_INCLUDE="$addcppflags"
371     WITH_NSS_LIB="$addlib"
372   ])
373 ],[
374   AC_MSG_ERROR([missing required header nss3/nss.h])
375 ])
376 CPPFLAGS="$save_CPPFLAGS"
377 AC_SUBST(WITH_NSS_INCLUDE)
378 AC_SUBST(WITH_NSS_LIB)
379
380 #=================
381 # Check for magic library.
382 WITH_MAGIC_INCLUDE=
383 WITH_MAGIC_LIB=
384
385 AC_CHECK_HEADER([magic.h], [
386     AC_CHECK_LIB(magic, magic_open, [
387       WITH_MAGIC_INCLUDE=
388       WITH_MAGIC_LIB="-lmagic"
389     ],[
390       AC_MSG_ERROR([missing required library 'libmagic']) 
391     ])
392 ],[
393       AC_MSG_ERROR([missing required header magic.h]) 
394 ])
395
396 AC_SUBST(WITH_MAGIC_INCLUDE)
397 AC_SUBST(WITH_MAGIC_LIB)
398
399 #=================
400 # Check for popt library.
401 WITH_POPT_INCLUDE=
402 WITH_POPT_LIB=
403
404 AC_CHECK_HEADER([popt.h], [
405   AC_CHECK_LIB(popt, poptGetContext, [
406       WITH_POPT_INCLUDE=
407       WITH_POPT_LIB="-lpopt"
408   ],[
409     AC_MSG_ERROR([missing required library popt])
410   ])
411 ],[
412   AC_MSG_ERROR([missing required header popt.h])
413 ])
414
415 AC_SUBST(WITH_POPT_INCLUDE)
416 AC_SUBST(WITH_POPT_LIB)
417
418 #=================
419 # Process --with/without-external-db
420 AC_ARG_WITH(external_db, [  --with-external-db      build against an external Berkeley db],
421 [case "$with_external_db" in
422 yes|no) ;;
423 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
424 esac],
425 [with_external_db=no])
426
427 case "$with_external_db" in
428 yes )
429   AC_CHECK_HEADERS([db.h],[
430     AC_CHECK_TYPE([db_threadid_t],[],
431       [AC_MSG_WARN([missing type db_threadid_t])],
432       [#include <db.h>])
433     save_LIBS="$LIBS"
434     AC_CHECK_LIB([db],[db_create],[],[
435       AC_MSG_ERROR([missing db_create in libdb])
436       ])
437     AC_CHECK_LIB([db],[db_env_create],[],[
438       AC_MSG_ERROR([missing db_env_create in libdb])
439       ])
440     AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
441       AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
442       ])
443     AC_CHECK_LIB([db],[db_strerror],[],[
444       AC_MSG_ERROR([missing db_strerror in libdb])
445       ])
446     WITH_DB_LIB=-ldb
447     LIBS="$save_LIBS"
448   ],[
449     AC_MSG_ERROR([missing required header db.h])
450   ])
451   ;;
452 * ) # Fall back to internal db if available
453   if [ test -x db/dist/configure ]; then
454     AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
455   else
456     AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL])
457   fi
458   ;;
459 esac
460
461 AC_SUBST([WITH_DB_LIB])
462
463 #=================
464 # Check for sqlite3 library.
465 AC_ARG_ENABLE(sqlite3, [  --enable-sqlite3        enable sqlite3 support],
466 [case "$enable_sqlite3" in
467 yes|no) ;;
468 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
469   ;;
470 esac],
471 [enable_sqlite3=no])
472
473 WITH_SQLITE3_INCLUDE=
474 WITH_SQLITE3_LIB=
475 WITH_SQLITE3=no
476 AS_IF([test "$enable_sqlite3" = yes],[
477   AC_CHECK_HEADERS([sqlite3.h],
478   [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
479       WITH_SQLITE3_INCLUDE=
480       WITH_SQLITE3_LIB="-lsqlite3"
481       WITH_SQLITE3=yes
482     ],[
483       AC_MSG_ERROR([missing libsqlite3])
484     ])
485   ],[
486     AC_MSG_ERROR([missing sqlite3.h])
487   ])
488 ])
489
490 AC_SUBST(WITH_SQLITE3_INCLUDE)
491 AC_SUBST(WITH_SQLITE3_LIB)
492 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
493
494 #=================
495
496 dnl AmigaOS and IXEmul have a fork() dummy
497   case "$host" in
498     m68k-*-amigaos ) 
499         echo "Building for AmigaOS: using vfork() instead of fork()"; 
500         CFLAGS="$CFLAGS -Dfork=vfork" 
501         ;;
502   esac
503
504 AM_GNU_GETTEXT_VERSION([0.16.1])
505 AM_GNU_GETTEXT([external])
506
507 dnl Checks for header files we can live without.
508 AC_HEADER_STDC
509 AC_HEADER_MAJOR
510 AC_HEADER_DIRENT
511 AC_HEADER_TIME
512
513 AC_CHECK_HEADERS(locale.h)
514
515 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
516
517 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
518 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
519 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
520
521 AC_CHECK_HEADERS(netinet/in_systm.h)
522 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
523 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
524 AC_CHECK_HEADERS(libio.h)
525 AC_CHECK_HEADERS(err.h mcheck.h)
526
527 AC_CHECK_HEADERS(glob.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], [], [AC_MSG_ERROR([mkstemp() is required by rpm])])
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_CHECK_HEADER([lua.h],[
815     AC_CHECK_LIB(lua,[luaL_openlibs],[with_lua=yes],[
816       AC_MSG_ERROR([--with-lua given, but liblua not found])
817     ], 
818     [-lm])
819   ],[
820       AC_MSG_ERROR([--with-lua given, but lua.h not found])
821   ])
822 ])
823
824 AS_IF([test "$with_lua" = yes],[
825   AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
826   WITH_LUA_INCLUDE="-I\${top_srcdir}/luaext"
827   WITH_LUA_LIB="-llua -lm \$(top_builddir)/luaext/libluaext.la"
828 ])
829 AC_SUBST(WITH_LUA_LIB)
830 AC_SUBST(WITH_LUA_INCLUDE)
831 AM_CONDITIONAL(WITH_LUAEXT,[test "$with_lua" = yes])
832
833 with_dmalloc=no
834 AC_ARG_WITH(dmalloc, [  --with-dmalloc          build with dmalloc debugging support ])
835 if test "$with_dmalloc" = yes ; then
836   AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
837   LIBS="$LIBS -ldmalloc"
838 fi
839
840 AC_CHECK_FUNCS(setlocale)
841
842 AC_CHECK_FUNCS(getpassphrase)
843
844 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
845   AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
846     AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
847       AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
848         AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r"; 
849                                         AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
850                  AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
851                  AC_LIBOBJ(getmntent)])
852       ])
853     ])
854   ])
855 ])
856
857 AC_CHECK_FUNC(lchown,
858    [__CHOWN_RHF="%{__chown} -Rhf"
859     __CHGRP_RHF="%{__chgrp} -Rhf"
860     AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
861    [__CHOWN_RHF="%{__chown} -Rf"
862     __CHGRP_RHF="%{__chgrp} -Rf"
863     dnl Does chown() follow symlinks? This should be a good enough test.
864     AC_MSG_CHECKING(whether chown() follows symlinks)
865     AC_ARG_ENABLE([broken-chown],
866     [  --enable-broken-chown   this system's chown follows symbolic links], 
867             result=$enableval, result=unknown)
868     if echo "$build" | ${EGREP} "(aix)|(hpux)|(linux)" > /dev/null ; then
869         result=yes
870     elif echo "$build" | ${EGREP} "(nextstep)" > /dev/null ; then
871         result=no
872     fi
873     if test $result = unknown; then
874         if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
875             rm -f foo bar
876             touch foo
877             ln -s foo bar
878             ${__CHOWN} 10 bar
879             if test `ls -l foo | awk '{print $3}'` != "root"; then
880                 result=yes
881             else
882                 result=no
883             fi
884             ${__RM} -f foo bar
885         else
886             AC_MSG_CHECKING((cannot check by non-root user))
887             result=no
888         fi
889     fi
890
891     AC_MSG_RESULT($result)
892     if test $result = yes; then
893             AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
894     fi])
895 AC_SUBST(__CHOWN_RHF)
896 AC_SUBST(__CHGRP_RHF)
897
898 dnl
899 dnl figure out what root's primary group is
900 dnl
901 AC_MSG_CHECKING(root's primary group)
902 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
903 #include <sys/types.h>
904 #include <pwd.h>
905 #include <grp.h>
906
907 int main()
908 {
909         struct passwd *root = NULL;
910         struct group *roots_group = NULL;
911         FILE * tempfile = NULL;
912
913         root = getpwuid( (uid_t) 0 );
914         if (root != NULL) {
915                 roots_group = getgrgid(root->pw_gid);
916                 if (roots_group != NULL) {
917                         tempfile = fopen("conftest_rootg", "w");
918                         if (tempfile != NULL) {
919                                 fprintf(tempfile, "%s\n", roots_group->gr_name);
920                                 fclose(tempfile);
921                                 exit(0);
922                         }
923                 }
924         }
925
926         exit(1);
927 }]])],[ROOT_GROUP=`cat conftest_rootg`],[ROOT_GROUP="root"],[ROOT_GROUP="root"
928 ])
929 AC_MSG_RESULT($ROOT_GROUP)
930 AC_SUBST(ROOT_GROUP)
931
932 if echo "$host_os" | grep sco > /dev/null; then
933         echo "hacking things up for sco"
934         AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
935         AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
936         [Define as 1 if you have "struct mnttab" (only sco?)])
937 elif echo "$host_os" | grep sunos > /dev/null; then
938         echo "hacking things up for sunos"
939         CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
940         AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
941         AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
942         AC_LIBOBJ(myrealloc)
943 fi
944
945 #
946 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
947 #
948 host_os_gnu=-gnu
949 if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
950         host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
951 fi
952 if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
953         host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
954         host_os_gnu=-gnueabi
955 fi
956 if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
957         host_os=`echo "${host_os}" | sed 's/-gnu$//'`
958 fi
959
960 changequote(<, >)
961 host_os_exact="${host_os}"
962 host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
963 host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
964 changequote([, ])
965
966 rm -f ./find-provides
967 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ; then
968         echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov for automatic provides generation"
969     ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ./find-provides
970 elif test -f ${srcdir}/autodeps/${host_os_exact}.prov ; then
971         echo "using ${srcdir}/autodeps/${host_os_exact}.prov for automatic provides generation"
972     ln -s ${srcdir}/autodeps/${host_os_exact}.prov ./find-provides
973 elif test -f ${srcdir}/autodeps/${host_os_major}.prov ; then
974         echo "using ${srcdir}/autodeps/${host_os_major}.prov for automatic provides generation"
975     ln -s ${srcdir}/autodeps/${host_os_major}.prov ./find-provides
976 elif test -f ${srcdir}/autodeps/${host_os_noversion}.prov ; then
977         echo "using ${srcdir}/autodeps/${host_os_noversion}.prov for automatic provides generation"
978     ln -s ${srcdir}/autodeps/${host_os_noversion}.prov ./find-provides
979 else
980     echo "*** no default provides information is available for ${host_os_noversion}"
981     ln -s ${srcdir}/autodeps/none ./find-provides
982 fi
983
984 rm -f ./find-requires
985 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ; then
986         echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req for automatic requires generation"
987     ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ./find-requires
988 elif test -f ${srcdir}/autodeps/${host_os_exact}.req ; then
989         echo "using ${srcdir}/autodeps/${host_os_exact}.req for automatic requires generation"
990     ln -s ${srcdir}/autodeps/${host_os_exact}.req ./find-requires
991 elif test -f ${srcdir}/autodeps/${host_os_major}.req ; then
992         echo "using ${srcdir}/autodeps/${host_os_major}.req for automatic requires generation"
993     ln -s ${srcdir}/autodeps/${host_os_major}.req ./find-requires
994 elif test -f ${srcdir}/autodeps/${host_os_noversion}.req ; then
995         echo "using ${srcdir}/autodeps/${host_os_noversion}.req for automatic requires generation"
996     ln -s ${srcdir}/autodeps/${host_os_noversion}.req ./find-requires
997 else
998     echo "*** no default requires information is available for ${host_os_noversion}"
999     ln -s ${srcdir}/autodeps/none ./find-requires
1000 fi
1001
1002 dnl Determine the canonical arch-vendor-os for the host machine
1003 case "${host_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 s390x*)         RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
1013 s390*)          RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
1014 powerpc64*|ppc64*)      RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
1015 powerpc*|ppc*)  RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
1016 arm*)           RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
1017 mipsel*)        RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
1018 mips*)          RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
1019 m68k*)          RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
1020 sh3*)           RPMCANONCOLOR=0; RPMCANONARCH=sh3 ;;
1021 sh4*)           RPMCANONCOLOR=0; RPMCANONARCH=sh4 ;;
1022 *)              RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
1023 esac
1024 case "${host_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="$host_os_noversion"
1040 RPMCANONGNU="$host_os_gnu"
1041 AC_SUBST(RPMCANONCOLOR)
1042 AC_SUBST(RPMCANONARCH)
1043 AC_SUBST(RPMCANONVENDOR)
1044 AC_SUBST(RPMCANONOS)
1045 AC_SUBST(RPMCANONGNU)
1046 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
1047
1048 if test X"$prefix" = XNONE ; then
1049     usrprefix="$ac_default_prefix"
1050 else
1051     usrprefix=$prefix
1052 fi
1053
1054 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1055 AC_SUBST(RPMCONFIGDIR)
1056
1057 AC_SUBST(OBJDUMP)
1058
1059 if test "$with_external_db" = no; then
1060     AC_CONFIG_SUBDIRS(db3)
1061 fi
1062
1063 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
1064 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
1065 AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = 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_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
1074
1075 AC_CONFIG_HEADERS([rpmdb/rpmints.h])
1076
1077 AC_CONFIG_FILES([Makefile
1078         rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1079         po/Makefile.in scripts/Makefile 
1080         misc/Makefile 
1081         doc/Makefile
1082         python/Makefile
1083         luaext/Makefile
1084         tests/Makefile
1085   ])
1086 AC_OUTPUT