]> git.ipfire.org Git - thirdparty/gcc.git/blame - ltconfig
Fix problems with copyrights for files that end up in libgcc.a.
[thirdparty/gcc.git] / ltconfig
CommitLineData
6599da04
JM
1#! /bin/sh
2
3# ltconfig - Create a system-specific libtool.
82e23236
AO
4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5# Free Software Foundation, Inc.
d207ebef 6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6599da04
JM
7#
8# This file is free software; you can redistribute it and/or modify it
9# under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
539df155 20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
6599da04
JM
21#
22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a
24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program.
26
27# A lot of this script is taken from autoconf-2.10.
28
cf4ccd63
JL
29# Check that we are running under the correct shell.
30SHELL=${CONFIG_SHELL-/bin/sh}
fbd836fc
ILT
31echo=echo
32if test "X$1" = X--no-reexec; then
cf4ccd63
JL
33 # Discard the --no-reexec flag, and continue.
34 shift
90fb0c24 35elif test "X$1" = X--fallback-echo; then
d207ebef
JM
36 # Avoid inline document here, it may be left over
37 :
fbd836fc
ILT
38elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
39 # Yippee, $echo works!
40 :
41else
cf4ccd63
JL
42 # Restart under the correct shell.
43 exec "$SHELL" "$0" --no-reexec ${1+"$@"}
44fi
45
d207ebef
JM
46if test "X$1" = X--fallback-echo; then
47 # used as fallback echo
48 shift
49 cat <<EOF
50$*
51EOF
52 exit 0
53fi
54
90fb0c24
TT
55# Find the correct PATH separator. Usually this is `:', but
56# DJGPP uses `;' like DOS.
d207ebef 57if test "X${PATH_SEPARATOR+set}" != Xset; then
90fb0c24
TT
58 UNAME=${UNAME-`uname 2>/dev/null`}
59 case X$UNAME in
60 *-DOS) PATH_SEPARATOR=';' ;;
61 *) PATH_SEPARATOR=':' ;;
62 esac
63fi
64
cf4ccd63
JL
65# The HP-UX ksh and POSIX shell print the target directory to stdout
66# if CDPATH is set.
d207ebef 67if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
cf4ccd63 68
d207ebef 69if test "X${echo_test_string+set}" != Xset; then
90fb0c24
TT
70 # find a string as large as possible, as long as the shell can cope with it
71 for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
72 # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
73 if (echo_test_string="`eval $cmd`") 2>/dev/null &&
74 echo_test_string="`eval $cmd`" &&
75 (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
76 break
77 fi
78 done
79fi
80
4f4caf92
AO
81if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
82 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
83 test "X$echo_testing_string" = "X$echo_test_string"; then
84 :
85else
cf4ccd63
JL
86 # The Solaris, AIX, and Digital Unix default echo programs unquote
87 # backslashes. This makes it impossible to quote backslashes using
88 # echo "$something" | sed 's/\\/\\\\/g'
89 #
90 # So, first we look for a working echo in the user's PATH.
90fb0c24
TT
91
92 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
cf4ccd63 93 for dir in $PATH /usr/ucb; do
d207ebef 94 if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
90fb0c24 95 test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
4f4caf92
AO
96 echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
97 test "X$echo_testing_string" = "X$echo_test_string"; then
cf4ccd63
JL
98 echo="$dir/echo"
99 break
100 fi
101 done
102 IFS="$save_ifs"
103
104 if test "X$echo" = Xecho; then
105 # We didn't find a better echo, so look for alternatives.
90fb0c24 106 if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
4f4caf92
AO
107 echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
108 test "X$echo_testing_string" = "X$echo_test_string"; then
cf4ccd63
JL
109 # This shell has a builtin print -r that does the trick.
110 echo='print -r'
d207ebef
JM
111 elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
112 test "X$CONFIG_SHELL" != X/bin/ksh; then
fbd836fc 113 # If we have ksh, try running ltconfig again with it.
90fb0c24
TT
114 ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
115 export ORIGINAL_CONFIG_SHELL
fbd836fc
ILT
116 CONFIG_SHELL=/bin/ksh
117 export CONFIG_SHELL
118 exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
cf4ccd63
JL
119 else
120 # Try using printf.
4f4caf92 121 echo='printf %s\n'
90fb0c24 122 if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
4f4caf92
AO
123 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
124 test "X$echo_testing_string" = "X$echo_test_string"; then
90fb0c24
TT
125 # Cool, printf works
126 :
4f4caf92
AO
127 elif echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` &&
128 test "X$echo_testing_string" = 'X\t' &&
129 echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
130 test "X$echo_testing_string" = "X$echo_test_string"; then
90fb0c24
TT
131 CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
132 export CONFIG_SHELL
133 SHELL="$CONFIG_SHELL"
134 export SHELL
135 echo="$CONFIG_SHELL $0 --fallback-echo"
4f4caf92
AO
136 elif echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` &&
137 test "X$echo_testing_string" = 'X\t' &&
138 echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
139 test "X$echo_testing_string" = "X$echo_test_string"; then
90fb0c24
TT
140 echo="$CONFIG_SHELL $0 --fallback-echo"
141 else
142 # maybe with a smaller string...
143 prev=:
144
145 for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
146 if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
147 break
148 fi
149 prev="$cmd"
150 done
151
152 if test "$prev" != 'sed 50q "$0"'; then
153 echo_test_string=`eval $prev`
4f4caf92 154
90fb0c24 155 export echo_test_string
4f4caf92 156 exec "${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}}" "$0" ${1+"$@"}
90fb0c24
TT
157 else
158 # Oops. We lost completely, so just stick with echo.
159 echo=echo
160 fi
cf4ccd63
JL
161 fi
162 fi
163 fi
164fi
165
166# Sed substitution that helps us do robust quoting. It backslashifies
167# metacharacters that are still active within double-quoted strings.
168Xsed='sed -e s/^X//'
169sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
170
171# Same as above, but do not quote variable references.
172double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
173
90fb0c24
TT
174# Sed substitution to delay expansion of an escaped shell variable in a
175# double_quote_subst'ed string.
176delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
177
6599da04 178# The name of this program.
cf4ccd63 179progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
6599da04
JM
180
181# Constants:
182PROGRAM=ltconfig
183PACKAGE=libtool
898c7238
AO
184VERSION=1.4a-GCC3.0
185TIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)"
d207ebef
JM
186ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
187ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
6599da04
JM
188rm="rm -f"
189
190help="Try \`$progname --help' for more information."
191
192# Global variables:
cf4ccd63 193default_ofile=libtool
6599da04
JM
194can_build_shared=yes
195enable_shared=yes
d207ebef
JM
196# All known linkers require a `.a' archive for static linking (except M$VC,
197# which needs '.lib').
6599da04 198enable_static=yes
90fb0c24
TT
199enable_fast_install=yes
200enable_dlopen=unknown
d207ebef 201enable_win32_dll=no
4f4caf92 202pic_mode=default
6599da04
JM
203ltmain=
204silent=
205srcdir=
206ac_config_guess=
207ac_config_sub=
208host=
4f4caf92
AO
209build=NONE
210nonopt=NONE
cf4ccd63 211ofile="$default_ofile"
6599da04 212verify_host=yes
4f4caf92 213tagname=
6599da04
JM
214with_gcc=no
215with_gnu_ld=no
90fb0c24
TT
216need_locks=yes
217ac_ext=c
fbd836fc 218libext=a
90fb0c24 219cache_file=
82e23236 220max_cmd_len=
6599da04 221
4f4caf92
AO
222## Dependencies to place before and after the object being linked:
223predep_objects=
224postdep_objects=
225predeps=
226postdeps=
227compiler_lib_search_path=
228
229## Link characteristics:
230allow_undefined_flag=
231no_undefined_flag=
232need_lib_prefix=unknown
233need_version=unknown
234# when you set need_version to no, make sure it does not cause -set_version
235# flags to be left without arguments
236archive_cmds=
237archive_expsym_cmds=
238old_archive_from_new_cmds=
239old_archive_from_expsyms_cmds=
240striplib=
241old_striplib=
242export_dynamic_flag_spec=
243whole_archive_flag_spec=
244thread_safe_flag_spec=
245hardcode_into_libs=no
246hardcode_libdir_flag_spec=
247hardcode_libdir_separator=
248hardcode_direct=no
249hardcode_minus_L=no
250hardcode_shlibpath_var=unsupported
251runpath_var=
252link_all_deplibs=unknown
253always_export_symbols=no
254export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
255# include_expsyms should be a list of space-separated symbols to be *always*
256# included in the symbol list
257include_expsyms=
258# exclude_expsyms can be an egrep regular expression of symbols to exclude
259# it will be wrapped by ` (' and `)$', so one must not match beginning or
260# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
261# as well as any symbol that contains `d'.
262exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
263# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
264# platforms (ab)use it in PIC code, but their linkers get confused if
265# the symbol is explicitly referenced. Since portable code cannot
266# rely on this symbol name, it's probably fine to never include it in
267# preloaded symbol tables.
268extract_expsyms_cmds=
c9392a2b 269file_list_spec=
4f4caf92
AO
270
271## Tools:
6599da04 272old_AR="$AR"
4f4caf92 273old_AR_FLAGS="$AR_FLAGS"
6599da04
JM
274old_CC="$CC"
275old_CFLAGS="$CFLAGS"
276old_CPPFLAGS="$CPPFLAGS"
d207ebef 277old_LDFLAGS="$LDFLAGS"
4f4caf92 278old_LIBS="$LIBS"
3dd7094e 279old_MAGIC_CMD="$MAGIC_CMD"
6599da04
JM
280old_LD="$LD"
281old_LN_S="$LN_S"
4f4caf92 282old_LTCC="$LTCC"
cf4ccd63 283old_NM="$NM"
6599da04 284old_RANLIB="$RANLIB"
4f4caf92
AO
285old_STRIP="$STRIP"
286old_AS="$AS"
cf4ccd63 287old_DLLTOOL="$DLLTOOL"
d207ebef 288old_OBJDUMP="$OBJDUMP"
4f4caf92
AO
289old_OBJEXT="$OBJEXT"
290old_EXEEXT="$EXEEXT"
291old_reload_flag="$reload_flag"
292old_deplibs_check_method="$deplibs_check_method"
293old_file_magic_cmd="$file_magic_cmd"
6599da04
JM
294
295# Parse the command line options.
296args=
297prev=
298for option
299do
82e23236 300 case $option in
6599da04
JM
301 -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
302 *) optarg= ;;
303 esac
304
305 # If the previous option needs an argument, assign it.
306 if test -n "$prev"; then
307 eval "$prev=\$option"
308 prev=
309 continue
310 fi
311
82e23236 312 case $option in
6599da04 313 --help) cat <<EOM
4f4caf92 314Usage: $progname [OPTION]... LTMAIN [HOST]
6599da04
JM
315
316Generate a system-specific libtool script.
317
4f4caf92 318 --build configure for building on BUILD [BUILD=HOST]
cf4ccd63 319 --debug enable verbose shell tracing
6599da04
JM
320 --disable-shared do not build shared libraries
321 --disable-static do not build static libraries
90fb0c24
TT
322 --disable-fast-install do not optimize for fast installation
323 --enable-dlopen enable dlopen support
d207ebef 324 --enable-win32-dll enable building dlls on win32 hosts
6599da04
JM
325 --help display this help and exit
326 --no-verify do not verify that HOST is a valid host type
cf4ccd63 327-o, --output=FILE specify the output file [default=$default_ofile]
6599da04 328 --quiet same as \`--silent'
cf4ccd63 329 --silent do not print informational messages
6599da04
JM
330 --srcdir=DIR find \`config.guess' in DIR
331 --version output version information and exit
4f4caf92 332 --add-tag=TAG append an alternate configuration
6599da04
JM
333 --with-gcc assume that the GNU C compiler will be used
334 --with-gnu-ld assume that the C compiler uses the GNU linker
4f4caf92
AO
335 --prefer-pic try to use only PIC objects
336 --prefer-non-pic try to use only non-PIC objects
90fb0c24
TT
337 --disable-lock disable file locking
338 --cache-file=FILE configure cache file
6599da04 339
90fb0c24
TT
340LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
341that provides basic libtool functionality.
6599da04
JM
342
343HOST is the canonical host system name [default=guessed].
344EOM
345 exit 0
346 ;;
347
4f4caf92
AO
348 --build) prev=build ;;
349 --build=*) build="$optarg" ;;
350
cf4ccd63
JL
351 --debug)
352 echo "$progname: enabling shell trace mode"
353 set -x
354 ;;
355
6599da04
JM
356 --disable-shared) enable_shared=no ;;
357
358 --disable-static) enable_static=no ;;
359
90fb0c24
TT
360 --disable-fast-install) enable_fast_install=no ;;
361
362 --enable-dlopen) enable_dlopen=yes ;;
363
d207ebef
JM
364 --enable-win32-dll) enable_win32_dll=yes ;;
365
6599da04
JM
366 --quiet | --silent) silent=yes ;;
367
368 --srcdir) prev=srcdir ;;
369 --srcdir=*) srcdir="$optarg" ;;
370
371 --no-verify) verify_host=no ;;
372
cf4ccd63
JL
373 --output | -o) prev=ofile ;;
374 --output=*) ofile="$optarg" ;;
375
90fb0c24 376 --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
6599da04 377
4f4caf92
AO
378 --add-tag) prev=tagname ;;
379 --add-tag=*) tagname="$optarg" ;;
380
6599da04
JM
381 --with-gcc) with_gcc=yes ;;
382 --with-gnu-ld) with_gnu_ld=yes ;;
383
4f4caf92
AO
384 --prefer-pic) pic_mode=yes ;;
385 --prefer-non-pic) pic_mode=no ;;
386
90fb0c24
TT
387 --disable-lock) need_locks=no ;;
388
389 --cache-file=*) cache_file="$optarg" ;;
390
6599da04
JM
391 -*)
392 echo "$progname: unrecognized option \`$option'" 1>&2
393 echo "$help" 1>&2
394 exit 1
395 ;;
396
397 *)
398 if test -z "$ltmain"; then
399 ltmain="$option"
400 elif test -z "$host"; then
cf4ccd63 401# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
6599da04
JM
402# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
403# echo "$progname: warning \`$option' is not a valid host type" 1>&2
404# fi
405 host="$option"
406 else
407 echo "$progname: too many arguments" 1>&2
408 echo "$help" 1>&2
409 exit 1
410 fi ;;
411 esac
412done
413
414if test -z "$ltmain"; then
415 echo "$progname: you must specify a LTMAIN file" 1>&2
416 echo "$help" 1>&2
417 exit 1
418fi
419
fbd836fc 420if test ! -f "$ltmain"; then
cf4ccd63
JL
421 echo "$progname: \`$ltmain' does not exist" 1>&2
422 echo "$help" 1>&2
423 exit 1
6599da04
JM
424fi
425
4f4caf92
AO
426if test -n "$tagname"; then
427 # Check whether tagname contains only valid characters
82e23236 428 case `$echo "X$tagname" | $Xsed -e 's/[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]//g'` in
92769744
MS
429 "") ;;
430 *)
4f4caf92
AO
431 echo "$progname: invalid tag name: $tagname" 1>&2
432 exit 1
433 ;;
434 esac
435
436 if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$ofile" > /dev/null; then
437 echo "$progname: tag name $tagname already exists" 1>&2
438 exit 1
439 fi
440
441 if test ! -f "$ofile"; then
442 echo "$progname: warning: output file \`$ofile' does not exist" 1>&2
443 fi
444
445 if test -z "$LTCC"; then
446 eval "`$SHELL $ofile --config | grep '^LTCC='`"
447 if test -z "$LTCC"; then
448 echo "$progname: warning: output file \`$ofile' does not look like a libtool script" 1>&2
449 else
450 echo "$progname: warning: using \`LTCC=$LTCC', extracted from \`$ofile'" 1>&2
451 fi
452 fi
453fi
454
6599da04
JM
455# Quote any args containing shell metacharacters.
456ltconfig_args=
457for arg
458do
82e23236 459 case $arg in
6599da04
JM
460 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
461 ltconfig_args="$ltconfig_args '$arg'" ;;
462 *) ltconfig_args="$ltconfig_args $arg" ;;
463 esac
464done
465
466# A relevant subset of AC_INIT.
467
468# File descriptor usage:
469# 0 standard input
470# 1 file creation
471# 2 errors and warnings
472# 3 some systems may open it to /dev/tty
473# 4 used on the Kubota Titan
474# 5 compiler messages saved in config.log
475# 6 checking for... messages and results
476if test "$silent" = yes; then
477 exec 6>/dev/null
478else
479 exec 6>&1
480fi
481exec 5>>./config.log
482
483# NLS nuisances.
484# Only set LANG and LC_ALL to C if already set.
485# These must not be set unconditionally because not all systems understand
486# e.g. LANG=C (notably SCO).
d207ebef
JM
487if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
488if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi
6599da04 489
06298abd 490if test -n "$cache_file" && test -r "$cache_file" && test -f "$cache_file"; then
90fb0c24
TT
491 echo "loading cache $cache_file within ltconfig"
492 . $cache_file
493fi
494
6599da04
JM
495if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
496 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
497 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
498 ac_n= ac_c='
499' ac_t=' '
500 else
501 ac_n=-n ac_c= ac_t=
502 fi
503else
504 ac_n= ac_c='\c' ac_t=
505fi
506
507if test -z "$srcdir"; then
90fb0c24
TT
508 # Assume the source directory is the same one as the path to LTMAIN.
509 srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
6599da04
JM
510 test "$srcdir" = "$ltmain" && srcdir=.
511fi
512
cf4ccd63 513trap "$rm conftest*; exit 1" 1 2 15
6599da04
JM
514if test "$verify_host" = yes; then
515 # Check for config.guess and config.sub.
516 ac_aux_dir=
517 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
518 if test -f $ac_dir/config.guess; then
519 ac_aux_dir=$ac_dir
520 break
521 fi
522 done
523 if test -z "$ac_aux_dir"; then
524 echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
525 echo "$help" 1>&2
526 exit 1
527 fi
528 ac_config_guess=$ac_aux_dir/config.guess
529 ac_config_sub=$ac_aux_dir/config.sub
530
531 # Make sure we can run config.sub.
fbd836fc 532 if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
6599da04
JM
533 else
534 echo "$progname: cannot run $ac_config_sub" 1>&2
535 echo "$help" 1>&2
536 exit 1
537 fi
538
539 echo $ac_n "checking host system type""... $ac_c" 1>&6
540
541 host_alias=$host
82e23236 542 case $host_alias in
6599da04 543 "")
4f4caf92
AO
544 # Force config.guess to use the C compiler.
545 # CC_FOR_BUILD overrides the CC variable in config.guess but I had
546 # problems with it so do it this way for now.
547 CC="$LTCC"
548
fbd836fc 549 if host_alias=`$SHELL $ac_config_guess`; then :
6599da04
JM
550 else
551 echo "$progname: cannot guess host type; you must specify one" 1>&2
552 echo "$help" 1>&2
553 exit 1
4f4caf92
AO
554 fi
555
556 # Restore the C compiler.
557 CC="$old_CC"
558 ;;
6599da04 559 esac
fbd836fc 560 host=`$SHELL $ac_config_sub $host_alias`
cf4ccd63
JL
561 echo "$ac_t$host" 1>&6
562
563 # Make sure the host verified.
564 test -z "$host" && exit 1
6599da04 565
4f4caf92
AO
566 # Check for the build system type
567 echo $ac_n "checking build system type... $ac_c" 1>&6
568
569 build_alias=$build
82e23236 570 case $build_alias in
4f4caf92
AO
571 NONE)
572 case $nonopt in
573 NONE) build_alias=$host_alias ;;
574 *) build_alias=$nonopt ;;
575 esac ;;
576 esac
577
578 build=`$SHELL $ac_config_sub $build_alias`
579 build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
580 build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
581 build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
582 echo "$ac_t""$build" 1>&6
583
6599da04
JM
584elif test -z "$host"; then
585 echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
586 echo "$help" 1>&2
587 exit 1
588else
589 host_alias=$host
4f4caf92
AO
590 build_alias=$host_alias
591 build=$host
592fi
593
594if test x"$host" != x"$build"; then
595 ac_tool_prefix=${host_alias}-
596else
597 ac_tool_prefix=
6599da04
JM
598fi
599
4f4caf92
AO
600host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
601host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
602host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
603
cf4ccd63 604# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
82e23236 605case $host_os in
cf4ccd63
JL
606linux-gnu*) ;;
607linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
6599da04
JM
608esac
609
82e23236 610case $host_os in
cf4ccd63
JL
611aix3*)
612 # AIX sometimes has problems with the GCC collect2 program. For some
613 # reason, if we set the COLLECT_NAMES environment variable, the problems
614 # vanish in a puff of smoke.
d207ebef 615 if test "X${COLLECT_NAMES+set}" != Xset; then
cf4ccd63
JL
616 COLLECT_NAMES=
617 export COLLECT_NAMES
618 fi
619 ;;
620esac
621
6599da04 622# Determine commands to create old-style static archives.
4f4caf92 623old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
6599da04 624old_postinstall_cmds='chmod 644 $oldlib'
cf4ccd63
JL
625old_postuninstall_cmds=
626
06298abd
AO
627if test -n "$RANLIB"; then
628 old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
629 old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
630fi
631
4f4caf92
AO
632# Source the script associated with the $tagname tag configuration.
633if test -n "$tagname"; then
634 . $ltmain
635else
636 # FIXME: We should use a variable here
637 # Configure for a C compiler
638 . $srcdir/ltcf-c.sh
6599da04
JM
639fi
640
4f4caf92
AO
641# Set sane defaults for various variables
642test -z "$AR" && AR=ar
643test -z "$AR_FLAGS" && AR_FLAGS=cru
644test -z "$AS" && AS=as
645test -z "$CC" && CC=cc
cf4ccd63 646test -z "$DLLTOOL" && DLLTOOL=dlltool
3dd7094e 647test -z "$MAGIC_CMD" && MAGIC_CMD=file
4f4caf92
AO
648test -z "$LD" && LD=ld
649test -z "$LN_S" && LN_S="ln -s"
650test -z "$NM" && NM=nm
d207ebef 651test -z "$OBJDUMP" && OBJDUMP=objdump
4f4caf92
AO
652test -z "$RANLIB" && RANLIB=:
653test -z "$STRIP" && STRIP=:
654test -z "$objext" && objext=o
6599da04 655
4f4caf92
AO
656echo $ac_n "checking for objdir... $ac_c" 1>&6
657rm -f .libs 2>/dev/null
658mkdir .libs 2>/dev/null
659if test -d .libs; then
660 objdir=.libs
661else
662 # MS-DOS does not allow filenames that begin with a dot.
663 objdir=_libs
6599da04 664fi
4f4caf92
AO
665rmdir .libs 2>/dev/null
666echo "$ac_t$objdir" 1>&6
667
668# If no C compiler was specified, use CC.
669LTCC=${LTCC-"$CC"}
6599da04
JM
670
671# Allow CC to be a program name with arguments.
672set dummy $CC
673compiler="$2"
674
4f4caf92
AO
675# We assume here that the value for ac_cv_prog_cc_pic will not be cached
676# in isolation, and that seeing it set (from the cache) indicates that
677# the associated values are set (in the cache) correctly too.
678echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
82e23236 679echo "$progname:678:checking for $compiler option to produce PIC" 1>&5
fbd836fc 680
4f4caf92
AO
681if test -z "$ac_cv_prog_cc_pic"; then
682 echo "$ac_t"none 1>&6
d207ebef 683else
4f4caf92
AO
684 echo "$ac_t""$ac_cv_prog_cc_pic" 1>&6
685
686 # Check to make sure the pic_flag actually works.
687 echo $ac_n "checking if $compiler PIC flag $ac_cv_prog_cc_pic works... $ac_c" 1>&6
82e23236 688 echo "$progname:687:checking that $compiler PIC flag $ac_cv_prog_cc_pic works." 1>&5
4f4caf92
AO
689 if test "X${ac_cv_prog_cc_pic_works+set}" = Xset && \
690 test "X${ac_cv_prog_cc_pic_works}" != X; then
691 echo $ac_n "(cached) $ac_c" 1>&6
692 else
693 ac_cv_prog_cc_pic_works=yes
d207ebef 694 $rm conftest*
4f4caf92
AO
695 echo $lt_simple_compile_test_code > conftest.$ac_ext
696 save_CFLAGS="$CFLAGS"
697 CFLAGS="$CFLAGS $ac_cv_prog_cc_pic -DPIC"
82e23236 698 if { (eval echo $progname:697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
d207ebef
JM
699 # Append any warnings to the config.log.
700 cat conftest.err 1>&5
701
82e23236 702 case $host_os in
4f4caf92
AO
703 hpux9* | hpux10* | hpux11*)
704 # On HP-UX, both CC and GCC only warn that PIC is supported... then
705 # they create non-PIC objects. So, if there were any warnings, we
706 # assume that PIC is not supported.
707 if test -s conftest.err; then
708 ac_cv_prog_cc_pic_works=no
709 ac_cv_prog_cc_can_build_shared=no
710 ac_cv_prog_cc_pic=
711 else
712 ac_cv_prog_cc_pic_works=yes
713 ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic"
714 fi
715 ;;
716 *)
717 ac_cv_prog_cc_pic_works=yes
718 ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic"
719 ;;
720 esac
d207ebef 721 else
4f4caf92 722 # Append any errors to the config.log.
d207ebef 723 cat conftest.err 1>&5
4f4caf92
AO
724 ac_cv_prog_cc_pic_works=no
725 ac_cv_prog_cc_can_build_shared=no
726 ac_cv_prog_cc_pic=
d207ebef 727 fi
4f4caf92 728 CFLAGS="$save_CFLAGS"
d207ebef 729 $rm conftest*
4f4caf92
AO
730 fi
731 # Belt *and* braces to stop my trousers falling down:
732 if test "X$ac_cv_prog_cc_pic_works" = Xno; then
733 ac_cv_prog_cc_pic=
734 ac_cv_prog_cc_can_build_shared=no
735 fi
736 echo "$ac_t""$ac_cv_prog_cc_pic_works" 1>&6
d207ebef 737fi
cf4ccd63 738
4f4caf92
AO
739# Check for any special shared library compilation flags.
740if test -n "$ac_cv_prog_cc_shlib"; then
741 echo "$progname: warning: \`$CC' requires \`$ac_cv_prog_cc_shlib' to build shared libraries" 1>&2
742 if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$ac_cv_prog_cc_shlib[ ]" >/dev/null; then :
743 else
744 echo "$progname: add \`$ac_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2
745 ac_cv_prog_cc_can_build_shared=no
746 fi
6599da04
JM
747fi
748
4f4caf92 749echo $ac_n "checking if $compiler static flag $ac_cv_prog_cc_static works... $ac_c" 1>&6
82e23236 750echo "$progname:749: checking if $compiler static flag $ac_cv_prog_cc_static works" >&5
4f4caf92
AO
751if test "X${ac_cv_prog_cc_static_works+set}" = Xset && \
752 test "X${ac_cv_prog_cc_static_works}" != X; then
753 echo $ac_n "(cached) $ac_c" 1>&6
754else
cf4ccd63 755 $rm conftest*
4f4caf92
AO
756 echo $lt_simple_link_test_code > conftest.$ac_ext
757 save_LDFLAGS="$LDFLAGS"
758 LDFLAGS="$LDFLAGS $ac_cv_prog_cc_static"
82e23236 759 if { (eval echo $progname:758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
4f4caf92 760 ac_cv_prog_cc_static_works=yes
90fb0c24 761 else
4f4caf92
AO
762 ac_cv_prog_cc_static_works=no
763 ac_cv_prog_cc_static=
90fb0c24 764 fi
4f4caf92 765 LDFLAGS="$save_LDFLAGS"
90fb0c24 766 $rm conftest*
90fb0c24 767fi
4f4caf92
AO
768# Belt *and* braces to stop my trousers falling down:
769if test "X$ac_cv_prog_cc_static_works" = Xno; then
770 ac_cv_prog_cc_static=
771fi
772echo "$ac_t""$ac_cv_prog_cc_static_works" 1>&6
773pic_flag="$ac_cv_prog_cc_pic"
774special_shlib_compile_flags="$ac_cv_prog_cc_shlib"
775wl="$ac_cv_prog_cc_wl"
776link_static_flag="$ac_cv_prog_cc_static"
777no_builtin_flag="$ac_cv_prog_cc_no_builtin"
778can_build_shared="$ac_cv_prog_cc_can_build_shared"
cf4ccd63 779
82e23236
AO
780# find the maximum length of command line arguments
781echo "$progname:780: finding the maximum length of command line arguments" 1>&5
782echo $ac_n "finding the maximum length of command line arguments... $ac_c" 1>&6
783if test "${lt_cv_sys_max_cmd_len+set}" = set; then
784 echo $ac_n "(cached) $ac_c" 1>&6
785else
786 i=0
33456445
AO
787 testring="ABCD"
788 # If test is not a shell built-in, we'll probably end up computing a
789 # maximum length that is only half of the actual maximum length, but
790 # we can't tell.
791 while test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
792 = "XX$testring" &&
82e23236
AO
793 new_result=`expr "X$testring" : ".*" 2>&1` &&
794 lt_cv_sys_max_cmd_len=$new_result &&
898c7238 795 test $i != 17 # 1/2 MB should be enough
82e23236
AO
796 do
797 i=`expr $i + 1`
798 testring=$testring$testring
799 done
800 testring=
801 # add a significant safety factor because C++ compilers can tack on massive amounts
802 # of additional arguments before passing them to the linker. 1/4 should be good.
803 len=`expr $lt_cv_sys_max_cmd_len \/ 4`
804 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len - $len`
805fi
806echo "$progname:@lineno@: result: $lt_cv_sys_max_cmd_len" 1>&5
807echo "${ac_t}$lt_cv_sys_max_cmd_len" 1>&6
808
809if test -n $lt_cv_sys_max_cmd_len ; then
810 max_cmd_len=$lt_cv_sys_max_cmd_len
811else
812 max_cmd_len=none
813fi
814
90fb0c24 815# Check to see if options -o and -c are simultaneously supported by compiler
4f4caf92 816echo $ac_n "checking if $compiler supports -c -o file.$objext... $ac_c" 1>&6
82e23236
AO
817if test "${lt_cv_compiler_c_o+set}" = set; then
818 echo $ac_n "(cached) $ac_c" 1>&6
90fb0c24 819else
82e23236
AO
820 $rm -r conftest 2>/dev/null
821 mkdir conftest
822 cd conftest
823 $rm conftest*
824 echo $lt_simple_compile_test_code > conftest.$ac_ext
825 mkdir out
826 # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
827 # that will create temporary files in the current directory regardless of
828 # the output directory. Thus, making CWD read-only will cause this test
829 # to fail, enabling locking or at least warning the user not to do parallel
830 # builds.
831 chmod -w .
832 save_CFLAGS="$CFLAGS"
833 CFLAGS="$CFLAGS -o out/conftest2.$objext"
33456445
AO
834 echo "$progname:833: checking if $compiler supports -c -o file.$objext" >&5
835 if { (eval echo $progname:834: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$objext; then
82e23236
AO
836
837 # The compiler can only warn and ignore the option if not recognized
838 # So say no if there are warnings
839 if test -s out/conftest.err; then
840 lt_cv_compiler_c_o=no
841 else
842 lt_cv_compiler_c_o=yes
843 fi
844 else
845 # Append any errors to the config.log.
846 cat out/conftest.err 1>&5
847 lt_cv_compiler_c_o=no
848 fi
849 CFLAGS="$save_CFLAGS"
850 chmod u+w .
851 $rm conftest* out/*
852 rmdir out
853 cd ..
854 rmdir conftest
855 $rm -r conftest 2>/dev/null
856fi
857compiler_c_o=$lt_cv_compiler_c_o
858echo "${ac_t}$compiler_c_o" 1>&6
90fb0c24 859
90fb0c24
TT
860# Check to see if we can do hard links to lock some files if needed
861hard_links="nottested"
862if test "$compiler_c_o" = no && test "$need_locks" != no; then
863 # do not overwrite the value of need_locks provided by the user
864 echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
865 hard_links=yes
866 $rm conftest*
867 ln conftest.a conftest.b 2>/dev/null && hard_links=no
868 touch conftest.a
869 ln conftest.a conftest.b 2>&5 || hard_links=no
870 ln conftest.a conftest.b 2>/dev/null && hard_links=no
871 echo "$ac_t$hard_links" 1>&6
872 $rm conftest*
873 if test "$hard_links" = no; then
874 echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
875 need_locks=warn
876 fi
877else
878 need_locks=no
879fi
880
881if test "$with_gcc" = yes; then
882 # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
883 echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
884 $rm conftest*
4f4caf92 885 echo $lt_simple_compile_test_code > conftest.$ac_ext
90fb0c24 886 save_CFLAGS="$CFLAGS"
4f4caf92 887 CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
33456445
AO
888 echo "$progname:887: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
889 if { (eval echo $progname:888: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
90fb0c24
TT
890
891 # The compiler can only warn and ignore the option if not recognized
892 # So say no if there are warnings
893 if test -s conftest.err; then
894 echo "$ac_t"no 1>&6
895 compiler_rtti_exceptions=no
896 else
897 echo "$ac_t"yes 1>&6
898 compiler_rtti_exceptions=yes
899 fi
900 else
901 # Append any errors to the config.log.
902 cat conftest.err 1>&5
903 compiler_rtti_exceptions=no
904 echo "$ac_t"no 1>&6
905 fi
906 CFLAGS="$save_CFLAGS"
907 $rm conftest*
908
909 if test "$compiler_rtti_exceptions" = "yes"; then
910 no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
911 else
912 no_builtin_flag=' -fno-builtin'
913 fi
914
6599da04
JM
915fi
916
4f4caf92
AO
917# See if the linker supports building shared libraries.
918echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
6599da04 919
4f4caf92
AO
920echo "$ac_t$ld_shlibs" 1>&6
921test "$ld_shlibs" = no && can_build_shared=no
6599da04
JM
922
923# Check hardcoding attributes.
924echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
925hardcode_action=
926if test -n "$hardcode_libdir_flag_spec" || \
cf4ccd63 927 test -n "$runpath_var"; then
6599da04
JM
928
929 # We can hardcode non-existant directories.
d207ebef
JM
930 if test "$hardcode_direct" != no &&
931 # If the only mechanism to avoid hardcoding is shlibpath_var, we
932 # have to relink, otherwise we might link with an installed library
933 # when we should be linking with a yet-to-be-installed one
934 ## test "$hardcode_shlibpath_var" != no &&
935 test "$hardcode_minus_L" != no; then
6599da04
JM
936 # Linking always hardcodes the temporary library directory.
937 hardcode_action=relink
938 else
939 # We can link without hardcoding, and we can hardcode nonexisting dirs.
940 hardcode_action=immediate
941 fi
6599da04 942else
cf4ccd63
JL
943 # We cannot hardcode anything, or else we can only hardcode existing
944 # directories.
945 hardcode_action=unsupported
6599da04 946fi
cf4ccd63 947echo "$ac_t$hardcode_action" 1>&6
6599da04 948
4f4caf92
AO
949echo $ac_n "checking whether stripping libraries is possible... $ac_c" 1>&6
950if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
951 test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
952 test -z "$striplib" && striplib="$STRIP --strip-unneeded"
953 echo "${ac_t}yes" 1>&6
954else
955 echo "${ac_t}no" 1>&6
956fi
6599da04 957
82e23236
AO
958case $reload_flag in
959"" | " "*) ;;
960*) reload_flag=" $reload_flag" ;;
961esac
6599da04 962reload_cmds='$LD$reload_flag -o $output$reload_objs'
4f4caf92 963test -z "$deplibs_check_method" && deplibs_check_method=unknown
6599da04
JM
964
965# PORTME Fill in your ld.so characteristics
966library_names_spec=
cf4ccd63 967libname_spec='lib$name'
6599da04 968soname_spec=
43d8d958 969shrext=".so"
6599da04 970postinstall_cmds=
cf4ccd63 971postuninstall_cmds=
6599da04 972finish_cmds=
cf4ccd63 973finish_eval=
6599da04 974shlibpath_var=
90fb0c24 975shlibpath_overrides_runpath=unknown
6599da04
JM
976version_type=none
977dynamic_linker="$host_os ld.so"
90fb0c24
TT
978sys_lib_dlsearch_path_spec="/lib /usr/lib"
979sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
4f4caf92 980
6599da04 981echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
82e23236 982case $host_os in
90fb0c24 983aix3*)
6599da04 984 version_type=linux
cf4ccd63 985 library_names_spec='${libname}${release}.so$versuffix $libname.a'
6599da04
JM
986 shlibpath_var=LIBPATH
987
82e23236 988 # AIX 3 has no versioning support, so we append a major version to the name.
cf4ccd63
JL
989 soname_spec='${libname}${release}.so$major'
990 ;;
991
0ef8b11b 992aix4* | aix5*)
5f7de4b8 993 version_type=linux
82e23236
AO
994 if test "$host_cpu" = ia64; then
995 # AIX 5 supports IA64
996 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
997 shlibpath_var=LD_LIBRARY_PATH
998 else
999 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
1000 # soname into executable. Probably we can add versioning support to
1001 # collect2, so additional links can be useful in future.
1002 # We preserve .a as extension for shared libraries though AIX4.2
1003 # and later linker supports .so
1004 if test "$aix_use_runtimelinking" = yes; then
1005 # If using run time linking (on AIX 4.2 or later) use lib<name>.so instead of
1006 # lib<name>.a to let people know that these are not typical AIX shared libraries.
1007 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1008 else
1009 # We preserve .a as extension for shared libraries though AIX4.2
1010 # and later when we are not doing run time linking.
1011 library_names_spec='${libname}${release}.a $libname.a'
5f7de4b8 1012 soname_spec='${libname}${release}.so$major'
82e23236
AO
1013 fi
1014 # If we're using GNU nm, then we don't want the "-C" option.
1015 # -C means demangle to AIX nm, but means don't demangle with GNU nm
1016 if $NM -V 2>&1 | egrep '(GNU)' > /dev/null; then
1017 export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
1018 else
1019 export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
1020 fi
1021 shlibpath_var=LIBPATH
1022 deplibs_check_method=pass_all
1023 case $host_os in
1024 aix4 | aix4.[01] | aix4.[01].*)
1025 if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
1026 echo ' yes '
1027 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
1028 :
1029 else
1030 # With GCC up to 2.95.x, collect2 would create an import file
1031 # for dependence libraries. The import file would start with
1032 # the line `#! .'. This would cause the generated library to
1033 # depend on `.', always an invalid library. This was fixed in
1034 # development snapshots of GCC prior to 3.0.
1035 can_build_shared=no
1036 fi
1037 ;;
1038 esac
1039 fi
90fb0c24
TT
1040 ;;
1041
cf4ccd63
JL
1042amigaos*)
1043 library_names_spec='$libname.ixlibrary $libname.a'
1044 # Create ${libname}_ixlibrary.a entries in /sys/libs.
1045 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
1046 ;;
1047
90fb0c24
TT
1048beos*)
1049 library_names_spec='${libname}.so'
1050 dynamic_linker="$host_os ld.so"
1051 shlibpath_var=LIBRARY_PATH
d207ebef
JM
1052 lt_cv_dlopen="load_add_on"
1053 lt_cv_dlopen_libs=
1054 lt_cv_dlopen_self=yes
90fb0c24
TT
1055 ;;
1056
1057bsdi4*)
1058 version_type=linux
d207ebef
JM
1059 need_version=no
1060 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1061 soname_spec='${libname}${release}.so$major'
1062 finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
90fb0c24 1063 shlibpath_var=LD_LIBRARY_PATH
90fb0c24
TT
1064 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
1065 sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
d207ebef 1066 export_dynamic_flag_spec=-rdynamic
90fb0c24
TT
1067 # the default ld.so.conf also contains /usr/contrib/lib and
1068 # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
1069 # libtool to hard-code these into programs
1070 ;;
1071
3dd7094e 1072cygwin* | mingw* | pw32*)
cf4ccd63 1073 version_type=windows
d207ebef
JM
1074 need_version=no
1075 need_lib_prefix=no
82e23236
AO
1076 case $with_gcc,$host_os in
1077 yes,cygwin*)
75b9074c
AO
1078 library_names_spec='$libname.dll.a'
1079 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll'
1080 postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i; echo \$dlname'\''`~
1081 dldir=$destdir/`dirname \$dlpath`~
1082 test -d \$dldir || mkdir -p \$dldir~
1083 $install_prog .libs/$dlname \$dldir/$dlname'
1084 postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
1085 dlpath=$dir/\$dldll; $rm \$dlpath'
82e23236
AO
1086 ;;
1087 yes,mingw*)
4f4caf92 1088 library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
82e23236
AO
1089 sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
1090 ;;
1091 yes,pw32*)
1092 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
1093;;
1094 *)
fbd836fc 1095 library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
82e23236
AO
1096 ;;
1097 esac
cf4ccd63 1098 dynamic_linker='Win32 ld.exe'
90fb0c24 1099 # FIXME: first we should search . and the directory the executable is in
cf4ccd63 1100 shlibpath_var=PATH
d207ebef
JM
1101 lt_cv_dlopen="LoadLibrary"
1102 lt_cv_dlopen_libs=
6599da04
JM
1103 ;;
1104
82e23236 1105darwin* | rhapsody*)
75b9074c 1106 dynamic_linker="$host_os dyld"
43d8d958
AT
1107 lt_cv_dlopen="dyld"
1108 lt_cv_dlopen_libs=
1109 lt_cv_dlopen_self=yes
75b9074c 1110 version_type=darwin
82e23236
AO
1111 need_lib_prefix=no
1112 need_version=no
43d8d958
AT
1113 # Disable shared library build on OS-X older than 10.3.
1114 case $host_os in
1115 darwin[1-6]*)
1116 can_build_shared=no
1117 ;;
1118 darwin7*)
1119 can_build_shared=yes
1120 ;;
1121 esac
1122 library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
1123 soname_spec='${libname}${release}${major}$shared_ext'
82e23236
AO
1124 shlibpath_overrides_runpath=yes
1125 shlibpath_var=DYLD_LIBRARY_PATH
43d8d958
AT
1126 shrext='$(test .$module = .yes && echo .so || echo .dylib)'
1127 sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
1128 sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
82e23236
AO
1129 ;;
1130
90fb0c24
TT
1131freebsd1*)
1132 dynamic_linker=no
1133 ;;
4f4caf92 1134
90fb0c24
TT
1135freebsd*)
1136 objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
1137 version_type=freebsd-$objformat
82e23236 1138 case $version_type in
90fb0c24 1139 freebsd-elf*)
90fb0c24
TT
1140 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
1141 need_version=no
06729913 1142 need_lc=no
90fb0c24
TT
1143 need_lib_prefix=no
1144 ;;
1145 freebsd-*)
90fb0c24
TT
1146 library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
1147 need_version=yes
1148 ;;
1149 esac
6599da04 1150 shlibpath_var=LD_LIBRARY_PATH
82e23236 1151 case $host_os in
4f4caf92
AO
1152 freebsd2*)
1153 shlibpath_overrides_runpath=yes
1154 ;;
06298abd 1155 *)
d207ebef 1156 shlibpath_overrides_runpath=no
4f4caf92 1157 hardcode_into_libs=yes
d207ebef
JM
1158 ;;
1159 esac
6599da04
JM
1160 ;;
1161
1162gnu*)
fbd836fc 1163 version_type=linux
d207ebef
JM
1164 need_lib_prefix=no
1165 need_version=no
1166 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
1167 soname_spec='${libname}${release}.so$major'
6599da04 1168 shlibpath_var=LD_LIBRARY_PATH
4f4caf92 1169 hardcode_into_libs=yes
6599da04
JM
1170 ;;
1171
80dc6aa0
RM
1172kfreebsd*-gnu | knetbsd*-gnu)
1173 version_type=linux
1174 need_lib_prefix=no
1175 need_version=no
1176 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
1177 soname_spec='${libname}${release}.so$major'
1178 shlibpath_var=LD_LIBRARY_PATH
1179 shlibpath_overrides_runpath=yes
1180 hardcode_into_libs=yes
1181 ;;
1182
cf4ccd63 1183hpux9* | hpux10* | hpux11*)
6599da04
JM
1184 # Give a soname corresponding to the major version so that dld.sl refuses to
1185 # link against other versions.
6599da04 1186 version_type=sunos
90fb0c24
TT
1187 need_lib_prefix=no
1188 need_version=no
f5cc59a7
AO
1189 case "$host_cpu" in
1190 ia64*)
1191 dynamic_linker="$host_os dld.so"
1192 shlibpath_var=LD_LIBRARY_PATH
1193 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1194 soname_spec='${libname}${release}.so$major'
1195 shlibpath_var=LD_LIBRARY_PATH
1196 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
1197 if test "X$HPUX_IA64_MODE" = X32; then
62cdd71e 1198 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
f5cc59a7
AO
1199 else
1200 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
1201 fi
1202 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
1203 ;;
1204 *)
1205 dynamic_linker="$host_os dld.sl"
1206 shlibpath_var=SHLIB_PATH
1207 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
1208 library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
1209 soname_spec='${libname}${release}.sl$major'
1210 ;;
1211 esac
6599da04
JM
1212 # HP-UX runs *really* slowly unless shared libraries are mode 555.
1213 postinstall_cmds='chmod 555 $lib'
1214 ;;
1215
d207ebef 1216irix5* | irix6*)
11856278
AO
1217 if test "$with_gnu_ld" = yes; then
1218 version_type=linux
1219 else
1220 version_type=irix
4063ae69 1221 fi
90fb0c24
TT
1222 need_lib_prefix=no
1223 need_version=no
4f4caf92
AO
1224 soname_spec='${libname}${release}.so$major'
1225 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
82e23236 1226 case $host_os in
d207ebef
JM
1227 irix5*)
1228 libsuff= shlibsuff=
d207ebef
JM
1229 ;;
1230 *)
82e23236 1231 case $LD in # libtool.m4 will add one of these switches to LD
11856278
AO
1232 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
1233 libsuff= shlibsuff= libmagic=32-bit;;
1234 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
1235 libsuff=32 shlibsuff=N32 libmagic=N32;;
1236 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
1237 libsuff=64 shlibsuff=64 libmagic=64-bit;;
d207ebef
JM
1238 *) libsuff= shlibsuff= libmagic=never-match;;
1239 esac
1240 ;;
90fb0c24
TT
1241 esac
1242 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
1243 shlibpath_overrides_runpath=no
d207ebef
JM
1244 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
1245 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
6599da04
JM
1246 ;;
1247
1248# No shared lib support for Linux oldld, aout, or coff.
1249linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
1250 dynamic_linker=no
1251 ;;
1252
1253# This must be Linux ELF.
1254linux-gnu*)
1255 version_type=linux
90fb0c24
TT
1256 need_lib_prefix=no
1257 need_version=no
cf4ccd63
JL
1258 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1259 soname_spec='${libname}${release}.so$major'
d207ebef 1260 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
6599da04 1261 shlibpath_var=LD_LIBRARY_PATH
90fb0c24 1262 shlibpath_overrides_runpath=no
4f4caf92
AO
1263 # This implies no fast_install, which is unacceptable.
1264 # Some rework will be needed to allow for fast_install
1265 # before this can be enabled.
1266 hardcode_into_libs=yes
1267
1268 # We used to test for /lib/ld.so.1 and disable shared libraries on
1269 # powerpc, because MkLinux only supported shared libraries with the
1270 # GNU dynamic linker. Since this was broken with cross compilers,
1271 # most powerpc-linux boxes support dynamic linking these days and
1272 # people can always --disable-shared, the test was removed, and we
1273 # assume the GNU/Linux dynamic linker is in use.
1274 dynamic_linker='GNU/Linux ld.so'
6599da04
JM
1275 ;;
1276
90fb0c24 1277netbsd*)
33456445
AO
1278 need_lib_prefix=no
1279 need_version=no
6599da04 1280 version_type=sunos
90fb0c24
TT
1281 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
1282 library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
d207ebef 1283 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
90fb0c24
TT
1284 dynamic_linker='NetBSD (a.out) ld.so'
1285 else
1286 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
1287 soname_spec='${libname}${release}.so$major'
1288 dynamic_linker='NetBSD ld.elf_so'
1289 fi
1290 shlibpath_var=LD_LIBRARY_PATH
3dd7094e
AO
1291 shlibpath_overrides_runpath=yes
1292 hardcode_into_libs=yes
90fb0c24
TT
1293 ;;
1294
82e23236
AO
1295newsos6)
1296 version_type=linux
1297 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1298 shlibpath_var=LD_LIBRARY_PATH
1299 shlibpath_overrides_runpath=yes
1300 ;;
1301
90fb0c24
TT
1302openbsd*)
1303 version_type=sunos
1304 if test "$with_gnu_ld" = yes; then
1305 need_lib_prefix=no
1306 need_version=no
1307 fi
1308 library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
6599da04
JM
1309 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
1310 shlibpath_var=LD_LIBRARY_PATH
1311 ;;
1312
cf4ccd63
JL
1313os2*)
1314 libname_spec='$name'
90fb0c24 1315 need_lib_prefix=no
cf4ccd63
JL
1316 library_names_spec='$libname.dll $libname.a'
1317 dynamic_linker='OS/2 ld.exe'
1318 shlibpath_var=LIBPATH
1319 ;;
1320
d207ebef 1321osf3* | osf4* | osf5*)
6599da04 1322 version_type=osf
d207ebef 1323 need_version=no
e6226a2f
RO
1324 soname_spec='${libname}${release}.so$major'
1325 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
6599da04 1326 shlibpath_var=LD_LIBRARY_PATH
90fb0c24
TT
1327 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
1328 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
6599da04
JM
1329 ;;
1330
1331sco3.2v5*)
1332 version_type=osf
cf4ccd63
JL
1333 soname_spec='${libname}${release}.so$major'
1334 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
6599da04
JM
1335 shlibpath_var=LD_LIBRARY_PATH
1336 ;;
1337
90fb0c24 1338solaris*)
6599da04 1339 version_type=linux
90fb0c24
TT
1340 need_lib_prefix=no
1341 need_version=no
cf4ccd63
JL
1342 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1343 soname_spec='${libname}${release}.so$major'
6599da04 1344 shlibpath_var=LD_LIBRARY_PATH
90fb0c24 1345 shlibpath_overrides_runpath=yes
4f4caf92 1346 hardcode_into_libs=yes
fbd836fc
ILT
1347 # ldd complains unless libraries are executable
1348 postinstall_cmds='chmod +x $lib'
6599da04
JM
1349 ;;
1350
1351sunos4*)
1352 version_type=sunos
fbd836fc 1353 library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
6599da04
JM
1354 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
1355 shlibpath_var=LD_LIBRARY_PATH
90fb0c24
TT
1356 shlibpath_overrides_runpath=yes
1357 if test "$with_gnu_ld" = yes; then
1358 need_lib_prefix=no
1359 fi
1360 need_version=yes
6599da04
JM
1361 ;;
1362
d207ebef 1363sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
cf4ccd63
JL
1364 version_type=linux
1365 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1366 soname_spec='${libname}${release}.so$major'
1367 shlibpath_var=LD_LIBRARY_PATH
82e23236 1368 case $host_vendor in
d207ebef
JM
1369 motorola)
1370 need_lib_prefix=no
1371 need_version=no
1372 shlibpath_overrides_runpath=no
1373 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
d207ebef 1374 ;;
90fb0c24 1375 esac
cf4ccd63
JL
1376 ;;
1377
1abb828a
D
1378tpf*)
1379 version_type=linux
1380 need_lib_prefix=no
1381 need_version=no
1382 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $major $libname.so'
1383 soname_spec='${libname}${release}.so$major'
1384 shlibpath_var=LD_LIBRARY_PATH
1385 shlibpath_overrides_runpath=no
1386 hardcode_into_libs=yes
1387 dynamic_linker='GNU/Linux ld.so'
1388 ;;
1389
cf4ccd63
JL
1390uts4*)
1391 version_type=linux
1392 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1393 soname_spec='${libname}${release}.so$major'
1394 shlibpath_var=LD_LIBRARY_PATH
1395 ;;
1396
90fb0c24
TT
1397dgux*)
1398 version_type=linux
1399 need_lib_prefix=no
1400 need_version=no
1401 library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1402 soname_spec='${libname}${release}.so$major'
1403 shlibpath_var=LD_LIBRARY_PATH
1404 ;;
1405
d207ebef
JM
1406sysv4*MP*)
1407 if test -d /usr/nec ;then
1408 version_type=linux
1409 library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
1410 soname_spec='$libname.so.$major'
1411 shlibpath_var=LD_LIBRARY_PATH
d207ebef
JM
1412 fi
1413 ;;
1414
6599da04
JM
1415*)
1416 dynamic_linker=no
1417 ;;
1418esac
90fb0c24 1419echo "$ac_t$dynamic_linker" 1>&6
6599da04
JM
1420test "$dynamic_linker" = no && can_build_shared=no
1421
4f4caf92
AO
1422# Check for command to grab the raw symbol name followed by C symbol from nm.
1423echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
1424
1425# These are sane defaults that work on at least a few old systems.
1426# [They come from Ultrix. What could be older than Ultrix?!! ;)]
1427
1428# Character class describing NM global symbol codes.
1429symcode='[BCDEGRST]'
1430
1431# Regexp to match symbols that can be accessed directly from C.
1432sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
1433
1434# Transform the above into a raw symbol and a C symbol.
1435symxfrm='\1 \2\3 \3'
1436
1437# Transform an extracted symbol line into a proper C declaration
1438global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
1439
1440# Define system-specific variables.
82e23236 1441case $host_os in
4f4caf92
AO
1442aix*)
1443 symcode='[BCDT]'
1444 ;;
3dd7094e 1445cygwin* | mingw* | pw32*)
4f4caf92
AO
1446 symcode='[ABCDGISTW]'
1447 ;;
1448hpux*) # Its linker distinguishes data from code symbols
33456445 1449 global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
4f4caf92
AO
1450 ;;
1451irix*)
1452 symcode='[BCDEGRST]'
1453 ;;
1454solaris* | sysv5*)
1455 symcode='[BDT]'
1456 ;;
1457sysv4)
1458 symcode='[DFNSTU]'
1459 ;;
1460esac
1461
75b9074c 1462# Handle CRLF in mingw tool chain
4f4caf92 1463opt_cr=
82e23236 1464case $host_os in
4f4caf92
AO
1465mingw*)
1466 opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
1467 ;;
1468esac
1469
1470# If we're using GNU nm, then use its standard symbol codes.
1471if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
1472 symcode='[ABCDGISTW]'
1473fi
1474
1475# Try without a prefix undercore, then with it.
1476for ac_symprfx in "" "_"; do
1477
1478 # Write the raw and C identifiers.
33456445 1479 global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
4f4caf92
AO
1480
1481 # Check to see that the pipe works correctly.
1482 pipe_works=no
1483 $rm conftest*
1484 cat > conftest.$ac_ext <<EOF
1485#ifdef __cplusplus
1486extern "C" {
1487#endif
1488char nm_test_var;
1489void nm_test_func(){}
1490#ifdef __cplusplus
1491}
1492#endif
82e23236 1493int main(){nm_test_var='a';nm_test_func();return(0);}
4f4caf92
AO
1494EOF
1495
5f7de4b8
AO
1496 echo "$progname:1431: checking if global_symbol_pipe works" >&5
1497 if { (eval echo $progname:1432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
4f4caf92
AO
1498 # Now try to grab the symbols.
1499 nlist=conftest.nm
5f7de4b8 1500 if { echo "$progname:1435: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
4f4caf92
AO
1501
1502 # Try sorting and uniquifying the output.
1503 if sort "$nlist" | uniq > "$nlist"T; then
1504 mv -f "$nlist"T "$nlist"
1505 else
1506 rm -f "$nlist"T
1507 fi
1508
1509 # Make sure that we snagged all the symbols we need.
1510 if egrep ' nm_test_var$' "$nlist" >/dev/null; then
1511 if egrep ' nm_test_func$' "$nlist" >/dev/null; then
1512 cat <<EOF > conftest.$ac_ext
1513#ifdef __cplusplus
1514extern "C" {
1515#endif
1516
1517EOF
1518 # Now generate the symbol file.
1519 eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
1520
1521 cat <<EOF >> conftest.$ac_ext
1522#if defined (__STDC__) && __STDC__
1523# define lt_ptr_t void *
1524#else
1525# define lt_ptr_t char *
1526# define const
1527#endif
1528
1529/* The mapping between symbol names and symbols. */
1530const struct {
1531 const char *name;
1532 lt_ptr_t address;
1533}
1534lt_preloaded_symbols[] =
1535{
1536EOF
33456445 1537 sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" >> conftest.$ac_ext
4f4caf92
AO
1538 cat <<\EOF >> conftest.$ac_ext
1539 {0, (lt_ptr_t) 0}
1540};
1541
1542#ifdef __cplusplus
1543}
1544#endif
1545EOF
1546 # Now try linking the two files.
1547 mv conftest.$objext conftstm.$objext
1548 save_LIBS="$LIBS"
1549 save_CFLAGS="$CFLAGS"
1550 LIBS="conftstm.$objext"
1551 CFLAGS="$CFLAGS$no_builtin_flag"
5f7de4b8 1552 if { (eval echo $progname:1487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
4f4caf92
AO
1553 pipe_works=yes
1554 else
1555 echo "$progname: failed program was:" >&5
1556 cat conftest.$ac_ext >&5
1557 fi
1558 LIBS="$save_LIBS"
1559 else
1560 echo "cannot find nm_test_func in $nlist" >&5
1561 fi
1562 else
1563 echo "cannot find nm_test_var in $nlist" >&5
1564 fi
1565 else
1566 echo "cannot run $global_symbol_pipe" >&5
1567 fi
1568 else
1569 echo "$progname: failed program was:" >&5
1570 cat conftest.$ac_ext >&5
1571 fi
1572 $rm conftest* conftst*
1573
1574 # Do not use the global_symbol_pipe unless it works.
1575 if test "$pipe_works" = yes; then
1576 break
1577 else
1578 global_symbol_pipe=
1579 fi
1580done
1581if test "$pipe_works" = yes; then
1582 echo "${ac_t}ok" 1>&6
1583else
1584 echo "${ac_t}failed" 1>&6
1585fi
1586
1587if test -z "$global_symbol_pipe"; then
1588 global_symbol_to_cdecl=
1589fi
1590
cf4ccd63 1591# Report the final consequences.
6599da04
JM
1592echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
1593
d207ebef
JM
1594# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
1595# configure.in, otherwise build static only libraries.
82e23236 1596case $host_os in
3dd7094e 1597cygwin* | mingw* | pw32* | os2*)
d207ebef
JM
1598 if test x$can_build_shared = xyes; then
1599 test x$enable_win32_dll = xno && can_build_shared=no
1600 echo "checking if package supports dlls... $can_build_shared" 1>&6
1601 fi
1602;;
1603esac
1604
6599da04
JM
1605echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
1606test "$can_build_shared" = "no" && enable_shared=no
1607
cf4ccd63
JL
1608# On AIX, shared libraries and static libraries use the same namespace, and
1609# are all built from PIC.
82e23236 1610case $host_os in
90fb0c24 1611aix3*)
6599da04
JM
1612 test "$enable_shared" = yes && enable_static=no
1613 if test -n "$RANLIB"; then
90fb0c24 1614 archive_cmds="$archive_cmds~\$RANLIB \$lib"
6599da04
JM
1615 postinstall_cmds='$RANLIB $lib'
1616 fi
1617 ;;
90fb0c24 1618
c18b95e5 1619aix4* | aix5*)
90fb0c24
TT
1620 test "$enable_shared" = yes && enable_static=no
1621 ;;
6599da04
JM
1622esac
1623
cf4ccd63 1624echo "$ac_t$enable_shared" 1>&6
6599da04
JM
1625
1626# Make sure either enable_shared or enable_static is yes.
1627test "$enable_shared" = yes || enable_static=yes
1628
1629echo "checking whether to build static libraries... $enable_static" 1>&6
1630
06298abd 1631if test "$hardcode_action" = relink; then
90fb0c24
TT
1632 # Fast installation is not supported
1633 enable_fast_install=no
1634elif test "$shlibpath_overrides_runpath" = yes ||
1635 test "$enable_shared" = no; then
1636 # Fast installation is not necessary
1637 enable_fast_install=needless
1638fi
1639
4f4caf92
AO
1640variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
1641if test "$with_gcc" = yes; then
1642 variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
cf4ccd63 1643fi
4f4caf92
AO
1644
1645# Check whether we must set pic_mode to default
1646test -z "$pic_flag" && pic_mode=default
cf4ccd63 1647
90fb0c24
TT
1648if test "x$enable_dlopen" != xyes; then
1649 enable_dlopen=unknown
1650 enable_dlopen_self=unknown
1651 enable_dlopen_self_static=unknown
1652else
4f4caf92 1653if test "X${lt_cv_dlopen+set}" != Xset; then
90fb0c24 1654 lt_cv_dlopen=no lt_cv_dlopen_libs=
d207ebef 1655echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
5f7de4b8 1656echo "$progname:1591: checking for dlopen in -ldl" >&5
4f4caf92 1657if test "X${ac_cv_lib_dl_dlopen+set}" = Xset; then
90fb0c24
TT
1658 echo $ac_n "(cached) $ac_c" 1>&6
1659else
d207ebef
JM
1660 ac_save_LIBS="$LIBS"
1661LIBS="-ldl $LIBS"
1662cat > conftest.$ac_ext <<EOF
5f7de4b8 1663#line 1598 "ltconfig"
90fb0c24
TT
1664/* Override any gcc2 internal prototype to avoid an error. */
1665/* We use char because int might match the return type of a gcc2
1666 builtin and then its argument prototype would still apply. */
d207ebef
JM
1667#ifdef __cplusplus
1668extern "C"
1669#endif
90fb0c24
TT
1670char dlopen();
1671
1672int main() {
d207ebef 1673dlopen()
90fb0c24
TT
1674; return 0; }
1675EOF
5f7de4b8 1676if { (eval echo $progname:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
90fb0c24 1677 rm -rf conftest*
4f4caf92 1678 ac_cv_lib_dl_dlopen=yes
90fb0c24
TT
1679else
1680 echo "$progname: failed program was:" >&5
1681 cat conftest.$ac_ext >&5
1682 rm -rf conftest*
4f4caf92 1683 ac_cv_lib_dl_dlopen=no
90fb0c24
TT
1684fi
1685rm -f conftest*
d207ebef 1686LIBS="$ac_save_LIBS"
90fb0c24 1687
d207ebef 1688fi
4f4caf92 1689if test "X$ac_cv_lib_dl_dlopen" = Xyes; then
90fb0c24 1690 echo "$ac_t""yes" 1>&6
d207ebef 1691 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
90fb0c24
TT
1692else
1693 echo "$ac_t""no" 1>&6
d207ebef 1694echo $ac_n "checking for dlopen""... $ac_c" 1>&6
5f7de4b8 1695echo "$progname:1630: checking for dlopen" >&5
4f4caf92 1696if test "X${ac_cv_func_dlopen+set}" = Xset; then
90fb0c24
TT
1697 echo $ac_n "(cached) $ac_c" 1>&6
1698else
d207ebef 1699 cat > conftest.$ac_ext <<EOF
5f7de4b8 1700#line 1635 "ltconfig"
d207ebef
JM
1701/* System header to define __stub macros and hopefully few prototypes,
1702 which can conflict with char dlopen(); below. */
1703#include <assert.h>
90fb0c24
TT
1704/* Override any gcc2 internal prototype to avoid an error. */
1705/* We use char because int might match the return type of a gcc2
1706 builtin and then its argument prototype would still apply. */
d207ebef
JM
1707#ifdef __cplusplus
1708extern "C"
1709#endif
90fb0c24
TT
1710char dlopen();
1711
1712int main() {
d207ebef
JM
1713
1714/* The GNU C library defines this for functions which it implements
1715 to always fail with ENOSYS. Some functions are actually named
1716 something starting with __ and the normal name is an alias. */
1717#if defined (__stub_dlopen) || defined (__stub___dlopen)
1718choke me
1719#else
1720dlopen();
1721#endif
1722
90fb0c24
TT
1723; return 0; }
1724EOF
5f7de4b8 1725if { (eval echo $progname:1660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
90fb0c24 1726 rm -rf conftest*
4f4caf92 1727 ac_cv_func_dlopen=yes
90fb0c24
TT
1728else
1729 echo "$progname: failed program was:" >&5
1730 cat conftest.$ac_ext >&5
1731 rm -rf conftest*
4f4caf92 1732 ac_cv_func_dlopen=no
90fb0c24
TT
1733fi
1734rm -f conftest*
90fb0c24 1735fi
4f4caf92 1736if test "X$ac_cv_func_dlopen" = Xyes; then
90fb0c24 1737 echo "$ac_t""yes" 1>&6
d207ebef 1738 lt_cv_dlopen="dlopen"
90fb0c24
TT
1739else
1740 echo "$ac_t""no" 1>&6
06298abd 1741echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
5f7de4b8 1742echo "$progname:1677: checking for dlopen in -lsvld" >&5
06298abd
AO
1743if test "X${ac_cv_lib_svld_dlopen+set}" = Xset; then
1744 echo $ac_n "(cached) $ac_c" 1>&6
1745else
1746 ac_save_LIBS="$LIBS"
1747LIBS="-lsvld $LIBS"
1748cat > conftest.$ac_ext <<EOF
5f7de4b8 1749#line 1684 "ltconfig"
06298abd
AO
1750/* Override any gcc2 internal prototype to avoid an error. */
1751/* We use char because int might match the return type of a gcc2
1752 builtin and then its argument prototype would still apply. */
1753#ifdef __cplusplus
1754extern "C"
1755#endif
1756char dlopen();
1757
1758int main() {
1759dlopen()
1760; return 0; }
1761EOF
5f7de4b8 1762if { (eval echo $progname:1697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
06298abd
AO
1763 rm -rf conftest*
1764 ac_cv_lib_svld_dlopen=yes
1765else
1766 echo "$progname: failed program was:" >&5
1767 cat conftest.$ac_ext >&5
1768 rm -rf conftest*
1769 ac_cv_lib_svld_dlopen=no
1770fi
1771rm -f conftest*
1772LIBS="$ac_save_LIBS"
1773
1774fi
1775if test "X$ac_cv_lib_svld_dlopen" = Xyes; then
1776 echo "$ac_t""yes" 1>&6
1777 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
1778else
1779 echo "$ac_t""no" 1>&6
90fb0c24 1780echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
5f7de4b8 1781echo "$progname:1716: checking for dld_link in -ldld" >&5
4f4caf92 1782if test "X${ac_cv_lib_dld_dld_link+set}" = Xset; then
90fb0c24
TT
1783 echo $ac_n "(cached) $ac_c" 1>&6
1784else
1785 ac_save_LIBS="$LIBS"
1786LIBS="-ldld $LIBS"
1787cat > conftest.$ac_ext <<EOF
5f7de4b8 1788#line 1723 "ltconfig"
90fb0c24
TT
1789/* Override any gcc2 internal prototype to avoid an error. */
1790/* We use char because int might match the return type of a gcc2
1791 builtin and then its argument prototype would still apply. */
d207ebef
JM
1792#ifdef __cplusplus
1793extern "C"
1794#endif
90fb0c24
TT
1795char dld_link();
1796
1797int main() {
1798dld_link()
1799; return 0; }
1800EOF
5f7de4b8 1801if { (eval echo $progname:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
90fb0c24 1802 rm -rf conftest*
4f4caf92 1803 ac_cv_lib_dld_dld_link=yes
90fb0c24
TT
1804else
1805 echo "$progname: failed program was:" >&5
1806 cat conftest.$ac_ext >&5
1807 rm -rf conftest*
4f4caf92 1808 ac_cv_lib_dld_dld_link=no
90fb0c24
TT
1809fi
1810rm -f conftest*
1811LIBS="$ac_save_LIBS"
1812
1813fi
4f4caf92 1814if test "X$ac_cv_lib_dld_dld_link" = Xyes; then
90fb0c24
TT
1815 echo "$ac_t""yes" 1>&6
1816 lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
1817else
1818 echo "$ac_t""no" 1>&6
1819echo $ac_n "checking for shl_load""... $ac_c" 1>&6
5f7de4b8 1820echo "$progname:1755: checking for shl_load" >&5
4f4caf92 1821if test "X${ac_cv_func_shl_load+set}" = Xset; then
90fb0c24
TT
1822 echo $ac_n "(cached) $ac_c" 1>&6
1823else
1824 cat > conftest.$ac_ext <<EOF
5f7de4b8 1825#line 1760 "ltconfig"
90fb0c24
TT
1826/* System header to define __stub macros and hopefully few prototypes,
1827 which can conflict with char shl_load(); below. */
1828#include <assert.h>
1829/* Override any gcc2 internal prototype to avoid an error. */
1830/* We use char because int might match the return type of a gcc2
1831 builtin and then its argument prototype would still apply. */
d207ebef
JM
1832#ifdef __cplusplus
1833extern "C"
1834#endif
90fb0c24
TT
1835char shl_load();
1836
1837int main() {
1838
1839/* The GNU C library defines this for functions which it implements
1840 to always fail with ENOSYS. Some functions are actually named
1841 something starting with __ and the normal name is an alias. */
1842#if defined (__stub_shl_load) || defined (__stub___shl_load)
1843choke me
1844#else
1845shl_load();
1846#endif
1847
1848; return 0; }
1849EOF
5f7de4b8 1850if { (eval echo $progname:1785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
90fb0c24 1851 rm -rf conftest*
4f4caf92 1852 ac_cv_func_shl_load=yes
90fb0c24
TT
1853else
1854 echo "$progname: failed program was:" >&5
1855 cat conftest.$ac_ext >&5
1856 rm -rf conftest*
4f4caf92 1857 ac_cv_func_shl_load=no
90fb0c24
TT
1858fi
1859rm -f conftest*
1860fi
1861
4f4caf92 1862if test "X$ac_cv_func_shl_load" = Xyes; then
90fb0c24
TT
1863 echo "$ac_t""yes" 1>&6
1864 lt_cv_dlopen="shl_load"
1865else
1866 echo "$ac_t""no" 1>&6
d207ebef 1867echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
5f7de4b8 1868echo "$progname:1803: checking for shl_load in -ldld" >&5
4f4caf92 1869if test "X${ac_cv_lib_dld_shl_load+set}" = Xset; then
90fb0c24
TT
1870 echo $ac_n "(cached) $ac_c" 1>&6
1871else
d207ebef
JM
1872 ac_save_LIBS="$LIBS"
1873LIBS="-ldld $LIBS"
1874cat > conftest.$ac_ext <<EOF
5f7de4b8 1875#line 1810 "ltconfig"
d207ebef 1876#include "confdefs.h"
90fb0c24
TT
1877/* Override any gcc2 internal prototype to avoid an error. */
1878/* We use char because int might match the return type of a gcc2
1879 builtin and then its argument prototype would still apply. */
d207ebef
JM
1880#ifdef __cplusplus
1881extern "C"
90fb0c24 1882#endif
d207ebef 1883char shl_load();
90fb0c24 1884
d207ebef
JM
1885int main() {
1886shl_load()
90fb0c24
TT
1887; return 0; }
1888EOF
5f7de4b8 1889if { (eval echo $progname:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
90fb0c24 1890 rm -rf conftest*
4f4caf92 1891 ac_cv_lib_dld_shl_load=yes
90fb0c24
TT
1892else
1893 echo "$progname: failed program was:" >&5
1894 cat conftest.$ac_ext >&5
1895 rm -rf conftest*
4f4caf92 1896 ac_cv_lib_dld_shl_load=no
90fb0c24
TT
1897fi
1898rm -f conftest*
d207ebef 1899LIBS="$ac_save_LIBS"
90fb0c24 1900
d207ebef 1901fi
4f4caf92 1902if test "X$ac_cv_lib_dld_shl_load" = Xyes; then
90fb0c24 1903 echo "$ac_t""yes" 1>&6
d207ebef 1904 lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
90fb0c24
TT
1905else
1906 echo "$ac_t""no" 1>&6
1907fi
1908
d207ebef 1909
90fb0c24
TT
1910fi
1911
4f4caf92 1912
90fb0c24
TT
1913fi
1914
4f4caf92 1915
90fb0c24
TT
1916fi
1917
1918
1919fi
1920
06298abd
AO
1921fi
1922
90fb0c24
TT
1923fi
1924
1925 if test "x$lt_cv_dlopen" != xno; then
1926 enable_dlopen=yes
06298abd
AO
1927 else
1928 enable_dlopen=no
90fb0c24
TT
1929 fi
1930
82e23236 1931 case $lt_cv_dlopen in
90fb0c24
TT
1932 dlopen)
1933for ac_hdr in dlfcn.h; do
1934ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1935echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
5f7de4b8 1936echo "$progname:1871: checking for $ac_hdr" >&5
4f4caf92 1937if eval "test \"`echo 'X$''{'ac_cv_header_$ac_safe'+set}'`\" = Xset"; then
90fb0c24
TT
1938 echo $ac_n "(cached) $ac_c" 1>&6
1939else
1940 cat > conftest.$ac_ext <<EOF
5f7de4b8 1941#line 1876 "ltconfig"
90fb0c24
TT
1942#include <$ac_hdr>
1943int fnord = 0;
4f4caf92 1944int main () { return(0); }
90fb0c24 1945EOF
d207ebef 1946ac_try="$ac_compile >/dev/null 2>conftest.out"
5f7de4b8 1947{ (eval echo $progname:1882: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
90fb0c24
TT
1948ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1949if test -z "$ac_err"; then
1950 rm -rf conftest*
1951 eval "ac_cv_header_$ac_safe=yes"
1952else
1953 echo "$ac_err" >&5
1954 echo "$progname: failed program was:" >&5
1955 cat conftest.$ac_ext >&5
1956 rm -rf conftest*
1957 eval "ac_cv_header_$ac_safe=no"
1958fi
1959rm -f conftest*
1960fi
1961if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1962 echo "$ac_t""yes" 1>&6
1963else
1964 echo "$ac_t""no" 1>&6
1965fi
1966done
1967
1968 if test "x$ac_cv_header_dlfcn_h" = xyes; then
1969 CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1970 fi
1971 eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
1972 LIBS="$lt_cv_dlopen_libs $LIBS"
1973
1974 echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
5f7de4b8 1975echo "$progname:1910: checking whether a program can dlopen itself" >&5
4f4caf92 1976if test "X${lt_cv_dlopen_self+set}" = Xset; then
90fb0c24
TT
1977 echo $ac_n "(cached) $ac_c" 1>&6
1978else
1979 if test "$cross_compiling" = yes; then
1980 lt_cv_dlopen_self=cross
1981 else
3dd7094e 1982 cat > conftest.$ac_ext <<EOF
5f7de4b8 1983#line 1918 "ltconfig"
90fb0c24
TT
1984
1985#if HAVE_DLFCN_H
1986#include <dlfcn.h>
1987#endif
1988
1989#include <stdio.h>
1990
1991#ifdef RTLD_GLOBAL
1992# define LTDL_GLOBAL RTLD_GLOBAL
1993#else
1994# ifdef DL_GLOBAL
1995# define LTDL_GLOBAL DL_GLOBAL
1996# else
1997# define LTDL_GLOBAL 0
1998# endif
1999#endif
2000
2001/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
2002 find out it does not work in some platform. */
2003#ifndef LTDL_LAZY_OR_NOW
2004# ifdef RTLD_LAZY
2005# define LTDL_LAZY_OR_NOW RTLD_LAZY
2006# else
2007# ifdef DL_LAZY
2008# define LTDL_LAZY_OR_NOW DL_LAZY
2009# else
2010# ifdef RTLD_NOW
2011# define LTDL_LAZY_OR_NOW RTLD_NOW
2012# else
2013# ifdef DL_NOW
2014# define LTDL_LAZY_OR_NOW DL_NOW
2015# else
2016# define LTDL_LAZY_OR_NOW 0
2017# endif
2018# endif
2019# endif
2020# endif
2021#endif
2022
82e23236
AO
2023void fnord() { int i=42; }
2024int main() {
2025 void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
90fb0c24 2026 if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
4f4caf92 2027 if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
90fb0c24
TT
2028
2029EOF
5f7de4b8 2030if { (eval echo $progname:1965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
90fb0c24
TT
2031then
2032 lt_cv_dlopen_self=yes
2033else
2034 echo "$progname: failed program was:" >&5
2035 cat conftest.$ac_ext >&5
2036 rm -fr conftest*
2037 lt_cv_dlopen_self=no
2038fi
2039rm -fr conftest*
2040fi
2041
2042fi
2043
2044echo "$ac_t""$lt_cv_dlopen_self" 1>&6
2045
2046 if test "$lt_cv_dlopen_self" = yes; then
2047 LDFLAGS="$LDFLAGS $link_static_flag"
2048 echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
5f7de4b8 2049echo "$progname:1984: checking whether a statically linked program can dlopen itself" >&5
4f4caf92 2050if test "X${lt_cv_dlopen_self_static+set}" = Xset; then
90fb0c24
TT
2051 echo $ac_n "(cached) $ac_c" 1>&6
2052else
2053 if test "$cross_compiling" = yes; then
2054 lt_cv_dlopen_self_static=cross
2055 else
3dd7094e 2056 cat > conftest.$ac_ext <<EOF
5f7de4b8 2057#line 1992 "ltconfig"
90fb0c24
TT
2058
2059#if HAVE_DLFCN_H
2060#include <dlfcn.h>
2061#endif
2062
2063#include <stdio.h>
2064
2065#ifdef RTLD_GLOBAL
2066# define LTDL_GLOBAL RTLD_GLOBAL
2067#else
2068# ifdef DL_GLOBAL
2069# define LTDL_GLOBAL DL_GLOBAL
2070# else
2071# define LTDL_GLOBAL 0
2072# endif
2073#endif
2074
2075/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
2076 find out it does not work in some platform. */
2077#ifndef LTDL_LAZY_OR_NOW
2078# ifdef RTLD_LAZY
2079# define LTDL_LAZY_OR_NOW RTLD_LAZY
2080# else
2081# ifdef DL_LAZY
2082# define LTDL_LAZY_OR_NOW DL_LAZY
2083# else
2084# ifdef RTLD_NOW
2085# define LTDL_LAZY_OR_NOW RTLD_NOW
2086# else
2087# ifdef DL_NOW
2088# define LTDL_LAZY_OR_NOW DL_NOW
2089# else
2090# define LTDL_LAZY_OR_NOW 0
2091# endif
2092# endif
2093# endif
2094# endif
2095#endif
2096
82e23236
AO
2097void fnord() { int i=42; }
2098int main() {
2099 void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
90fb0c24 2100 if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
4f4caf92 2101 if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
90fb0c24
TT
2102
2103EOF
5f7de4b8 2104if { (eval echo $progname:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
90fb0c24
TT
2105then
2106 lt_cv_dlopen_self_static=yes
2107else
2108 echo "$progname: failed program was:" >&5
2109 cat conftest.$ac_ext >&5
2110 rm -fr conftest*
2111 lt_cv_dlopen_self_static=no
2112fi
2113rm -fr conftest*
2114fi
2115
2116fi
2117
2118echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
2119fi
2120 ;;
2121 esac
2122
82e23236 2123 case $lt_cv_dlopen_self in
90fb0c24
TT
2124 yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
2125 *) enable_dlopen_self=unknown ;;
2126 esac
2127
82e23236 2128 case $lt_cv_dlopen_self_static in
90fb0c24
TT
2129 yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
2130 *) enable_dlopen_self_static=unknown ;;
2131 esac
2132fi
2133
cf4ccd63
JL
2134# Copy echo and quote the copy, instead of the original, because it is
2135# used later.
2136ltecho="$echo"
90fb0c24
TT
2137if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
2138 ltecho="$CONFIG_SHELL \$0 --fallback-echo"
2139fi
2140LTSHELL="$SHELL"
cf4ccd63 2141
90fb0c24
TT
2142LTCONFIG_VERSION="$VERSION"
2143
2144# Only quote variables if we're using ltmain.sh.
82e23236 2145case $ltmain in
90fb0c24
TT
2146*.sh)
2147 # Now quote all the things that may contain metacharacters.
4f4caf92 2148 for var in ltecho old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \
3dd7094e 2149 old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \
4f4caf92
AO
2150 old_LN_S old_NM old_RANLIB old_STRIP \
2151 old_AS old_DLLTOOL old_OBJDUMP \
2152 old_OBJEXT old_EXEEXT old_reload_flag \
2153 old_deplibs_check_method old_file_magic_cmd \
2154 AR AR_FLAGS CC LTCC LD LN_S NM LTSHELL LTCONFIG_VERSION \
90fb0c24
TT
2155 reload_flag reload_cmds wl \
2156 pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
2157 thread_safe_flag_spec whole_archive_flag_spec libname_spec \
2158 library_names_spec soname_spec \
2159 RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
4f4caf92
AO
2160 old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
2161 postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
2162 predep_objects postdep_objects predeps postdeps compiler_lib_search_path \
2163 old_striplib striplib file_magic_cmd export_symbols_cmds \
2164 deplibs_check_method allow_undefined_flag no_undefined_flag \
90fb0c24
TT
2165 finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
2166 hardcode_libdir_flag_spec hardcode_libdir_separator \
2167 sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
c9392a2b 2168 compiler_c_o need_locks exclude_expsyms include_expsyms file_list_spec; do
90fb0c24 2169
82e23236 2170 case $var in
90fb0c24
TT
2171 reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
2172 old_postinstall_cmds | old_postuninstall_cmds | \
2173 export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
4f4caf92 2174 extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
90fb0c24
TT
2175 postinstall_cmds | postuninstall_cmds | \
2176 finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
2177 # Double-quote double-evaled strings.
4f4caf92 2178 eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ### testsuite: skip nested quoting test
90fb0c24
TT
2179 ;;
2180 *)
4f4caf92 2181 eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ### testsuite: skip nested quoting test
90fb0c24
TT
2182 ;;
2183 esac
2184 done
2185
82e23236 2186 case $ltecho in
90fb0c24
TT
2187 *'\$0 --fallback-echo"')
2188 ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
cf4ccd63
JL
2189 ;;
2190 esac
6599da04 2191
4f4caf92
AO
2192 if test -z "$tagname"; then
2193 trap "$rm \"$ofile\"; exit 1" 1 2 15
2194 echo "creating $ofile"
2195 $rm "$ofile"
2196 cat <<EOF > "$ofile"
cf4ccd63
JL
2197#! $SHELL
2198
2199# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
90fb0c24 2200# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
cf4ccd63
JL
2201# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
2202#
4f4caf92 2203# Copyright (C) 1996-2000 Free Software Foundation, Inc.
d207ebef 2204# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
cf4ccd63
JL
2205#
2206# This program is free software; you can redistribute it and/or modify
2207# it under the terms of the GNU General Public License as published by
2208# the Free Software Foundation; either version 2 of the License, or
2209# (at your option) any later version.
2210#
2211# This program is distributed in the hope that it will be useful, but
2212# WITHOUT ANY WARRANTY; without even the implied warranty of
2213# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2214# General Public License for more details.
2215#
2216# You should have received a copy of the GNU General Public License
2217# along with this program; if not, write to the Free Software
539df155 2218# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
cf4ccd63
JL
2219#
2220# As a special exception to the GNU General Public License, if you
2221# distribute this file as part of a program that contains a
2222# configuration script generated by Autoconf, you may include it under
2223# the same distribution terms that you use for the rest of that program.
2224
2225# Sed that helps us avoid accidentally triggering echo(1) options like -n.
2226Xsed="sed -e s/^X//"
2227
2228# The HP-UX ksh and POSIX shell print the target directory to stdout
2229# if CDPATH is set.
d207ebef 2230if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
cf4ccd63 2231
4f4caf92
AO
2232# The names of the tagged configurations supported by this script.
2233available_tags=
2234
cf4ccd63 2235### BEGIN LIBTOOL CONFIG
90fb0c24 2236EOF
4f4caf92
AO
2237 else
2238 echo "appending configuration tag \"$tagname\" to $ofile"
2239 echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
2240 fi
90fb0c24
TT
2241 cfgfile="$ofile"
2242 ;;
2243
2244*)
2245 # Double-quote the variables that need it (for aesthetics).
4f4caf92 2246 for var in old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \
3dd7094e 2247 old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \
4f4caf92
AO
2248 old_LN_S old_NM old_RANLIB old_STRIP \
2249 old_AS old_DLLTOOL old_OBJDUMP \
2250 old_OBJEXT old_EXEEXT old_reload_flag \
2251 old_deplibs_check_method old_file_magic_cmd; do
90fb0c24
TT
2252 eval "$var=\\\"\$var\\\""
2253 done
2254
2255 # Just create a config file.
2256 cfgfile="$ofile.cfg"
4f4caf92
AO
2257 if test -z "$tagname"; then
2258 trap "$rm \"$cfgfile\"; exit 1" 1 2 15
2259 echo "creating $cfgfile"
2260 $rm "$cfgfile"
2261 cat <<EOF > "$cfgfile"
90fb0c24
TT
2262# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
2263# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
4f4caf92
AO
2264
2265### BEGIN LIBTOOL CONFIG
90fb0c24 2266EOF
4f4caf92
AO
2267 else
2268 echo "appending to $cfgfile"
2269 echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
2270 fi
90fb0c24
TT
2271 ;;
2272esac
2273
2274cat <<EOF >> "$cfgfile"
cf4ccd63 2275# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
6599da04 2276#
4f4caf92
AO
2277# AR=$old_AR AR_FLAGS=$old_AR_FLAGS LTCC=$old_LTCC CC=$old_CC \\
2278# CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
3dd7094e 2279# MAGIC_CMD=$old_MAGIC_CMD LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
4f4caf92
AO
2280# LN_S=$old_LN_S NM=$old_NM RANLIB=$old_RANLIB STRIP=$old_STRIP \\
2281# AS=$old_AS DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP \\
2282# objext=$old_OBJEXT exeext=$old_EXEEXT reload_flag=$old_reload_flag \\
2283# deplibs_check_method=$old_deplibs_check_method \\
2284# file_magic_cmd=$old_file_magic_cmd \\
6599da04
JM
2285# $0$ltconfig_args
2286#
2287# Compiler and other test output produced by $progname, useful for
2288# debugging $progname, is in ./config.log if it exists.
2289
2290# The version of $progname that generated this script.
90fb0c24 2291LTCONFIG_VERSION=$LTCONFIG_VERSION
6599da04 2292
cf4ccd63 2293# Shell to use when invoking shell scripts.
90fb0c24 2294SHELL=$LTSHELL
cf4ccd63
JL
2295
2296# Whether or not to build shared libraries.
6599da04
JM
2297build_libtool_libs=$enable_shared
2298
4f4caf92
AO
2299# Whether or not to add -lc for building shared libraries.
2300build_libtool_need_lc=$need_lc
2301
cf4ccd63 2302# Whether or not to build static libraries.
6599da04
JM
2303build_old_libs=$enable_static
2304
90fb0c24
TT
2305# Whether or not to optimize for fast installation.
2306fast_install=$enable_fast_install
2307
6599da04 2308# The host system.
90fb0c24
TT
2309host_alias=$host_alias
2310host=$host
6599da04 2311
cf4ccd63 2312# An echo program that does not interpret backslashes.
90fb0c24 2313echo=$ltecho
cf4ccd63 2314
6599da04 2315# The archiver.
90fb0c24 2316AR=$AR
4f4caf92 2317AR_FLAGS=$AR_FLAGS
cf4ccd63 2318
4f4caf92
AO
2319# A C compiler.
2320LTCC=$LTCC
2321
2322# A language-specific compiler.
90fb0c24 2323CC=$CC
6599da04 2324
06298abd
AO
2325# Is the compiler the GNU C compiler?
2326with_gcc=$with_gcc
2327
6599da04 2328# The linker used to build libraries.
90fb0c24 2329LD=$LD
6599da04
JM
2330
2331# Whether we need hard or soft links.
90fb0c24 2332LN_S=$LN_S
cf4ccd63
JL
2333
2334# A BSD-compatible nm program.
90fb0c24 2335NM=$NM
cf4ccd63 2336
4f4caf92
AO
2337# A symbol stripping program
2338STRIP=$STRIP
2339
2340# Used to examine libraries when file_magic_cmd begins "file"
3dd7094e 2341MAGIC_CMD=$MAGIC_CMD
4f4caf92 2342
90fb0c24 2343# Used on cygwin: DLL creation program.
cf4ccd63
JL
2344DLLTOOL="$DLLTOOL"
2345
d207ebef
JM
2346# Used on cygwin: object dumper.
2347OBJDUMP="$OBJDUMP"
2348
90fb0c24 2349# Used on cygwin: assembler.
cf4ccd63
JL
2350AS="$AS"
2351
2352# The name of the directory that contains temporary libtool files.
90fb0c24 2353objdir=$objdir
6599da04
JM
2354
2355# How to create reloadable object files.
90fb0c24
TT
2356reload_flag=$reload_flag
2357reload_cmds=$reload_cmds
6599da04
JM
2358
2359# How to pass a linker flag through the compiler.
90fb0c24 2360wl=$wl
6599da04 2361
fbd836fc
ILT
2362# Object file suffix (normally "o").
2363objext="$objext"
2364
2365# Old archive suffix (normally "a").
2366libext="$libext"
2367
43d8d958
AT
2368# Shared library suffix (normally ".so").
2369shrext='$shrext'
2370
d207ebef
JM
2371# Executable file suffix (normally "").
2372exeext="$exeext"
2373
6599da04 2374# Additional compiler flags for building library objects.
90fb0c24 2375pic_flag=$pic_flag
4f4caf92 2376pic_mode=$pic_mode
90fb0c24 2377
82e23236
AO
2378# What is the maximum length of a command?
2379max_cmd_len=$max_cmd_len
2380
d207ebef 2381# Does compiler simultaneously support -c and -o options?
90fb0c24
TT
2382compiler_c_o=$compiler_c_o
2383
90fb0c24
TT
2384# Must we lock files when doing compilation ?
2385need_locks=$need_locks
2386
2387# Do we need the lib prefix for modules?
2388need_lib_prefix=$need_lib_prefix
2389
2390# Do we need a version for libraries?
2391need_version=$need_version
2392
2393# Whether dlopen is supported.
4f4caf92 2394dlopen_support=$enable_dlopen
90fb0c24
TT
2395
2396# Whether dlopen of programs is supported.
2397dlopen_self=$enable_dlopen_self
2398
2399# Whether dlopen of statically linked programs is supported.
2400dlopen_self_static=$enable_dlopen_self_static
6599da04
JM
2401
2402# Compiler flag to prevent dynamic linking.
90fb0c24 2403link_static_flag=$link_static_flag
6599da04 2404
cf4ccd63 2405# Compiler flag to turn off builtin functions.
90fb0c24 2406no_builtin_flag=$no_builtin_flag
6599da04 2407
cf4ccd63 2408# Compiler flag to allow reflexive dlopens.
90fb0c24 2409export_dynamic_flag_spec=$export_dynamic_flag_spec
6599da04 2410
fbd836fc 2411# Compiler flag to generate shared objects directly from archives.
90fb0c24
TT
2412whole_archive_flag_spec=$whole_archive_flag_spec
2413
2414# Compiler flag to generate thread-safe objects.
2415thread_safe_flag_spec=$thread_safe_flag_spec
fbd836fc 2416
6599da04
JM
2417# Library versioning type.
2418version_type=$version_type
2419
cf4ccd63 2420# Format of library name prefix.
90fb0c24 2421libname_spec=$libname_spec
cf4ccd63 2422
6599da04
JM
2423# List of archive names. First name is the real one, the rest are links.
2424# The last name is the one that the linker finds with -lNAME.
90fb0c24 2425library_names_spec=$library_names_spec
6599da04
JM
2426
2427# The coded name of the library, if different from the real name.
90fb0c24 2428soname_spec=$soname_spec
6599da04
JM
2429
2430# Commands used to build and install an old-style archive.
90fb0c24
TT
2431RANLIB=$RANLIB
2432old_archive_cmds=$old_archive_cmds
2433old_postinstall_cmds=$old_postinstall_cmds
2434old_postuninstall_cmds=$old_postuninstall_cmds
cf4ccd63
JL
2435
2436# Create an old-style archive from a shared archive.
90fb0c24 2437old_archive_from_new_cmds=$old_archive_from_new_cmds
6599da04 2438
4f4caf92
AO
2439# Create a temporary old-style archive to link instead of a shared archive.
2440old_archive_from_expsyms_cmds=$old_archive_from_expsyms_cmds
2441
6599da04 2442# Commands used to build and install a shared archive.
90fb0c24
TT
2443archive_cmds=$archive_cmds
2444archive_expsym_cmds=$archive_expsym_cmds
2445postinstall_cmds=$postinstall_cmds
2446postuninstall_cmds=$postuninstall_cmds
2447
4f4caf92
AO
2448# Commands to strip libraries.
2449old_striplib=$old_striplib
2450striplib=$striplib
2451
2452# Dependencies to place before the objects being linked to create a
2453# shared library.
2454predep_objects=$predep_objects
2455
2456# Dependencies to place after the objects being linked to create a
2457# shared library.
2458postdep_objects=$postdep_objects
2459
2460# Dependencies to place before the objects being linked to create a
2461# shared library.
2462predeps=$predeps
2463
2464# Dependencies to place after the objects being linked to create a
2465# shared library.
2466postdeps=$postdeps
2467
2468# The library search path used internally by the compiler when linking
2469# a shared library.
2470compiler_lib_search_path=$compiler_lib_search_path
2471
90fb0c24
TT
2472# Method to check whether dependent libraries are shared objects.
2473deplibs_check_method=$deplibs_check_method
2474
d207ebef 2475# Command to use when deplibs_check_method == file_magic.
90fb0c24 2476file_magic_cmd=$file_magic_cmd
6599da04
JM
2477
2478# Flag that allows shared libraries with undefined symbols to be built.
90fb0c24 2479allow_undefined_flag=$allow_undefined_flag
cf4ccd63
JL
2480
2481# Flag that forces no undefined symbols.
90fb0c24 2482no_undefined_flag=$no_undefined_flag
6599da04
JM
2483
2484# Commands used to finish a libtool library installation in a directory.
90fb0c24 2485finish_cmds=$finish_cmds
cf4ccd63
JL
2486
2487# Same as above, but a single script fragment to be evaled but not shown.
90fb0c24 2488finish_eval=$finish_eval
6599da04 2489
cf4ccd63 2490# Take the output of nm and produce a listing of raw symbols and C names.
90fb0c24
TT
2491global_symbol_pipe=$global_symbol_pipe
2492
2493# Transform the output of nm in a proper C declaration
2494global_symbol_to_cdecl=$global_symbol_to_cdecl
6599da04
JM
2495
2496# This is the shared library runtime path variable.
2497runpath_var=$runpath_var
2498
2499# This is the shared library path variable.
2500shlibpath_var=$shlibpath_var
2501
90fb0c24
TT
2502# Is shlibpath searched before the hard-coded library search path?
2503shlibpath_overrides_runpath=$shlibpath_overrides_runpath
2504
6599da04
JM
2505# How to hardcode a shared library path into an executable.
2506hardcode_action=$hardcode_action
2507
4f4caf92
AO
2508# Whether we should hardcode library paths into libraries.
2509hardcode_into_libs=$hardcode_into_libs
2510
6599da04
JM
2511# Flag to hardcode \$libdir into a binary during linking.
2512# This must work even if \$libdir does not exist.
90fb0c24 2513hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
6599da04
JM
2514
2515# Whether we need a single -rpath flag with a separated argument.
90fb0c24 2516hardcode_libdir_separator=$hardcode_libdir_separator
6599da04
JM
2517
2518# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
2519# resulting binary.
2520hardcode_direct=$hardcode_direct
2521
2522# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
2523# resulting binary.
2524hardcode_minus_L=$hardcode_minus_L
2525
6599da04
JM
2526# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
2527# the resulting binary.
2528hardcode_shlibpath_var=$hardcode_shlibpath_var
fbd836fc 2529
4f4caf92
AO
2530# Variables whose values should be saved in libtool wrapper scripts and
2531# restored at relink time.
2532variables_saved_for_relink="$variables_saved_for_relink"
2533
2534# Whether libtool must link a program against all its dependency libraries.
2535link_all_deplibs=$link_all_deplibs
2536
90fb0c24
TT
2537# Compile-time system search path for libraries
2538sys_lib_search_path_spec=$sys_lib_search_path_spec
2539
2540# Run-time system search path for libraries
2541sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
2542
fbd836fc
ILT
2543# Fix the shell variable \$srcfile for the compiler.
2544fix_srcfile_path="$fix_srcfile_path"
90fb0c24 2545
d207ebef 2546# Set to yes if exported symbols are required.
90fb0c24
TT
2547always_export_symbols=$always_export_symbols
2548
d207ebef 2549# The commands to list exported symbols.
90fb0c24
TT
2550export_symbols_cmds=$export_symbols_cmds
2551
4f4caf92
AO
2552# The commands to extract the exported symbol list from a shared archive.
2553extract_expsyms_cmds=$extract_expsyms_cmds
2554
d207ebef 2555# Symbols that should not be listed in the preloaded symbols.
90fb0c24
TT
2556exclude_expsyms=$exclude_expsyms
2557
d207ebef 2558# Symbols that must always be exported.
90fb0c24
TT
2559include_expsyms=$include_expsyms
2560
c9392a2b
DE
2561# Specify filename containing input files.
2562file_list_spec=$file_list_spec
2563
2564# with_gnu_ld value
2565with_gnu_ld=$with_gnu_ld
2566
6599da04
JM
2567EOF
2568
4f4caf92
AO
2569if test -z "$tagname"; then
2570 echo '### END LIBTOOL CONFIG' >> "$ofile"
2571else
2572 echo "### END LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
2573fi
2574
82e23236 2575case $ltmain in
90fb0c24 2576*.sh)
90fb0c24 2577 echo >> "$ofile"
4f4caf92 2578 if test -z "$tagname"; then
82e23236 2579 case $host_os in
4f4caf92
AO
2580 aix3*)
2581 cat <<\EOF >> "$ofile"
cf4ccd63
JL
2582
2583# AIX sometimes has problems with the GCC collect2 program. For some
2584# reason, if we set the COLLECT_NAMES environment variable, the problems
2585# vanish in a puff of smoke.
d207ebef 2586if test "X${COLLECT_NAMES+set}" != Xset; then
cf4ccd63
JL
2587 COLLECT_NAMES=
2588 export COLLECT_NAMES
2589fi
4f4caf92
AO
2590EOF
2591 ;;
2592 esac
82e23236 2593 case $host in
3dd7094e 2594 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4f4caf92
AO
2595 cat <<'EOF' >> "$ofile"
2596 # This is a source program that is used to create dlls on Windows
2597 # Don't remove nor modify the starting and closing comments
2598# /* ltdll.c starts here */
2599# #define WIN32_LEAN_AND_MEAN
2600# #include <windows.h>
2601# #undef WIN32_LEAN_AND_MEAN
2602# #include <stdio.h>
2603#
2604# #ifndef __CYGWIN__
2605# # ifdef __CYGWIN32__
2606# # define __CYGWIN__ __CYGWIN32__
2607# # endif
2608# #endif
2609#
2610# #ifdef __cplusplus
2611# extern "C" {
2612# #endif
2613# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
2614# #ifdef __cplusplus
2615# }
2616# #endif
2617#
2618# #ifdef __CYGWIN__
2619# #include <cygwin/cygwin_dll.h>
2620# DECLARE_CYGWIN_DLL( DllMain );
2621# #endif
2622# HINSTANCE __hDllInstance_base;
2623#
2624# BOOL APIENTRY
2625# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
2626# {
2627# __hDllInstance_base = hInst;
2628# return TRUE;
2629# }
2630# /* ltdll.c ends here */
2631 # This is a source program that is used to create import libraries
2632 # on Windows for dlls which lack them. Don't remove nor modify the
2633 # starting and closing comments
2634# /* impgen.c starts here */
2635# /* Copyright (C) 1999-2000 Free Software Foundation, Inc.
2636#
2637# This file is part of GNU libtool.
2638#
2639# This program is free software; you can redistribute it and/or modify
2640# it under the terms of the GNU General Public License as published by
2641# the Free Software Foundation; either version 2 of the License, or
2642# (at your option) any later version.
2643#
2644# This program is distributed in the hope that it will be useful,
2645# but WITHOUT ANY WARRANTY; without even the implied warranty of
2646# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2647# GNU General Public License for more details.
2648#
2649# You should have received a copy of the GNU General Public License
2650# along with this program; if not, write to the Free Software
539df155 2651# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
4f4caf92
AO
2652# */
2653#
2654# #include <stdio.h> /* for printf() */
2655# #include <unistd.h> /* for open(), lseek(), read() */
2656# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
2657# #include <string.h> /* for strdup() */
2658#
2659# /* O_BINARY isn't required (or even defined sometimes) under Unix */
2660# #ifndef O_BINARY
2661# #define O_BINARY 0
2662# #endif
2663#
2664# static unsigned int
2665# pe_get16 (fd, offset)
2666# int fd;
2667# int offset;
2668# {
2669# unsigned char b[2];
2670# lseek (fd, offset, SEEK_SET);
2671# read (fd, b, 2);
2672# return b[0] + (b[1]<<8);
2673# }
2674#
2675# static unsigned int
2676# pe_get32 (fd, offset)
2677# int fd;
2678# int offset;
2679# {
2680# unsigned char b[4];
2681# lseek (fd, offset, SEEK_SET);
2682# read (fd, b, 4);
2683# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
2684# }
2685#
2686# static unsigned int
2687# pe_as32 (ptr)
2688# void *ptr;
2689# {
2690# unsigned char *b = ptr;
2691# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
2692# }
2693#
2694# int
2695# main (argc, argv)
2696# int argc;
2697# char *argv[];
2698# {
2699# int dll;
2700# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
2701# unsigned long export_rva, export_size, nsections, secptr, expptr;
2702# unsigned long name_rvas, nexp;
2703# unsigned char *expdata, *erva;
2704# char *filename, *dll_name;
2705#
2706# filename = argv[1];
2707#
2708# dll = open(filename, O_RDONLY|O_BINARY);
75b9074c 2709# if (dll < 1)
4f4caf92
AO
2710# return 1;
2711#
2712# dll_name = filename;
2713#
2714# for (i=0; filename[i]; i++)
2715# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
2716# dll_name = filename + i +1;
2717#
2718# pe_header_offset = pe_get32 (dll, 0x3c);
2719# opthdr_ofs = pe_header_offset + 4 + 20;
2720# num_entries = pe_get32 (dll, opthdr_ofs + 92);
2721#
2722# if (num_entries < 1) /* no exports */
2723# return 1;
2724#
2725# export_rva = pe_get32 (dll, opthdr_ofs + 96);
2726# export_size = pe_get32 (dll, opthdr_ofs + 100);
2727# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
2728# secptr = (pe_header_offset + 4 + 20 +
2729# pe_get16 (dll, pe_header_offset + 4 + 16));
2730#
2731# expptr = 0;
2732# for (i = 0; i < nsections; i++)
2733# {
2734# char sname[8];
2735# unsigned long secptr1 = secptr + 40 * i;
2736# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
2737# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
2738# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
2739# lseek(dll, secptr1, SEEK_SET);
2740# read(dll, sname, 8);
2741# if (vaddr <= export_rva && vaddr+vsize > export_rva)
2742# {
2743# expptr = fptr + (export_rva - vaddr);
2744# if (export_rva + export_size > vaddr + vsize)
2745# export_size = vsize - (export_rva - vaddr);
2746# break;
2747# }
2748# }
2749#
2750# expdata = (unsigned char*)malloc(export_size);
2751# lseek (dll, expptr, SEEK_SET);
2752# read (dll, expdata, export_size);
2753# erva = expdata - export_rva;
2754#
2755# nexp = pe_as32 (expdata+24);
2756# name_rvas = pe_as32 (expdata+32);
2757#
2758# printf ("EXPORTS\n");
2759# for (i = 0; i<nexp; i++)
2760# {
2761# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
2762# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
2763# }
2764#
2765# return 0;
2766# }
2767# /* impgen.c ends here */
2768
cf4ccd63 2769EOF
90fb0c24
TT
2770 ;;
2771 esac
2772
90fb0c24 2773
4f4caf92
AO
2774 # Append the ltmain.sh script.
2775 sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
2776 # We use sed instead of cat because bash on DJGPP gets confused if
2777 # if finds mixed CR/LF and LF-only lines. Since sed operates in
2778 # text mode, it properly converts lines to CR/LF. This bash problem
2779 # is reportedly fixed, but why not run on old versions too?
2780
2781 chmod +x "$ofile"
2782 fi
90fb0c24
TT
2783 ;;
2784
2785*)
2786 # Compile the libtool program.
2787 echo "FIXME: would compile $ltmain"
6599da04
JM
2788 ;;
2789esac
2790
4f4caf92
AO
2791# Update the list of available tags.
2792if test -n "$tagname"; then
2793
2794 # Extract list of available tagged configurations in $ofile.
2795 # Note that this assumes the entire list is on one line.
2796 available_tags=`grep "^available_tags=" $ofile | sed -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
2797
2798 # Append the new tag name to the list of available tags.
2799 available_tags="$available_tags $tagname"
2800
2801 # Now substitute the updated of available tags.
2802 if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' ${ofile} > ${ofile}.new"; then
2803 mv ${ofile}.new ${ofile}
2804 chmod +x "$ofile"
2805 else
2806 rm -f ${ofile}.new
2807 echo "$progname: unable to update list of available tagged configurations."
2808 exit 1
2809 fi
2810fi
2811
2812# Don't cache tagged configuration!
2813test -n "$cache_file" && test -z "$tagname" || exit 0
cf4ccd63 2814
90fb0c24
TT
2815# AC_CACHE_SAVE
2816trap '' 1 2 15
2817cat > confcache <<\EOF
2818# This file is a shell script that caches the results of configure
2819# tests run on this system so they can be shared between configure
2820# scripts and configure runs. It is not useful on other systems.
2821# If it contains results you don't want to keep, you may remove or edit it.
2822#
2823# By default, configure uses ./config.cache as the cache file,
2824# creating it if it does not exist already. You can give configure
2825# the --cache-file=FILE option to use a different cache file; that is
2826# what configure does when it calls configure scripts in
2827# subdirectories, so they share the cache.
2828# Giving --cache-file=/dev/null disables caching, for debugging configure.
2829# config.status only pays attention to the cache file if you give it the
2830# --recheck option to rerun configure.
2831#
2832EOF
2833# The following way of writing the cache mishandles newlines in values,
2834# but we know of no workaround that is simple, portable, and efficient.
2835# So, don't put newlines in cache variables' values.
2836# Ultrix sh set writes to stderr and can't be redirected directly,
2837# and sets the high bit in the cache file unless we assign to the vars.
2838(set) 2>&1 |
2839 case `(ac_space=' '; set | grep ac_space) 2>&1` in
2840 *ac_space=\ *)
2841 # `set' does not quote correctly, so add quotes (double-quote substitution
2842 # turns \\\\ into \\, and sed turns \\ into \).
2843 sed -n \
2844 -e "s/'/'\\\\''/g" \
2845 -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
2846 ;;
2847 *)
2848 # `set' quotes correctly as required by POSIX, so do not add quotes.
2849 sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
2850 ;;
2851 esac >> confcache
2852if cmp -s $cache_file confcache; then
2853 :
2854else
2855 if test -w $cache_file; then
2856 echo "updating cache $cache_file"
2857 cat confcache > $cache_file
2858 else
2859 echo "not updating unwritable cache $cache_file"
2860 fi
2861fi
2862rm -f confcache
6599da04 2863
6599da04
JM
2864exit 0
2865
2866# Local Variables:
2867# mode:shell-script
2868# sh-indentation:2
2869# End: