1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 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 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 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 350 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 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 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 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 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 720 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 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797
|
## Directories to search for usable builds:
##
## - [$PFX]_INC and [$PFX]_LIB
## - the dir specified by --with-[$pfx]=*
## - each dir named [$pfx]-* under [$PFX]_BASE (descending order)
## - each dir named [$pfx]-* under $ngx_src_dir/.. (descending order)
## - system_paths (see below)
##
## Note : specifying [$PFX]_INC or [$PFX]_LIB prevents other dirs being tried
## specifying --with-[$pfx]= prevents autodiscovery of dirs
##
## Note : if this file is not in the same directory as the config file, the value
## for ngx_auto_lib_file should be changed to a relative path from that file
## e.g. : $ngx_addon_dir/libs/ngx_auto_lib
##
## TODO : explain hooks
#############
## VERSION ##
#############
ngx_auto_lib_version=1001
if [ ! $ngx_auto_lib_file_version ] || [ $ngx_auto_lib_file_version -lt $ngx_auto_lib_version ]; then
if [ ! $ngx_addon_dir ]; then
ngx_addon_dir=`cd $(dirname $0); pwd`
fi
ngx_auto_lib_file="$ngx_addon_dir/ngx_auto_lib_core"
ngx_auto_lib_file_version="$ngx_auto_lib_version"
fi
###############
## VARIABLES ##
###############
v=
v="$v inc_path"
v="$v incs"
v="$v libs"
v="$v name"
v="$v path"
v="$v run"
v="$v test"
ev=
ev="$ev add_libs"
ev="$ev add_path"
ev="$ev build_dirs"
ev="$ev build_inc_dirs"
ev="$ev build_lib_dirs"
ev="$ev check_macros_defined"
ev="$ev check_macros_non_zero"
ev="$ev defines"
ev="$ev deps"
ev="$ev exit_if_not_found"
ev="$ev haves"
ev="$ev inc_names"
ev="$ev lib_files"
ev="$ev lib_names"
ev="$ev libs_to_add"
ev="$ev modules"
ev="$ev srcs"
ev="$ev shared"
ev="$ev test_libs"
ev="$ev variables"
ngx_feature_vars="$v"
ngx_feature_extra_vars="$ev"
ngx_feature_all_vars="$v $ev"
NGX_AUTO_LIB_DEFAULT_SYSTEM_DIRS='/usr/local /usr /opt/local /opt /usr/pkg'
####################
## UTIL FUNCTIONS ##
####################
to_upper() {
echo "$@" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
}
to_lower() {
echo "$@" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
}
####################
## INIT FUNCTIONS ##
####################
ngx_auto_lib_init() {
. $ngx_auto_lib_file
ngx_auto_lib_init_latest $@
}
ngx_auto_lib_init_latest() {
# set name and prefixes
if [ ! $1 ]; then
echo "ngx_auto_lib_init() requires that a name be passed"
exit 1
fi
ngx_auto_lib_name=$1
ngx_auto_lib_module_name=$2
if [ $2 ]; then
NGX_AUTO_LIB_PFX=`to_upper $2`
else
NGX_AUTO_LIB_PFX=`to_upper $1`
fi
ngx_auto_lib_pfx=`to_lower $NGX_AUTO_LIB_PFX`
ngx_auto_lib_clean_feature_vars
}
ngx_auto_lib_clean_feature_vars() {
for var in $ngx_feature_all_vars; do
eval ngx_feature_$var=
done
}
ngx_auto_lib_get_variables() {
local pfx=$ngx_auto_lib_pfx
local PFX=$NGX_AUTO_LIB_PFX
eval NGX_AUTO_LIB_INC=\"\$${PFX}_INC\"
eval NGX_AUTO_LIB_LIB=\"\$${PFX}_LIB\"
eval NGX_AUTO_LIB_DIR=\"\$${PFX}\"
eval NGX_AUTO_LIB_BASE=\"\$${PFX}_BASE\"
eval NGX_AUTO_LIB_SEARCH_LIB_INC=\"\$${PFX}_SEARCH_LIB_INC\"
eval NGX_AUTO_LIB_SEARCH_DIR=\"\$${PFX}_SEARCH_DIR\"
eval NGX_AUTO_LIB_SEARCH_BASE=\"\$${PFX}_SEARCH_BASE\"
eval NGX_AUTO_LIB_SEARCH_BASE_PREFIX=\"\$${PFX}_SEARCH_BASE_PREFIX\"
eval NGX_AUTO_LIB_SEARCH_PARENT=\"\$${PFX}_SEARCH_PARENT\"
eval NGX_AUTO_LIB_SEARCH_SYSTEM=\"\$${PFX}_SEARCH_SYSTEM\"
eval NGX_AUTO_LIB_SHARED=\"\$${PFX}_SHARED\"
eval NGX_AUTO_LIB_SYSTEM_DIRS=\"\$${PFX}_SYSTEM_DIR\"
eval USE_NGX_AUTO_LIB=\"\$USE_${LIB}\"
if [ ! "$NGX_AUTO_LIB_DIR" ]; then
NGX_AUTO_LIB_DIR=NONE
fi
if [ ! "$USE_NGX_AUTO_LIB" ]; then
if [ $ngx_feature_check_macros_defined -o $ngx_feature_check_macros_non_zero ]; then
USE_NGX_AUTO_LIB=MAYBE
elif [ "$ngx_feature_required" = no ]; then
USE_NGX_AUTO_LIB=MAYBE
else
USE_NGX_AUTO_LIB=YES
fi
fi
if [ ! "$NGX_AUTO_LIB_SYSTEM_DIRS" ]; then
NGX_AUTO_LIB_SYSTEM_DIRS=$NGX_AUTO_LIB_DEFAULT_SYSTEM_DIRS
fi
# TODO : add _STATIC, and do searches for both static and shared libs
if [ ! "$NGX_AUTO_LIB_SHARED" ]; then
if [ "$ngx_feature_shared" = no ]; then
NGX_AUTO_LIB_SHARED=NO
else
NGX_AUTO_LIB_SHARED=YES
fi
fi
NGX_AUTO_LIB_SEARCH_DEP=NO
# set default search methods
# Note : these can be over-ridden by setting NGX_AUTO_LIB_SEARCH_[type]=YES|NO
local auto=y
if [ "$NGX_AUTO_LIB_INC" ] || [ "$NGX_AUTO_LIB_LIB" ]; then
ngx_auto_lib_search LIB_INC YES
auto=n
fi
if [ "$NGX_AUTO_LIB_DIR" != NONE ]; then
ngx_auto_lib_search DIR YES
auto=n
fi
if [ "$NGX_AUTO_LIB_BASE" ]; then
ngx_auto_lib_search BASE YES
auto=n
fi
if [ $auto = y ]; then
ngx_auto_lib_search PARENT YES
ngx_auto_lib_search SYSTEM YES
fi
ngx_auto_lib_search LIB_INC NO
ngx_auto_lib_search DIR NO
ngx_auto_lib_search BASE NO
ngx_auto_lib_search PARENT NO
ngx_auto_lib_search SYSTEM NO
if [ ! "$ngx_feature_lib_names" ]; then
ngx_feature_lib_names=$pfx
fi
if [ ! "$ngx_feature_inc_names" ]; then
ngx_feature_inc_names=$ngx_feature_lib_names
fi
if [ ! "$ngx_feature_exit_if_not_found" ]; then
ngx_feature_exit_if_not_found=yes
fi
}
#######################
## DEFAULT FUNCTIONS ##
#######################
ngx_auto_lib_set_default() {
local suffix=
if [ $1 ]; then
suffix="_$1"
fi
local def=$2
local var="NGX_AUTO_LIB$suffix"
val=
if [ ! `eval echo '$'$var` ]; then
eval $var=\"$def\"
fi
#eval echo "$var = \$$var"
}
ngx_auto_lib_search() {
ngx_auto_lib_set_default "SEARCH_$1" $2
}
####################
## SAVE FUNCTIONS ##
####################
ngx_auto_lib_save_vars() {
OLD_CORE_DEPS=$CORE_DEPS
OLD_CORE_INCS=$CORE_INCS
OLD_CORE_LIBS=$CORE_LIBS
OLD_CORE_SRCS=$CORE_SRCS
OLD_LINK_DEPS=$LINK_DEPS
CORE_DEPS=
CORE_INCS=
CORE_LIBS=
CORE_SRCS=
LINK_DEPS=
}
ngx_auto_lib_reset_vars() {
CORE_DEPS=$OLD_CORE_DEPS
CORE_INCS=$OLD_CORE_INCS
CORE_LIBS=$OLD_CORE_LIBS
CORE_SRCS=$OLD_CORE_SRCS
LINK_DEPS=$OLD_LINK_DEPS
}
ngx_auto_lib_save_feature_vars() {
for var in $ngx_feature_all_vars; do
eval main_ngx_feature_$var=\"\$ngx_feature_$var\"
done
}
ngx_auto_lib_reset_feature_vars() {
for var in $ngx_feature_all_vars; do
eval ngx_feature_$var=\"\$main_ngx_feature_$var\"
done
}
########################
## CHECKING FUNCTIONS ##
########################
ngx_auto_lib_check_auto_config() {
ngx_auto_lib_save_feature_vars
ngx_auto_lib_clean_feature_vars
ngx_feature=$1
ngx_feature_inc_path="`echo $CFLAGS | tr ' ' '\n' | grep -- -D | tr '\n' ' '`"
ngx_feature_incs="#include <$NGX_AUTO_CONFIG_H>"
ngx_feature_libs=
ngx_feature_path=`pwd`
ngx_feature_run=no
ngx_feature_test=$2
#ngx_auto_lib_print_feature_vars
. auto/feature
if [ $ngx_found = yes ]; then
rv=0
else
rv=1
fi
ngx_auto_lib_reset_feature_vars
return $rv
}
ngx_auto_lib_check_macro_defined() {
for m in $@; do
ngx_auto_lib_check_auto_config "$m" "
#ifndef $m
rubbish
#endif" && return 0
done
return 1
}
ngx_auto_lib_check_macro_non_zero() {
for m in $@; do
ngx_auto_lib_check_auto_config "$m" "
#if !($m)
rubbish
#endif" && return 0
done
return 1
}
ngx_auto_lib_check_require() {
if [ $USE_NGX_AUTO_LIB = YES ]; then
return 0
elif [ $USE_NGX_AUTO_LIB = NO ]; then
return 1
fi
# check if the libraries are required elsewhere
for l in $ngx_feature_lib_names; do
[ ! "`echo $CORE_LIBS $ADDON_LIBS | grep -w -- -l$l`" ] && return 0
done
# check that any required macros are set
local d=$ngx_feature_check_macros_defined
local nz=$ngx_feature_check_macros_non_zero
if [ "$d" ] || [ "$nz" ]; then
ngx_auto_lib_check_macro_defined $d && return 0
ngx_auto_lib_check_macro_non_zero $nz && return 0
fi
ngx_auto_lib_check
}
ngx_auto_lib_check() {
return 1
}
##################################
## TEST PHASE HANDLER FUNCTIONS ##
##################################
ngx_auto_lib_test() {
ngx_auto_lib_test_pre_setup "$@"
ngx_auto_lib_test_setup "$@"
ngx_auto_lib_test_post_setup "$@"
ngx_auto_lib_test_feature
}
ngx_auto_lib_test_pre_setup() {
return 0
}
ngx_auto_lib_test_setup() {
local INC=$1
local LIB=$2
ngx_auto_lib_inc_dir=$INC
ngx_auto_lib_lib_dir=$LIB
ngx_auto_lib_reset_feature_vars
if [ ! "$ngx_feature_path" ]; then
ngx_feature_path="$INC"
fi
ngx_feature_path="$ngx_feature_path $ngx_feature_add_path"
for sfx in $ngx_feature_path_suffixes; do
ngx_feature_path="$ngx_feature_path $INC/$sfx"
done
local inc=
local lib=
local incs="$ngx_feature_inc_names"
local libs="$ngx_feature_lib_names"
local lib_files="$ngx_feature_lib_files"
for inc in $incs; do
ngx_feature_incs="$ngx_feature_incs
#include <$inc.h>"
done
if [ ! "$ngx_feature_libs" ]; then
if [ $NGX_AUTO_LIB_SHARED = YES ]; then
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R$LIB"
fi
ngx_feature_libs="$ngx_feature_libs -L$LIB"
for lib in $libs; do
ngx_feature_libs="$ngx_feature_libs -l$lib"
done
# TODO : only add --rpath when the path is not a standard system path - warn if /usr
ngx_feature_libs="$ngx_feature_libs -Wl,--rpath -Wl,$LIB"
else
for lib in $lib_files; do
ngx_feature_libs="$ngx_feature_libs $LIB/$lib"
done
for lib in $libs; do
ngx_feature_libs="$ngx_feature_libs $LIB/lib$lib.a"
done
fi
fi
if [ ! $ngx_feature_run ]; then
ngx_feature_run=no
fi
if [ $NGX_AUTO_LIB_SHARED = YES ]; then
# Add a test to be called in auto/feature after compilation that will check
# whether any libraries that are linked are in fact using the path provided to
# link libraries rather than a standard path. Note : this test will work on
# all linked shared objects, even if supplied directly by setting
# $ngx_feature_libs instead of usign $ngx_feature_lib_names
# TODO : allow for some libraries to not be checked here if desired - if part of system paths
libs="`echo $ngx_feature_libs | tr ' ' '\n' | grep -- -l | sed 's|-l||g'`"
local test="
for l in $libs; do
o="'\`ldd '$NGX_AUTOTEST' | grep '$LIB'/lib\$l\\.so\`;
if [ ! \"\$o\" ]; then
chmod -x $NGX_AUTOTEST;
echo Linker does not link to correct version
else
chmod +x $NGX_AUTOTEST;
fi
done'
test="`echo "$test" | tr '\n' ' '`"
ngx_feature_test_libs="$ngx_feature_test_libs; $test"
fi
ngx_feature_libs="$ngx_feature_libs $ngx_feature_add_libs"
ngx_feature_libs_to_add="$ngx_feature_libs"
ngx_feature_libs="$ngx_feature_libs $ngx_feature_test_libs"
ngx_feature="$ngx_auto_lib_name library $ngx_feature"
}
ngx_auto_lib_test_post_setup() {
return 0
}
ngx_auto_lib_test_feature() {
#ngx_auto_lib_print_feature_vars
. auto/feature
[ $ngx_found = yes ] && return 0
return 1
}
########################
## TEST DIR FUNCTIONS ##
########################
ngx_auto_lib_test_dir_pair() {
ngx_auto_lib_test_inc_dir=$1
ngx_auto_lib_test_lib_dir=$2
if [ $1 = $2 ]; then
ngx_feature="in $1$3"
else
ngx_feature="in $1 and $2$3"
fi
ngx_auto_lib_test "$1" "$2" "$3"
}
ngx_auto_lib_test_dir_pairs() {
ngx_auto_lib_test_dir_pair "$1/include" "$2/lib" "$3" && return 0
ngx_auto_lib_test_dir_pair "$1" "$2" "$3" && return 0
return 1
}
ngx_auto_lib_test_dirs() {
local msg="$1"
local bdir idir ldir
local bdirs=$ngx_feature_build_dirs
local idirs=$ngx_feature_build_inc_dirs
local ldirs=$ngx_feature_build_lib_dirs
shift
for dir in "$@"; do
ngx_auto_lib_test_dir=$dir
for ldir in $ldirs; do
for idir in $idirs; do
ngx_auto_lib_test_dir_pair "$dir/$idir" "$dir/$ldir" "$msg" && return 0
done
done
for ldir in $ldirs; do
ngx_auto_lib_test_dir_pair "$dir" "$dir/$ldir" "$msg" && return 0
done
for idir in $idirs; do
ngx_auto_lib_test_dir_pair "$dir/$idir" "$dir" "$msg" && return 0
done
for bdir in $bdirs; do
ngx_auto_lib_test_dir_pairs "$dir/$bdir" "$dir/$bdir" "$msg" && return 0
done
ngx_auto_lib_test_dir_pairs "$dir" "$dir" "$msg" && return 0
ngx_auto_lib_test_dir=
done
return 1
}
ngx_auto_lib_test_install_dirs() {
local msg="$1"
local dir=
shift
for dir in "$@"; do
ngx_auto_lib_test_dir=$dir
ngx_auto_lib_test_dir_pair "$dir/include" "$dir/lib" "$msg" && return 0
ngx_auto_lib_test_dir=
done
return 1
}
ngx_auto_lib_run_tests() {
local name="$ngx_auto_lib_name"
local pfx="$ngx_auto_lib_pfx"
local PFX="$NGX_AUTO_LIB_PFX"
local INC="$NGX_AUTO_LIB_INC"
local LIB="$NGX_AUTO_LIB_LIB"
local DIR="$NGX_AUTO_LIB_DIR"
local BASE="$NGX_AUTO_LIB_BASE"
local MSG="$NGX_AUTO_LIB_MSG"
ngx_found=no
# dependency
if [ $NGX_AUTO_LIB_SEARCH_DEP = YES ]; then
ngx_auto_lib_test_dir_pair "$INC" "$LIB" "$MSG"
return $?
fi
# lib and include dirs set explicitly (e.g. $OPENSSL_INC, $OPENSSL_LIB)
if [ $NGX_AUTO_LIB_SEARCH_LIB_INC = YES ]; then
ngx_auto_lib_test_dir_pair "$INC" "$LIB" " (specified by \$${PFX}_INC and \$${PFX}_LIB)" && return 0
fi
# path specified by ${PFX} (e.g. $OPENSSL, $PCRE)
# Note : these will be set automatically by configure for OpenSSL, PCRE, Zlib etc
# TODO : change to searching more than one path
if [ $NGX_AUTO_LIB_SEARCH_DIR = YES ] && [ $DIR != NONE ]; then
ngx_auto_lib_test_dirs " (specified by \$${PFX})" $DIR && return 0
fi
# directories beginning with '$pfx-' that are in $NGX_AUTO_LIB_BASE (e.g. $OPENSSL_BASE)
if [ $NGX_AUTO_LIB_SEARCH_BASE = YES ] && [ $BASE ]; then
p=$NGX_AUTO_LIB_SEARCH_BASE_PREFIX
if [ "$p" = YES ]; then
p="!ame $pfx-*"
elif [ "$p" ]; then
p="!ame $p*"
fi
ngx_auto_lib_test_dirs " (found under \$${PFX}_BASE)" \
`find $BASE/* -maxdepth 0 -type d $p 2> /dev/null | sort -r` && return 0
fi
# directories beginning with '$pfx-' that are in the same directory as the Nginx source
if [ $NGX_AUTO_LIB_SEARCH_PARENT = YES ]; then
local src_dir=`cd ..; pwd`
ngx_auto_lib_test_dirs " (found under Nginx source parent dir)" \
`find $src_dir/* -maxdepth 0 -type d !ame $pfx-* 2> /dev/null | sort -r` && return 0
fi
# system folders
if [ $NGX_AUTO_LIB_SEARCH_SYSTEM = YES ]; then
ngx_auto_lib_test_install_dirs "" $NGX_AUTO_LIB_SYSTEM_DIRS && return 0
fi
return 1
}
#######################
## HANDLER FUNCTIONS ##
#######################
ngx_auto_lib_run() {
ngx_auto_lib_get_variables
eval AUTO_$NGX_AUTO_LIB_PFX=NO
ngx_auto_lib_check_require || return
ngx_auto_lib_setup || return
ngx_auto_lib_save_feature_vars
ngx_auto_lib_run_tests
ngx_auto_lib_post_tests || return
ngx_auto_lib_finalize
}
ngx_auto_lib_print_feature_vars() {
echo ----------------------------
for var in $ngx_feature_vars; do
eval "echo ngx_feature_$var = \$ngx_feature_$var"
done
echo ----------------------------
}
ngx_auto_lib_setup() {
return 0
}
ngx_auto_lib_post_tests() {
return 0
}
#############################
## SET VARIABLES FUNCTIONS ##
#############################
# TODO : add HTTP/ADDON settings too
ngx_auto_lib_set_core_variables() {
# TODO : don't add includes / libs more than once
eval CORE_DEPS=\"$CORE_DEPS $ngx_feature_deps\"
eval CORE_INCS=\"$CORE_INCS $ngx_feature_path\"
eval CORE_LIBS=\"$CORE_LIBS $ngx_feature_libs_to_add\"
eval CORE_SRCS=\"$CORE_SRCS $ngx_feature_srcs\"
}
ngx_auto_lib_set_generic_variables() {
local INC=$ngx_auto_lib_test_inc_dir
local LIB=$ngx_auto_lib_test_lib_dir
modules="$modules $ngx_feature_modules"
for have in $ngx_feature_haves; do
. auto/have
done
set - $ngx_feature_defines
while [ $1 ]; do
have=$1
value=$2
. auto/define
done
local PFX=$NGX_AUTO_LIB_PFX
eval USE_$PFX=NO
if [ $ngx_auto_lib_test_dir ]; then
eval $PFX=$ngx_auto_lib_test_dir
else
eval $PFX=$ngx_auto_lib_lib_dir
fi
if [ $NGX_AUTO_LIB_SHARED != YES ]; then
for l in $ngx_feature_lib_names; do
CORE_LIBS=`echo $CORE_LIBS | sed 's|-\<l$l\>||g'`
ADDON_LIBS=`echo $ADDON_LIBS | sed 's|-\<l$l\>||g'`
done
fi
eval ${PFX}_INC=$INC
eval ${PFX}_LIB=$LIB
eval ${PFX}_SHARED=$NGX_AUTO_LIB_SHARED
eval AUTO_$PFX=YES
}
ngx_auto_lib_set_custom_variables() {
return 0
}
########################
## FINALIZE FUNCTIONS ##
########################
ngx_auto_lib_finalize() {
ngx_auto_lib_finalize_core
}
ngx_auto_lib_finalize_core() {
if [ $ngx_found = yes ]; then
ngx_auto_lib_set_core_variables
ngx_auto_lib_set_generic_variables
if [ "$ngx_feature_variables" ]; then
eval $ngx_feature_variables
fi
ngx_auto_lib_set_custom_variables
elif [ $ngx_feature_exit_if_not_found = yes ]; then
if [ $ngx_auto_lib_module_name ]; then
module_txt=" by the $ngx_auto_lib_module_name module"
else
module_text=
fi
lib=$ngx_auto_lib_name
pfx=$ngx_auto_lib_pfx
PFX=$NGX_AUTO_LIB_PFX
cat << END
$0: error: the $lib library is required$module_txt, but cannot
be found using the current configuration. In order for the compilation to succeed,
you will need to install the library using your system's package installer or point
the configure script to the library using one of the following variables :
to define a dir to find $pfx library (source or install dir) $PFX
to define $pfx lib and include dirs separately ${PFX}_LIB & ${PFX}_INC
to define a base dir to search for dirs beginning with $pfx- ${PFX}_BASE
e.g.
$ export ${PFX}_LIB=/path/to/library/lib
$ export ${PFX}_LIB=/path/to/library/include
$ $0 ...
END
exit 1
fi
}
|