RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 21-Jun-2007 10:15:48 Branch: HEAD Handle: 2007062109154800 Modified files: rpm acinclude.m4 configure.ac Log: Improve RPM_CHECK_LIB in order to better support building against third-party libraries in default system locations: - split default --with-foo argument into default enable mode ("yes" and "no") and default locations (for "yes" enable mode). - assemble all abort error handlings directly at the action clause to even permit locating libraries fully implicitly (either because they are under default locations the compiler seaches anyway or because the user passed in the necessary CPPFLAGS and LDFLAGS himself). - an explicit "abort" is now explicitly handled by either not having "none" as the last location or by explicitly using AC_ERROR in the <failure-action>. Summary: Revision Changes Path 2.2 +20 -25 rpm/acinclude.m4 2.102 +14 -14 rpm/configure.ac ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/acinclude.m4 ============================================================================ $ cvs diff -u -r2.1 -r2.2 acinclude.m4 --- rpm/acinclude.m4 20 Jun 2007 21:10:19 -0000 2.1 +++ rpm/acinclude.m4 21 Jun 2007 08:15:48 -0000 2.2 @@ -33,7 +33,7 @@ dnl ## <lib-link-name>, -- [$3] e.g. bz2 dnl ## <lib-function-name>, -- [$4] e.g. BZ2_bzlibVersion dnl ## <lib-header-filename>, -- [$5] e.g. bzlib.h -dnl ## <with-arg-default>[, -- [$6] e.g. external:internal:none +dnl ## <with-arg-default>[, -- [$6] e.g. yes,external:internal:none dnl ## <internal-subdir>[, -- [$7] e.g. lib/bzip2 dnl ## <success-action>[, -- [$8] e.g. AC_DEFINE(USE_BZIP2, 1, [...]) dnl ## <failure-action> -- [$9] e.g. AC_ERROR([...]) @@ -58,8 +58,7 @@ dnl ## | <location-spec> ":" <location-spec> dnl ## | "external" /* arbitrary system path */ dnl ## | "internal" /* <internal-subdir> only */ -dnl ## | "abort" /* explicit error if library not found */ -dnl ## | "none" /* no error if library not found */ +dnl ## | "none" /* no default error action if library not found */ dnl ## <directory-path> ::= [...] /* valid argument for test(1) option "-d" */ dnl ## @@ -68,19 +67,18 @@ dnl ## PROLOG dnl ## + dnl # parse <with-arg-default> into default enable mode and default locations + m4_define([__rcl_default_enable], [m4_substr([$6], 0, m4_index([$6], [,]))]) + m4_define([__rcl_default_locations], [m4_substr([$6], m4_eval(m4_index([$6], [,]) + 1))]) + + dnl # provide defaults if test ".${with_$2+set}" != .set; then - dnl # neither "--with-foo[=<arg>]" nor "--without-foo" given - dnl # on command line so just assume "--with-foo=<with-arg-default>" - with_$2="$6" - fi - if test ".${with_$2}" = .yes; then - dnl # map "--with-foo=yes" onto "--with-foo=<with-arg-default>" - dnl # unless <with-arg-default> is a destructive "no" - with_$2="m4_if([$6], no, yes, [$6])" + dnl # initialize to default enable mode + with_$2="__rcl_default_enable" fi if test ".${with_$2}" = .yes; then - dnl # map a final "--with-foo=yes" onto a hard-coded default - with_$2="internal:external:abort" + dnl # map simple "--with-foo=yes" to an enabled default location path + with_$2="__rcl_default_locations" fi dnl ## @@ -89,22 +87,19 @@ __rcl_result_hint="" __rcl_location_$2="" + __rcl_location_last="" WITH_[]m4_translit([$2],[a-z],[A-Z])[]_SUBDIR="" AC_ARG_WITH($2, - AS_HELP_STRING([--with-$2=ARG], [build with $1 library [[$6]]]), [dnl + AS_HELP_STRING([--with-$2=ARG], [build with $1 library (__rcl_default_enable) (location path: "__rcl_default_locations")]), [dnl if test ".${with_$2}" != .no; then dnl # iterate over location path specification for searching purposes - __rcl_location_last="" __rcl_IFS="${IFS}"; IFS=":" for __rcl_location in ${with_$2}; do IFS="${__rcl_IFS}" __rcl_location_last="${__rcl_location}" if test ".${__rcl_location}" = .none; then - dnl # no operation in loop, ignore search failure later, too. + dnl # no operation in loop, ignore failure later, too. : - elif test ".${__rcl_location}" = .abort; then - dnl # the explicit suicide case - AC_ERROR([unable to find available $1 library]) m4_if([$7],,, [ elif test ".${__rcl_location}" = .internal; then dnl # optional support for <internal-subdir> feature m4_define([__rcl_subdir], @@ -240,7 +235,6 @@ fi dnl # in any sub-area if test ".${__rcl_found}" = .no; then - dnl changequote(, )dnl for __rcl_file in _ `find ${__rcl_location} -name "$5" -type f -print`; do test .${__rcl_file} = ._ && continue __rcl_dir=`echo ${__rcl_file} | sed -e 's;[[^/]]*[$];;' -e 's;\(.\)/[$];\1;'` @@ -261,7 +255,6 @@ done ]) fi - dnl changequote([, ])dnl if test ".${__rcl_found}" = .yes; then __rcl_result_hint="external: tree ${__rcl_location}" fi @@ -298,9 +291,6 @@ test ".${__rcl_found_lib}" = .no && __rcl_found="no" dnl # determine final results with_$2=${__rcl_found} - if test ".${with_$2}" = .no && test ".${__rcl_location_last}" != .none; then - AC_ERROR([unable to find usable $1 library]) - fi m4_if([$7],,, [ fi ]) if test ".${with_$2}" = .yes && test ".${__rcl_result_hint}" = .; then dnl # was not found explicitly via searching above, but @@ -339,7 +329,12 @@ m4_if([$8],, :, [$8]) else dnl # support optional <failure-action> - m4_if([$9],, :, [$9]) + m4_if([$9],, [ + if test ".${RPM_CHECK_LIB_LOCATION}" != . && \ + test ".${RPM_CHECK_LIB_LOCATION}" != .none; then + AC_ERROR([unable to find usable $1 library]) + fi + ], [$9]) fi ${as_unset} RPM_CHECK_LIB_LOCATION ]) @@ . patch -p0 <<'@@ .' Index: rpm/configure.ac ============================================================================ $ cvs diff -u -r2.101 -r2.102 configure.ac --- rpm/configure.ac 21 Jun 2007 06:36:07 -0000 2.101 +++ rpm/configure.ac 21 Jun 2007 08:15:48 -0000 2.102 @@ -314,12 +314,12 @@ RPM_CHECK_LIB([ZLib], [zlib], [z gz], [gzread], [zlib.h], - [internal:external:none], [zlib], + [yes,internal:external:none], [zlib], [AC_CHECK_FUNC(gzseek)], []) RPM_CHECK_LIB([GNU BZip2], [bzip2], [bz2], [BZ2_bzread], [bzlib.h], - [external:none], [], + [no,external:none], [], [], []) #================= @@ -524,14 +524,14 @@ RPM_CHECK_LIB([BeeCrypt], [beecrypt], [beecrypt], [mpfprintln], [beecrypt/api.h], - [external:internal:abort], [beecrypt], + [yes,external:internal], [beecrypt], [], [ AC_ERROR([mandatory BeeCrypt library not found]) ]) #================= RPM_CHECK_LIB([Neon], [neon], [neon], [ne_session_create], [ne_session.h], - [external:internal:abort], [neon:src:src], + [yes,external:internal], [neon:src:src], [ if test ".$RPM_CHECK_LIB_LOCATION" = .internal; then AC_DEFINE(HAVE_NEON_NE_GET_RESPONSE_HEADER, 1, [Define to 1 if you have ne_get_response_header() in libneon.]) @@ -549,21 +549,21 @@ RPM_CHECK_LIB([File (magic)], [file], [magic], [magic_open], [magic.h], - [external:internal:abort], [file:src:src], - ], [ AC_ERROR([mandatory File (magic) library not found]) ]) + [yes,external:internal], [file:src:src], + [], [ AC_ERROR([mandatory File (magic) library not found]) ]) #================= RPM_CHECK_LIB([Linux keyutils], [keyutils], [keyutils], [keyctl_read], [keyutils.h], - [external:none], [], + [no,external:none], [], [], []) #================= RPM_CHECK_LIB([POPT], [popt], [popt], [poptGetContext], [popt.h], - [external:abort], [], + [yes,external], [], [], [AC_ERROR([mandatory POPT library not found])]) #================= @@ -572,7 +572,7 @@ RPM_CHECK_LIB([Berkeley-DB], [db], [db], [db_create], [db.h], - [internal:external:abort], [db3], + [yes,internal:external], [db3], [ DBLIBSRCS="$DBLIBSRCS db3.c" if test ".$RPM_CHECK_LIB_LOCATION" = .internal; then AC_DEFINE(HAVE_DB_H, 1, [Have <db.h> header]) @@ -588,9 +588,9 @@ RPM_CHECK_LIB([SQLite], [sqlite], [sqlite3], [sqlite3_open], [sqlite3.h], - [external:abort], [], + [no,external:none], [], [ DBLIBSRCS="$DBLIBSRCS sqlite.c" ], - [ AC_ERROR([mandatory SQLite library not found]) ]) + []) DBLIBOBJS=`echo $DBLIBSRCS | sed -e "s/\.c/\.lo/g"` @@ -972,7 +972,7 @@ WITH_LUA_SUBDIR_LIB="" RPM_CHECK_LIB([Lua], [lua], [lua], [_], [_], - [internal:none], [lua:include,local], + [no,internal:none], [lua:include,local], [ AC_CHECK_LIB(dl, dlopen, [ LIBS="-ldl $LIBS"; WITH_LUA_SUBDIR_LIB="-ldl" ]) AC_CHECK_FUNC(dlopen, [ WITH_LUA_SUBDIR_DEF="-DUSE_DLOPEN" ]) ], []) AC_SUBST(WITH_LUA_SUBDIR_DEF) @@ -980,12 +980,12 @@ RPM_CHECK_LIB([DMalloc], [dmalloc], [dmalloc], [dmalloc_malloc], [dmalloc.h], - [no], [], + [no,external:none], [], [], []) RPM_CHECK_LIB([ElectricFence], [efence], [efence], [malloc], [stdlib.h], - [no], [], + [no,external:none], [], [], []) AC_CHECK_FUNCS(setlocale) @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org