configure.ac 31.6 KB
Newer Older
1
AC_PREREQ(2.61)
2
AC_INIT(rpm, 4.14.2.1, rpm-maint@lists.rpm.org)
3

4
AC_CONFIG_SRCDIR([rpmqv.c])
5 6 7
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

8
AM_INIT_AUTOMAKE([1.10 foreign tar-pax dist-bzip2 subdir-objects nostdinc])
9 10
dnl Allow silent build on automake versions that support it
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
11

12
AC_CONFIG_TESTDIR(tests)
13

14
AC_USE_SYSTEM_EXTENSIONS
15

16
AC_DISABLE_STATIC
17

18 19
PKG_PROG_PKG_CONFIG

20 21 22 23 24 25 26 27
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
28
AC_PROG_LIBTOOL
29 30
AC_PROG_YACC

31 32 33 34 35 36
AC_SUBST(__CC, $CC)
AC_PROG_CC_C99
if test "$ac_cv_prog_cc_c99" = no; then
    AC_MSG_ERROR([ISO C99 capable compiler required])
fi

37 38
AS=${AS-as}
AC_SUBST(AS)
39
if test "$GCC" = yes; then
40
    cflags_to_try="-fno-strict-aliasing -fstack-protector -Wempty-body"
41 42 43 44
    AC_MSG_CHECKING([supported compiler flags])
    old_cflags=$CFLAGS
    echo
    for flag in $cflags_to_try; do
45
        CFLAGS="$CFLAGS $flag -Werror"
46 47
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[#include <alloca.h>
						alloca(100);]])],[
48 49
                echo "   $flag"
                RPMCFLAGS="$RPMCFLAGS $flag"
50
        ],[])
51 52
        CFLAGS=$old_cflags
    done
53
    RPMCFLAGS="-fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes $RPMCFLAGS"
54
fi
55
AC_SUBST(RPMCFLAGS)
56 57 58 59 60 61 62 63 64 65

AC_SYS_LARGEFILE

dnl
dnl look for POSIX chmod attributes
dnl
AC_MSG_CHECKING(POSIX chmod)
touch foo.chmodtest
chmod 744 foo.chmodtest
chmod +X foo.chmodtest 2>/dev/null
66
a=`ls -l foo.chmodtest | awk '{print substr($1,1,10)}'`
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
rm -f foo.chmodtest
if test "$a" = "-rwxr-xr-x"; then
    AC_MSG_RESULT(yes)
    FIXPERMS=a+rX,u+w,g-w,o-w 
else
    AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
    FIXPERMS=a+r,u+w,g-w,o-w 
fi
AC_SUBST(FIXPERMS)

dnl AM_DISABLE_SHARED
AM_PROG_LIBTOOL

AC_CHECK_TOOL(AR, ar, :)

dnl
dnl use defaults if cross-compiling, otherwise use the default path.
dnl
if test "$cross_compiling" = "yes"; then
    MYPATH=":"
else
    MYPATH=$PATH
fi

