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