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