1dnl @synopsis AX_PATH_BDB([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 2dnl 3dnl This macro finds the latest version of Berkeley DB on the system, 4dnl and ensures that the header file and library versions match. If 5dnl MINIMUM-VERSION is specified, it will ensure that the library found 6dnl is at least that version. 7dnl 8dnl It determines the name of the library as well as the path to the 9dnl header file and library. It will check both the default environment 10dnl as well as the default Berkeley DB install location. When found, it 11dnl sets BDB_LIBS, BDB_CPPFLAGS, and BDB_LDFLAGS to the necessary 12dnl values to add to LIBS, CPPFLAGS, and LDFLAGS, as well as setting 13dnl BDB_VERSION to the version found. HAVE_DB_H is defined also. 14dnl 15dnl The option --with-bdb-dir=DIR can be used to specify a specific 16dnl Berkeley DB installation to use. 17dnl 18dnl An example of it's use is: 19dnl 20dnl AX_PATH_BDB([3],[ 21dnl LIBS="$BDB_LIBS $LIBS" 22dnl LDFLAGS="$BDB_LDFLAGS $LDFLAGS" 23dnl CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS" 24dnl ]) 25dnl 26dnl which will locate the latest version of Berkeley DB on the system, 27dnl and ensure that it is version 3.0 or higher. 28dnl 29dnl Details: This macro does not use either AC_CHECK_HEADERS or 30dnl AC_CHECK_LIB because, first, the functions inside the library are 31dnl sometimes renamed to contain a version code that is only available 32dnl from the db.h on the system, and second, because it is common to 33dnl have multiple db.h and libdb files on a system it is important to 34dnl make sure the ones being used correspond to the same version. 35dnl Additionally, there are many different possible names for libdb 36dnl when installed by an OS distribution, and these need to be checked 37dnl if db.h does not correspond to libdb. 38dnl 39dnl When cross compiling, only header versions are verified since it 40dnl would be difficult to check the library version. Additionally the 41dnl default Berkeley DB installation locations /usr/local/BerkeleyDB* 42dnl are not searched for higher versions of the library. 43dnl 44dnl The format for the list of library names to search came from the 45dnl Cyrus IMAP distribution, although they are generated dynamically 46dnl here, and only for the version found in db.h. 47dnl 48dnl The macro AX_COMPARE_VERSION is required to use this macro, and 49dnl should be available from the Autoconf Macro Archive. 50dnl 51dnl The author would like to acknowledge the generous and valuable 52dnl feedback from Guido Draheim, without which this macro would be far 53dnl less robust, and have poor and inconsistent cross compilation 54dnl support. 55dnl 56dnl Changes: 57dnl 58dnl 1/5/05 applied patch from Rafa Rzepecki to eliminate compiler 59dnl warning about unused variable, argv 60dnl 61dnl @category InstalledPackages 62dnl @author Tim Toolan <toolan@ele.uri.edu> 63dnl @version 2005-01-17 64dnl @license GPLWithACException 65 66dnl ######################################################################### 67AC_DEFUN([AX_PATH_BDB], [ 68 dnl # Used to indicate success or failure of this function. 69 ax_path_bdb_ok=no 70 71 # Add --with-bdb-dir option to configure. 72 AC_ARG_WITH([bdb-dir], 73 [AC_HELP_STRING([--with-bdb-dir=DIR], 74 [Berkeley DB installation directory])]) 75 76 # Check if --with-bdb-dir was specified. 77 if test "x$with_bdb_dir" = "x" ; then 78 # No option specified, so just search the system. 79 AX_PATH_BDB_NO_OPTIONS([$1], [HIGHEST], [ 80 ax_path_bdb_ok=yes 81 ]) 82 else 83 # Set --with-bdb-dir option. 84 ax_path_bdb_INC="$with_bdb_dir/include" 85 ax_path_bdb_LIB="$with_bdb_dir/lib" 86 87 dnl # Save previous environment, and modify with new stuff. 88 ax_path_bdb_save_CPPFLAGS="$CPPFLAGS" 89 CPPFLAGS="-I$ax_path_bdb_INC $CPPFLAGS" 90 91 ax_path_bdb_save_LDFLAGS=$LDFLAGS 92 LDFLAGS="-L$ax_path_bdb_LIB $LDFLAGS" 93 94 # Check for specific header file db.h 95 AC_MSG_CHECKING([db.h presence in $ax_path_bdb_INC]) 96 if test -f "$ax_path_bdb_INC/db.h" ; then 97 AC_MSG_RESULT([yes]) 98 # Check for library 99 AX_PATH_BDB_NO_OPTIONS([$1], [ENVONLY], [ 100 ax_path_bdb_ok=yes 101 BDB_CPPFLAGS="-I$ax_path_bdb_INC" 102 BDB_LDFLAGS="-L$ax_path_bdb_LIB" 103 ]) 104 else 105 AC_MSG_RESULT([no]) 106 AC_MSG_NOTICE([no usable Berkeley DB not found]) 107 fi 108 109 dnl # Restore the environment. 110 CPPFLAGS="$ax_path_bdb_save_CPPFLAGS" 111 LDFLAGS="$ax_path_bdb_save_LDFLAGS" 112 113 fi 114 115 dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND. 116 if test "$ax_path_bdb_ok" = "yes" ; then 117 m4_ifvaln([$2],[$2],[:])dnl 118 m4_ifvaln([$3],[else $3])dnl 119 fi 120 121]) dnl AX_PATH_BDB 122 123dnl ######################################################################### 124dnl Check for berkeley DB of at least MINIMUM-VERSION on system. 125dnl 126dnl The OPTION argument determines how the checks occur, and can be one of: 127dnl 128dnl HIGHEST - Check both the environment and the default installation 129dnl directories for Berkeley DB and choose the version that 130dnl is highest. (default) 131dnl ENVFIRST - Check the environment first, and if no satisfactory 132dnl library is found there check the default installation 133dnl directories for Berkeley DB which is /usr/local/BerkeleyDB* 134dnl ENVONLY - Check the current environment only. 135dnl 136dnl Requires AX_PATH_BDB_PATH_GET_VERSION, AX_PATH_BDB_PATH_FIND_HIGHEST, 137dnl AX_PATH_BDB_ENV_CONFIRM_LIB, AX_PATH_BDB_ENV_GET_VERSION, and 138dnl AX_COMPARE_VERSION macros. 139dnl 140dnl Result: sets ax_path_bdb_no_options_ok to yes or no 141dnl sets BDB_LIBS, BDB_CPPFLAGS, BDB_LDFLAGS, BDB_VERSION 142dnl 143dnl AX_PATH_BDB_NO_OPTIONS([MINIMUM-VERSION], [OPTION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 144AC_DEFUN([AX_PATH_BDB_NO_OPTIONS], [ 145 dnl # Used to indicate success or failure of this function. 146 ax_path_bdb_no_options_ok=no 147 148 # Values to add to environment to use Berkeley DB. 149 BDB_VERSION='' 150 BDB_LIBS='' 151 BDB_CPPFLAGS='' 152 BDB_LDFLAGS='' 153 154 # Check cross compilation here. 155 if test "x$cross_compiling" = "xyes" ; then 156 # If cross compiling, can't use AC_RUN_IFELSE so do these tests. 157 # The AC_PREPROC_IFELSE confirms that db.h is preprocessable, 158 # and extracts the version number from it. 159 AC_MSG_CHECKING([for db.h]) 160 161 AS_VAR_PUSHDEF([HEADER_VERSION],[ax_path_bdb_no_options_HEADER_VERSION])dnl 162 HEADER_VERSION='' 163 AC_PREPROC_IFELSE([ 164 AC_LANG_SOURCE([[ 165#include <db.h> 166AX_PATH_BDB_STUFF DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH 167 ]]) 168 ],[ 169 # Extract version from preprocessor output. 170 HEADER_VERSION=`eval "$ac_cpp conftest.$ac_ext" 2> /dev/null \ 171 | grep AX_PATH_BDB_STUFF | sed 's/[[^0-9,]]//g;s/,/./g;1q'` 172 ],[]) 173 174 if test "x$HEADER_VERSION" = "x" ; then 175 AC_MSG_RESULT([no]) 176 else 177 AC_MSG_RESULT([$HEADER_VERSION]) 178 179 # Check that version is high enough. 180 AX_COMPARE_VERSION([$HEADER_VERSION],[ge],[$1],[ 181 # get major and minor version numbers 182 AS_VAR_PUSHDEF([MAJ],[ax_path_bdb_no_options_MAJOR])dnl 183 MAJ=`echo $HEADER_VERSION | sed 's,\..*,,'` 184 AS_VAR_PUSHDEF([MIN],[ax_path_bdb_no_options_MINOR])dnl 185 MIN=`echo $HEADER_VERSION | sed 's,^[[0-9]]*\.,,;s,\.[[0-9]]*$,,'` 186 187 dnl # Save LIBS. 188 ax_path_bdb_no_options_save_LIBS="$LIBS" 189 190 # Check that we can link with the library. 191 AC_SEARCH_LIBS([db_version], 192 [db db-$MAJ.$MIN db$MAJ.$MIN db$MAJ$MIN db-$MAJ db$MAJ],[ 193 # Sucessfully found library. 194 ax_path_bdb_no_options_ok=yes 195 BDB_VERSION=$HEADER_VERSION 196 197 # Extract library from LIBS 198 ax_path_bdb_no_options_LEN=` \ 199 echo "x$ax_path_bdb_no_options_save_LIBS" \ 200 | awk '{print(length)}'` 201 BDB_LIBS=`echo "x$LIBS " \ 202 | sed "s/.\{$ax_path_bdb_no_options_LEN\}\$//;s/^x//;s/ //g"` 203 ],[]) 204 205 dnl # Restore LIBS 206 LIBS="$ax_path_bdb_no_options_save_LIBS" 207 208 AS_VAR_POPDEF([MAJ])dnl 209 AS_VAR_POPDEF([MIN])dnl 210 ]) 211 fi 212 213 AS_VAR_POPDEF([HEADER_VERSION])dnl 214 else 215 # Not cross compiling. 216 # Check version of Berkeley DB in the current environment. 217 AX_PATH_BDB_ENV_GET_VERSION([ 218 AX_COMPARE_VERSION([$ax_path_bdb_env_get_version_VERSION],[ge],[$1],[ 219 # Found acceptable version in current environment. 220 ax_path_bdb_no_options_ok=yes 221 BDB_VERSION="$ax_path_bdb_env_get_version_VERSION" 222 BDB_LIBS="$ax_path_bdb_env_get_version_LIBS" 223 ]) 224 ]) 225 226 # Determine if we need to search /usr/local/BerkeleyDB* 227 ax_path_bdb_no_options_DONE=no 228 if test "x$2" = "xENVONLY" ; then 229 ax_path_bdb_no_options_DONE=yes 230 elif test "x$2" = "xENVFIRST" ; then 231 ax_path_bdb_no_options_DONE=$ax_path_bdb_no_options_ok 232 fi 233 234 if test "$ax_path_bdb_no_options_DONE" = "no" ; then 235 # Check for highest in /usr/local/BerkeleyDB* 236 AX_PATH_BDB_PATH_FIND_HIGHEST([ 237 if test "$ax_path_bdb_no_options_ok" = "yes" ; then 238 # If we already have an acceptable version use this if higher. 239 AX_COMPARE_VERSION( 240 [$ax_path_bdb_path_find_highest_VERSION],[gt],[$BDB_VERSION]) 241 else 242 # Since we didn't have an acceptable version check if this one is. 243 AX_COMPARE_VERSION( 244 [$ax_path_bdb_path_find_highest_VERSION],[ge],[$1]) 245 fi 246 ]) 247 248 dnl # If result from _AX_COMPARE_VERSION is true we want this version. 249 if test "$ax_compare_version" = "true" ; then 250 ax_path_bdb_no_options_ok=yes 251 BDB_LIBS="-ldb" 252 if test "x$ax_path_bdb_path_find_highest_DIR" != x ; then 253 BDB_CPPFLAGS="-I$ax_path_bdb_path_find_highest_DIR/include" 254 BDB_LDFLAGS="-L$ax_path_bdb_path_find_highest_DIR/lib" 255 fi 256 BDB_VERSION="$ax_path_bdb_path_find_highest_VERSION" 257 fi 258 fi 259 fi 260 261 dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND. 262 if test "$ax_path_bdb_no_options_ok" = "yes" ; then 263 AC_MSG_NOTICE([using Berkeley DB version $BDB_VERSION]) 264 AC_DEFINE([HAVE_DB_H],[1], 265 [Define to 1 if you have the <db.h> header file.]) 266 m4_ifvaln([$3],[$3])dnl 267 else 268 AC_MSG_NOTICE([no Berkeley DB version $1 or higher found]) 269 m4_ifvaln([$4],[$4])dnl 270 fi 271]) dnl AX_PATH_BDB_NO_OPTIONS 272 273dnl ######################################################################### 274dnl Check the default installation directory for Berkeley DB which is 275dnl of the form /usr/local/BerkeleyDB* for the highest version. 276dnl 277dnl Result: sets ax_path_bdb_path_find_highest_ok to yes or no, 278dnl sets ax_path_bdb_path_find_highest_VERSION to version, 279dnl sets ax_path_bdb_path_find_highest_DIR to directory. 280dnl 281dnl AX_PATH_BDB_PATH_FIND_HIGHEST([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 282AC_DEFUN([AX_PATH_BDB_PATH_FIND_HIGHEST], [ 283 dnl # Used to indicate success or failure of this function. 284 ax_path_bdb_path_find_highest_ok=no 285 286 AS_VAR_PUSHDEF([VERSION],[ax_path_bdb_path_find_highest_VERSION])dnl 287 VERSION='' 288 289 ax_path_bdb_path_find_highest_DIR='' 290 291 # find highest verison in default install directory for Berkeley DB 292 AS_VAR_PUSHDEF([CURDIR],[ax_path_bdb_path_find_highest_CURDIR])dnl 293 AS_VAR_PUSHDEF([CUR_VERSION],[ax_path_bdb_path_get_version_VERSION])dnl 294 295 for CURDIR in `ls -d /usr/local/BerkeleyDB* 2> /dev/null` 296 do 297 AX_PATH_BDB_PATH_GET_VERSION([$CURDIR],[ 298 AX_COMPARE_VERSION([$CUR_VERSION],[gt],[$VERSION],[ 299 ax_path_bdb_path_find_highest_ok=yes 300 ax_path_bdb_path_find_highest_DIR="$CURDIR" 301 VERSION="$CUR_VERSION" 302 ]) 303 ]) 304 done 305 306 AS_VAR_POPDEF([VERSION])dnl 307 AS_VAR_POPDEF([CUR_VERSION])dnl 308 AS_VAR_POPDEF([CURDIR])dnl 309 310 dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND. 311 if test "$ax_path_bdb_path_find_highest_ok" = "yes" ; then 312 m4_ifvaln([$1],[$1],[:])dnl 313 m4_ifvaln([$2],[else $2])dnl 314 fi 315 316]) dnl AX_PATH_BDB_PATH_FIND_HIGHEST 317 318dnl ######################################################################### 319dnl Checks for Berkeley DB in specified directory's lib and include 320dnl subdirectories. 321dnl 322dnl Result: sets ax_path_bdb_path_get_version_ok to yes or no, 323dnl sets ax_path_bdb_path_get_version_VERSION to version. 324dnl 325dnl AX_PATH_BDB_PATH_GET_VERSION(BDB-DIR, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 326AC_DEFUN([AX_PATH_BDB_PATH_GET_VERSION], [ 327 dnl # Used to indicate success or failure of this function. 328 ax_path_bdb_path_get_version_ok=no 329 330 # Indicate status of checking for Berkeley DB header. 331 AC_MSG_CHECKING([in $1/include for db.h]) 332 ax_path_bdb_path_get_version_got_header=no 333 test -f "$1/include/db.h" && ax_path_bdb_path_get_version_got_header=yes 334 AC_MSG_RESULT([$ax_path_bdb_path_get_version_got_header]) 335 336 # Indicate status of checking for Berkeley DB library. 337 AC_MSG_CHECKING([in $1/lib for library -ldb]) 338 339 ax_path_bdb_path_get_version_VERSION='' 340 341 if test -d "$1/include" && test -d "$1/lib" && 342 test "$ax_path_bdb_path_get_version_got_header" = "yes" ; then 343 dnl # save and modify environment 344 ax_path_bdb_path_get_version_save_CPPFLAGS="$CPPFLAGS" 345 CPPFLAGS="-I$1/include $CPPFLAGS" 346 347 ax_path_bdb_path_get_version_save_LIBS="$LIBS" 348 LIBS="$LIBS -ldb" 349 350 ax_path_bdb_path_get_version_save_LDFLAGS="$LDFLAGS" 351 LDFLAGS="-L$1/lib $LDFLAGS" 352 353 # Compile and run a program that compares the version defined in 354 # the header file with a version defined in the library function 355 # db_version. 356 AC_RUN_IFELSE([ 357 AC_LANG_SOURCE([[ 358#include <stdio.h> 359#include <db.h> 360int main(int argc,char **argv) 361{ 362 int major,minor,patch; 363 (void) argv; 364 db_version(&major,&minor,&patch); 365 if (argc > 1) 366 printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH); 367 if (DB_VERSION_MAJOR == major && DB_VERSION_MINOR == minor && 368 DB_VERSION_PATCH == patch) 369 return 0; 370 else 371 return 1; 372} 373 ]]) 374 ],[ 375 # Program compiled and ran, so get version by adding argument. 376 ax_path_bdb_path_get_version_VERSION=`./conftest$ac_exeext x` 377 ax_path_bdb_path_get_version_ok=yes 378 ],[],[]) 379 380 dnl # restore environment 381 CPPFLAGS="$ax_path_bdb_path_get_version_save_CPPFLAGS" 382 LIBS="$ax_path_bdb_path_get_version_save_LIBS" 383 LDFLAGS="$ax_path_bdb_path_get_version_save_LDFLAGS" 384 fi 385 386 dnl # Finally, execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND. 387 if test "$ax_path_bdb_path_get_version_ok" = "yes" ; then 388 AC_MSG_RESULT([$ax_path_bdb_path_get_version_VERSION]) 389 m4_ifvaln([$2],[$2])dnl 390 else 391 AC_MSG_RESULT([no]) 392 m4_ifvaln([$3],[$3])dnl 393 fi 394]) dnl AX_PATH_BDB_PATH_GET_VERSION 395 396############################################################################# 397dnl Checks if version of library and header match specified version. 398dnl Only meant to be used by AX_PATH_BDB_ENV_GET_VERSION macro. 399dnl 400dnl Requires AX_COMPARE_VERSION macro. 401dnl 402dnl Result: sets ax_path_bdb_env_confirm_lib_ok to yes or no. 403dnl 404dnl AX_PATH_BDB_ENV_CONFIRM_LIB(VERSION, [LIBNAME]) 405AC_DEFUN([AX_PATH_BDB_ENV_CONFIRM_LIB], [ 406 dnl # Used to indicate success or failure of this function. 407 ax_path_bdb_env_confirm_lib_ok=no 408 409 dnl # save and modify environment to link with library LIBNAME 410 ax_path_bdb_env_confirm_lib_save_LIBS="$LIBS" 411 LIBS="$LIBS $2" 412 413 # Compile and run a program that compares the version defined in 414 # the header file with a version defined in the library function 415 # db_version. 416 AC_RUN_IFELSE([ 417 AC_LANG_SOURCE([[ 418#include <stdio.h> 419#include <db.h> 420int main(int argc,char **argv) 421{ 422 int major,minor,patch; 423 (void) argv; 424 db_version(&major,&minor,&patch); 425 if (argc > 1) 426 printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH); 427 if (DB_VERSION_MAJOR == major && DB_VERSION_MINOR == minor && 428 DB_VERSION_PATCH == patch) 429 return 0; 430 else 431 return 1; 432} 433 ]]) 434 ],[ 435 # Program compiled and ran, so get version by giving an argument, 436 # which will tell the program to print the output. 437 ax_path_bdb_env_confirm_lib_VERSION=`./conftest$ac_exeext x` 438 439 # If the versions all match up, indicate success. 440 AX_COMPARE_VERSION([$ax_path_bdb_env_confirm_lib_VERSION],[eq],[$1],[ 441 ax_path_bdb_env_confirm_lib_ok=yes 442 ]) 443 ],[],[]) 444 445 dnl # restore environment 446 LIBS="$ax_path_bdb_env_confirm_lib_save_LIBS" 447 448]) dnl AX_PATH_BDB_ENV_CONFIRM_LIB 449 450############################################################################# 451dnl Finds the version and library name for Berkeley DB in the 452dnl current environment. Tries many different names for library. 453dnl 454dnl Requires AX_PATH_BDB_ENV_CONFIRM_LIB macro. 455dnl 456dnl Result: set ax_path_bdb_env_get_version_ok to yes or no, 457dnl set ax_path_bdb_env_get_version_VERSION to the version found, 458dnl and ax_path_bdb_env_get_version_LIBNAME to the library name. 459dnl 460dnl AX_PATH_BDB_ENV_GET_VERSION([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 461AC_DEFUN([AX_PATH_BDB_ENV_GET_VERSION], [ 462 dnl # Used to indicate success or failure of this function. 463 ax_path_bdb_env_get_version_ok=no 464 465 ax_path_bdb_env_get_version_VERSION='' 466 ax_path_bdb_env_get_version_LIBS='' 467 468 AS_VAR_PUSHDEF([HEADER_VERSION],[ax_path_bdb_env_get_version_HEADER_VERSION])dnl 469 AS_VAR_PUSHDEF([TEST_LIBNAME],[ax_path_bdb_env_get_version_TEST_LIBNAME])dnl 470 471 # Indicate status of checking for Berkeley DB library. 472 AC_MSG_CHECKING([for db.h]) 473 474 # Compile and run a program that determines the Berkeley DB version 475 # in the header file db.h. 476 HEADER_VERSION='' 477 AC_RUN_IFELSE([ 478 AC_LANG_SOURCE([[ 479#include <stdio.h> 480#include <db.h> 481int main(int argc,char **argv) 482{ 483 (void) argv; 484 if (argc > 1) 485 printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH); 486 return 0; 487} 488 ]]) 489 ],[ 490 # Program compiled and ran, so get version by adding an argument. 491 HEADER_VERSION=`./conftest$ac_exeext x` 492 AC_MSG_RESULT([$HEADER_VERSION]) 493 ],[AC_MSG_RESULT([no])],[AC_MSG_RESULT([no])]) 494 495 # Have header version, so try to find corresponding library. 496 # Looks for library names in the order: 497 # nothing, db, db-X.Y, dbX.Y, dbXY, db-X, dbX 498 # and stops when it finds the first one that matches the version 499 # of the header file. 500 if test "x$HEADER_VERSION" != "x" ; then 501 AC_MSG_CHECKING([for library containing Berkeley DB $HEADER_VERSION]) 502 503 AS_VAR_PUSHDEF([MAJOR],[ax_path_bdb_env_get_version_MAJOR])dnl 504 AS_VAR_PUSHDEF([MINOR],[ax_path_bdb_env_get_version_MINOR])dnl 505 506 # get major and minor version numbers 507 MAJOR=`echo $HEADER_VERSION | sed 's,\..*,,'` 508 MINOR=`echo $HEADER_VERSION | sed 's,^[[0-9]]*\.,,;s,\.[[0-9]]*$,,'` 509 510 # see if it is already specified in LIBS 511 TEST_LIBNAME='' 512 AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME]) 513 514 if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then 515 # try format "db" 516 TEST_LIBNAME='-ldb' 517 AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME]) 518 fi 519 520 if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then 521 # try format "db-X.Y" 522 TEST_LIBNAME="-ldb-${MAJOR}.$MINOR" 523 AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME]) 524 fi 525 526 if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then 527 # try format "dbX.Y" 528 TEST_LIBNAME="-ldb${MAJOR}.$MINOR" 529 AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME]) 530 fi 531 532 if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then 533 # try format "dbXY" 534 TEST_LIBNAME="-ldb$MAJOR$MINOR" 535 AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME]) 536 fi 537 538 if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then 539 # try format "db-X" 540 TEST_LIBNAME="-ldb-$MAJOR" 541 AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME]) 542 fi 543 544 if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then 545 # try format "dbX" 546 TEST_LIBNAME="-ldb$MAJOR" 547 AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME]) 548 fi 549 550 dnl # Found a valid library. 551 if test "$ax_path_bdb_env_confirm_lib_ok" = "yes" ; then 552 if test "x$TEST_LIBNAME" = "x" ; then 553 AC_MSG_RESULT([none required]) 554 else 555 AC_MSG_RESULT([$TEST_LIBNAME]) 556 fi 557 ax_path_bdb_env_get_version_VERSION="$HEADER_VERSION" 558 ax_path_bdb_env_get_version_LIBS="$TEST_LIBNAME" 559 ax_path_bdb_env_get_version_ok=yes 560 else 561 AC_MSG_RESULT([no]) 562 fi 563 564 AS_VAR_POPDEF([MAJOR])dnl 565 AS_VAR_POPDEF([MINOR])dnl 566 fi 567 568 AS_VAR_POPDEF([HEADER_VERSION])dnl 569 AS_VAR_POPDEF([TEST_LIBNAME])dnl 570 571 dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND. 572 if test "$ax_path_bdb_env_confirm_lib_ok" = "yes" ; then 573 m4_ifvaln([$1],[$1],[:])dnl 574 m4_ifvaln([$2],[else $2])dnl 575 fi 576 577]) dnl BDB_ENV_GET_VERSION 578 579############################################################################# 580