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