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