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