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