dnl
dnl Find some common programs
dnl
94
AC_PATH_PROGS(__7ZIP, [7zip 7za 7z], /usr/bin/7za, $MYPATH)
95
AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
96 97 98 99 100 101
AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
102
AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
103
AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
104
AC_PATH_PROGS(__GPG, gpg2 gpg, /usr/bin/gpg2, $MYPATH)
105
AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
106 107
AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
108 109
AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
110 111
AC_PATH_PROG(__LRZIP, lrzip, /usr/bin/lrzip, $MYPATH)
AC_PATH_PROG(__LZIP, lzip, /usr/bin/lzip, $MYPATH)
112
AC_PATH_PROG(__XZ, xz, /usr/bin/xz, $MYPATH)
113
AC_PATH_PROG(__GEM, gem, /usr/bin/gem, $MYPATH)
114 115 116 117
AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
118
AC_PATH_PROG(__RESTORECON, restorecon, /sbin/restorecon, $MYPATH)
119 120 121 122 123 124 125 126 127 128 129 130
AC_MSG_CHECKING(old version of patch)
    PATCHVERSION=`patch --version 2>&1`

    if test "$PATCHVERSION" = "Patch version 2.1"; then
	AC_DEFINE(HAVE_OLDPATCH_21, 1,
		[Define if the patch call you'll be using is 2.1 or older])
	AC_MSG_RESULT(patch older then 2.2 found)
    else
	AC_MSG_RESULT(patch later then 2.2 found)
    fi

AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
131 132
AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH) 
133 134 135
AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
136
AC_PATH_PROG(__SEMODULE, semodule, /usr/bin/semodule, $MYPATH)
137 138
AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
139
AC_PATH_PROG(__ZSTD, zstd, /usr/bin/zstd, $MYPATH)
140 141 142 143 144 145

AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
146

147 148 149 150 151
AC_PATH_PROG(__GIT, git, /usr/bin/git, $MYPATH)
AC_PATH_PROG(__HG, hg, /usr/bin/hg, $MYPATH)
AC_PATH_PROG(__BZR, bzr, /usr/bin/bzr, $MYPATH)
AC_PATH_PROG(__QUILT, quilt, /usr/bin/quilt, $MYPATH)

152 153
AC_PATH_PROG(__FAKECHROOT, fakechroot, no, $MYPATH)
AM_CONDITIONAL(HAVE_FAKECHROOT, [test "$__FAKECHROOT" != "no"])
154

155 156 157 158 159 160 161 162 163 164 165 166
dnl see if we have a mkdir that supports `-p' for rpmbuild's purposes
AC_PROG_MKDIR_P
if ! echo $MKDIR_P | grep -q mkdir; then 
  __MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
else
  __MKDIR_P=$MKDIR_P
fi
AC_DEFINE_UNQUOTED(__MKDIR_P, "${__MKDIR_P}",
[A full path to a program, possibly with arguments, that will create a
   directory and all necessary parent directories, ala 'mkdir -p'])
AC_SUBST(__MKDIR_P)

167 168 169
#=================
# Check for zlib library. 

170 171
WITH_ZLIB_INCLUDE=
WITH_ZLIB_LIB=
172

173 174 175 176 177 178
AC_CHECK_HEADERS([zlib.h],[
  AS_IF([test -z "${WITH_ZLIB_LIB}"],[
    for zlib in z gz ; do
      AC_CHECK_LIB(${zlib}, gzread, 
	[WITH_ZLIB_LIB="-l${zlib}"; break])
    done
179 180

dnl zlib-1.0.4 has not gzseek
181 182
    AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
  ])
183 184
],[
  AC_MSG_ERROR([missing required header zlib.h])
185
])
186

187 188 189
AC_SUBST(WITH_ZLIB_INCLUDE)
AC_SUBST(WITH_ZLIB_LIB)

190
#=================
191 192 193
# Check for bzip2 library.

AC_CHECK_HEADERS([bzlib.h],[
194
  AC_CHECK_LIB(bz2, BZ2_bzread, [WITH_BZ2_LIB=-lbz2])
195 196
])
AC_SUBST(WITH_BZ2_LIB)
197 198

#=================
199
# Check for lzma library.
200

201 202 203 204
AC_CHECK_HEADERS([lzma.h],[
  AC_CHECK_LIB(lzma, lzma_easy_encoder, [WITH_LZMA_LIB=-llzma])
])
AC_SUBST(WITH_LZMA_LIB)
205

206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
#=================
# Check for zstd.

AC_ARG_ENABLE([zstd],
              [AS_HELP_STRING([--enable-zstd=@<:@yes/no/auto@:>@],
                              [build without zstd support (default=auto)])],
              [enable_zstd="$enableval"],
              [enable_zstd=auto])

AS_IF([test "x$enable_zstd" != "xno"], [
  PKG_CHECK_MODULES([ZSTD], [libzstd], [have_zstd=yes], [have_zstd=no])
  AS_IF([test "$enable_zstd" = "yes"], [
    if test "$have_zstd" = "no"; then
      AC_MSG_ERROR([--enable-zstd specified, but not available])
    fi
  ])
])

if test "x$have_zstd" = "xyes"; then
  AC_DEFINE([HAVE_ZSTD], [1], [Define if libzstd is available])
  ZSTD_REQUIRES=libzstd
  AC_SUBST(ZSTD_REQUIRES)
fi
AM_CONDITIONAL([HAVE_ZSTD], [test "x$have_zstd" = "xyes"])

231
#=================
232 233 234 235 236 237 238

dnl
dnl Check for features
dnl

dnl Checks for libraries.

239 240
AC_CHECK_FUNC(gethostname, [], [
    AC_CHECK_LIB(nsl, gethostname)
241 242
])

243
AC_CHECK_HEADERS(pthread.h)
244 245 246 247 248 249 250 251

AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
  dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
  AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
    AC_CHECK_LIB(thread, mutex_lock)
  ])
])

252
AC_SEARCH_LIBS(dlopen, [dl])
253

254
#=================
255
# Check for libelf library. Prefer external, otherwise none.
256 257
WITH_LIBELF_LIB=
AC_CHECK_HEADER([libelf.h])
258
AC_CHECK_HEADERS([gelf.h], [
259
	AC_CHECK_LIB(elf, gelf_getvernaux, [
260
	    AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
261
	    WITH_LIBELF_LIB="-lelf"
262
	    WITH_LIBELF=yes
263 264 265
	])
])
AC_SUBST(WITH_LIBELF_LIB)
266
AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
267

268 269
AC_CHECK_HEADERS([dwarf.h], [
  WITH_LIBDWARF=yes
270
])
271
AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
272

273
#=================
274 275 276 277 278 279 280 281 282 283 284 285 286
# Select crypto library
AC_ARG_WITH(crypto,
            [AC_HELP_STRING([--with-crypto=CRYPTO_LIB],
                            [The cryptographic library to use (nss|beecrypt|openssl). The default is nss.])
                            ],[],
                            [with_crypto=nss])

# Refuse to proceed if someone specified --with-beecrypt (removed)
AC_ARG_WITH(beecrypt,
    [AC_HELP_STRING([--with-beecrypt (OBSOLETE)], [Obsolete argument. Use --with-crypto=beecrypt])
    ],[AC_MSG_ERROR([--with-beecrypt no longer supported. Use --with-crypto=beecrypt])],
    [])

287 288 289 290
# Check for beecrypt library if requested.
AC_ARG_WITH(internal_beecrypt, [  --with-internal-beecrypt build with internal beecrypt library ],,[with_internal_beecrypt=no])
AM_CONDITIONAL([WITH_INTERNAL_BEECRYPT],[test "$with_internal_beecrypt" = yes])
if test "$with_internal_beecrypt" = yes ; then
291
  with_crypto=beecrypt
292
fi
293
AM_CONDITIONAL([WITH_BEECRYPT],[test "$with_crypto" = beecrypt])
294 295 296

WITH_BEECRYPT_INCLUDE=
WITH_BEECRYPT_LIB=
297
if test "$with_crypto" = beecrypt ; then
298 299 300 301 302 303 304 305
  AC_DEFINE(WITH_BEECRYPT, 1, [Build with beecrypt instead of nss3 support?])
  if test "$with_internal_beecrypt" = yes ; then
    WITH_BEECRYPT_INCLUDE="-I\$(top_srcdir)/beecrypt"
    AC_DEFINE(HAVE_BEECRYPT_API_H, 1, [Define to 1 if you have the <beecrypt/api.h> header file.])
  else
    AC_CHECK_LIB(beecrypt, mpfprintln, [
      WITH_BEECRYPT_LIB="-lbeecrypt"
    ],[
306
      AC_MSG_ERROR([missing required library 'beecrypt'])
307 308 309 310 311 312 313 314
    ])
    AC_CHECK_HEADER([beecrypt/api.h], [AC_DEFINE(HAVE_BEECRYPT_API_H, 1, [Define to 1 if you have the <beecrypt/api.h> header file.])
    ])
  fi
fi
AC_SUBST(WITH_BEECRYPT_LIB)
AC_SUBST(WITH_BEECRYPT_INCLUDE)

315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
#=================
# Check for OpenSSL library.
# We need evp.h from OpenSSL.

WITH_OPENSSL_INCLUDE=
WITH_OPENSSL_LIB=
if test "$with_crypto" = openssl; then
# If we have pkgconfig make sure CPPFLAGS are setup correctly for the OpenSSL
# -I include path.
AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no], [$PATH:/usr/bin:/usr/local/bin])
if test "x$PKGCONFIG" != "xno"; then
  CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags libcrypto)"
  WITH_OPENSSL_LIB=$($PKGCONFIG --libs libcrypto)
else
  WITH_OPENSSL_LIB=-lcrypto
fi

AC_CHECK_HEADERS([openssl/evp.h], [], [
  AC_MSG_ERROR([missing required OpenSSL header])
])
AC_CHECK_HEADERS([openssl/rsa.h], [], [
  AC_MSG_ERROR([missing required OpenSSL header])
])
AC_CHECK_HEADERS([openssl/dsa.h], [], [
  AC_MSG_ERROR([missing required OpenSSL header])
])

AC_CHECK_LIB(crypto, EVP_DigestInit_ex, [], [
  AC_MSG_ERROR([required OpenSSL library 'libcrypto' missing or too old])
])

AC_CHECK_LIB(crypto, EVP_MD_CTX_new, [
    AC_DEFINE(HAVE_EVP_MD_CTX_NEW, 1, [Define to 1 if OpenSSL has EVP_MD_CTX_new])
    AC_SUBST(HAVE_EVP_MD_CTX_NEW, [1])
  ], [
350
  AC_CHECK_LIB(crypto, EVP_MD_CTX_create, [], [
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
      AC_MSG_ERROR([required OpenSSL library 'libcrypto' missing or too old])
  ])
])

AC_CHECK_LIB(crypto, EVP_PKEY_CTX_new, [], [
  AC_MSG_ERROR([required OpenSSL library 'libcrypto' missing or too old])
])

AC_CHECK_LIB(crypto, DSA_set0_key, [
    AC_DEFINE(HAVE_DSA_SET0_KEY, 1, [Define to 1 if OpenSSL has DSA_set0_key])
    AC_SUBST(HAVE_DSA_SET0_KEY, [1])
    ], []
)

AC_CHECK_LIB(crypto, DSA_set0_pqg, [
    AC_DEFINE(HAVE_DSA_SET0_PQG, 1, [Define to 1 if OpenSSL has DSA_set0_pqg])
    AC_SUBST(HAVE_DSA_SET0_PQG, [1])
    ], []
)

AC_CHECK_LIB(crypto, DSA_SIG_set0, [
    AC_DEFINE(HAVE_DSA_SIG_SET0, 1, [Define to 1 if OpenSSL has DSA_SIG_set0])
    AC_SUBST(HAVE_DSA_SIG_SET0, [1])
    ], []
)

AC_CHECK_LIB(crypto, RSA_set0_key, [
    AC_DEFINE(HAVE_RSA_SET0_KEY, 1, [Define to 1 if OpenSSL has RSA_set0_key])
    AC_SUBST(HAVE_RSA_SET0_KEY, [1])
    ], []
)

AC_CHECK_LIB(crypto, BN_bn2binpad, [
    AC_DEFINE(HAVE_BN2BINPAD, 1, [Define to 1 if OpenSSL has BN_bn2binpad])
    AC_SUBST(HAVE_BN2BINPAD, [1])
    ], []
)

fi

AM_CONDITIONAL([WITH_OPENSSL],[test "$with_crypto" = openssl])
AC_SUBST(WITH_OPENSSL_INCLUDE)
AC_SUBST(WITH_OPENSSL_LIB)

395
#=================
396
# Check for NSS library.
397 398
# We need nss.h from NSS which needs nspr.h. Unfortunately both glibc and NSS
# have a header named nss.h... so make extra check for NSS's sechash.h
399 400 401
# which we use too and hopefully is slightly more unique to NSS.
WITH_NSS_INCLUDE=
WITH_NSS_LIB=
402 403 404 405 406 407 408 409
if test "$with_crypto" = nss; then
# If we have pkgconfig make sure CPPFLAGS are setup correctly for the nss
# -I include path. Otherwise the below checks will fail because nspr.h
# cannot be found.
AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no], [$PATH:/usr/bin:/usr/local/bin])
if test "x$PKGCONFIG" != "xno"; then
  CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags nss)"
fi
410 411
AC_CHECK_HEADERS([nspr.h nss.h sechash.h], [], [
  AC_MSG_ERROR([missing required NSPR / NSS header])
412
])
413
AC_CHECK_LIB(nss3, VFY_VerifyDigestDirect, [
414
  WITH_NSS_LIB=-lnss3
415 416 417 418
  AC_CHECK_LIB(nss3, NSS_InitContext, [
    AC_DEFINE(HAVE_NSS_INITCONTEXT, 1, [Define to 1 if NSS has NSS_InitContext])
    AC_SUBST(HAVE_NSS_INITCONTEXT, [1])
  ])
419
], [
420
  AC_MSG_ERROR([required NSS library 'nss3' missing or too old])
421
])
422
fi
423 424
AC_SUBST(WITH_NSS_INCLUDE)
AC_SUBST(WITH_NSS_LIB)
425

426
#=================
427
# Check for magic library.
428 429 430
WITH_MAGIC_INCLUDE=
WITH_MAGIC_LIB=

431
AC_CHECK_HEADER([magic.h], [
432 433 434
    AC_CHECK_LIB(magic, magic_open, [
      WITH_MAGIC_INCLUDE=
      WITH_MAGIC_LIB="-lmagic"
435 436
    ],[
      AC_MSG_ERROR([missing required library 'libmagic']) 
437
    ])
438 439 440
],[
      AC_MSG_ERROR([missing required header magic.h]) 
])
441

442 443
AC_SUBST(WITH_MAGIC_INCLUDE)
AC_SUBST(WITH_MAGIC_LIB)
444

445
#=================
446
# Check for popt library.
447 448 449
WITH_POPT_INCLUDE=
WITH_POPT_LIB=

450 451
AC_CHECK_HEADER([popt.h], [
  AC_CHECK_LIB(popt, poptGetContext, [
452 453
      WITH_POPT_INCLUDE=
      WITH_POPT_LIB="-lpopt"
454 455
  ],[
    AC_MSG_ERROR([missing required library popt])
456
  ])
457 458 459
],[
  AC_MSG_ERROR([missing required header popt.h])
])
460

461 462
AC_SUBST(WITH_POPT_INCLUDE)
AC_SUBST(WITH_POPT_LIB)
463

464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
#=================
# Check for libarchive library.
AC_ARG_WITH([archive], [AS_HELP_STRING([--with-archive], [build rpm2archive - requires libarchive])],
            [],
            [with_archive=yes])

WITH_ARCHIVE_INCLUDE=
WITH_ARCHIVE_LIB=
AS_IF([test "$with_archive" != no],[
  AC_CHECK_HEADER([archive.h], [
    AC_CHECK_LIB(archive, archive_write_open_filename, [
      WITH_ARCHIVE_INCLUDE=
      WITH_ARCHIVE_LIB="-larchive"
    ],[
      AC_MSG_ERROR([missing required library 'libarchive'])
    ])
],[
      AC_MSG_ERROR([missing required header archive.h])
  ])
])

AC_SUBST(WITH_ARCHIVE_INCLUDE)
AC_SUBST(WITH_ARCHIVE_LIB)
AM_CONDITIONAL(WITH_ARCHIVE,[test "$with_archive" = yes])

489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
#=================
# Check for elfutils libdw library with dwelf_elf_gnu_build_id.
WITH_LIBDW_LIB=
HAVE_LIBDW_STRTAB=
AS_IF([test "$WITH_LIBELF" = yes],[
  AC_CHECK_HEADERS([elfutils/libdwelf.h],[
    # dwelf_elf_gnu_build_id was introduced in elfutils 0.159
    AC_CHECK_LIB(dw, dwelf_elf_gnu_build_id, [
      AC_DEFINE(HAVE_LIBDW, 1,
                [Define to 1 if you have elfutils libdw library])
      WITH_LIBDW_LIB="-ldw"
      WITH_LIBDW=yes
      # If possible we also want the strtab functions from elfutils 0.167.
      # But we can fall back on the (unsupported) ebl alternatives if not.
      AC_CHECK_LIB(dw, dwelf_strtab_init, [HAVE_LIBDW_STRTAB=yes])
    ])
  ])
])
AC_SUBST(WITH_LIBDW_LIB)
AM_CONDITIONAL(LIBDW,[test "$WITH_LIBDW" = yes])
AM_CONDITIONAL(HAVE_LIBDW_STRTAB,[test "$HAVE_LIBDW_STRTAB" = yes])

511
#=================
512
# Process --with/without-external-db
513
AC_ARG_WITH(external_db, [AS_HELP_STRING([--with-external-db],[build against an external Berkeley db])],
514 515 516 517
[case "$with_external_db" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
esac],
518
[with_external_db=maybe])
519 520 521 522

case "$with_external_db" in
yes )
  AC_CHECK_HEADERS([db.h],[
523
    AC_PREPROC_IFELSE([
524
      AC_LANG_SOURCE([
525 526 527 528
	#include <db.h>
	#if ((DB_VERSION_MAJOR < 4) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 5))
	#error Berkeley DB too old
	#endif
529
      ])
530 531 532
    ],[ WITH_DB_LIB=-ldb ], 
      [ AC_MSG_ERROR([Berkeley DB version >= 4.5 required])
    ])
533 534 535 536
  ],[
    AC_MSG_ERROR([missing required header db.h])
  ])
  ;;
537 538 539
no|maybe )
  # Try internal database first, then fall back to external
  # unless --without-external-db (no) was explicitly given.
540 541 542
  if [ test -x db/dist/configure ]; then
    AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
  else
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
    case "$with_external_db" in
    maybe)
      AC_CHECK_HEADERS([db.h],[
        AC_PREPROC_IFELSE([
          AC_LANG_SOURCE([
	    #include <db.h>
	    #if ((DB_VERSION_MAJOR < 4) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 5))
	    #error Berkeley DB too old
	    #endif
          ])
        ],[ WITH_DB_LIB=-ldb ],
          [ AC_MSG_ERROR([Berkeley DB version >= 4.5 required])
        ])
      ],[
        AC_MSG_ERROR([missing required header db.h])
      ])
    ;;
    no)
      AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL])
    ;;
    esac
564 565 566
  fi
  ;;
esac
567

568
AC_SUBST([WITH_DB_LIB])
569

570 571
#=================
# Process --enable-ndb
572
AC_ARG_ENABLE([ndb], [AS_HELP_STRING([--enable-ndb (EXPERIMENTAL)],[enable the new rpm database format])],
573 574 575 576 577 578 579
[case "$enable_ndb" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --enable-ndb])
  ;;
esac],
[enable_ndb=no])
AS_IF([test "$enable_ndb" = yes],[
580 581 582 583
  AC_CHECK_FUNCS([mremap],
    [AC_DEFINE(ENABLE_NDB, 1, [Enable new rpm database format?])],
    [AC_MSG_ERROR([mremap function required by ndb])],
    [#include <sys/mman.h>])
584 585 586
])
AM_CONDITIONAL([NDB], [test "$enable_ndb" = yes])

587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
#=================
# Check for LMDB support
AC_ARG_ENABLE([lmdb],
              [AS_HELP_STRING([--enable-lmdb=@<:@yes/no/auto@:>@ (EXPERIMENTAL)],
                              [build with LMDB rpm database format support (default=auto)])],
              [enable_lmdb="$enableval"],
              [enable_lmdb=auto])

AS_IF([test "x$enable_lmdb" != "xno"], [
  PKG_CHECK_MODULES([LMDB], [lmdb], [have_lmdb=yes], [have_lmdb=no])
  AS_IF([test "$enable_lmdb" = "yes"], [
    if test "$have_lmdb" = "no"; then
      AC_MSG_ERROR([--enable-lmdb specified, but not available])
    fi
  ])
])

if test "x$have_lmdb" = "xyes"; then
  AC_DEFINE([WITH_LMDB], [1], [Define if LMDB is available])
  LMDB_REQUIRES=lmdb
  AC_SUBST(LMDB_REQUIRES)
fi
AM_CONDITIONAL([LMDB], [test "x$have_lmdb" = "xyes"])

611
AM_GNU_GETTEXT_VERSION([0.16.1])
612
AM_GNU_GETTEXT([external])
613
AM_ICONV
614 615 616

dnl Checks for header files we can live without.
AC_HEADER_STDC
617 618 619 620 621 622 623
dnl glibc and autoconf don't really play well together.
dnl glibc will produce a warning when including the wrong header.
dnl but still define major and minor. Causing us to include the header
dnl that produces a giant warning for each major/minor use.
dnl Use -Werror to work around that.
old_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
624
AC_HEADER_MAJOR
625
CFLAGS=$old_CFLAGS
626
AC_STRUCT_DIRENT_D_TYPE
627

628
AC_CHECK_HEADERS(limits.h)
629
AC_CHECK_HEADERS(fcntl.h getopt.h)
630

631
AC_CHECK_HEADERS(sys/utsname.h)
632

633 634
AC_CHECK_HEADERS(sys/systemcfg.h)
AC_CHECK_HEADERS(sys/param.h)
635
AC_CHECK_HEADERS(sys/auxv.h)
636 637 638 639 640 641 642

dnl statfs portability fiddles.
dnl
dnl We should really emulate/steal sections of the statfs and struct statfs
dnl checks from GNU fileutils.
dnl
AC_MSG_CHECKING(for struct statfs)
643

644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719
dnl
dnl this is easier than nesting AC_TRY_COMPILEs...
dnl
found_struct_statfs=no

if test X$found_struct_statfs = Xno ; then
dnl Solaris 2.6+ wants to use statvfs
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
	AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
		[statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
	found_struct_statfs=yes],[])
fi

if test X$found_struct_statfs = Xno ; then
dnl first try including sys/vfs.h
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
	AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
	found_struct_statfs=yes],[])
fi

if test X$found_struct_statfs = Xno ; then
dnl ...next try including sys/mount.h
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
	AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
	found_struct_statfs=yes],[])
fi

if test X$found_struct_statfs = Xno ; then
dnl ...still no joy.  Try sys/statfs.h
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
	AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
	found_struct_statfs=yes],[])
fi

if test X$found_struct_statfs = Xno ; then
dnl ...no luck.  Warn the user of impending doom.
AC_MSG_WARN(not found)
fi

dnl
dnl if we found the struct, see if it has the f_bavail member.  Some OSes
dnl don't, including IRIX 6.5+
dnl
if test X$found_struct_statfs = Xyes ; then
AC_MSG_CHECKING(for f_bavail member in struct statfs)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if STATFS_IN_SYS_STATVFS
# include <sys/statvfs.h>
  typedef struct statvfs STATFS_t;
#else
  typedef struct statfs STATFS_t;
# if STATFS_IN_SYS_VFS
#  include <sys/vfs.h>
# elif STATFS_IN_SYS_MOUNT
720
#  include <sys/mount.h>
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
# elif STATFS_IN_SYS_STATFS
#  include <sys/statfs.h>
# endif
#endif ]], [[STATFS_t sfs;
	sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
	AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
])
fi

if test X$found_struct_statfs = Xyes ; then
dnl
dnl now check to see if we have the 4-argument variant of statfs()
dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
dnl
AC_MSG_CHECKING([if statfs() requires 4 arguments])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef STATFS_IN_SYS_VFS
#include <sys/vfs.h>
#elif STATFS_IN_SYS_MOUNT
#include <sys/mouht.h>
#elif STATFS_IN_SYS_STATFS
#include <sys/statfs.h>
#endif
main() {
	struct statfs sfs;
	exit (statfs(".", &sfs, sizeof(sfs), 0));
}
]])],[AC_MSG_RESULT(yes)
	AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
])
fi

dnl look for libc features

dnl Check for missing typedefs
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T

dnl Checks for library functions.
765
AC_CHECK_FUNCS(putenv)
766 767
AC_CHECK_FUNCS(mempcpy)
AC_CHECK_FUNCS(fdatasync)
768
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
769 770
AC_CHECK_FUNCS(lutimes)
AC_CHECK_FUNCS(mergesort)
771
AC_CHECK_FUNCS(getauxval)
772 773 774 775 776 777 778 779
AC_CHECK_FUNCS(setprogname, [], [], [#include <stdlib.h>])

AC_MSG_CHECKING([whether __progname is defined])
AC_LINK_IFELSE([AC_LANG_PROGRAM([extern const char *__progname;],
	   [if (*__progname == 0) return 0;])],
	   AC_DEFINE([HAVE___PROGNAME], [1], [Define if __progname is defined])
	   AC_MSG_RESULT([yes]),
	   AC_MSG_RESULT([no]))
780

781
AC_REPLACE_FUNCS(stpcpy stpncpy)
782

783
AC_CHECK_FUNCS([secure_getenv __secure_getenv])
784

785
AC_CHECK_FUNCS(
786 787
   [mkstemp getcwd basename dirname realpath setenv unsetenv regcomp lchown \
    utimes getline],
788
   [], [AC_MSG_ERROR([function required by rpm])])
789

790 791
AC_LIBOBJ(fnmatch)

792
dnl check if python is requested
793
AC_ARG_ENABLE(python, [AS_HELP_STRING([--enable-python],[build rpm python bindings])],
794 795 796 797 798 799 800
[case "$enable_python" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --enable-python])
  ;;
esac],
[enable_python=no])

801
WITH_PYTHON_SUBPACKAGE=0
802
AS_IF([test "$enable_python" = yes],[
803
  AM_PATH_PYTHON([2.6],[
804 805 806
    PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}], [WITH_PYTHON_SUBPACKAGE=1])
    AC_SUBST(PYTHON_CFLAGS)
    AC_SUBST(PYTHON_LIB)
807 808
  ])
])
809

810
AM_CONDITIONAL(ENABLE_PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
811

812
AC_PATH_PROG(DOXYGEN, doxygen, no)
813
dnl
814
dnl Only build internal API + source hacking docs on request
815
dnl
816
AC_ARG_WITH(hackingdocs, [AS_HELP_STRING([--with-hackingdocs],[build rpm hacking docs])],,[with_hackingdocs=no])
817 818 819 820 821 822 823 824 825 826 827

case "$with_hackingdocs" in
auto)
  AS_IF([test "$DOXYGEN" = no],[with_hackingdocs=no],[with_hackingdocs=no])
  ;;
yes)
  AS_IF([test "$DOXYGEN" = no],
    [AC_MSG_ERROR([rpm hacking docs eeds doxygen in PATH])])
  ;;
esac
AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
828 829

WITH_SELINUX_LIB=
830
AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux],[build with selinux support])],
831 832 833 834 835 836 837 838 839
[case "$with_selinux" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --with-selinux])
  ;;
esac],
[with_selinux=no])

AS_IF([test "$with_selinux" = yes],[
  AC_CHECK_HEADER([selinux/selinux.h],[
840 841 842 843 844 845 846
    save_LIBS="$LIBS"
    AC_CHECK_LIB([selinux],[is_selinux_enabled],[],[
      AC_MSG_ERROR([--with-selinux given, but is_selinux_enabled not found in libselinux])])
    AC_CHECK_LIB([selinux],[selinux_getpolicytype],[],[
      AC_MSG_ERROR([--with-selinux given, but selinux_getpolicytype not found in libselinux])])
    AC_CHECK_LIB([selinux],[selinux_reset_config],[],[
      AC_MSG_ERROR([--with-selinux given, but selinux_reset_config not found in libselinux])])
847 848
    AC_CHECK_LIB([selinux],[setexecfilecon],[
      AC_DEFINE([HAVE_SETEXECFILECON],[1],[Define to 1 if SELinux setexecfilecon is present])])
849
    LIBS="$save_LIBS"
850 851 852
  ],[
    AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
  ])
853 854 855 856 857 858 859 860 861 862 863 864 865

  AC_CHECK_HEADER([selinux/label.h],[
    save_LIBS="$LIBS"
    AC_CHECK_LIB([selinux],[selabel_close],[],[
      AC_MSG_ERROR([--with-selinux given, but selabel_close not found in libselinux])])
    AC_CHECK_LIB([selinux],[selabel_lookup_raw],[],[
      AC_MSG_ERROR([--with-selinux given, but selabel_lookup_raw not found in libselinux])])
    AC_CHECK_LIB([selinux],[selabel_open],[],[
      AC_MSG_ERROR([--with-selinux given, but selabel_open not found in libselinux])])
    LIBS="$save_LIBS"
  ],[
    AC_MSG_ERROR([--with-selinux given, but selinux/label.h not found])
  ])
866 867 868
])

AS_IF([test "$with_selinux" = yes],[
869 870
  AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
  WITH_SELINUX_LIB="-lselinux"
871
])
872
AC_SUBST(WITH_SELINUX_LIB)
873
AC_SUBST(WITH_SEMANAGE_LIB)
874 875
AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])

876 877 878 879
# libimaevm
with_iamevm=no
AC_ARG_WITH(imaevm, [AS_HELP_STRING([--with-imaevm],[build with imaevm support])])
if test "$with_imaevm" = yes ; then
880 881 882 883 884 885 886 887 888 889 890 891
  AC_MSG_CHECKING([libimaevm >= 1.0])
  AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM(
      [[#include <imaevm.h>]],
      [[return sign_hash(NULL, NULL, 0, NULL, NULL, NULL);]]
    )],
    [AC_MSG_RESULT(yes)
     AC_DEFINE(WITH_IMAEVM, 1, [Build with imaevm support?])
     WITH_IMAEVM_LIB="-limaevm"
    ],
    [AC_MSG_ERROR([libimaevm not present or too old (< 1.0)])]
  )
892 893
fi
AM_CONDITIONAL(WITH_IMAEVM,[test "$with_imaevm" = yes])
894
AC_SUBST(WITH_IMAEVM_LIB)
895

896 897
# libcap
WITH_CAP_LIB=
898
AC_ARG_WITH(cap, [AS_HELP_STRING([--with-cap],[build with capability support])],
899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
[case "$with_cap" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --with-cap])
  ;;
esac],
[with_cap=no])

AS_IF([test "$with_cap" = yes],[
  AC_CHECK_HEADER([sys/capability.h],[
    AC_CHECK_LIB(cap,[cap_get_file], [
      with_cap=yes
      save_LIBS="$LIBS"
      AC_CHECK_LIB(cap,[cap_compare], [
        AC_DEFINE(HAVE_CAP_COMPARE, 1, [Have cap_compare function?])
      ])
      LIBS="$save_LIBS"
    ],[
      AC_MSG_ERROR([--with-cap given, but libcap not found])])
  ],[
    AC_MSG_ERROR([--with-cap given, but sys/capability.h not found])
  ])
])

AS_IF([test "$with_cap" = yes],[
  AC_DEFINE(WITH_CAP, 1, [Build with capability support?])
  WITH_CAP_LIB="-lcap"
])
AC_SUBST(WITH_CAP_LIB)
AM_CONDITIONAL(CAP,[test "$with_cap" = yes])

WITH_ACL_LIB=
930
AC_ARG_WITH(acl, [AS_HELP_STRING([--with-acl],[build with acl support])],
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953
[case "$with_acl" in
yes|no) ;;
*) AC_MSG_ERROR([invalid argument to --with-acl])
  ;;
esac],
[with_acl=no])

AS_IF([test "$with_acl" = yes],[
  dnl verification uses non-portable acl_equiv_mode() 
  AC_CHECK_HEADER([acl/libacl.h],[
    AC_CHECK_LIB(acl,[acl_equiv_mode],[with_acl=yes],[
      AC_MSG_ERROR([--with-acl given, but libacl not found or not suitable])])
  ],[
    AC_MSG_ERROR([--with-acl given, but acl/libacl.h not found])
  ])
])

AS_IF([test "$with_acl" = yes],[
  AC_DEFINE(WITH_ACL, 1, [Build with acl support?])
  WITH_ACL_LIB="-lacl"
])
AC_SUBST(WITH_ACL_LIB)
AM_CONDITIONAL(ACL,[test "$with_acl" = yes])
954

955 956 957 958 959 960 961 962 963 964 965
AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [build with lua support])],
            [],
            [with_lua=yes])

AS_IF([test "$with_lua" != no],[
  PKG_CHECK_MODULES([LUA],
    [lua >= 5.1],
    [AC_DEFINE(WITH_LUA, 1, [Build with lua support?])],
    [AC_MSG_ERROR([lua not present (--without-lua to disable)])])
  AC_SUBST(LUA_CFLAGS)
  AC_SUBST(LUA_LIBS)
966
])
967
AM_CONDITIONAL(WITH_LUA,[test "$with_lua" = yes])
968

969 970 971 972 973 974
AC_ARG_ENABLE(plugins, [AS_HELP_STRING([--disable-plugins],[build without plugin support])],,[enable_plugins=yes])
AS_IF([test "$enable_plugins" = yes],[
  AC_DEFINE(ENABLE_PLUGINS, 1, [Build with plugin support?])
])
AM_CONDITIONAL(ENABLE_PLUGINS,[test "$enable_plugins" = yes])

975 976 977 978 979 980
AC_ARG_ENABLE(inhibit_plugin, [AS_HELP_STRING([--disable-inhibit-plugin],[build without systemd inhibit plugin])],,[enable_inhibit_plugin=yes])
AS_IF([test "$enable_inhibit_plugin" = yes],[
  AC_DEFINE(ENABLE_INHIBIT_PLUGIN, 1, [Build with systemd inhibit plugin?])
])
AM_CONDITIONAL(ENABLE_INHIBIT_PLUGIN,[test "$enable_inhibit_plugin" = yes])

981 982
with_dbus=no
AS_IF([test "$enable_plugins" != no],[
983
 AS_IF([test "$enable_inhibit_plugin" != no],[
984 985 986 987 988 989
  PKG_CHECK_MODULES([DBUS],
    [dbus-1 >= 1.3],
    [AC_DEFINE(DBUS, 1, [Build with dbus support?]) with_dbus=yes],
    [with_dbus=no])
  AC_SUBST(DBUS_CFLAGS)
  AC_SUBST(DBUS_LIBS)
990
 ])
991 992
])
AM_CONDITIONAL(DBUS, [test "$with_dbus" = yes])
993

994 995 996 997 998
AS_IF([test "$enable_plugins" != no],[
  AC_CHECK_FUNCS(lsetxattr, [], [], [#include <sys/xattr.h>])
])
AM_CONDITIONAL(IMA, [test "x$ac_cv_func_lsetxattr" = xyes])

999
with_dmalloc=no
1000
AC_ARG_WITH(dmalloc, [AS_HELP_STRING([--with-dmalloc],[build with dmalloc debugging support])])
1001
if test "$with_dmalloc" = yes ; then
1002 1003 1004 1005
  AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
  LIBS="$LIBS -ldmalloc"
fi

1006 1007
user_with_uid0=$(awk -F: '$3==0 {print $1;exit}' /etc/passwd)
group_with_gid0=$(awk -F: '$3==0 {print $1;exit}' /etc/group)
1008 1009 1010
AC_DEFINE_UNQUOTED([UID_0_USER],["$user_with_uid0"],[Get the user name having userid 0])
AC_DEFINE_UNQUOTED([GID_0_GROUP],["$group_with_gid0"],[Get the group name having groupid 0])

1011
#
1012
# get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
1013
#
1014 1015 1016
host_os_gnu=-gnu
if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
	host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
1017
fi
1018 1019 1020
if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
	host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
	host_os_gnu=-gnueabi
1021
fi
1022 1023
if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
	host_os=`echo "${host_os}" | sed 's/-gnu$//'`
1024 1025 1026
fi

changequote(<, >)
1027 1028 1029
host_os_exact="${host_os}"
host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
1030 1031
changequote([, ])

1032
dnl permit overriding build_vendor for "canonical rpm vendor"
1033
RPMCANONVENDOR="$build_vendor"
1034 1035 1036 1037 1038
AC_ARG_WITH([vendor], 
  AS_HELP_STRING([--with-vendor=VENDOR], [specify rpm vendor name]),
  [RPMCANONVENDOR=$withval])
AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
	   
1039 1040
RPMCANONOS="$host_os_noversion"
RPMCANONGNU="$host_os_gnu"
1041 1042
AC_SUBST(RPMCANONVENDOR)
AC_SUBST(RPMCANONOS)
1043
AC_SUBST(RPMCANONGNU)
1044

1045 1046 1047 1048 1049 1050 1051
RUNDIR="/run"
AC_ARG_WITH([rundir], 
  AS_HELP_STRING([--with-rundir=RUNDIR], [specify run-time variable directory]),
  [RUNDIR=$withval])
AC_DEFINE_UNQUOTED([RUNDIR],["${RUNDIR}"],[run-time variable directory])
AC_SUBST(RUNDIR)

1052 1053 1054 1055 1056
if test X"$prefix" = XNONE ; then
    usrprefix="$ac_default_prefix"
else
    usrprefix=$prefix
fi
1057

1058 1059 1060 1061 1062
RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
AC_SUBST(RPMCONFIGDIR)

AC_SUBST(OBJDUMP)

1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
if test "$with_external_db" = no; then
    AC_CONFIG_SUBDIRS(db3)
fi

AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes])

AC_PATH_PROG(AUTOM4TE,autom4te,:)

AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
1074

1075
AC_CONFIG_FILES([Makefile
1076 1077
	rpmio/Makefile lib/Makefile build/Makefile sign/Makefile
	po/Makefile.in scripts/Makefile fileattrs/Makefile
1078
	misc/Makefile 
1079 1080
	doc/Makefile
	python/Makefile
1081 1082
 	luaext/Makefile
 	tests/Makefile
1083
 	plugins/Makefile
1084
	python/setup.py
1085 1086
  ])
AC_OUTPUT