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 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999
|
#!/bin/sh
#
# nspluginwrapper configure script (C) 2005-2009 Gwenole Beauchesne
# derived from qemu configure script, (C) 2003 Fabrice Bellard
#
PACKAGE=nspluginwrapper
# set temporary file name
if test ! -z "$TMPDIR" ; then
TMPDIR1="${TMPDIR}"
elif test ! -z "$TEMPDIR" ; then
TMPDIR1="${TEMPDIR}"
else
TMPDIR1="/tmp"
fi
TMPC="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.o"
TMPE="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}"
TMPS="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.S"
# find source path
# XXX: we assume an absolute path is given when launching configure,
# except in './configure' case.
source_path=${0%configure}
source_path=${source_path%/}
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
source_path=`pwd`
source_path_used="no"
fi
# determine versions
VERSION=`sed < $source_path/$PACKAGE.spec -n '/^\%define version[ ]*/s///p'`
RELEASE=`sed < $source_path/$PACKAGE.spec -n '/^\%define release[ ]*/s///p'`
SVNDATE=`sed < $source_path/$PACKAGE.spec -n '/^\%define svndate[ ]*/s///p'`
if test -z "$SVNDATE"; then
SVNDATE=`date '+%Y%m%d'`
fi
MAJOR_VERSION=`echo "$VERSION"|cut -d'.' -f1`
MINOR_VERSION=`echo "$VERSION"|cut -d'.' -f2`
MICRO_VERSION=`echo "$VERSION"|cut -d'.' -f3`
# development snapshots are officially generated tarballs for testing
# ("odd" minor and micro versions)
is_odd() {
local rem=`expr "$1" % 2`
test $rem -eq 1 && return 0 || return 1
}
if is_odd $MINOR_VERSION || is_odd $MICRO_VERSION; then
SNAPSHOT=1
else
SNAPSHOT=0
fi
# snapshots can also be unofficially generated tarballs
# (Release: 0.1 in specfile)
if echo "$RELEASE" | grep -q ^0; then
SNAPSHOT=2
fi
if test $SNAPSHOT -ge 1; then
yes_for_snapshots="yes"
else
yes_for_snapshots="no"
fi
# default parameters
prefix="/usr"
lib32=""
lib64=""
x_base_dirs=""
build_viewer="guess"
build_player="yes"
build_generic="guess"
build_biarch="guess"
strip="no"
cc="gcc"
cxx="g++"
host_os=`uname -s | tr '[A-Z]' '[a-z]'`
host_cpu=`uname -m`
target_os="linux"
target_cpu="i386"
rpc_init_timeout=5
malloc_hooks="glib,libc"
enable_malloc_check="$yes_for_snapshots"
enable_thread_check="$yes_for_snapshots"
normalize_cpu() {
local cpu="$1"
case "$cpu" in
arm*)
cpu="arm"
;;
i[3456]86|k[678]|i86pc|BePC)
cpu="i386"
;;
ia64)
cpu="ia64"
;;
"Power Macintosh"|ppc)
cpu="ppc"
;;
ppc64)
cpu="ppc64"
;;
sparc)
cpu="sparc"
;;
sparc64)
cpu="sparc64"
;;
x86_64|amd64)
cpu="x86_64"
;;
esac
echo "$cpu"
}
normalize_os() {
local os="$1"
case "$os" in
sunos*)
os="solaris"
;;
esac
echo "$os"
}
for opt do
case "$opt" in
--prefix=*)
prefix=`echo "$opt" | cut -d '=' -f 2`
;;
--pkglibdir=*)
pkglibdir=`echo "$opt" | cut -d '=' -f 2`
;;
--viewer-paths=*)
viewer_paths=`echo "$opt" | cut -d '=' -f 2`
;;
--target-os=*)
target_os=`echo "$opt" | cut -d '=' -f 2 | tr '[A-Z]' '[a-z]'`
;;
--target-cpu=*)
target_cpu=`echo "$opt" | cut -d '=' -f 2`
;;
--enable-generic)
build_generic="yes"
;;
--disable-generic)
build_generic="no"
;;
--enable-strip)
strip="yes"
;;
--disable-strip)
strip="no"
;;
--enable-biarch)
build_biarch="yes"
;;
--disable-biarch)
build_biarch="no"
;;
--enable-viewer)
build_viewer="yes"
;;
--disable-viewer)
build_viewer="no"
;;
--enable-player)
build_player="yes"
;;
--disable-player)
build_player="no"
;;
--enable-thread-check)
enable_thread_check="yes"
;;
--disable-thread-check)
enable_thread_check="no"
;;
--enable-malloc-check)
enable_malloc_check="yes"
;;
--disable-malloc-check)
enable_malloc_check="no"
;;
--with-lib32=*)
lib32=`echo "$opt" | cut -d '=' -f 2`
;;
--with-lib64=*)
lib64=`echo "$opt" | cut -d '=' -f 2`
;;
--with-x11-prefix=*)
x_base_dirs=`echo "$opt" | cut -d '=' -f 2`
;;
--with-cc=*)
cc=`echo "$opt" | cut -d '=' -f 2`
;;
--with-cxx=*)
cxx=`echo "$opt" | cut -d '=' -f 2`
;;
--with-malloc=*)
malloc_hooks=`echo "$opt" | cut -d '=' -f 2`
;;
--rpc-init-timeout=*)
rpc_init_timeout=`echo "$opt" | cut -d '=' -f 2`
;;
esac
done
host_cpu=`normalize_cpu "$host_cpu"`
host_os=`normalize_os "$host_os"`
target_cpu=`normalize_cpu "$target_cpu"`
target_os=`normalize_os "$target_os"`
# check for linux only build
if test "$build_generic" = "guess"; then
if test "$host_os" = "linux" -a "$target_os" = "linux"; then
build_generic="no"
else
build_generic="yes"
fi
fi
# check for biarch build (Linux only)
# XXX: biarch builds require LSB headers for now
build_biarch_possible="no"
if test "$host_os" = "linux" -a "$target_os" = "linux"; then
case $host_cpu:$target_cpu in
x86_64:i386 | ppc64:ppc)
build_biarch_possible="yes"
;;
esac
fi
if test "$build_biarch" = "guess"; then
build_biarch="$build_biarch_possible"
elif test "$build_biarch" = "yes"; then
if test "$build_biarch_possible" = "no"; then
echo "WARNING: bi-arch build is not possible, disabling"
build_biarch="no"
fi
fi
# check for viewer build
if test "$build_viewer" = "guess"; then
build_viewer="no"
case $host_os in
linux)
if test "$host_cpu" = "$target_cpu" -o "$build_biarch" = "yes"; then
build_viewer="yes"
fi
;;
esac
fi
# check for libdir name
if test -z "$lib64"; then
case $host_os in
linux)
# test if the compiler is 64bit
echo 'int i;' > $TMPC
nspluginwrapper_64bit_output=no
if $cc -o $TMPO -c $TMPC; then
case `/usr/bin/file $TMPO` in
*"ELF 64"*)
nspluginwrapper_64bit_output=yes
;;
esac
fi
rm -f $TMPC $TMPO
;;
esac
case $host_cpu:$nspluginwrapper_64bit_output in
ppc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
lib64="lib64"
;;
*)
lib64="lib"
;;
esac
fi
if test -z "$lib32"; then
lib32="lib"
fi
# check for installation root
if test -z "$pkglibdir"; then
pkglibdir="$prefix/lib/$PACKAGE"
fi
# check for viewer paths
default_viewer_paths="$pkglibdir/%ARCH%/%OS%"
if test -z "$viewer_paths"; then
viewer_paths="$default_viewer_paths"
fi
# check for __attribute__((visibility())) support
cat > $TMPC << EOF
int foo __attribute__((visibility("hidden"))) = 1;
int bar __attribute__((visibility("protected"))) = 1;
EOF
has_visibility_attribute=no
if $cc -Werror -S $TMPC -o $TMPS >/dev/null 2>&1; then
if grep '\.hidden.*foo' $TMPS >/dev/null; then
if grep '\.protected.*bar' $TMPS >/dev/null; then
has_visibility_attribute=yes
fi
fi
fi
rm -f $TMPC $TMPS
# check for .init_array/.fini_array support
cat > $TMPC << EOF
static int x = -1;
int main(void) { return x; }
int foo(void) { x = 0; }
int (*fp)(void) __attribute__((section(".init_array"))) = foo;
EOF
has_initfini_array=no
if $cc -Werror $TMPC -o $TMPE >/dev/null 2>&1; then
if $TMPE; then
has_initfini_array=yes
fi
fi
rm -f $TMPC $TMPE
# check for sockaddr_un::sun_len member
cat > $TMPC << EOF
#include <sys/types.h>
#include <sys/un.h>
int main(void) {
struct sockaddr_un addr;
addr.sun_len = 0;
return 0;
}
EOF
has_sockaddr_un_sun_len=no
if $cc -Werror $TMPC -o $TMPE >/dev/null 2>&1; then
if $TMPE; then
has_sockaddr_un_sun_len=yes
fi
fi
rm -f $TMPC $TMPE
# check for egrep program
if echo a | (grep -E '(a|b)') >/dev/null 2>&1; then
EGREP='grep -E'
else
EGREP='egrep'
fi
# check for __stack_chk_fail() in target GNU C library
if test "$build_biarch" = "yes"; then
glibc_header_dir="/usr/include"
libc_provides_ssp=no
if test -f $glibc_header_dir/features.h \
&& $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
$glibc_header_dir/features.h > /dev/null; then
if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+([1-9][0-9]|[3-9])' \
$glibc_header_dir/features.h > /dev/null; then
libc_provides_ssp=yes
elif $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \
$glibc_header_dir/features.h > /dev/null \
&& $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[4-9])' \
$glibc_header_dir/features.h > /dev/null; then
libc_provides_ssp=yes
fi
fi
fi
# check for compiler type
cat > $TMPC << EOF
#include <stdio.h>
#if defined __INTEL_COMPILER
#define COMPILER_NAME "icc"
#elif defined __GNUC__
#define COMPILER_NAME "gcc"
#elif defined __xlC__
#define COMPILER_NAME "xlc"
#elif defined __sgi
#define COMPILER_NAME "mipspro"
#elif defined __SUNPRO_C || defined __SUNPRO_CC
#define COMPILER_NAME "sunstudio"
#else
#define COMPILER_NAME "unknown"
#endif
int main(void)
{
printf("%s\n", COMPILER_NAME);
return 0;
}
EOF
compiler="unknown"
if $cc $TMPC -o $TMPE >/dev/null 2>&1; then
compiler=`$TMPE`
fi
rm -f $TMPC $TMPE
# check for compiler flag
check_cc_option() {
echo "int i;" > $TMPC
if $cc $* -c $TMPC -o $TMPO > /dev/null 2>&1; then
rm -f $TMPC $TMPO
return 0
fi
rm -f $TMPC
return 1
}
# check for c99 support
if test "$compiler" = "gcc"; then
if check_cc_option -std=c99; then
cc="$cc -std=c99"
fi
elif test "$compiler" = "icc"; then
if check_cc_option -std=c99; then
cc="$cc -std=c99"
elif check_cc_option -c99; then
cc="$cc -c99"
fi
elif test "$compiler" = "xlc"; then
if check_cc_option -qlanglvl=extc99; then
cc="$cc -qlanglvl=extc99"
fi
elif test "$compiler" = "mipspro"; then
if check_cc_option -c99; then
cc="$cc -c99"
fi
elif test "$compiler" = "sunstudio"; then
if check_cc_option -xc99; then
cc="$cc -xc99"
fi
fi
# check for CFLAGS
if test "$compiler" = "gcc"; then
if test -z "$CFLAGS"; then
CFLAGS="-O2 -g"
if check_cc_option -mtune=generic $CFLAGS; then
CFLAGS="$CFLAGS -mtune=generic"
fi
fi
if test "$build_biarch" = "yes" -a -z "$CFLAGS_32"; then
CFLAGS_32="-m32 -O2 -g"
if check_cc_option -mtune=generic $CFLAGS_32; then
CFLAGS_32="$CFLAGS_32 -mtune=generic"
fi
fi
if check_cc_option -Wall; then
CFLAGS="$CFLAGS -Wall"
fi
fi
# check for pkg-config
pkgconfig=`which pkg-config`
if test -z "$pkgconfig"; then
echo "pkg-config not found"
exit 1
fi
# check for Glib 2.0 compile CFLAGS
if $pkgconfig --exists glib-2.0; then
GLIB_CFLAGS=`$pkgconfig --cflags glib-2.0`
GLIB_LDFLAGS=`$pkgconfig --libs glib-2.0`
GLIB_VERSION=`$pkgconfig --modversion glib-2.0`
else
echo "GLIB 2.0 environment not found"
exit 1
fi
cat > $TMPC << EOF
#include <glib.h>
int main(void) {
(void) g_main_pending();
return 0;
}
EOF
if ! $cc $CFLAGS $GLIB_CFLAGS $GLIB_LDFLAGS $TMPC -o $TMPE > /dev/null 2>&1; then
echo "GLIB 2.0 environment not usable"
rm -f $TMPC
exit 1
fi
rm -f $TMPC $TMPE
# check for GTK+ 2.0 compile CFLAGS
if test "$build_viewer" = "yes" -o "$build_player" = "yes"; then
if $pkgconfig --exists gtk+-2.0; then
GTK_CFLAGS=`$pkgconfig --cflags gtk+-2.0`
GTK_LDFLAGS=`$pkgconfig --libs gtk+-2.0`
GTK_VERSION=`$pkgconfig --modversion gtk+-2.0`
else
echo "GTK+ 2.0 environment not found"
exit 1
fi
cat > $TMPC << EOF
#include <gtk/gtk.h>
int main(void) {
gtk_main_quit();
return 0;
}
EOF
if ! $cc $CFLAGS $GTK_CFLAGS $GTK_LDFLAGS $TMPC -o $TMPE > /dev/null 2>&1; then
echo "GTK+ 2.0 environment not usable"
rm -f $TMPC
exit 1
fi
rm -f $TMPC $TMPE
fi
# check for cURL compile CFLAGS
if test "$build_player" = "yes"; then
if $pkgconfig --exists libcurl; then
CURL_CFLAGS=`$pkgconfig --cflags libcurl`
CURL_LDFLAGS=`$pkgconfig --libs libcurl`
else
curlconfig=`which curl-config`
if test -n "$curlconfig"; then
CURL_CFLAGS=`$curlconfig --cflags`
CURL_LDFLAGS=`$curlconfig --libs`
else
echo "cURL environment not found"
exit 1
fi
fi
cat > $TMPC << EOF
#include <curl/curl.h>
int main(void) {
curl_global_init(CURL_GLOBAL_NOTHING);
return 0;
}
EOF
if ! $cc $CFLAGS $CURL_CFLAGS $CURL_LDFLAGS $TMPC -o $TMPE > /dev/null 2>&1; then
echo "cURL environment not usable"
rm -f $TMPC
exit 1
fi
rm -f $TMPC $TMPE
fi
# check for X11 base dir
if test -z "$x_base_dirs"; then
x_base_dirs="
/usr
/usr/X11R6
/usr/local/X11R6
$prefix
"
fi
for dir in $x_base_dirs; do
x_include_dir="$dir/include"
if test -f $x_include_dir/X11/Intrinsic.h; then
x_lib_dir="$dir/$lib64"
if test -f $x_lib_dir/libXt.so; then
x_base_dir=$dir
break
fi
fi
done
if test -z "$x_base_dir"; then
echo "X11/Xt environment not found"
exit 1
fi
# big/little endian test
cat > $TMPC << EOF
#include <inttypes.h>
int main(int argc, char ** argv){
volatile uint32_t i=0x01234567;
return (*((uint8_t*)(&i))) == 0x67;
}
EOF
bigendian="no"
if $cc -o $TMPE $TMPC 2>/dev/null ; then
$TMPE && bigendian="yes"
else
echo "big/little test failed"
fi
rm -f $TMPO $TMPC $TMPE $TMPS
# floating point endian test
cat > $TMPC << EOF
/* This will not work unless sizeof(double) == 8. */
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
/* This structure must have no internal padding. */
struct possibility {
char prefix[8];
double candidate;
char postfix[8];
};
#define C(cand) { "\nformat:", cand, ":tamrof\n" }
struct possibility table [] =
{
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
C( 3.53802595280598432000e+18), /* D__float - VAX */
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
};
EOF
if $cc -o $TMPO -c $TMPC 2>/dev/null; then
od -c $TMPO |
sed 's/^[0-7]*[ ]*/ /
s/\*/./g
s/ \\n/*/g
s/ [0-9][0-9][0-9]/./g
s/ \\[^ ]/./g' |
tr -d '
' | tr -s '*' '
' | fold | sed '$a\
' > $TMPE
if grep 'format:.@IEEEF.:tamrof' $TMPE >/dev/null 2>&1; then
float_format='IEEE (big-endian)'
elif grep 'format:.I@@PFE.:tamrof' $TMPE >/dev/null 2>&1; then
float_format='IEEE (big-endian)'
elif grep 'format:.FEEEI@.:tamrof' $TMPE >/dev/null 2>&1; then
float_format='IEEE (little-endian)'
elif grep 'format:.EFP@@I.:tamrof' $TMPE >/dev/null 2>&1; then
float_format='IEEE (little-endian)'
elif grep 'format:.__floa.:tamrof' $TMPE >/dev/null 2>&1; then
float_format='VAX D-float'
elif grep 'format:..PDP-1.:tamrof' $TMPE >/dev/null 2>&1; then
float_format='PDP-10'
elif grep 'format:.BMHEXF.:tamrof' $TMPE >/dev/null 2>&1; then
float_format='IBM 370 hex'
else
echo "unknown floating point format"
exit 1
fi
fbigendian=
case $float_format in
'IEEE (big-endian)')
if test "$bigendian" = "no"; then
fbigendian=1
fi
;;
'IEEE (little-endian)')
if test "$bigendian" = "yes"; then
fbigendian=0
fi
;;
*)
echo "unsupported floating point format $float_format"
exit 1
;;
esac
else
echo "floating point endian test failed"
fi
rm -f $TMPO $TMPC $TMPE
# detect memory allocation hooks
malloc_hooks_list=`echo "$malloc_hooks" | sed -e 's/,/ /g'`
malloc_hooks=""
malloc_hook_default=""
for mh in $malloc_hooks_list; do
is_ok="no"
case $mh in
libc)
is_ok="yes"
;;
glib)
if test "x$build_generic" = "xyes"; then
echo "WARNING: disabling glib memory hooks with --enable-generic"
elif ! $pkgconfig --atleast-version=2.10 glib-2.0; then
echo "WARNING: disabling glib memory hooks that require glib >= 2.10 (system is $GLIB_VERSION)"
else
is_ok="yes"
fi
;;
esac
if test "x$is_ok" = "xyes"; then
if test -n "$malloc_hooks"; then
malloc_hooks="$malloc_hooks $mh"
else
malloc_hooks="$mh"
malloc_hook_default="$mh"
fi
fi
done
if test -z "$malloc_hooks"; then
malloc_hook_default="libc"
malloc_hooks="$malloc_hook_default"
fi
# print configure help
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
cat << EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
EOF
echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
echo " --pkglibdir=ROOT install private files in ROOT [$pkglibdir]"
echo " --viewer-paths=PATH allowed viewer lookup PATH [$viewer_paths]"
echo " --target-os=OS build plugin support for target OS [$target_os]"
echo " --target-cpu=CPU build plugin support for target CPU [$target_cpu]"
echo " --enable-viewer build viewer [$build_viewer]"
echo " --enable-player build player [$build_player]"
echo ""
echo "Advanced options (experts only):"
echo " --source-path=PATH path of source code [$source_path]"
echo " --enable-strip strip resulting binaries and libraries [$strip]"
echo " --enable-generic build with generic APIs [$build_generic]"
echo " --enable-biarch build both 32-bit and 64-bit components at once [$build_biarch]"
echo " --enable-thread-check enable main thread checks (DEBUG) [$enable_thread_check]"
echo " --enable-malloc-check enable memory allocation checks (DEBUG) [$enable_malloc_check]"
echo " --with-lib32=NAME use NAME as the 32-bit library dir name [$lib32]"
echo " --with-lib64=NAME use NAME as the 64-bit library dir name [$lib64]"
echo " --with-x11-prefix=PREFIX use PREFIX as the X11 base dir [autodetect]"
echo " --with-cc=CC use C compiler CC [$cc]"
echo " --with-cxx=CXX use C++ compiler CXX [$cxx]"
echo " --with-malloc=MALLOC use MALLOC for memory allocation hooks [$malloc_hooks]"
echo " --rpc-init-timeout=VALUE wait VALUE seconds for the plugin to connect [$rpc_init_timeout]"
echo ""
echo "NOTE: The object files are built at the place where configure is launched"
exit 1
fi
echo "Source path $source_path"
echo "Install prefix $prefix"
echo "nspluginwrapper root dir $pkglibdir"
echo "Viewer paths $viewer_paths"
echo "Build viewer $build_viewer"
echo "Build standalone player $build_player"
echo "Build 32-/64-bit at once $build_biarch"
echo "Build with generic APIs $build_generic"
echo "32-bit library dir name $lib32"
echo "64-bit library dir name $lib64"
echo "C compiler $cc"
echo "C++ compiler $cxx"
echo "Strip binaries $strip"
echo "Host OS $host_os"
echo "Host CPU $host_cpu"
echo "Host big endian $bigendian"
echo "Target OS $target_os"
echo "Target CPU $target_cpu"
echo "RPC init timeout $rpc_init_timeout secs"
echo "Memory allocation hooks $malloc_hooks"
echo "Use thread checks (DEBUG) $enable_thread_check"
echo "Use malloc checks (DEBUG) $enable_malloc_check"
config_mak="config-host.mak"
echo "# Automatically generated by configure - do not modify" > $config_mak
config_h="config-host.h"
echo "/* Automatically generated by configure - do not modify */" > $config_h
echo "COMPILER=$compiler" >> $config_mak
echo "CC=$cc" >> $config_mak
echo "CXX=$cxx" >> $config_mak
echo "CFLAGS=$CFLAGS" >> $config_mak
echo "GLIB_CFLAGS=$GLIB_CFLAGS" >> $config_mak
echo "GLIB_LDFLAGS=$GLIB_LDFLAGS" >> $config_mak
echo "GTK_CFLAGS=$GTK_CFLAGS" >> $config_mak
echo "GTK_LDFLAGS=$GTK_LDFLAGS" >> $config_mak
echo "CURL_CFLAGS=$CURL_CFLAGS" >> $config_mak
echo "CURL_LDFLAGS=$CURL_LDFLAGS" >> $config_mak
if test "$build_biarch" = "yes"; then
echo "LDFLAGS_32=-m32" >> $config_mak
echo "CFLAGS_32=$CFLAGS_32" >> $config_mak
else
echo 'CFLAGS_32=$(CFLAGS)' >> $config_mak
fi
if test "$host_os" = "linux"; then
echo "OS=linux" >> $config_mak
echo "#define HOST_LINUX 1" >> $config_h
echo "#define HOST_OS \"linux\"" >> $config_h
elif test "$host_os" = "dragonfly"; then
echo "OS=dragonfly" >> $config_mak
echo "#define HOST_DRAGONFLY 1" >> $config_h
echo "#define HOST_OS \"dragonfly\"" >> $config_h
elif test "$host_os" = "freebsd"; then
echo "OS=freebsd" >> $config_mak
echo "#define HOST_FREEBSD 1" >> $config_h
echo "#define HOST_OS \"freebsd\"" >> $config_h
elif test "$host_os" = "netbsd"; then
echo "OS=netbsd" >> $config_mak
echo "#define HOST_NETBSD 1" >> $config_h
echo "#define HOST_OS \"netbsd\"" >> $config_h
elif test "$host_os" = "solaris"; then
echo "OS=solaris" >> $config_mak
echo "#define HOST_SOLARIS 1" >> $config_h
echo "#define HOST_OS \"solaris\"" >> $config_h
else
echo "Unsupported OS"
exit 1
fi
if test "$host_cpu" = "i386" ; then
echo "ARCH=i386" >> $config_mak
echo "#define HOST_I386 1" >> $config_h
echo "#define HOST_ARCH \"i386\"" >> $config_h
elif test "$host_cpu" = "x86_64" ; then
echo "ARCH=x86_64" >> $config_mak
echo "#define HOST_X86_64 1" >> $config_h
echo "#define HOST_ARCH \"x86_64\"" >> $config_h
elif test "$host_cpu" = "ppc" ; then
echo "ARCH=ppc" >> $config_mak
echo "#define HOST_PPC 1" >> $config_h
echo "#define HOST_ARCH \"ppc\"" >> $config_h
elif test "$host_cpu" = "ppc64" ; then
echo "ARCH=ppc64" >> $config_mak
echo "#define HOST_PPC64 1" >> $config_h
echo "#define HOST_ARCH \"ppc64\"" >> $config_h
elif test "$host_cpu" = "sparc" ; then
echo "ARCH=sparc" >> $config_mak
echo "#define HOST_SPARC 1" >> $config_h
echo "#define HOST_ARCH \"sparc\"" >> $config_h
elif test "$host_cpu" = "sparc64" ; then
echo "ARCH=sparc64" >> $config_mak
echo "#define HOST_SPARC64 1" >> $config_h
echo "#define HOST_ARCH \"sparc64\"" >> $config_h
elif test "$host_cpu" = "ia64" ; then
echo "ARCH=ia64" >> $config_mak
echo "#define HOST_IA64 1" >> $config_h
echo "#define HOST_ARCH \"ia64\"" >> $config_h
elif test "$host_cpu" = "arm" ; then
echo "ARCH=arm" >> $config_mak
echo "#define HOST_ARM 1" >> $config_h
echo "#define HOST_ARCH \"arm\"" >> $config_h
else
echo "Unsupported CPU"
exit 1
fi
if test "$bigendian" = "yes" ; then
echo "WORDS_BIGENDIAN=yes" >> $config_mak
echo "#define WORDS_BIGENDIAN 1" >> $config_h
fi
if test -n "$fbigendian" ; then
echo "#define FLOAT_WORDS_BIGENDIAN $fbigendian" >> $config_h
fi
echo "SRC_PATH=$source_path" >> $config_mak
echo "build_viewer=$build_viewer" >> $config_mak
echo "build_player=$build_player" >> $config_mak
echo "build_biarch=$build_biarch" >> $config_mak
echo "lib32=$lib32" >> $config_mak
echo "lib64=$lib64" >> $config_mak
echo "prefix=$prefix" >> $config_mak
echo "bindir=$prefix/bin" >> $config_mak
libdir="$prefix/$lib64"
echo "libdir=$libdir" >> $config_mak
echo "#define LIB \"$lib64\"" >> $config_h
echo "#define LIBDIR \"$libdir\"" >> $config_h
echo "x11prefix=$x_base_dir" >> $config_mak
echo "ALLOW_STRIP=$strip" >> $config_mak
echo "VERSION=$VERSION" >> $config_mak
echo "SVNDATE=$SVNDATE" >> $config_mak
echo "SNAPSHOT=$SNAPSHOT" >> $config_mak
echo "#define NPW_SNAPSHOT $SNAPSHOT" >> $config_h
if test $SNAPSHOT -ge 2; then
echo "#define NPW_VERSION \"$VERSION-Pre ($SVNDATE)\"" >> $config_h
else
echo "#define NPW_VERSION \"$VERSION\"" >> $config_h
fi
echo "pkglibdir=$pkglibdir" >> $config_mak
echo "#define NPW_LIBDIR \"$pkglibdir\"" >> $config_h
# check if we want to install files in ARCH/OS specific locations
if echo ":$viewer_paths" | $EGREP -q ":$pkglibdir/%(ARCH|OS)%"; then
npw_common_libdir="$pkglibdir/noarch"
npw_host_libdir="$pkglibdir/$host_cpu/$host_os"
npw_target_libdir="$pkglibdir/$target_cpu/$target_os"
npw_target_libdir_var="$pkglibdir/\\\$\$TARGET_ARCH/\\\$\$TARGET_OS"
else
npw_common_libdir="$pkglibdir"
npw_host_libdir="$npw_common_libdir"
npw_target_libdir="$npw_common_libdir"
npw_target_libdir_var="$npw_common_libdir"
fi
echo "npcommondir=$npw_common_libdir" >> $config_mak
echo "nphostdir=$npw_host_libdir" >> $config_mak
echo "nptargetdir=$npw_target_libdir" >> $config_mak
echo "nptargetdir_var=$npw_target_libdir_var" >> $config_mak
echo "#define NPW_HOST_LIBDIR \"$npw_host_libdir\"" >> $config_h
echo "#define NPW_TARGET_LIBDIR \"$npw_target_libdir\"" >> $config_h
echo "#define NPW_VIEWER_PATHS \"$viewer_paths\"" >> $config_h
echo "#define RPC_INIT_TIMEOUT $rpc_init_timeout" >> $config_h
for mh in $malloc_hooks; do
echo "#define USE_MALLOC_`echo $mh | tr '[a-z]' '[A-Z]'` 1" >> $config_h
done
echo "#define DEFAULT_MALLOC_LIB $malloc_hook_default" >> $config_h
if test "$has_visibility_attribute" = "yes"; then
echo "#define attribute_hidden __attribute__((visibility(\"hidden\")))" >> $config_h
echo "#define attribute_protected __attribute__((visibility(\"protected\")))" >> $config_h
else
echo "#define attribute_hidden" >> $config_h
echo "#define attribute_protected" >> $config_h
fi
if test "$has_initfini_array" = "yes"; then
echo "#define HAVE_INITFINI_ARRAY 1" >> $config_h
else
echo "#undef HAVE_INITFINI_ARRAY" >> $config_h
fi
if test "$has_sockaddr_un_sun_len" = "yes"; then
echo "#define HAVE_SOCKADDR_UN_SUN_LEN 1" >> $config_h
else
echo "#undef HAVE_SOCKADDR_UN_SUN_LEN" >> $config_h
fi
if test "$libc_provides_ssp" = "yes"; then
echo "#define TARGET_LIBC_PROVIDES_SSP 1" >> $config_h
else
echo "#undef TARGET_LIBC_PROVIDES_SSP" >> $config_h
fi
if test "$enable_thread_check" = "yes"; then
echo "#define ENABLE_THREAD_CHECK 1" >> $config_h
else
echo "#undef ENABLE_THREAD_CHECK" >> $config_h
fi
if test "$enable_malloc_check" = "yes"; then
echo "#define ENABLE_MALLOC_CHECK 1" >> $config_h
else
echo "#undef ENABLE_MALLOC_CHECK" >> $config_h
fi
# check for functions in <glib.h>
for func in g_hash_table_remove_all g_hash_table_find; do
cat > $TMPC << EOF
extern void $func(void);
int main(void) { $func(); return 0; }
EOF
if $cc $TMPC -o $TMPE $GLIB_CFLAGS $GLIB_LDFLAGS > /dev/null 2>&1; then
func_def=`echo "$func" | tr '[:lower:]./-' '[:upper:]___'`
echo "#define HAVE_$func_def 1" >> $config_h
fi
rm -f $TMPC $TMPE
done
config_mak="config.mak"
echo "# Automatically generated by configure - do not modify" > $config_mak
echo "include config-host.mak" >> $config_mak
config_h="config.h"
echo "/* Automatically generated by configure - do not modify */" > $config_h
echo "#include \"config-host.h\"" >> $config_h
if test "$build_generic" = "yes"; then
echo "#define BUILD_GENERIC 1" >> $config_h
else
echo "#undef BUILD_GENERIC" >> $config_h
fi
if test "$target_os" = "linux"; then
echo "TARGET_OS=linux" >> $config_mak
echo "#define TARGET_OS \"linux\"" >> $config_h
echo "#define TARGET_LINUX 1" >> $config_h
elif test "$target_os" = "solaris"; then
echo "TARGET_OS=solaris" >> $config_mak
echo "#define TARGET_OS \"solaris\"" >> $config_h
echo "#define TARGET_SOLARIS 1" >> $config_h
else
echo "Unsupported target OS"
exit 1
fi
if test "$target_cpu" = "i386" ; then
echo "TARGET_ARCH=i386" >> $config_mak
echo "#define TARGET_ARCH \"i386\"" >> $config_h
echo "#define TARGET_I386 1" >> $config_h
elif test "$target_cpu" = "x86_64" ; then
echo "TARGET_ARCH=x86_64" >> $config_mak
echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
echo "#define TARGET_X86_64 1" >> $config_h
elif test "$target_cpu" = "ppc" ; then
echo "TARGET_ARCH=ppc" >> $config_mak
echo "#define TARGET_ARCH \"ppc\"" >> $config_h
echo "#define TARGET_PPC 1" >> $config_h
else
echo "Unsupported target CPU"
exit 1
fi
# build tree in object directory if source path is different from current one
if test "$source_path_used" = "yes" ; then
case $source_path in
..*)
sp1=..
;;
esac
ln -sf $source_path/Makefile Makefile
fi
|