1dnl Project : ipv6calc 2dnl File : configure.in 3dnl Version : $Id: 68ed8bfe35425698dc2cdf5121ed171e39813f84 $ 4dnl Copyright: 2001-2021 by Peter Bieringer <pb (at) bieringer.de> 5 6dnl Process this file with autoconf to produce a configure script. 7 8AC_INIT(ipv6calc, 3.2.0, ipv6calc@deepspace6.net, ipv6calc, http://www.deepspace6.net/projects/ipv6calc.html) 9 10COPYRIGHT_YEAR=2021 11 12dnl Program/library version (align with version above) 13PACKAGE_VERSION_MAJOR=3 14PACKAGE_VERSION_MINOR=2 15PACKAGE_VERSION_BUGFIX=0 16 17dnl API version 18API_VERSION_MAJOR=3 19API_VERSION_MINOR=2 20API_VERSION_BUGFIX=0 21 22 23dnl Generic data definitions 24AC_SUBST(COPYRIGHT_YEAR) 25AC_DEFINE_UNQUOTED(COPYRIGHT_YEAR, "$COPYRIGHT_YEAR", [Copyright year]) 26 27dnl Program/library version variants 28PACKAGE_VERSION_NUMERIC=$(echo "$PACKAGE_VERSION_MAJOR $PACKAGE_VERSION_MINOR $PACKAGE_VERSION_BUGFIX" | awk '{ print ( $1 * 1000 + $2 ) * 1000 + $3 }') 29PACKAGE_VERSION_STRING=$(echo "$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_BUGFIX") 30 31AC_DEFINE_UNQUOTED(IPV6CALC_PACKAGE_VERSION_MAJOR, $PACKAGE_VERSION_MAJOR , "Package version Major") 32AC_DEFINE_UNQUOTED(IPV6CALC_PACKAGE_VERSION_MINOR, $PACKAGE_VERSION_MINOR , "Package version Minor") 33AC_DEFINE_UNQUOTED(IPV6CALC_PACKAGE_VERSION_BUGFIX, $PACKAGE_VERSION_BUGFIX , "Package version Bugfix") 34AC_DEFINE_UNQUOTED(IPV6CALC_PACKAGE_VERSION_STRING, "$PACKAGE_VERSION_STRING", "Package version as string") 35AC_DEFINE_UNQUOTED(IPV6CALC_PACKAGE_VERSION_NUMERIC, $PACKAGE_VERSION_NUMERIC , "Package version numeric") 36 37dnl API version variants 38API_VERSION_NUMERIC=$(echo "$API_VERSION_MAJOR $API_VERSION_MINOR $API_VERSION_BUGFIX" | awk '{ print ( $1 * 1000 + $2 ) * 1000 + $3 }') 39API_VERSION_STRING=$(echo "$API_VERSION_MAJOR.$API_VERSION_MINOR.$API_VERSION_BUGFIX") 40 41AC_DEFINE_UNQUOTED(IPV6CALC_API_VERSION_MAJOR, $API_VERSION_MAJOR , "API version Major") 42AC_DEFINE_UNQUOTED(IPV6CALC_API_VERSION_MINOR, $API_VERSION_MINOR , "API version Minor") 43AC_DEFINE_UNQUOTED(IPV6CALC_API_VERSION_BUGFIX, $API_VERSION_BUGFIX , "API version Bugfix") 44AC_DEFINE_UNQUOTED(IPV6CALC_API_VERSION_STRING, "$API_VERSION_STRING", "API version as string") 45AC_DEFINE_UNQUOTED(IPV6CALC_API_VERSION_NUMERIC, $API_VERSION_NUMERIC , "API version numeric") 46 47dnl Define version header 48AC_CONFIG_HEADER(config.h) 49 50dnl Checks for programs. 51AC_PROG_AWK 52AC_PROG_CC 53dnl AC_PROG_INSTALL 54AC_PROG_RANLIB 55AC_PROG_MAKE_SET 56 57dnl Checks for header files. 58AC_HEADER_STDC 59 60dnl Checks for typedefs, structures, and compiler characteristics. 61AC_C_CONST 62AC_TYPE_OFF_T 63AC_TYPE_SIZE_T 64AC_C_BIGENDIAN 65 66dnl Copy inital provided CFLAGS into CFLAGS_EXTRA 67CFLAGS_EXTRA=$CFLAGS 68 69dnl Copy inital provided LDFLAGS into LDFLAGS_EXTRA 70LDFLAGS_EXTRA=$LDFLAGS 71 72 73dnl ************************************************* 74dnl 32-bit mode 75dnl ************************************************* 76AC_ARG_ENABLE( 77 [m32], 78 AS_HELP_STRING([--enable-m32], 79 [Enable 32-bit compilation]), 80 [ 81 if test "$enable_m32" = "yes"; then 82 AC_MSG_RESULT([*** switch to 32-bit compilation]) 83 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-m32 -DMMDB_UINT128_IS_BYTE_ARRAY=1" 84 LDFLAGS="${LDFLAGS:+$LDFLAGS }-m32" 85 fi 86 ]) 87 88 89dnl ************************************************* 90dnl check for compiler options for several -W* 91dnl ************************************************* 92AC_ARG_ENABLE([compiler-warning-to-error], 93 AS_HELP_STRING([--disable-compiler-warning-to-error], 94 [Disable extra CFLAGS for mapping warnings to errors during compilation]), 95 [ 96 ],[ 97 AC_MSG_RESULT([**** analyze compiler options: CC=$CC]) 98 99 AC_MSG_RESULT([*** check for CFLAGS: -Werror=format-security]) 100 CFLAGS_SAVE="$CFLAGS" 101 CFLAGS="$CFLAGS -Wformat -Werror -Werror=format-security" 102 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 103 [[int a=1;]]) 104 ], 105 [ 106 AC_MSG_RESULT([*** CFLAGS supported: -Werror=format-security]) 107 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-Wformat -Werror -Werror=format-security" 108 ], 109 [ 110 AC_MSG_WARN([*** missing CFLAGS support: -Werror=format-security]) 111 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-Wformat" 112 ]) 113 CFLAGS="$CFLAGS_SAVE" 114 115 AC_MSG_RESULT([*** check for CFLAGS: -Wsizeof-array-argument]) 116 CFLAGS_SAVE="$CFLAGS" 117 CFLAGS="$CFLAGS -Wsizeof-array-argument" 118 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 119 [[int a=1;]]) 120 ], 121 [ 122 AC_MSG_RESULT([*** CFLAGS supported: -Wsizeof-array-argument]) 123 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-Wsizeof-array-argument" 124 ], 125 [ 126 AC_MSG_WARN([*** missing CFLAGS support: -Wsizeof-array-argument]) 127 ]) 128 CFLAGS="$CFLAGS_SAVE" 129 130 AC_MSG_RESULT([*** check for CFLAGS: -Wparentheses-equality]) 131 CFLAGS_SAVE="$CFLAGS" 132 CFLAGS="$CFLAGS -Wparentheses-equality" 133 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 134 [[int a=1;]]) 135 ], 136 [ 137 AC_MSG_RESULT([*** CFLAGS supported: -Wparentheses-equality]) 138 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-Wparentheses-equality" 139 ], 140 [ 141 AC_MSG_WARN([*** missing CFLAGS support: -Wparentheses-equality]) 142 ]) 143 CFLAGS="$CFLAGS_SAVE" 144 145 AC_MSG_RESULT([*** check for CFLAGS: -Wextra]) 146 CFLAGS_SAVE="$CFLAGS" 147 CFLAGS="$CFLAGS -Wextra" 148 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 149 [[int a=1;]]) 150 ], 151 [ 152 AC_MSG_RESULT([*** CFLAGS supported: -Wextra]) 153 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-Wextra" 154 ], 155 [ 156 AC_MSG_WARN([*** missing CFLAGS support: -Wextra]) 157 ]) 158 CFLAGS="$CFLAGS_SAVE" 159 160 AC_MSG_RESULT([*** check for CFLAGS: -Werror=format-truncation=0]) 161 CFLAGS_SAVE="$CFLAGS" 162 CFLAGS="$CFLAGS -Werror -Werror=format-truncation=0" 163 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 164 [[int a=1;]]) 165 ], 166 [ 167 AC_MSG_RESULT([*** CFLAGS supported: -Werror=format-truncation=0]) 168 # disable errors related to format-truncation 169 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-Werror=format-truncation=0" 170 ], 171 [ 172 AC_MSG_WARN([*** missing CFLAGS support: -Werror=format-truncation=0]) 173 ]) 174 CFLAGS="$CFLAGS_SAVE" 175 176 AC_MSG_RESULT([*** check for CFLAGS: -Werror=char-subscripts]) 177 CFLAGS_SAVE="$CFLAGS" 178 CFLAGS="$CFLAGS -Werror -Werror=char-subscripts" 179 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 180 [[int a=1;]]) 181 ], 182 [ 183 AC_MSG_RESULT([*** CFLAGS supported: -Werror=char-subscripts]) 184 # disable errors related to format-truncation 185 CFLAGS_EXTRA="${CFLAGS_EXTRA:+$CFLAGS_EXTRA }-Werror=char-subscripts" 186 ], 187 [ 188 AC_MSG_WARN([*** missing CFLAGS support: -Werror=char-subscripts]) 189 ]) 190 CFLAGS="$CFLAGS_SAVE" 191 ]) 192 193dnl ************************************************* 194dnl add -Wno-unused-const-variable if supported 195dnl ************************************************* 196dnl AC_MSG_RESULT([*** check for CFLAGS: -Wno-unused-const-variable]) 197dnl CFLAGS_SAVE="$CFLAGS" 198dnl CFLAGS="$CFLAGS -Wno-unused-const-variable" 199dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 200dnl [[int a=1;]]) 201dnl ], 202dnl [ 203dnl AC_MSG_RESULT([*** CFLAGS supported: -Wno-unused-const-variable]) 204dnl CFLAGS_EXTRA="-Wno-unused-const-variable" 205dnl ], 206dnl [ 207dnl AC_MSG_WARN([*** missing CFLAGS support: -Wno-unused-const-variable]) 208dnl CFLAGS_EXTRA="-Wformat" 209dnl ]) 210dnl CFLAGS="$CFLAGS_SAVE" 211 212 213dnl ************************************************* 214dnl getopt library 215dnl ************************************************* 216ENABLE_BUNDLED_GETOPT=0 217AC_ARG_ENABLE( 218 [bundled-getopt], 219 AS_HELP_STRING([--enable-bundled-getopt], 220 [Enable bundled getopt library (default: autoselected)]), 221 [ 222 if test "$enable_bundled_getopt" = "yes"; then 223 AC_MSG_RESULT([*** use of bundled getopt library forced]) 224 ENABLE_BUNDLED_GETOPT=1 225 else 226 AC_MSG_RESULT([*** use of system getopt library forced]) 227 fi 228 ], 229 [ 230 AC_CHECK_FUNC(getopt_long, 231 [ 232 AC_MSG_RESULT([*** use of system getopt library autoselected]) 233 ], 234 [ 235 AC_MSG_RESULT([*** use of bundled getopt library autoselected]) 236 ENABLE_BUNDLED_GETOPT=1 237 ]) 238 ]) 239 240if test "$ENABLE_BUNDLED_GETOPT" = "1"; then 241 AC_LIBOBJ(../getopt/getopt) 242 AC_LIBOBJ(../getopt/getopt1) 243 GETOPT_INCLUDE=-I../getopt 244 AC_DEFINE(ENABLE_BUNDLED_GETOPT, 1, Define if bundled GETOPT should be used) 245fi 246 247AC_SUBST(GETOPT_INCLUDE) 248AC_SUBST(ENABLE_BUNDLED_GETOPT) 249 250 251dnl ************************************************* 252dnl MD5 library 253dnl ************************************************* 254ENABLE_BUNDLED_MD5=0 255AC_ARG_ENABLE( 256 [bundled-md5], 257 AS_HELP_STRING([--enable-bundled-md5], 258 [Enable bundled MD5 library (default: autoselected)]), 259 [ 260 if test "$enable_bundled_md5" = "yes"; then 261 AC_MSG_RESULT([*** use of bundled MD5 library forced]) 262 ENABLE_BUNDLED_MD5=1 263 else 264 AC_MSG_RESULT([*** use of system MD5 library forced]) 265 fi 266 ], 267 [ 268 AC_CHECK_HEADER(openssl/md5.h, [ 269 AC_MSG_RESULT([*** openssl/md5.h header file found]) 270 AC_CHECK_LIB(crypto, MD5_Init, 271 [ 272 LDFLAGS="-lcrypto $LDFLAGS" 273 AC_CHECK_FUNCS(MD5_Init MD5_Update MD5_Final, 274 [ 275 md5_found="yes" 276 ], 277 [ 278 ENABLE_BUNDLED_MD5=1 279 ]) 280 if test "$md5_found" = "yes"; then 281 AC_MSG_RESULT([*** use of system MD5 library autoselected]) 282 else 283 AC_MSG_RESULT([*** use of bundled MD5 library autoselected]) 284 fi 285 ], 286 [ 287 AC_MSG_WARN([crypto library header files were found but not supporting required MD5 functions (will use bundled MD5 function).]) 288 ENABLE_BUNDLED_MD5=1 289 ]) 290 ], [ 291 AC_MSG_WARN([openssl/md5.h header file not found (will use bundled MD5 function).]) 292 ENABLE_BUNDLED_MD5=1 293 ]) 294 ],[ 295 ]) 296 297if test "$ENABLE_BUNDLED_MD5" = "1"; then 298 AC_LIBOBJ(../md5/md5) 299 GETOPT_INCLUDE=-I../md5 300 AC_DEFINE(ENABLE_BUNDLED_MD5, 1, Define if bundled MD5 should be used) 301else 302 LDFLAGS_EXTRA="-lcrypto $LDFLAGS_EXTRA" 303 LDFLAGS_EXTRA_MOD_IPV6CALC="-lcrypto $LDFLAGS_EXTRA_MOD_IPV6CALC" 304 LDFLAGS_EXTRA_STATIC="-lcrypto -lz -ldl $LDFLAGS_EXTRA_STATIC" 305fi 306 307AC_SUBST(MD5_INCLUDE) 308AC_SUBST(ENABLE_BUNDLED_MD5) 309 310 311dnl ************************************************* 312dnl defaults 313dnl ************************************************* 314geoip_db_default="/usr/share/GeoIP" 315ip2location_db_default="/usr/share/IP2Location" 316dbip_db_default="/usr/share/DBIP" 317external_db_default="/usr/share/ipv6calc/db" 318 319mmdb_dyn_lib_default="libmaxminddb.so.0" 320ip2location_dyn_lib_default="libIP2Location.so.3" 321 322 323dnl ************************************************* 324dnl Create binaries ushing shared library 325dnl ************************************************* 326AC_ARG_ENABLE( 327 [shared], 328 AS_HELP_STRING([--enable-shared], 329 [Enable shared library build (default: disabled)]) 330 ) 331 332if test "$enable_shared" = "yes"; then 333 AC_MSG_RESULT([*** Shared library build enabled]) 334 SHARED_LIBRARY="yes" 335 AC_DEFINE(SHARED_LIBRARY, 1, Define if you want ipv6calc binaries compiled with shared library libipv6calc) 336 LDFLAGS_EXTRA_MOD_IPV6CALC="-Wl,../lib/libipv6calc.so.$PACKAGE_VERSION -Wl,../databases/lib/libipv6calc_db_wrapper.so.$PACKAGE_VERSION $LDFLAGS_EXTRA" 337 LDFLAGS_EXTRA="../lib/libipv6calc.so.$PACKAGE_VERSION ../databases/lib/libipv6calc_db_wrapper.so.$PACKAGE_VERSION $LDFLAGS_EXTRA" 338 LD_LIBRARY_PATH=../lib:../databases/lib:$LD_LIBRARY_PATH 339 LD_LIBRARY_PATH_BASIC=../lib:../databases/lib:$LD_LIBRARY_PATH_BASIC 340else 341 SHARED_LIBRARY="no" 342 IPV6CALC_LIB="-L../lib/ -L../databases/lib/ -lipv6calc_db_wrapper -lipv6calc" 343fi 344 345AC_SUBST(SHARED_LIBRARY) 346AC_SUBST(IPV6CALC_LIB) 347 348 349dnl ************************************************* 350dnl Check for dynamic loading of libraries capability 351dnl ************************************************* 352AC_CHECK_HEADER(dlfcn.h, 353 [ 354 AC_MSG_RESULT([*** Dynamic loading of libraries is SUPPORTED]) 355 DYNAMIC_LOAD_SUPPORT="yes" 356 ], 357 [ 358 DYNAMIC_LOAD_SUPPORT="no" 359 AC_MSG_WARN(["Dynamic loading of libraries is not supported, no header file found"]) 360 ]) 361 362AC_ARG_ENABLE( 363 [dynamic-load], 364 AS_HELP_STRING([--disable-dynamic-load], 365 [Disable dynamic load of libraries (default: enabled)]) 366 ) 367 368if test "$enable_dynamic_load" = "yes"; then 369 DYNAMIC_LOAD="no" 370else 371 DYNAMIC_LOAD="yes" 372fi 373 374if test "$DYNAMIC_LOAD_SUPPORT" = "yes"; then 375 if test "$DYNAMIC_LOAD" = "no"; then 376 AC_MSG_WARN(["Dynamic loading of libraries forced to be disabled"]) 377 fi 378fi 379 380dnl ************************************************* 381dnl internal databases default 382dnl ************************************************* 383BUILTIN="no" 384 385dnl ************************************************* 386dnl disable built-in database IEEE 387dnl ************************************************* 388AC_ARG_ENABLE([db-ieee], 389 AS_HELP_STRING([--disable-db-ieee], 390 [Disable built-in IEEE database (default: enabled)]), 391 [ 392 DB_IEEE="$enable_db_ieee" 393 ],[ 394 DB_IEEE="yes" 395 BUILTIN="yes" 396 ]) 397 398if test "$DB_IEEE" = "yes"; then 399 AC_DEFINE(SUPPORT_DB_IEEE, 1, Define if you want IEEE database included.) 400fi 401 402 403dnl ************************************************* 404dnl disable built-in database IPv4 405dnl ************************************************* 406AC_ARG_ENABLE([db-ipv4], 407 AS_HELP_STRING([--disable-db-ipv4], 408 [Disable built-in IPv4-to-Registry database (default: enabled)]), 409 [ 410 DB_IPV4="$enable_db_ipv4" 411 ],[ 412 DB_IPV4="yes" 413 BUILTIN="yes" 414 ]) 415 416if test "$DB_IPV4" = "yes"; then 417 AC_DEFINE(SUPPORT_DB_IPV4_REG, 1, Define if you want IPv4-to-Registry database included.) 418fi 419 420 421dnl ************************************************* 422dnl disable built-in database IPv6 423dnl ************************************************* 424AC_ARG_ENABLE([db-ipv6], 425 AS_HELP_STRING([--disable-db-ipv6], 426 [Disable built-in IPv6-to-Registry database (default: enabled)]), 427 [ 428 DB_IPV6="$enable_db_ipv6" 429 ], 430 [ 431 DB_IPV6="yes" 432 BUILTIN="yes" 433 ]) 434 435if test "$DB_IPV6" = "yes"; then 436 AC_DEFINE(SUPPORT_DB_IPV6_REG, 1, Define if you want IPv6-to-Registry database included.) 437fi 438 439 440dnl ************************************************* 441dnl disable built-in database AS->Registry 442dnl ************************************************* 443AC_ARG_ENABLE([db-as-registry], 444 AS_HELP_STRING([--disable-db-as-registry], 445 [Disable built-in AS-to-Registry database (default: enabled)]), 446 [ 447 DB_AS_REG="$enable_db_as_registry" 448 ], 449 [ 450 DB_AS_REG="yes" 451 BUILTIN="yes" 452 ]) 453 454if test "$DB_AS_REG" = "yes"; then 455 AC_DEFINE(SUPPORT_DB_AS_REG, 1, Define if you want AS-to-Registry database included.) 456fi 457 458 459dnl ************************************************* 460dnl disable built-in database CC->Registry 461dnl ************************************************* 462AC_ARG_ENABLE([db-cc-registry], 463 AS_HELP_STRING([--disable-db-cc-registry], 464 [Disable built-in CountryCode-to-Registry database (default: enabled)]), 465 [ 466 DB_CC_REG="$enable_db_cc_registry" 467 ], 468 [ 469 DB_CC_REG="yes" 470 BUILTIN="yes" 471 ]) 472 473if test "$DB_CC_REG" = "yes"; then 474 AC_DEFINE(SUPPORT_DB_CC_REG, 1, Define if you want CC-to-Registry database included.) 475fi 476 477 478dnl ************************************************* 479dnl Built-in database support (catch-all) 480dnl ************************************************* 481AC_ARG_ENABLE([builtin], 482 AS_HELP_STRING([--disable-builtin], 483 [Disable all built-in databases (default: enabled)]), 484 [ 485 DB_CC_REG="$enable_builtin" 486 DB_AS_REG="$enable_builtin" 487 DB_IEEE="$enable_builtin" 488 DB_IPV4="$enable_builtin" 489 DB_IPV6="$enable_builtin" 490 ], 491 [ 492 ]) 493 494 495 496dnl ************************************************* 497dnl enable built-in database support in general 498dnl ************************************************* 499if test "$BUILTIN" = "yes"; then 500 AC_DEFINE(SUPPORT_BUILTIN, 1, Define if you want general BuiltIn database included.) 501fi 502 503 504dnl ************************************************* 505dnl External ipv6calc db support 506dnl ************************************************* 507AC_ARG_ENABLE([external], 508 AS_HELP_STRING([--enable-external], 509 [Enable external db support (default: disabled)]), 510 [ 511 EXTERNAL="$enable_external" 512 ], 513 [ 514 EXTERNAL="no" 515 ]) 516 517dnl defaults for database directories 518AC_ARG_WITH([external-db], 519 AS_HELP_STRING([--with-external-db=DIR], 520 [Use specified external database directory, default: /usr/share/ipv6calc/db]), 521 [ 522 external_db="$with_external_db" 523 ], 524 [ 525 external_db=$external_db_default 526 ]) 527 528if test "$EXTERNAL" = "yes"; then 529 require_libdb="yes" 530 531 AC_DEFINE(SUPPORT_EXTERNAL, 1, Define if you want external support included.) 532 AC_MSG_RESULT([*** external db dir: $external_db]) 533 AC_DEFINE_UNQUOTED(EXTERNAL_DB, "$external_db", Define external database directory.) 534fi 535 536EXTERNAL_DB=$external_db 537AC_SUBST(EXTERNAL_DB) 538 539 540dnl ************************************************* 541dnl libdb required 542dnl ************************************************* 543if test "$require_libdb" = "yes"; then 544 AC_CHECK_HEADER(db.h, [ 545 AC_CHECK_LIB(db, db_create, 546 [ 547 AC_MSG_RESULT([*** Berkeley DB library found and usable]) 548 ], 549 [ 550 AC_MSG_ERROR([Berkeley DB library file misses db_create]) 551 ]) 552 ], 553 [ 554 AC_MSG_ERROR([Berkeley DB library header files not found (perhaps missing one of the following packages: db4-devel libdb-devel)]) 555 ]) 556 557 LDFLAGS_EXTRA="${LDFLAGS_EXTRA:+$LDFLAGS_EXTRA }-ldb" 558 LDFLAGS="${LDFLAGS:+$LDFLAGS }-ldb" 559 LDFLAGS_EXTRA_MOD_IPV6CALC="-ldb $LDFLAGS_EXTRA_MOD_IPV6CALC" 560 AC_DEFINE(HAVE_BERKELEY_DB_SUPPORT, 1, Define if Berkeley DB support is required.) 561fi 562 563 564dnl ************************************************* 565dnl MaxMindDB support (GeoIP2, DB-IP) 566dnl ************************************************* 567MMDB_LIB_NAME="maxminddb" 568MMDB_INCLUDE_VERSION="" 569 570AC_ARG_ENABLE([mmdb], 571 AS_HELP_STRING([--enable-mmdb], 572 [Enable MaxMindDB support (GeoIP/db-ip.com) (default: disabled)]), 573 [ 574 if test "$enable_mmdb" != "no"; then 575 MMDB="$enable_mmdb" 576 fi 577 ],[ 578 MMDB="no" 579 ]) 580 581AC_ARG_WITH([mmdb-dynamic], 582 AS_HELP_STRING([--with-mmdb-dynamic], 583 [Enable use of dynamic loading of MaxMindDB library (default=no)]), 584 [ 585 if test "$with_mmdb_dynamic" != "no"; then 586 MMDB_DYN="yes" 587 fi 588 ],[ 589 true 590 ]) 591 592AC_ARG_WITH([mmdb-headers], 593 AS_HELP_STRING([--with-mmdb-headers=DIR], 594 [MaxMindDB include files location]), 595 [ 596 MMDB_INCLUDE_DIR="$with_mmdb_headers" 597 ]) 598 599if test -n "$MMDB_INCLUDE_DIR"; then 600 MMDB_INCLUDE="-I$MMDB_INCLUDE_DIR" 601 if echo "$MMDB_INCLUDE_DIR" | grep -q "^/"; then 602 # absolute path 603 MMDB_INCLUDE_L1="-I$MMDB_INCLUDE_DIR" 604 MMDB_INCLUDE_L2="-I$MMDB_INCLUDE_DIR" 605 else 606 MMDB_INCLUDE_L1="-I../$MMDB_INCLUDE_DIR" 607 MMDB_INCLUDE_L2="-I../../$MMDB_INCLUDE_DIR" 608 fi 609fi 610 611AC_ARG_WITH([mmdb-lib], 612 AS_HELP_STRING([--with-mmdb-lib=DIR], 613 [MaxMindDB library location]), 614 [ 615 if test -d "$with_mmdb_lib"; then 616 MMDB_LIB_DIR="$with_mmdb_lib" 617 MMDB_LIB="-L$MMDB_LIB_DIR $MMDB_LIB" 618 AC_MSG_RESULT([MaxMindDB library directory given: $MMDB_LIB_DIR]) 619 else 620 AC_MSG_ERROR([MaxMindDB library directory not found: $with_mmdb_lib]) 621 fi 622 623 if echo "$MMDB_LIB_DIR" | grep -q "^/"; then 624 # absolute path 625 MMDB_LIB_L1="-L$MMDB_LIB_DIR" 626 MMDB_LIB_L2="-L$MMDB_LIB_DIR" 627 LD_LIBRARY_PATH=$MMDB_LIB_DIR:$LD_LIBRARY_PATH 628 else 629 MMDB_LIB_L1="-L../$MMDB_LIB_DIR" 630 MMDB_LIB_L2="-L../../$MMDB_LIB_DIR" 631 LD_LIBRARY_PATH=../$MMDB_LIB_DIR:$LD_LIBRARY_PATH 632 fi 633 ]) 634 635AC_ARG_WITH([mmdb-dyn-lib], 636 AS_HELP_STRING([--with-mmdb-dyn-lib=NAME], 637 [Use specified MaxMindDB dynamic library, default: libmaxminddb.so.0]), 638 [ 639 mmdb_dyn_lib="$with_mmdb_dyn_lib" 640 ], 641 [ 642 mmdb_dyn_lib=$mmdb_dyn_lib_default 643 ]) 644 645if test "$MMDB" = "yes"; then 646 if test "$MMDB_DYN" != "yes"; then 647 MMDB_LIB="-l$MMDB_LIB_NAME $MMDB_LIB" 648 MMDB_LIB_L1="-l$MMDB_LIB_NAME $MMDB_LIB_L1" 649 MMDB_LIB_L2="-l$MMDB_LIB_NAME $MMDB_LIB_L2" 650 else 651 AC_MSG_RESULT([*** MaxMindDB dynamic load support enabled, disable MaxMindDB linker options]) 652 fi 653 654 CPPFLAGS="$CPPLAGS $MMDB_INCLUDE" 655 656 AC_MSG_RESULT([*** MaxMindDB support requested]) 657 658 AC_MSG_RESULT([***** CPPFLAGS=$CPPFLAGS]) 659 AC_MSG_RESULT([***** CFLAGS =$CFLAGS]) 660 AC_MSG_RESULT([***** LDFLAGS =$LDFLAGS]) 661 662 AC_CHECK_HEADER(maxminddb.h, [ 663 if test -n "$MMDB_INCLUDE_DIR"; then 664 if test -e "$MMDB_INCLUDE_DIR/maxminddb.h"; then 665 CPPFLAGS="$CPPFLAGS -include $MMDB_INCLUDE_DIR/maxminddb.h" 666 else 667 AC_MSG_ERROR([MaxMindDB library header file not found: $MMDB_INCLUDE_DIR/maxminddb.h]) 668 fi 669 else 670 CPPFLAGS="$CPPFLAGS -include maxminddb.h" 671 fi 672 673 AC_CHECK_DECL([MMDB_open],, 674 AC_MSG_ERROR([MaxMindDB library header file misses MMDB_open])) 675 676 AC_CHECK_DECLS([MMDB_lib_version]) 677 678 ], 679 [ 680 AC_MSG_ERROR([MaxMindDB library header files not found]) 681 ]) 682 683 AC_MSG_RESULT([*** MaxMindDB database directory: $mmdb_db]) 684 AC_DEFINE_UNQUOTED(MMDB_DB, "$mmdb_db", Define MaxMindDB database directory.) 685 686 if test "$MMDB_DYN" != "yes"; then 687 CPPFLAGS="$CFLAGS" 688 689 if test -n "$MMDB_LIB_DIR"; then 690 if test -e "$MMDB_LIB_DIR/lib$MMDB_LIB_NAME.so"; then 691 LDFLAGS="$LDFLAGS -L$MMDB_LIB_DIR" 692 CFLAGS="$CFLAGS -L$MMDB_LIB_DIR" 693 LIBS="-L$MMDB_LIB_DIR" 694 else 695 AC_MSG_ERROR([MaxMindDB library file not found: $MMDB_INCLUDE_DIR/lib$MMDB_LIB_NAME.so]) 696 fi 697 fi 698 699 AC_MSG_RESULT([***** CPPFLAGS=$CPPFLAGS]) 700 AC_MSG_RESULT([***** CFLAGS =$CFLAGS]) 701 AC_MSG_RESULT([***** LDFLAGS =$LDFLAGS]) 702 703 AC_CHECK_LIB($MMDB_LIB_NAME, MMDB_open, 704 [ 705 AC_DEFINE(SUPPORT_MMDB, 1, Define if you want MaxMindDB support.) 706 AC_MSG_RESULT([*** MaxMindDB support enabled]) 707 ], 708 [ 709 AC_MSG_ERROR([MaxMindDB library header files given but the library was not found, LDFLAGS=$LDFLAGS]) 710 ]) 711 else 712 # wrapper detects by itself the real support 713 AC_MSG_RESULT([*** GeoIP dyn lib: $mmdb_dyn_lib]) 714 AC_DEFINE_UNQUOTED(MMDB_DYN_LIB, "$mmdb_dyn_lib", Define MaxMindDB dynamic library.) 715 716 AC_MSG_RESULT([*** MaxMindDB support will be implemented by using dynamic load of library]) 717 AC_DEFINE(SUPPORT_MMDB, 1, Define if you want MaxMindDB support.) 718 AC_DEFINE(SUPPORT_MMDB_DYN, 1, Define if you want MaxMindDB support with dynamic loading support - requires also additional linker options.) 719 fi 720 721 # GeoIPv2 and DBIPv2 support 722 AC_ARG_ENABLE([geoip2], 723 AS_HELP_STRING([--disable-geoip2], 724 [Disable MaxMindDB support for GeoIP (default: enabled)]), 725 [ 726 GEOIP2="no" 727 ],[ 728 GEOIP2="yes" 729 ]) 730 731 AC_ARG_ENABLE([dbip2], 732 AS_HELP_STRING([--disable-dbip2], 733 [Disable MaxMindDB support for db-ip.com (default: enabled)]), 734 [ 735 DBIP2="no" 736 ],[ 737 DBIP2="yes" 738 ]) 739else 740 GEOIP2=no 741 DBIP2=no 742fi 743 744AC_SUBST(MMDB_INCLUDE) 745AC_SUBST(MMDB_INCLUDE_VERSION) 746AC_SUBST(MMDB_INCLUDE_L2) 747AC_SUBST(MMDB_INCLUDE_L1) 748AC_SUBST(MMDB_LIB) 749AC_SUBST(MMDB_LIB_L1) 750AC_SUBST(MMDB_LIB_L2) 751AC_SUBST(MMDB_DYN_LIB) 752 753if test -n "$MMDB_INCLUDE_VERSION"; then 754 AC_DEFINE_UNQUOTED(MMDB_INCLUDE_VERSION, "$MMDB_INCLUDE_VERSION", MaxMindDB include file version.) 755fi 756 757 758dnl ************************************************* 759dnl DB-IP.com support 760dnl ************************************************* 761AC_ARG_ENABLE([dbip], 762 AS_HELP_STRING([--enable-dbip], 763 [Compatibility Dummy (no longer supported)]), 764 [ 765 ], 766 [ 767 ]) 768 769dnl defaults for database directories 770AC_ARG_WITH([dbip-db], 771 AS_HELP_STRING([--with-dbip-db=DIR], 772 [Use specified db-ip.com database directory, default: /usr/share/DBIP]), 773 [ 774 dbip_db="$with_dbip_db" 775 ], 776 [ 777 dbip_db=$dbip_db_default 778 ]) 779 780if test "$DBIP2" = "yes"; then 781 AC_MSG_RESULT([*** db-ip.com (MaxMindDB) support auotenabled"]) 782 AC_DEFINE(SUPPORT_DBIP2, 1, Define if you want db-ip.com (MaxMindDB) support included.) 783 AC_MSG_RESULT([*** db-ip.com (MaxMindDB) database directory: $dbip_db]) 784 AC_DEFINE_UNQUOTED(DBIP2_DB, "$dbip_db", Define db-ip.com (MaxMindDB) database directory.) 785fi 786 787DBIP2_DB=$dbip_db 788AC_SUBST(DBIP2_DB) 789 790 791dnl ************************************************* 792dnl IP2Location support 793dnl ************************************************* 794IP2LOCATION_LIB_NAME="IP2Location" 795IP2LOCATION_INCLUDE_VERSION="" 796 797AC_ARG_ENABLE([ip2location], 798 AS_HELP_STRING([--enable-ip2location], 799 [Enable IP2Location support (default: disabled)]), 800 [ 801 IP2LOCATION="$enable_ip2location" 802 ],[ 803 IP2LOCATION="no" 804 ]) 805 806AC_ARG_WITH([ip2location-dynamic], 807 AS_HELP_STRING([--with-ip2location-dynamic], 808 [Enable use of dynamic loading of IP2Location library (default=no)]), 809 [ 810 if test "$enable_ip2location_dynamic" != "no"; then 811 IP2LOCATION_DYN="yes" 812 fi 813 ],[ 814 true 815 ]) 816 817AC_ARG_WITH([ip2location-headers], 818 AS_HELP_STRING([--with-ip2location-headers=DIR], 819 [IP2Location include files location]), 820 [ 821 IP2LOCATION_INCLUDE_DIR="$with_ip2location_headers" 822 ]) 823 824AC_ARG_WITH([ip2location-headers-fallback], 825 AS_HELP_STRING([--with-ip2location-headers-fallback], 826 [Compatibility Dummy (no longer supported)]), 827 [ 828 ]) 829 830if test -n "$IP2LOCATION_INCLUDE_DIR"; then 831 IP2LOCATION_INCLUDE="-I$IP2LOCATION_INCLUDE_DIR" 832 if test -d "$IP2LOCATION_INCLUDE_DIR/iMath"; then 833 # include iMath where existing (API < 7.0.0) 834 IP2LOCATION_INCLUDE="$IP2LOCATION_INCLUDE -I$IP2LOCATION_INCLUDE_DIR/iMath" 835 fi 836 if echo "$IP2LOCATION_INCLUDE_DIR" | grep -q "^/"; then 837 # absolute path 838 IP2LOCATION_INCLUDE_L1="-I$IP2LOCATION_INCLUDE_DIR" 839 IP2LOCATION_INCLUDE_L2="-I$IP2LOCATION_INCLUDE_DIR" 840 if test -d "$IP2LOCATION_INCLUDE_DIR/iMath"; then 841 # include iMath where existing (API < 7.0.0) 842 IP2LOCATION_INCLUDE_L1="$IP2LOCATION_INCLUDE_L1 -I$IP2LOCATION_INCLUDE_DIR/iMath" 843 IP2LOCATION_INCLUDE_L2="$IP2LOCATION_INCLUDE_L2 -I$IP2LOCATION_INCLUDE_DIR/iMath" 844 fi 845 else 846 IP2LOCATION_INCLUDE_L1="-I../$IP2LOCATION_INCLUDE_DIR" 847 IP2LOCATION_INCLUDE_L2="-I../../$IP2LOCATION_INCLUDE_DIR" 848 if test -d "$IP2LOCATION_INCLUDE_DIR/iMath"; then 849 # include iMath where existing (API < 7.0.0) 850 IP2LOCATION_INCLUDE_L1="$IP2LOCATION_INCLUDE_L1 -I../$IP2LOCATION_INCLUDE_DIR/iMath" 851 IP2LOCATION_INCLUDE_L2="$IP2LOCATION_INCLUDE_L2 -I../../$IP2LOCATION_INCLUDE_DIR/iMath" 852 fi 853 fi 854fi 855 856AC_ARG_WITH([ip2location-lib], 857 AS_HELP_STRING([--with-ip2location-lib=FILE], 858 [IP2Location library location]), 859 [ 860 if test -d "$with_ip2location_lib"; then 861 IP2LOCATION_LIB_DIR="$with_ip2location_lib" 862 IP2LOCATION_LIB="-L$IP2LOCATION_LIB_DIR $IP2LOCATION_LIB" 863 AC_MSG_RESULT([IP2Location library directory given: $IP2LOCATION_LIB_DIR]) 864 else 865 AC_MSG_ERROR([IP2Location library directory not found: $with_ip2location_lib]) 866 fi 867 868 if echo "$IP2LOCATION_LIB_DIR" | grep -q "^/"; then 869 # absolute path 870 IP2LOCATION_LIB_L1="-L$IP2LOCATION_LIB_DIR" 871 IP2LOCATION_LIB_L2="-L$IP2LOCATION_LIB_DIR" 872 if test -n "$LD_LIBRARY_PATH"; then 873 LD_LIBRARY_PATH=$IP2LOCATION_LIB_DIR:$LD_LIBRARY_PATH 874 else 875 LD_LIBRARY_PATH=$IP2LOCATION_LIB_DIR 876 fi 877 else 878 IP2LOCATION_LIB_L1="-L../$IP2LOCATION_LIB_DIR" 879 IP2LOCATION_LIB_L2="-L../../$IP2LOCATION_LIB_DIR" 880 if test -n "$LD_LIBRARY_PATH"; then 881 LD_LIBRARY_PATH=../$IP2LOCATION_LIB_DIR:$LD_LIBRARY_PATH 882 else 883 LD_LIBRARY_PATH=$IP2LOCATION_LIB_DIR 884 fi 885 fi 886 ]) 887 888# must be tested 889#AC_ARG_WITH([ip2location-lib-name], 890# AS_HELP_STRING([--with-ip2location-lib-name=NAME], 891# [IP2Location library name]), 892# [ 893# IP2LOCATION_LIB_NAME="$with_ip2location_lib_name" 894# IP2LOCATION_LIB="-l$IP2LOCATION_LIB_NAME $IP2LOCATION_LIB" 895# AC_MSG_RESULT([IP2Location library name given: $IP2LOCATION_LIB_NAME]) 896# ],[ 897# ]) 898 899AC_ARG_WITH([ip2location-static], 900 AS_HELP_STRING([--with-ip2location-static], 901 [Explicitly link IP2Location statically (default=no)]), 902 [ 903 if test "$with_ip2location_static" != "no"; then 904 IP2LOCATION_LIB="-Wl,-Bstatic $IP2LOCATION_LIB -Wl,-Bdynamic" 905 fi 906 ]) 907 908dnl defaults for database directories 909AC_ARG_WITH([ip2location-db], 910 AS_HELP_STRING([--with-ip2location-db=DIR], 911 [Use specified IP2Location database directory, default: /usr/share/IP2Location]), 912 [ 913 ip2location_db="$with_ip2location_db" 914 ], 915 [ 916 ip2location_db=$ip2location_db_default 917 ]) 918 919AC_ARG_WITH([ip2location-dyn-lib], 920 AS_HELP_STRING([--with-ip2location-dyn-lib=NAME], 921 [Use specified IP2Location dynamic library, default: libIP2Location.so]), 922 [ 923 ip2location_dyn_lib="$with_ip2location_dyn_lib" 924 ], 925 [ 926 ip2location_dyn_lib=$ip2location_dyn_lib_default 927 ]) 928 929if test "$IP2LOCATION" = "yes"; then 930 if test "$IP2LOCATION_DYN" != "yes"; then 931 IP2LOCATION_LIB="-l$IP2LOCATION_LIB_NAME $IP2LOCATION_LIB" 932 IP2LOCATION_LIB_L1="-l$IP2LOCATION_LIB_NAME $IP2LOCATION_LIB_L1" 933 IP2LOCATION_LIB_L2="-l$IP2LOCATION_LIB_NAME $IP2LOCATION_LIB_L2" 934 else 935 AC_MSG_RESULT([**** IP2Location dynamic load support enabled, disable IP2Location linker options]) 936 fi 937 938 CPPFLAGS="$CPPFLAGS $IP2LOCATION_INCLUDE" 939 940 AC_MSG_RESULT([*** IP2Location support requested]) 941 942 AC_MSG_RESULT([***** CPPFLAGS=$CPPFLAGS]) 943 AC_MSG_RESULT([***** CFLAGS =$CFLAGS]) 944 AC_MSG_RESULT([***** LDFLAGS =$LDFLAGS]) 945 946 AC_CHECK_HEADER(IP2Location.h, [ 947 if test -n "$IP2LOCATION_INCLUDE_DIR"; then 948 if test -e "$IP2LOCATION_INCLUDE_DIR/IP2Location.h"; then 949 CPPFLAGS="$CPPFLAGS -include $IP2LOCATION_INCLUDE_DIR/IP2Location.h" 950 else 951 AC_MSG_ERROR([IP2Location library header file not found: $IP2LOCATION_INCLUDE_DIR/IP2Location.h]) 952 fi 953 else 954 CPPFLAGS="$CPPFLAGS -include IP2Location.h" 955 fi 956 957 AC_CHECK_DECL([IP2Location_open],, 958 AC_MSG_ERROR([IP2Location library header file misses IP2Location_open])) 959 960 AC_CHECK_DECLS([IP2Location_close, 961 IP2Location_get_country_short, 962 IP2Location_get_country_long]) 963 964 AC_CHECK_DECLS([API_VERSION]) 965 966 AC_CHECK_DECLS([IP2Location_api_version_string], IP2LOCATION_HAS_API_STRING="yes") 967 AC_CHECK_DECL([IP2Location_lib_version_string], IP2LOCATION_HAS_LIB_STRING="yes") 968 969 AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 970 [[ 971 #include <IP2Location.h> 972 IP2Location loc; 973 void test() { 974 loc.ipv6_database_address = 1; 975 }; 976 ]])],[ 977 AC_MSG_RESULT([IP2Location has full (and updated) IPv6 support (API >= 8.2.0)]) 978 ],[ 979 AC_MSG_ERROR([IP2Location has only compat IPv6 support (API < 7.0.0) or old (API < 8.2.0) which is no longer supported]) 980 ] 981 ) 982 983 AC_CHECK_DECLS([USAGETYPE], 984 [ 985 AC_MSG_RESULT([IP2Location has full support (library >= 6.0.0)]) 986 ], 987 [ 988 AC_MSG_ERROR([IP2Location library header file misses USAGETYPE (library < 6.0.0) which is no longer supported]) 989 ] 990 ) 991 992 ], 993 [ 994 AC_MSG_ERROR([IP2Location library header files not found]) 995 ]) 996 997 AC_MSG_RESULT([*** IP2location db dir: $ip2location_db]) 998 AC_DEFINE_UNQUOTED(IP2LOCATION_DB, "$ip2location_db", Define IP2Location database directory.) 999 1000 if test "$IP2LOCATION_DYN" != "yes"; then 1001 if test "$IP2LOCATION_STATIC" = "yes"; then 1002 AC_DEFINE(SUPPORT_IP2LOCATION_STATIC, 1, Define if you want IP2Location support statically linked - requires also additional linker options.) 1003 fi 1004 1005 CPPFLAGS="$CFLAGS" 1006 1007 if test -n "$IP2LOCATION_LIB_DIR"; then 1008 if test -e "$IP2LOCATION_LIB_DIR/lib$IP2LOCATION_LIB_NAME.so"; then 1009 LDFLAGS="$LDFLAGS -L$IP2LOCATION_LIB_DIR" 1010 CFLAGS="$CFLAGS -L$IP2LOCATION_LIB_DIR" 1011 LIBS="-L$IP2LOCATION_LIB_DIR" 1012 else 1013 AC_MSG_ERROR([IP2Location library file not found: $IP2LOCATION_INCLUDE_DIR/lib$IP2LOCATION_LIB_NAME.so]) 1014 fi 1015 fi 1016 1017 AC_CHECK_LIB($IP2LOCATION_LIB_NAME, IP2Location_api_version_string, 1018 [ 1019 AC_MSG_RESULT([*** IP2Location library supports API version string]) 1020 ],[ 1021 AC_MSG_ERROR([IP2Location library file misses IP2Location_api_version_string - no longer supported]) 1022 ]) 1023 1024 AC_CHECK_LIB($IP2LOCATION_LIB_NAME, IP2Location_lib_version_string, 1025 [ 1026 if test "$IP2LOCATION_HAS_LIB_STRING" != "yes"; then 1027 AC_MSG_ERROR([IP2Location library header file misses IP2Location_lib_version_string while library contains]) 1028 else 1029 AC_MSG_RESULT([*** IP2Location library supports LIB version string]) 1030 fi 1031 ]) 1032 1033 AC_MSG_RESULT([***** CPPFLAGS=$CPPFLAGS]) 1034 AC_MSG_RESULT([***** CFLAGS =$CFLAGS]) 1035 AC_MSG_RESULT([***** LDFLAGS =$LDFLAGS]) 1036 1037 AC_CHECK_LIB($IP2LOCATION_LIB_NAME, IP2Location_open, 1038 [ 1039 AC_DEFINE(SUPPORT_IP2LOCATION, 1, Define if you want IP2Location support.) 1040 AC_MSG_RESULT([*** IP2Location support enabled]) 1041 ], 1042 [ 1043 AC_MSG_ERROR([IP2Location library header files were found but the library was not found, LDFLAGS=$LDFLAGS, CFLAGS=$CFLAGS]) 1044 ]) 1045 else 1046 AC_CHECK_DECLS([IP2Location_api_version_string], 1047 [ 1048 AC_MSG_RESULT([*** IP2Location header supports API version string]) 1049 ],[ 1050 AC_MSG_ERROR([IP2Location library header file misses IP2Location_api_version_string - no longer supported]) 1051 ]) 1052 1053 # wrapper detects by itself the real support 1054 AC_MSG_RESULT([*** IP2Location dyn lib: $ip2location_dyn_lib]) 1055 AC_DEFINE_UNQUOTED(IP2LOCATION_DYN_LIB, "$ip2location_dyn_lib", Define IP2Location dynamic library.) 1056 1057 AC_MSG_RESULT([*** IP2Location support will be implemented by using dynamic load of library]) 1058 AC_DEFINE(SUPPORT_IP2LOCATION, 1, Define if you want IP2Location support.) 1059 AC_DEFINE(SUPPORT_IP2LOCATION_DYN, 1, Define if you want IP2Location support with dynamic loading support - requires also additional linker options.) 1060 fi 1061fi 1062 1063IP2LOCATION_DB=$ip2location_db 1064AC_SUBST(IP2LOCATION_INCLUDE) 1065AC_SUBST(IP2LOCATION_INCLUDE_L1) 1066AC_SUBST(IP2LOCATION_INCLUDE_L2) 1067AC_SUBST(IP2LOCATION_LIB) 1068AC_SUBST(IP2LOCATION_LIB_L1) 1069AC_SUBST(IP2LOCATION_LIB_L2) 1070AC_SUBST(IP2LOCATION_DB) 1071AC_SUBST(IP2LOCATION_DYN_LIB) 1072 1073if test -n "$IP2LOCATION_INCLUDE_VERSION"; then 1074 AC_DEFINE_UNQUOTED(IP2LOCATION_INCLUDE_VERSION, "$IP2LOCATION_INCLUDE_VERSION", IP2Location include file version.) 1075fi 1076 1077 1078dnl ************************************************* 1079dnl GeoIP v1 support 1080dnl ************************************************* 1081GEOIP_LIB_NAME="GeoIP" 1082GEOIP_INCLUDE_VERSION="" 1083 1084AC_ARG_ENABLE([geoip], 1085 AS_HELP_STRING([--enable-geoip], 1086 [Compatibility Dummy (no longer supported)]), 1087 [ 1088 ],[ 1089 ]) 1090 1091AC_ARG_WITH([geoip-dynamic], 1092 AS_HELP_STRING([--with-geoip-dynamic], 1093 [Compatibility Dummy (no longer supported)]), 1094 [ 1095 ],[ 1096 ]) 1097 1098AC_ARG_WITH([geoip-headers], 1099 AS_HELP_STRING([--with-geoip-headers=DIR], 1100 [Compatibility Dummy (no longer supported)]), 1101 [ 1102 ]) 1103 1104AC_ARG_WITH([geoip-headers-fallback], 1105 AS_HELP_STRING([--with-geoip-headers-fallback], 1106 [Compatibility Dummy (no longer supported)]), 1107 [ 1108 ]) 1109 1110AC_ARG_WITH([geoip-lib], 1111 AS_HELP_STRING([--with-geoip-lib=DIR], 1112 [Compatibility Dummy (no longer supported)]), 1113 [ 1114 ]) 1115 1116AC_ARG_WITH([geoip-static], 1117 AS_HELP_STRING([--with-geoip-static], 1118 [Compatibility Dummy (no longer supported)]), 1119 [ 1120 ],[ 1121 ]) 1122 1123AC_ARG_WITH([geoip-dyn-lib], 1124 AS_HELP_STRING([--with-geoip-dyn-lib=NAME], 1125 [Compatibility Dummy (no longer supported)]), 1126 [ 1127 ], 1128 [ 1129 ]) 1130 1131AC_ARG_WITH([geoip-ipv6-compat], 1132 AS_HELP_STRING([--with-geoip-ipv6-compat], 1133 [Compatibility Dummy (no longer supported)]), 1134 [ 1135 ],[ 1136 ]) 1137 1138 1139dnl ************************************************* 1140dnl GeoIP v2 support powered by MaxMindDB 1141dnl ************************************************* 1142if test "$GEOIP2" = "yes"; then 1143 AC_MSG_RESULT([*** GeoIP (MaxMindDB) auotenabled"]) 1144fi 1145 1146 1147dnl ************************************************* 1148dnl GeoIP common support powered by MaxMindDB 1149dnl ************************************************* 1150AC_ARG_WITH([geoip-db], 1151 AS_HELP_STRING([--with-geoip-db=DIR], 1152 [Use specified GeoIP database directory, default: /usr/share/GeoIP]), 1153 [ 1154 geoip_db="$with_geoip_db" 1155 ], 1156 [ 1157 geoip_db=$geoip_db_default 1158 ]) 1159 1160 1161if test "$GEOIP2" = "yes"; then 1162 AC_DEFINE(SUPPORT_GEOIP2, 1, Define if you want GeoIP (MaxMindDB) support.) 1163 AC_MSG_RESULT([*** GeoIP (MaxMindDB) support enabled]) 1164 1165 AC_MSG_RESULT([*** GeoIP (MaxMindDB) database directory: $geoip_db]) 1166 AC_DEFINE_UNQUOTED(GEOIP2_DB, "$geoip_db", Define GeoIP (MaxMindDB) database directory.) 1167fi 1168 1169GEOIP2_DB=$geoip_db 1170 1171 1172dnl ************************************************* 1173dnl Dynamic load used? 1174dnl ************************************************* 1175if test "$DYNAMIC_LOAD" = "yes"; then 1176 if test "$GEOIP_DYN" = "yes" -o "$IP2LOCATION_DYN" = "yes" -o "$MMDB_DYN" = "yes"; then 1177 DYNAMIC_LOAD="yes" 1178 AC_MSG_RESULT([*** Dynamic loading of libraries is ENABLED]) 1179 DYNLOAD_LIB="-rdynamic -ldl" 1180 fi 1181fi 1182 1183AC_SUBST(DYNLOAD_LIB) 1184 1185 1186dnl ************************************************* 1187dnl mod_ipv6calc / apxs - APache eXtension tool 1188dnl ************************************************* 1189AC_ARG_ENABLE([mod_ipv6calc], 1190 AS_HELP_STRING([--enable-mod_ipv6calc], 1191 [Enable build of mod_ipv6calc for Apache (default: disabled)]) 1192 ) 1193 1194if test "$enable_mod_ipv6calc" = "yes"; then 1195 ENABLE_MOD_IPV6CALC="1" 1196else 1197 ENABLE_MOD_IPV6CALC="0" 1198fi 1199 1200AC_SUBST(ENABLE_MOD_IPV6CALC) 1201 1202AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME], 1203 [name of the apxs executable (apxs)]), 1204 [APXS="$with_apxs"]) 1205 1206if test "$ENABLE_MOD_IPV6CALC" = "1"; then 1207 AC_MSG_RESULT([Build of mod_ipv6calc enabled]) 1208 1209 if test -z "$APXS"; then 1210 AC_PATH_PROGS(APXS, apxs2 apxs, [], [$PATH:/usr/local/apache/bin:/usr/sbin]) 1211 fi 1212 1213 if test -z "$APXS"; then 1214 AC_MSG_ERROR([No APXS binary found: cannot create Apache module - missing httpd-devel?]) 1215 else 1216 AC_MSG_RESULT([APXS binary found: $APXS]) 1217 1218 # partially taken from configure.ac from mod_wsgi 1219 AC_MSG_CHECKING(Apache version) 1220 HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`" 1221 HTTPD_INCLUDEDIR="`${APXS} -q INCLUDEDIR`" 1222 if test -x ${HTTPD}; then 1223 HTTPD_VERSION=`${HTTPD} -v | awk '/version/ {print $3}' \ 1224 | awk -F/ '{print $2}'` 1225 else 1226 if test -f ${HTTPD_INCLUDEDIR}/ap_release.h; then 1227 HTTPD_VERSION=`grep '^#define AP_SERVER_MAJORVERSION_NUMBER ' \ 1228 ${HTTPD_INCLUDEDIR}/ap_release.h | sed -e \ 1229 's/^#define AP_SERVER_MAJORVERSION_NUMBER \([0-9]\).*/\1.X/'` 1230 else 1231 if test -f ${HTTPD_INCLUDEDIR}/httpd.h; then 1232 HTTPD_VERSION=`grep '^#define APACHE_RELEASE ' \ 1233 ${HTTPD_INCLUDEDIR}/httpd.h | sed -e \ 1234 's/^#define APACHE_RELEASE \([0-9]\).*/\1.X/'` 1235 else 1236 HTTPD_VERSION="2.?" 1237 fi 1238 fi 1239 fi 1240 1241 HTTPD_LIBEXECDIR="`${APXS} -q libexecdir`" 1242 if test -z "$HTTPD_LIBEXECDIR"; then 1243 AC_MSG_ERROR([${APXS} cannot retrieve libexecdir]) 1244 fi 1245 1246 HTTPD_SYSCONFDIR="`${APXS} -q sysconfdir`" 1247 if test -z "$HTTPD_SYSCONFDIR"; then 1248 AC_MSG_ERROR([${APXS} cannot retrieve sysconfdir]) 1249 fi 1250 1251 if test -n "$HTTPD_SYSCONFDIR"; then 1252 HTTPD_SYSCONFDIR="$HTTPD_SYSCONFDIR.d" 1253 fi 1254 if test -n "$HTTPD_VERSION"; then 1255 HTTPD_VERSION_MAJOR_MINOR=`echo "$HTTPD_VERSION" | awk -F. '{ print $1 "." $2 }'` 1256 fi 1257 fi 1258 1259 AC_SUBST(HTTPD_LIBEXECDIR) 1260 AC_SUBST(HTTPD_SYSCONFDIR) 1261 AC_SUBST(HTTPD_VERSION_MAJOR_MINOR) 1262 AC_SUBST(APXS) 1263else 1264 AC_MSG_WARN([Build of mod_ipv6calc NOT enabled]) 1265fi 1266 1267 1268dnl ************************************************* 1269dnl Files to create from <file>.in 1270dnl ************************************************* 1271AC_SUBST(CFLAGS_EXTRA) 1272AC_SUBST(LDFLAGS_EXTRA) 1273AC_SUBST(LDFLAGS_EXTRA_MOD_IPV6CALC) 1274AC_SUBST(LDFLAGS_EXTRA_STATIC) 1275AC_SUBST(LD_LIBRARY_PATH) 1276AC_SUBST(LD_LIBRARY_PATH_BASIC) 1277 1278AC_OUTPUT([ 1279 Makefile 1280 md5/Makefile 1281 tools/Makefile 1282 getopt/Makefile 1283 ipv6calc/Makefile 1284 lib/Makefile 1285 man/Makefile 1286 databases/lib/Makefile 1287 ipv6logconv/Makefile 1288 ipv6loganon/Makefile 1289 ipv6logstats/Makefile 1290 ipv6calcweb/Makefile 1291 contrib/ipv6calc.spec 1292 tools/ipv6calc-db-update.sh 1293 tools/DBIP-update.sh 1294 tools/IP2Location-update.sh 1295 tools/GeoIP-update.sh 1296 mod_ipv6calc/Makefile 1297 VERSION 1298 ]) 1299 1300AC_MSG_RESULT([***** Summary]) 1301 1302AC_MSG_RESULT([*** MMDB =$MMDB]) 1303AC_MSG_RESULT([*** MMDB_DYN =$MMDB_DYN]) 1304AC_MSG_RESULT([*** MMDB_DYN_LIB =$mmdb_dyn_lib]) 1305AC_MSG_RESULT([*** MMDB_INCLUDE =$MMDB_INCLUDE]) 1306AC_MSG_RESULT([*** MMDB_INCLUDE_VERSION =$MMDB_INCLUDE_VERSION]) 1307AC_MSG_RESULT([*** MMDB_LIB =$MMDB_LIB]) 1308AC_MSG_RESULT([*** MMDB_LIB_NAME =$MMDB_LIB_NAME]) 1309AC_MSG_RESULT([*** MMDB_LIB_DIR =$MMDB_LIB_DIR]) 1310 1311AC_MSG_RESULT([]) 1312 1313AC_MSG_RESULT([*** IP2LOCATION =$IP2LOCATION]) 1314AC_MSG_RESULT([*** IP2LOCATION_DB =$IP2LOCATION_DB]) 1315AC_MSG_RESULT([*** IP2LOCATION_DYN =$IP2LOCATION_DYN]) 1316AC_MSG_RESULT([*** IP2LOCATION_DYN_LIB =$ip2location_dyn_lib]) 1317AC_MSG_RESULT([*** IP2LOCATION_INCLUDE =$IP2LOCATION_INCLUDE]) 1318AC_MSG_RESULT([*** IP2LOCATION_INCLUDE_VERSION=$IP2LOCATION_INCLUDE_VERSION]) 1319AC_MSG_RESULT([*** IP2LOCATION_LIB =$IP2LOCATION_LIB]) 1320AC_MSG_RESULT([*** IP2LOCATION_LIB_NAME =$IP2LOCATION_LIB_NAME]) 1321AC_MSG_RESULT([*** IP2LOCATION_LIB_DIR =$IP2LOCATION_LIB_DIR]) 1322 1323AC_MSG_RESULT([]) 1324 1325AC_MSG_RESULT([*** GEOIP2 =$GEOIP2]) 1326AC_MSG_RESULT([*** GEOIP2_DB =$GEOIP2_DB]) 1327 1328AC_MSG_RESULT([]) 1329 1330AC_MSG_RESULT([*** DBIP2 =$DBIP2]) 1331AC_MSG_RESULT([*** DBIP2_DB =$DBIP2_DB]) 1332 1333AC_MSG_RESULT([]) 1334 1335AC_MSG_RESULT([*** EXTERNAL =$EXTERNAL]) 1336AC_MSG_RESULT([*** EXTERNAL_DB =$EXTERNAL_DB]) 1337 1338AC_MSG_RESULT([]) 1339 1340AC_MSG_RESULT([*** BUILTIN =$BUILTIN]) 1341AC_MSG_RESULT([*** DB_IPV4 =$DB_IPV4]) 1342AC_MSG_RESULT([*** DB_IPV6 =$DB_IPV6]) 1343AC_MSG_RESULT([*** DB_IEEE =$DB_IEEE]) 1344AC_MSG_RESULT([*** DB_AS_REG =$DB_AS_REG]) 1345AC_MSG_RESULT([*** DB_CC_REG =$DB_CC_REG]) 1346 1347AC_MSG_RESULT([]) 1348 1349AC_MSG_RESULT([*** CC =$CC]) 1350AC_MSG_RESULT([*** CFLAGS_EXTRA =$CFLAGS_EXTRA]) 1351AC_MSG_RESULT([*** LDFLAGS_EXTRA =$LDFLAGS_EXTRA]) 1352AC_MSG_RESULT([*** LD_LIBRARY_PATH =$LD_LIBRARY_PATH]) 1353AC_MSG_RESULT([*** LD_LIBRARY_PATH_BASIC =$LD_LIBRARY_PATH_BASIC]) 1354 1355AC_MSG_RESULT([]) 1356 1357AC_MSG_RESULT([*** CPPLAGS =$CPPLAGS]) 1358AC_MSG_RESULT([*** CFLAGS =$CFLAGS]) 1359AC_MSG_RESULT([*** LDFLAGS =$LDFLAGS]) 1360 1361AC_MSG_RESULT([]) 1362 1363AC_MSG_RESULT([*** PACKAGE_VERSION_NUMERIC =$PACKAGE_VERSION_NUMERIC]) 1364AC_MSG_RESULT([*** PACKAGE_VERSION_STRING =$PACKAGE_VERSION_STRING]) 1365AC_MSG_RESULT([*** API_VERSION_NUMERIC =$API_VERSION_NUMERIC]) 1366AC_MSG_RESULT([*** API_VERSION_STRING =$API_VERSION_STRING]) 1367 1368AC_MSG_RESULT([]) 1369 1370AC_MSG_RESULT([*** ENABLE_MOD_IPV6CALC =$ENABLE_MOD_IPV6CALC]) 1371if test "$ENABLE_MOD_IPV6CALC" = "1"; then 1372 AC_MSG_RESULT([*** APXS =$APXS]) 1373 AC_MSG_RESULT([*** HTTPD_SYSCONFDIR =$HTTPD_SYSCONFDIR]) 1374 AC_MSG_RESULT([*** HTTPD_LIBEXECDIR =$HTTPD_LIBEXECDIR]) 1375 AC_MSG_RESULT([*** HTTPD_VERSION =$HTTPD_VERSION]) 1376 AC_MSG_RESULT([*** HTTPD_VERSION_MAJOR_MINOR =$HTTPD_VERSION_MAJOR_MINOR]) 1377 AC_MSG_RESULT([*** LDFLAGS_EXTRA_MOD_IPV6CALC =$LDFLAGS_EXTRA_MOD_IPV6CALC]) 1378fi 1379