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