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