Commit | Line | Data |
---|---|---|
a7a8349d MV |
1 | #! /bin/sh |
2 | ||
3 | # ltconfig - Create a system-specific libtool. | |
4 | # Generated automatically from ltconfig.in by configure. | |
96abf47d | 5 | # Copyright (C) 1996, 1997, Free Software Foundation, Inc. |
a7a8349d MV |
6 | # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
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 | |
20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
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 | ||
29 | # The name of this program. | |
30 | progname=`echo "$0" | sed 's%^.*/%%'` | |
31 | ||
32 | # Constants: | |
33 | PROGRAM=ltconfig | |
34 | PACKAGE=libtool | |
93ad5c88 | 35 | VERSION=1.0e |
a7a8349d | 36 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' |
553f653a | 37 | ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' |
a7a8349d MV |
38 | rm="rm -f" |
39 | ||
40 | help="Try \`$progname --help' for more information." | |
41 | ||
553f653a JB |
42 | # Sed substitution that helps us do robust quoting. It backslashifies |
43 | # metacharacters that are still active within double-quoted strings. | |
93ad5c88 JB |
44 | sed_quote_subst='s/\([\\"$\\\\]\)/\\\1/g' |
45 | ||
46 | # Same as above, but don't quote variable references. | |
47 | double_quote_subst='s/\([\\"\\\\]\)/\\\1/g' | |
48 | ||
49 | # AIX sometimes has problems with the GCC collect2 program. For some | |
50 | # reason, if we set the COLLECT_NAMES environment variable, the problems | |
51 | # vanish in a puff of smoke. | |
52 | if test "${COLLECT_NAMES+set}" != set; then | |
53 | COLLECT_NAMES= | |
54 | export COLLECT_NAMES | |
55 | fi | |
553f653a | 56 | |
a7a8349d | 57 | # Global variables: |
96abf47d | 58 | can_build_shared=yes |
a7a8349d MV |
59 | enable_shared=yes |
60 | # All known linkers require a `.a' archive for static linking. | |
61 | enable_static=yes | |
553f653a | 62 | ltmain= |
a7a8349d MV |
63 | silent= |
64 | srcdir= | |
65 | ac_config_guess= | |
66 | ac_config_sub= | |
553f653a JB |
67 | host= |
68 | nonopt= | |
a7a8349d MV |
69 | verify_host=yes |
70 | with_gcc=no | |
553f653a | 71 | with_gnu_ld=no |
a7a8349d | 72 | |
4cdcd100 | 73 | old_AR="$AR" |
a7a8349d MV |
74 | old_CC="$CC" |
75 | old_CFLAGS="$CFLAGS" | |
76 | old_CPPFLAGS="$CPPFLAGS" | |
77 | old_LD="$LD" | |
553f653a JB |
78 | old_LN_S="$LN_S" |
79 | old_NM="$NM" | |
a7a8349d MV |
80 | old_RANLIB="$RANLIB" |
81 | ||
82 | # Parse the command line options. | |
83 | args= | |
84 | prev= | |
85 | for option | |
86 | do | |
87 | case "$option" in | |
88 | -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; | |
89 | *) optarg= ;; | |
90 | esac | |
91 | ||
92 | # If the previous option needs an argument, assign it. | |
93 | if test -n "$prev"; then | |
94 | eval "$prev=\$option" | |
95 | prev= | |
96 | continue | |
97 | fi | |
98 | ||
99 | case "$option" in | |
100 | --help) cat <<EOM | |
101 | Usage: $progname [OPTION]... LTMAIN [HOST] | |
102 | ||
103 | Generate a system-specific libtool script. | |
104 | ||
105 | --disable-shared do not build shared libraries | |
393e4e4d | 106 | --disable-static do not build static libraries |
a7a8349d MV |
107 | --help display this help and exit |
108 | --no-verify do not verify that HOST is a valid host type | |
109 | --quiet same as \`--silent' | |
110 | --silent don't print informational messages | |
111 | --srcdir=DIR find \`config.guess' in DIR | |
112 | --version output version information and exit | |
113 | --with-gcc assume that the GNU C compiler will be used | |
553f653a | 114 | --with-gnu-ld assume that the C compiler uses the GNU linker |
a7a8349d MV |
115 | |
116 | LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool | |
117 | functionality. | |
118 | ||
119 | HOST is the canonical host system name [default=guessed]. | |
120 | EOM | |
121 | exit 0 | |
122 | ;; | |
123 | ||
124 | --disable-shared) enable_shared=no ;; | |
125 | ||
393e4e4d JB |
126 | --disable-static) enable_static=no ;; |
127 | ||
a7a8349d MV |
128 | --quiet | --silent) silent=yes ;; |
129 | ||
130 | --srcdir) prev=srcdir ;; | |
131 | --srcdir=*) srcdir="$optarg" ;; | |
132 | ||
133 | --no-verify) verify_host=no ;; | |
134 | ||
135 | --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;; | |
136 | ||
137 | --with-gcc) with_gcc=yes ;; | |
553f653a | 138 | --with-gnu-ld) with_gnu_ld=yes ;; |
a7a8349d MV |
139 | |
140 | -*) | |
141 | echo "$progname: unrecognized option \`$option'" 1>&2 | |
142 | echo "$help" 1>&2 | |
143 | exit 1 | |
144 | ;; | |
145 | ||
146 | *) | |
553f653a | 147 | if test -z "$ltmain"; then |
a7a8349d | 148 | ltmain="$option" |
553f653a | 149 | elif test -z "$host"; then |
a7a8349d MV |
150 | # FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 |
151 | # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then | |
152 | # echo "$progname: warning \`$option' is not a valid host type" 1>&2 | |
153 | # fi | |
154 | host="$option" | |
155 | else | |
156 | echo "$progname: too many arguments" 1>&2 | |
157 | echo "$help" 1>&2 | |
158 | exit 1 | |
159 | fi ;; | |
160 | esac | |
161 | done | |
162 | ||
553f653a | 163 | if test -z "$ltmain"; then |
a7a8349d MV |
164 | echo "$progname: you must specify a LTMAIN file" 1>&2 |
165 | echo "$help" 1>&2 | |
166 | exit 1 | |
167 | fi | |
168 | ||
169 | if test -f "$ltmain"; then : | |
170 | else | |
171 | echo "$progname: warning: \`$ltmain' does not exist" 1>&2 | |
172 | fi | |
173 | ||
174 | # Quote any args containing shell metacharacters. | |
175 | ltconfig_args= | |
176 | for arg | |
177 | do | |
178 | case "$arg" in | |
179 | *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) | |
180 | ltconfig_args="$ltconfig_args '$arg'" ;; | |
181 | *) ltconfig_args="$ltconfig_args $arg" ;; | |
182 | esac | |
183 | done | |
184 | ||
185 | # A relevant subset of AC_INIT. | |
186 | ||
187 | # File descriptor usage: | |
188 | # 0 standard input | |
189 | # 1 file creation | |
190 | # 2 errors and warnings | |
191 | # 3 some systems may open it to /dev/tty | |
192 | # 4 used on the Kubota Titan | |
193 | # 5 compiler messages saved in config.log | |
194 | # 6 checking for... messages and results | |
195 | if test "$silent" = yes; then | |
196 | exec 6>/dev/null | |
197 | else | |
198 | exec 6>&1 | |
199 | fi | |
200 | exec 5>>./config.log | |
201 | ||
202 | # NLS nuisances. | |
203 | # Only set LANG and LC_ALL to C if already set. | |
204 | # These must not be set unconditionally because not all systems understand | |
205 | # e.g. LANG=C (notably SCO). | |
206 | if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi | |
207 | if test "${LANG+set}" = set; then LANG=C; export LANG; fi | |
208 | ||
209 | if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then | |
210 | # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. | |
211 | if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then | |
212 | ac_n= ac_c=' | |
213 | ' ac_t=' ' | |
214 | else | |
215 | ac_n=-n ac_c= ac_t= | |
216 | fi | |
217 | else | |
218 | ac_n= ac_c='\c' ac_t= | |
219 | fi | |
220 | ||
221 | if test -z "$srcdir"; then | |
222 | # Assume the source directory is the same one as the path to ltmain.sh. | |
223 | srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'` | |
224 | test "$srcdir" = "$ltmain" && srcdir=. | |
225 | fi | |
226 | ||
553f653a | 227 | trap "$rm conftest*; exit 1" 1 2 15 |
a7a8349d MV |
228 | if test "$verify_host" = yes; then |
229 | # Check for config.guess and config.sub. | |
230 | ac_aux_dir= | |
231 | for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do | |
232 | if test -f $ac_dir/config.guess; then | |
233 | ac_aux_dir=$ac_dir | |
234 | break | |
235 | fi | |
236 | done | |
237 | if test -z "$ac_aux_dir"; then | |
238 | echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 | |
239 | echo "$help" 1>&2 | |
240 | exit 1 | |
241 | fi | |
242 | ac_config_guess=$ac_aux_dir/config.guess | |
243 | ac_config_sub=$ac_aux_dir/config.sub | |
244 | ||
245 | # Make sure we can run config.sub. | |
246 | if $ac_config_sub sun4 >/dev/null 2>&1; then : | |
247 | else | |
248 | echo "$progname: cannot run $ac_config_sub" 1>&2 | |
249 | echo "$help" 1>&2 | |
250 | exit 1 | |
251 | fi | |
252 | ||
253 | echo $ac_n "checking host system type""... $ac_c" 1>&6 | |
254 | ||
255 | host_alias=$host | |
256 | case "$host_alias" in | |
553f653a | 257 | "") |
a7a8349d MV |
258 | if host_alias=`$ac_config_guess`; then : |
259 | else | |
260 | echo "$progname: cannot guess host type; you must specify one" 1>&2 | |
261 | echo "$help" 1>&2 | |
262 | exit 1 | |
263 | fi ;; | |
264 | esac | |
265 | host=`$ac_config_sub $host_alias` | |
93ad5c88 JB |
266 | echo "$ac_t$host" 1>&6 |
267 | ||
268 | # Make sure the host verified. | |
269 | test -z "$host" && exit 1 | |
a7a8349d | 270 | |
553f653a | 271 | elif test -z "$host"; then |
a7a8349d MV |
272 | echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 |
273 | echo "$help" 1>&2 | |
274 | exit 1 | |
96abf47d | 275 | else |
a7a8349d MV |
276 | host_alias=$host |
277 | fi | |
278 | ||
4cdcd100 JB |
279 | # Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts. |
280 | case "$host" in | |
281 | *-*-linux-gnu*) ;; | |
282 | *-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` | |
283 | esac | |
284 | ||
393e4e4d JB |
285 | host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` |
286 | host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` | |
287 | host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` | |
a7a8349d MV |
288 | |
289 | # Determine commands to create old-style static archives. | |
4cdcd100 | 290 | old_archive_cmds='$AR cru $oldlib$oldobjs' |
a7a8349d MV |
291 | old_postinstall_cmds='chmod 644 $oldlib' |
292 | ||
553f653a JB |
293 | # Set a sane default for `AR'. |
294 | test -z "$AR" && AR=ar | |
295 | ||
a7a8349d MV |
296 | # If RANLIB is not set, then run the test. |
297 | if test "${RANLIB+set}" != "set"; then | |
298 | result=no | |
299 | ||
300 | echo $ac_n "checking for ranlib... $ac_c" 1>&6 | |
553f653a JB |
301 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" |
302 | for dir in $PATH; do | |
303 | test -z "$dir" && dir=. | |
304 | if test -f $dir/ranlib; then | |
305 | RANLIB="ranlib" | |
306 | result="ranlib" | |
307 | break | |
308 | fi | |
309 | done | |
310 | IFS="$save_ifs" | |
a7a8349d | 311 | |
93ad5c88 | 312 | echo "$ac_t$result" 1>&6 |
a7a8349d MV |
313 | fi |
314 | ||
315 | if test -n "$RANLIB"; then | |
316 | old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib" | |
317 | old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib" | |
318 | fi | |
319 | ||
a7a8349d | 320 | # Check to see if we are using GCC. |
553f653a | 321 | if test "$with_gcc" != yes || test -z "$CC"; then |
a7a8349d MV |
322 | # If CC is not set, then try to find GCC or a usable CC. |
323 | if test -z "$CC"; then | |
324 | echo $ac_n "checking for gcc... $ac_c" 1>&6 | |
325 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
326 | for dir in $PATH; do | |
327 | IFS="$save_ifs" | |
328 | test -z "$dir" && dir=. | |
329 | if test -f $dir/gcc; then | |
330 | CC="gcc" | |
331 | break | |
332 | fi | |
333 | done | |
334 | IFS="$save_ifs" | |
335 | ||
336 | if test -n "$CC"; then | |
93ad5c88 | 337 | echo "$ac_t$CC" 1>&6 |
a7a8349d | 338 | else |
93ad5c88 | 339 | echo "$ac_t"no 1>&6 |
a7a8349d MV |
340 | fi |
341 | fi | |
342 | ||
343 | # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". | |
344 | if test -z "$CC"; then | |
345 | echo $ac_n "checking for cc... $ac_c" 1>&6 | |
346 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
347 | cc_rejected=no | |
348 | for dir in $PATH; do | |
349 | test -z "$dir" && dir=. | |
350 | if test -f $dir/cc; then | |
351 | if test "$dir/cc" = "/usr/ucb/cc"; then | |
352 | cc_rejected=yes | |
353 | continue | |
354 | fi | |
355 | CC="cc" | |
356 | break | |
357 | fi | |
358 | done | |
359 | IFS="$save_ifs" | |
360 | if test $cc_rejected = yes; then | |
361 | # We found a bogon in the path, so make sure we never use it. | |
362 | set dummy $CC | |
363 | shift | |
364 | if test $# -gt 0; then | |
365 | # We chose a different compiler from the bogus one. | |
366 | # However, it has the same name, so the bogon will be chosen | |
367 | # first if we set CC to just the name; use the full file name. | |
368 | shift | |
369 | set dummy "$dir/cc" "$@" | |
370 | shift | |
371 | CC="$@" | |
372 | fi | |
373 | fi | |
374 | ||
375 | if test -n "$CC"; then | |
93ad5c88 | 376 | echo "$ac_t$CC" 1>&6 |
a7a8349d | 377 | else |
93ad5c88 | 378 | echo "$ac_t"no 1>&6 |
a7a8349d MV |
379 | fi |
380 | ||
381 | if test -z "$CC"; then | |
382 | echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 | |
383 | exit 1 | |
384 | fi | |
385 | fi | |
386 | ||
387 | # Now see if the compiler is really GCC. | |
388 | with_gcc=no | |
389 | echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 | |
93ad5c88 | 390 | echo "$progname:390: checking whether we are using GNU C" >&5 |
a7a8349d | 391 | |
a7a8349d MV |
392 | $rm conftest.c |
393 | cat > conftest.c <<EOF | |
394 | #ifdef __GNUC__ | |
395 | yes; | |
396 | #endif | |
397 | EOF | |
93ad5c88 | 398 | if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then |
a7a8349d MV |
399 | with_gcc=yes |
400 | fi | |
401 | $rm conftest.c | |
93ad5c88 | 402 | echo "$ac_t$with_gcc" 1>&6 |
a7a8349d MV |
403 | fi |
404 | ||
405 | # Allow CC to be a program name with arguments. | |
406 | set dummy $CC | |
407 | compiler="$2" | |
408 | ||
409 | echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 | |
410 | pic_flag= | |
411 | profile_flag_pattern= | |
96abf47d | 412 | special_shlib_compile_flags= |
a7a8349d MV |
413 | wl= |
414 | link_static_flag= | |
553f653a | 415 | no_builtin_flag= |
a7a8349d MV |
416 | |
417 | if test "$with_gcc" = yes; then | |
a7a8349d MV |
418 | profile_flag_pattern='-pg?' |
419 | wl='-Wl,' | |
420 | link_static_flag='-static' | |
553f653a JB |
421 | no_builtin_flag=' -fno-builtin' |
422 | ||
423 | case "$host_os" in | |
93ad5c88 | 424 | aix3* | aix4* | irix5* | irix6* | osf3* | osf4*) |
553f653a JB |
425 | # PIC is the default for these OSes. |
426 | pic_flag= | |
427 | ;; | |
428 | *) | |
429 | pic_flag='-fPIC' | |
430 | ;; | |
431 | esac | |
a7a8349d MV |
432 | else |
433 | # PORTME Check for PIC flags for the system compiler. | |
393e4e4d JB |
434 | case "$host_os" in |
435 | aix3* | aix4*) | |
93ad5c88 | 436 | # All AIX code is PIC. |
a7a8349d MV |
437 | link_static_flag='-bnso -bI:/lib/syscalls.exp' |
438 | ;; | |
439 | ||
393e4e4d | 440 | hpux9* | hpux10*) |
96abf47d MD |
441 | # FIXME is there a better link_static_flag that works with the bundled CC? |
442 | wl='-Wl,' | |
443 | link_static_flag='${wl}-a ${wl}archive' | |
a7a8349d MV |
444 | ;; |
445 | ||
393e4e4d | 446 | irix5* | irix6*) |
96abf47d MD |
447 | wl='-Wl,' |
448 | link_static_flag='-non_shared' | |
449 | # PIC (with -KPIC) is the default. | |
450 | pic_flag= | |
451 | ;; | |
452 | ||
93ad5c88 JB |
453 | os2*) |
454 | # We can build DLLs from non-PIC. | |
455 | ;; | |
456 | ||
393e4e4d | 457 | osf3* | osf4*) |
93ad5c88 | 458 | # All OSF/1 code is PIC. |
96abf47d MD |
459 | wl='-Wl,' |
460 | link_static_flag='-non_shared' | |
461 | ;; | |
462 | ||
393e4e4d | 463 | sco3.2v5*) |
96abf47d MD |
464 | pic_flag='-Kpic' |
465 | link_static_flag='-dn' | |
466 | special_shlib_compile_flags='-belf' | |
a7a8349d MV |
467 | ;; |
468 | ||
393e4e4d | 469 | solaris2*) |
a7a8349d MV |
470 | pic_flag='-KPIC' |
471 | link_static_flag='-Bstatic' | |
a6a5a664 | 472 | wl='-Wl,' |
a7a8349d MV |
473 | ;; |
474 | ||
393e4e4d | 475 | sunos4*) |
a7a8349d MV |
476 | pic_flag='-PIC' |
477 | link_static_flag='-Bstatic' | |
478 | wl='-Qoption ld ' | |
479 | ;; | |
480 | ||
93ad5c88 JB |
481 | uts4*) |
482 | pic_flag='-pic' | |
483 | link_static_flag='-Bstatic' | |
484 | ;; | |
485 | ||
a7a8349d MV |
486 | *) |
487 | can_build_shared=no | |
488 | ;; | |
489 | esac | |
490 | fi | |
491 | ||
a7a8349d | 492 | if test -n "$pic_flag"; then |
93ad5c88 | 493 | echo "$ac_t$pic_flag" 1>&6 |
553f653a JB |
494 | |
495 | # Check to make sure the pic_flag actually works. | |
496 | echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 | |
497 | $rm conftest* | |
498 | echo > conftest.c | |
499 | save_CFLAGS="$CFLAGS" | |
500 | CFLAGS="$CFLAGS $pic_flag -DPIC" | |
93ad5c88 JB |
501 | echo "$progname:501: checking if $compiler PIC flag $pic_flag works" >&5 |
502 | if { (eval echo $progname:502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then | |
553f653a JB |
503 | # Append any errors to the config.log. |
504 | cat conftest.err 1>&5 | |
505 | ||
506 | # On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also | |
507 | # reports no error. So, we need to grep stderr for (Bundled). | |
508 | if grep '(Bundled)' conftest.err >/dev/null; then | |
93ad5c88 | 509 | echo "$ac_t"no 1>&6 |
553f653a JB |
510 | can_build_shared=no |
511 | pic_flag= | |
512 | else | |
93ad5c88 | 513 | echo "$ac_t"yes 1>&6 |
553f653a JB |
514 | pic_flag=" $pic_flag" |
515 | fi | |
516 | else | |
517 | # Append any errors to the config.log. | |
518 | cat conftest.err 1>&5 | |
519 | can_build_shared=no | |
520 | pic_flag= | |
93ad5c88 | 521 | echo "$ac_t"no 1>&6 |
553f653a JB |
522 | fi |
523 | CFLAGS="$save_CFLAGS" | |
524 | $rm conftest* | |
a7a8349d | 525 | else |
93ad5c88 | 526 | echo "$ac_t"none 1>&6 |
a7a8349d MV |
527 | fi |
528 | ||
96abf47d MD |
529 | # Check for any special shared library compilation flags. |
530 | if test -n "$special_shlib_compile_flags"; then | |
531 | echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 | |
532 | if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : | |
533 | else | |
534 | echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 | |
535 | can_build_shared=no | |
536 | fi | |
537 | fi | |
538 | ||
553f653a JB |
539 | echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 |
540 | $rm conftest* | |
541 | echo 'main(){return(0);}' > conftest.c | |
542 | save_LDFLAGS="$LDFLAGS" | |
543 | LDFLAGS="$LDFLAGS $link_static_flag" | |
93ad5c88 JB |
544 | echo "$progname:544: checking if $compiler static flag $link_static_flag works" >&5 |
545 | if { (eval echo $progname:545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then | |
546 | echo "$ac_t$link_static_flag" 1>&6 | |
a7a8349d | 547 | else |
93ad5c88 | 548 | echo "$ac_t"none 1>&6 |
553f653a | 549 | link_static_flag= |
a7a8349d | 550 | fi |
553f653a JB |
551 | LDFLAGS="$save_LDFLAGS" |
552 | $rm conftest* | |
553 | ||
554 | if test -z "$LN_S"; then | |
555 | # Check to see if we can use ln -s, or we need hard links. | |
556 | echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 | |
557 | $rm conftestdata | |
558 | if ln -s X conftestdata 2>/dev/null; then | |
559 | $rm conftestdata | |
560 | LN_S="ln -s" | |
a6a5a664 | 561 | else |
553f653a | 562 | LN_S=ln |
a6a5a664 | 563 | fi |
553f653a JB |
564 | if test "$LN_S" = "ln -s"; then |
565 | echo "$ac_t"yes 1>&6 | |
566 | else | |
567 | echo "$ac_t"no 1>&6 | |
a6a5a664 JB |
568 | fi |
569 | fi | |
570 | ||
553f653a | 571 | # Make sure LD is an absolute path. |
93ad5c88 | 572 | if test -z "$LD"; then |
553f653a JB |
573 | ac_prog=ld |
574 | if test "$with_gcc" = yes; then | |
575 | # Check if gcc -print-prog-name=ld gives a path. | |
576 | echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 | |
93ad5c88 | 577 | echo "$progname:577: checking for ld used by GCC" >&5 |
553f653a JB |
578 | ac_prog=`($CC -print-prog-name=ld) 2>&5` |
579 | case "$ac_prog" in | |
580 | # Accept absolute paths. | |
93ad5c88 JB |
581 | /*) |
582 | test -z "$LD" && LD="$ac_prog" | |
583 | ;; | |
553f653a JB |
584 | "") |
585 | # If it fails, then pretend we aren't using GCC. | |
586 | ac_prog=ld | |
587 | ;; | |
588 | *) | |
589 | # If it is relative, then search for the first ld in PATH. | |
590 | with_gnu_ld=unknown | |
591 | ;; | |
592 | esac | |
593 | elif test "$with_gnu_ld" = yes; then | |
594 | echo $ac_n "checking for GNU ld... $ac_c" 1>&6 | |
93ad5c88 | 595 | echo "$progname:595: checking for GNU ld" >&5 |
553f653a JB |
596 | else |
597 | echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 | |
93ad5c88 | 598 | echo "$progname:598: checking for non-GNU ld" >&5 |
553f653a | 599 | fi |
93ad5c88 JB |
600 | |
601 | if test -z "$LD"; then | |
553f653a JB |
602 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" |
603 | for ac_dir in $PATH; do | |
604 | test -z "$ac_dir" && ac_dir=. | |
605 | if test -f "$ac_dir/$ac_prog"; then | |
606 | LD="$ac_dir/$ac_prog" | |
607 | # Check to see if the program is GNU ld. I'd rather use --version, | |
608 | # but apparently some GNU ld's only accept -v. | |
609 | # Break only if it was the GNU/non-GNU ld that we prefer. | |
610 | if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then | |
611 | test "$with_gnu_ld" != no && break | |
612 | else | |
613 | test "$with_gnu_ld" != yes && break | |
614 | fi | |
615 | fi | |
616 | done | |
617 | IFS="$ac_save_ifs" | |
93ad5c88 JB |
618 | fi |
619 | ||
620 | if test -n "$LD"; then | |
621 | echo "$ac_t$LD" 1>&6 | |
622 | else | |
623 | echo "$ac_t"no 1>&6 | |
624 | fi | |
625 | ||
626 | if test -z "$LD"; then | |
627 | echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 | |
628 | exit 1 | |
629 | fi | |
630 | fi | |
a7a8349d | 631 | |
476f3c84 MD |
632 | # Check to see if it really is or isn't GNU ld. |
633 | echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 | |
634 | # I'd rather use --version here, but apparently some GNU ld's only accept -v. | |
635 | if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then | |
636 | with_gnu_ld=yes | |
637 | else | |
638 | with_gnu_ld=no | |
639 | fi | |
93ad5c88 | 640 | echo "$ac_t$with_gnu_ld" 1>&6 |
476f3c84 | 641 | |
a7a8349d | 642 | # See if the linker supports building shared libraries. |
553f653a | 643 | echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 |
a7a8349d | 644 | |
393e4e4d | 645 | allow_undefined_flag= |
a7a8349d | 646 | archive_cmds= |
93ad5c88 | 647 | old_archive_from_new_cmds= |
553f653a | 648 | export_dynamic_flag_spec= |
4cdcd100 JB |
649 | hardcode_libdir_flag_spec= |
650 | hardcode_libdir_separator= | |
96abf47d | 651 | hardcode_direct=no |
a7a8349d | 652 | hardcode_minus_L=no |
393e4e4d | 653 | hardcode_runpath_var=no |
96abf47d | 654 | hardcode_shlibpath_var=unsupported |
393e4e4d | 655 | runpath_var= |
a7a8349d MV |
656 | |
657 | ld_shlibs=yes | |
658 | if test "$with_gnu_ld" = yes; then | |
659 | # See if GNU ld supports shared libraries. | |
660 | ||
393e4e4d JB |
661 | case "$host_os" in |
662 | sunos4*) | |
a7a8349d | 663 | ld_shlibs=yes |
96abf47d MD |
664 | hardcode_direct=yes |
665 | hardcode_shlibpath_var=no | |
a7a8349d MV |
666 | ;; |
667 | ||
668 | *) | |
669 | if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then | |
393e4e4d JB |
670 | runpath_var=LD_RUN_PATH |
671 | hardcode_runpath_var=yes | |
a7a8349d MV |
672 | ld_shlibs=yes |
673 | else | |
674 | ld_shlibs=no | |
675 | fi | |
676 | ;; | |
677 | esac | |
678 | ||
679 | if test "$ld_shlibs" = yes; then | |
553f653a | 680 | archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' |
4cdcd100 | 681 | hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir' |
553f653a | 682 | export_dynamic_flag_spec='${wl}-export-dynamic' |
a7a8349d MV |
683 | fi |
684 | else | |
685 | # PORTME fill in a description of your system's linker (not GNU ld) | |
393e4e4d JB |
686 | case "$host_os" in |
687 | aix3*) | |
688 | allow_undefined_flag=unsupported | |
93ad5c88 | 689 | archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE$deplibs;$AR cru $lib $objdir/$soname' |
4cdcd100 JB |
690 | # Note: this linker hardcodes the directories in LIBPATH if there |
691 | # are no directories specified by -L. | |
a7a8349d | 692 | hardcode_minus_L=yes |
553f653a JB |
693 | if test "$with_gcc" = yes && test -z "$link_static_flag"; then |
694 | # Neither direct hardcoding nor static linking is supported with a | |
695 | # broken collect2. | |
696 | hardcode_direct=unsupported | |
697 | fi | |
a7a8349d MV |
698 | ;; |
699 | ||
393e4e4d JB |
700 | aix4*) |
701 | allow_undefined_flag=unsupported | |
553f653a | 702 | archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname' |
79131585 | 703 | hardcode_direct=yes |
a7a8349d MV |
704 | hardcode_minus_L=yes |
705 | ;; | |
706 | ||
393e4e4d JB |
707 | # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor |
708 | # support. Future versions do this automatically, but an explicit c++rt0.o | |
709 | # doesn't break anything, and helps significantly (at the cost of a little | |
710 | # extra space). | |
711 | freebsd2.2*) | |
712 | archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o' | |
713 | hardcode_direct=yes | |
714 | hardcode_minus_L=yes | |
715 | hardcode_shlibpath_var=no | |
716 | ;; | |
717 | ||
718 | # Unfortunately, older versions of FreeBSD 2 don't have this feature. | |
719 | freebsd2*) | |
a7a8349d | 720 | archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' |
96abf47d MD |
721 | hardcode_direct=yes |
722 | hardcode_minus_L=yes | |
723 | hardcode_shlibpath_var=no | |
724 | ;; | |
725 | ||
393e4e4d JB |
726 | # FreeBSD 3, at last, uses gcc -shared to do shared libraries. |
727 | freebsd3*) | |
728 | archive_cmds='$CC -shared -o $lib$libobjs$deplibs' | |
476f3c84 | 729 | hardcode_libdir_flag_spec='-R$libdir' |
393e4e4d | 730 | hardcode_direct=yes |
476f3c84 | 731 | hardcode_minus_L=yes |
393e4e4d JB |
732 | hardcode_shlibpath_var=no |
733 | ;; | |
734 | ||
735 | hpux9*) | |
96abf47d | 736 | archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib' |
4cdcd100 | 737 | hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' |
96abf47d | 738 | hardcode_direct=yes |
a7a8349d MV |
739 | hardcode_minus_L=yes |
740 | ;; | |
741 | ||
393e4e4d | 742 | hpux10*) |
a7a8349d | 743 | archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' |
4cdcd100 | 744 | hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' |
96abf47d | 745 | hardcode_direct=yes |
a7a8349d | 746 | hardcode_minus_L=yes |
96abf47d MD |
747 | ;; |
748 | ||
393e4e4d | 749 | irix5* | irix6*) |
93ad5c88 | 750 | archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' |
4cdcd100 | 751 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' |
a7a8349d MV |
752 | ;; |
753 | ||
393e4e4d | 754 | netbsd* | openbsd*) |
a7a8349d MV |
755 | # Tested with NetBSD 1.2 ld |
756 | archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' | |
4cdcd100 | 757 | hardcode_libdir_flag_spec='-R$libdir' |
96abf47d MD |
758 | hardcode_direct=yes |
759 | hardcode_shlibpath_var=no | |
a7a8349d MV |
760 | ;; |
761 | ||
93ad5c88 JB |
762 | os2*) |
763 | # FIXME: unsure of OS/2 hardcoding properties | |
764 | hardcode_direct=yes | |
765 | allow_undefined_flag=unsupported | |
766 | archive_cmds='echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;echo DATA >> $objdir/$libname.def;echo " SINGLE NONSHARED" >> $objdir/$libname.def;echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def$deplibs' | |
767 | old_archive_from_new_cmds='emximp -o $libname.a $objdir/$libname.def' | |
768 | ;; | |
769 | ||
770 | osf3*) | |
393e4e4d | 771 | allow_undefined_flag=' -expect_unresolved' |
93ad5c88 JB |
772 | archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' |
773 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' | |
774 | hardcode_libdir_separator=: | |
775 | ;; | |
776 | ||
777 | osf4*) | |
778 | allow_undefined_flag=' -expect_unresolved \*' | |
779 | archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' | |
4cdcd100 JB |
780 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' |
781 | hardcode_libdir_separator=: | |
96abf47d MD |
782 | ;; |
783 | ||
393e4e4d | 784 | sco3.2v5*) |
96abf47d MD |
785 | archive_cmds='$LD -G -o $lib$libobjs$deplibs' |
786 | hardcode_direct=yes | |
a7a8349d MV |
787 | ;; |
788 | ||
393e4e4d | 789 | solaris2*) |
a7a8349d | 790 | archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' |
4cdcd100 | 791 | hardcode_libdir_flag_spec='-R$libdir' |
96abf47d | 792 | hardcode_shlibpath_var=no |
a7a8349d MV |
793 | ;; |
794 | ||
393e4e4d | 795 | sunos4*) |
96abf47d | 796 | archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' |
4cdcd100 | 797 | hardcode_libdir_flag_spec='-L$libdir' |
96abf47d | 798 | hardcode_direct=yes |
a7a8349d | 799 | hardcode_minus_L=yes |
96abf47d | 800 | hardcode_shlibpath_var=no |
a7a8349d MV |
801 | ;; |
802 | ||
93ad5c88 JB |
803 | uts4*) |
804 | archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' | |
805 | hardcode_libdir_flag_spec='-L$libdir' | |
806 | hardcode_direct=no | |
807 | hardcode_minus_L=no | |
808 | hardcode_shlibpath_var=no | |
809 | ;; | |
810 | ||
a7a8349d MV |
811 | *) |
812 | ld_shlibs=no | |
813 | can_build_shared=no | |
814 | ;; | |
815 | esac | |
816 | fi | |
93ad5c88 | 817 | echo "$ac_t$ld_shlibs" 1>&6 |
a7a8349d | 818 | |
553f653a JB |
819 | if test -z "$NM"; then |
820 | echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 | |
821 | case "$NM" in | |
822 | /*) ;; # Let the user override the test with a path. | |
823 | *) | |
824 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
93ad5c88 | 825 | for ac_dir in /usr/ucb $PATH /bin; do |
553f653a JB |
826 | test -z "$ac_dir" && dir=. |
827 | if test -f $ac_dir/nm; then | |
828 | # Check to see if the nm accepts a BSD-compat flag. | |
829 | if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then | |
830 | NM="$ac_dir/nm -B" | |
831 | elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then | |
832 | NM="$ac_dir/nm -p" | |
833 | else | |
834 | NM="$ac_dir/nm" | |
835 | fi | |
836 | break | |
837 | fi | |
838 | done | |
839 | IFS="$ac_save_ifs" | |
840 | test -z "$NM" && NM=nm | |
841 | ;; | |
842 | esac | |
843 | echo "$ac_t$NM" 1>&6 | |
844 | fi | |
845 | ||
846 | # Check for command to grab the raw symbol name followed by C symbol from nm. | |
847 | echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 | |
848 | ||
476f3c84 MD |
849 | # These are sane defaults that work on at least a few old systems. |
850 | # [They come from Ultrix. What could be older than Ultrix?!! ;)] | |
851 | ||
852 | # Character class describing NM global symbol codes. | |
853 | symcode='[BCDEGRSTU]' | |
854 | ||
855 | # Regexp to match symbols that can be accessed directly from C. | |
856 | sympat='\([_A-Za-z][_A-Za-z0-9]*\)' | |
857 | ||
858 | # Transform the above into a raw symbol and a C symbol. | |
859 | symxfrm='\1 \1' | |
860 | ||
861 | # Define system-specific variables. | |
862 | case "$host_os" in | |
863 | aix*) | |
864 | symcode='[BCDTU]' | |
865 | ;; | |
866 | solaris2*) | |
867 | symcode='[BDTU]' | |
868 | ;; | |
869 | esac | |
553f653a | 870 | |
476f3c84 | 871 | # If we're using GNU nm, then use its standard symbol codes. |
553f653a | 872 | if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then |
93ad5c88 | 873 | symcode='[ABCDGISTUW]' |
553f653a JB |
874 | fi |
875 | ||
476f3c84 | 876 | # Write the raw and C identifiers. |
93ad5c88 | 877 | global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'" |
476f3c84 | 878 | |
553f653a JB |
879 | # Check to see that the pipe works correctly. |
880 | pipe_works=no | |
881 | $rm conftest* | |
882 | cat > conftest.c <<EOF | |
883 | char nm_test_var; | |
884 | void nm_test_func(){} | |
885 | main(){nm_test_var='a';nm_test_func();return(0);} | |
886 | EOF | |
887 | ||
93ad5c88 JB |
888 | echo "$progname:888: checking if global_symbol_pipe works" >&5 |
889 | if { (eval echo $progname:889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then | |
553f653a JB |
890 | # Now try to grab the symbols. |
891 | nlist=conftest.nm | |
93ad5c88 | 892 | if { echo "$progname:892: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then |
553f653a JB |
893 | |
894 | # Try sorting and uniquifying the output. | |
895 | if sort "$nlist" | uniq > "$nlist"T; then | |
896 | mv -f "$nlist"T "$nlist" | |
897 | wcout=`wc "$nlist" 2>/dev/null` | |
898 | count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` | |
93ad5c88 | 899 | (test "$count" -ge 0) 2>/dev/null || count=-1 |
553f653a JB |
900 | else |
901 | rm -f "$nlist"T | |
902 | count=-1 | |
903 | fi | |
904 | ||
905 | # Make sure that we snagged all the symbols we need. | |
906 | if egrep ' nm_test_var$' "$nlist" >/dev/null; then | |
907 | if egrep ' nm_test_func$' "$nlist" >/dev/null; then | |
93ad5c88 JB |
908 | cat <<EOF > conftest.c |
909 | #ifdef __cplusplus | |
910 | extern "C" { | |
911 | #endif | |
912 | ||
913 | EOF | |
553f653a | 914 | # Now generate the symbol file. |
93ad5c88 | 915 | sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c |
553f653a JB |
916 | |
917 | cat <<EOF >> conftest.c | |
918 | #if defined (__STDC__) && __STDC__ | |
919 | # define __ptr_t void * | |
920 | #else | |
921 | # define __ptr_t char * | |
922 | #endif | |
923 | ||
924 | /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ | |
925 | int dld_preloaded_symbol_count = $count; | |
926 | ||
927 | /* The mapping between symbol names and symbols. */ | |
928 | struct { | |
929 | char *name; | |
930 | __ptr_t address; | |
931 | } | |
932 | dld_preloaded_symbols[] = | |
933 | { | |
934 | EOF | |
935 | sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> conftest.c | |
936 | cat <<\EOF >> conftest.c | |
937 | {0}, | |
938 | }; | |
93ad5c88 JB |
939 | |
940 | #ifdef __cplusplus | |
941 | } | |
942 | #endif | |
553f653a JB |
943 | EOF |
944 | # Now try linking the two files. | |
945 | mv conftest.o conftestm.o | |
946 | save_LIBS="$LIBS" | |
947 | save_CFLAGS="$CFLAGS" | |
948 | LIBS='conftestm.o' | |
949 | CFLAGS="$CFLAGS$no_builtin_flag" | |
93ad5c88 | 950 | if { (eval echo $progname:950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then |
553f653a JB |
951 | pipe_works=yes |
952 | else | |
953 | echo "$progname: failed program was:" >&5 | |
954 | cat conftest.c >&5 | |
955 | fi | |
956 | LIBS="$save_LIBS" | |
93ad5c88 JB |
957 | else |
958 | echo "cannot find nm_test_func in $nlist" >&5 | |
553f653a JB |
959 | fi |
960 | else | |
93ad5c88 | 961 | echo "cannot find nm_test_var in $nlist" >&5 |
553f653a JB |
962 | fi |
963 | else | |
93ad5c88 | 964 | echo "cannot run $global_symbol_pipe" >&5 |
553f653a JB |
965 | fi |
966 | else | |
967 | echo "$progname: failed program was:" >&5 | |
968 | cat conftest.c >&5 | |
969 | fi | |
970 | $rm conftest* | |
971 | ||
972 | # Don't use the global_symbol_pipe unless it works. | |
973 | echo "$ac_t$pipe_works" 1>&6 | |
974 | test "$pipe_works" = yes || global_symbol_pipe= | |
975 | ||
96abf47d MD |
976 | # Check hardcoding attributes. |
977 | echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 | |
978 | hardcode_action= | |
393e4e4d JB |
979 | if test -n "$hardcode_libdir_flag_spec" || \ |
980 | test "$hardcode_runpath_var" = yes; then | |
981 | ||
96abf47d | 982 | # We can hardcode non-existant directories. |
393e4e4d JB |
983 | if test "$hardcode_direct" != no && \ |
984 | test "$hardcode_minus_L" != no && \ | |
96abf47d MD |
985 | test "$hardcode_shlibpath_var" != no; then |
986 | ||
79131585 | 987 | # Linking always hardcodes the temporary library directory. |
96abf47d MD |
988 | hardcode_action=relink |
989 | else | |
79131585 | 990 | # We can link without hardcoding, and we can hardcode nonexisting dirs. |
4cdcd100 | 991 | hardcode_action=immediate |
96abf47d | 992 | fi |
393e4e4d JB |
993 | elif test "$hardcode_direct" != yes && \ |
994 | test "$hardcode_minus_L" != yes && \ | |
79131585 | 995 | test "$hardcode_shlibpath_var" != yes; then |
96abf47d MD |
996 | # We can't hardcode anything. |
997 | hardcode_action=unsupported | |
79131585 JB |
998 | else |
999 | # We can only hardcode existing directories. | |
1000 | hardcode_action=relink | |
a7a8349d | 1001 | fi |
93ad5c88 | 1002 | echo "$ac_t$hardcode_action" 1>&6 |
96abf47d MD |
1003 | test "$hardcode_action" = unsupported && can_build_shared=no |
1004 | ||
a7a8349d MV |
1005 | |
1006 | reload_flag= | |
1007 | reload_cmds='$LD$reload_flag -o $output$reload_objs' | |
553f653a | 1008 | echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 |
a7a8349d MV |
1009 | # PORTME Some linker may need a different reload flag. |
1010 | reload_flag='-r' | |
93ad5c88 | 1011 | echo "$ac_t$reload_flag" |
a7a8349d MV |
1012 | test -n "$reload_flag" && reload_flag=" $reload_flag" |
1013 | ||
1014 | # PORTME Fill in your ld.so characteristics | |
4cdcd100 | 1015 | library_names_spec= |
a7a8349d MV |
1016 | soname_spec= |
1017 | postinstall_cmds= | |
1018 | finish_cmds= | |
1019 | shlibpath_var= | |
1020 | version_type=none | |
1021 | dynamic_linker="$host_os ld.so" | |
1022 | ||
1023 | echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 | |
393e4e4d JB |
1024 | case "$host_os" in |
1025 | aix3* | aix4*) | |
a7a8349d | 1026 | version_type=linux |
4cdcd100 | 1027 | library_names_spec='$libname.so.$versuffix $libname.a' |
a7a8349d MV |
1028 | shlibpath_var=LIBPATH |
1029 | ||
1030 | # AIX has no versioning support, so we append a major version to the name. | |
1031 | soname_spec='$libname.so.$major' | |
1032 | ;; | |
1033 | ||
393e4e4d | 1034 | freebsd2* | freebsd3*) |
a7a8349d | 1035 | version_type=sunos |
4cdcd100 | 1036 | library_names_spec='$libname.so.$versuffix $libname.so' |
553f653a | 1037 | finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' |
a7a8349d MV |
1038 | shlibpath_var=LD_LIBRARY_PATH |
1039 | ;; | |
1040 | ||
393e4e4d JB |
1041 | gnu*) |
1042 | version_type=sunos | |
1043 | library_names_spec='$libname.so.$versuffix' | |
1044 | shlibpath_var=LD_LIBRARY_PATH | |
1045 | ;; | |
a7a8349d | 1046 | |
393e4e4d | 1047 | hpux9* | hpux10*) |
a7a8349d MV |
1048 | # Give a soname corresponding to the major version so that dld.sl refuses to |
1049 | # link against other versions. | |
1050 | dynamic_linker="$host_os dld.sl" | |
1051 | version_type=sunos | |
1052 | shlibpath_var=SHLIB_PATH | |
4cdcd100 | 1053 | library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl' |
a7a8349d MV |
1054 | soname_spec='$libname.sl.$major' |
1055 | # HP-UX runs *really* slowly unless shared libraries are mode 555. | |
1056 | postinstall_cmds='chmod 555 $lib' | |
1057 | ;; | |
1058 | ||
393e4e4d | 1059 | irix5* | irix6*) |
96abf47d MD |
1060 | version_type=osf |
1061 | soname_spec='$libname.so' | |
4cdcd100 | 1062 | library_names_spec='$libname.so.$versuffix $libname.so' |
96abf47d MD |
1063 | shlibpath_var=LD_LIBRARY_PATH |
1064 | ;; | |
1065 | ||
4cdcd100 | 1066 | # No shared lib support for Linux oldld, aout, or coff. |
393e4e4d | 1067 | linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) |
a7a8349d | 1068 | dynamic_linker=no |
a7a8349d MV |
1069 | ;; |
1070 | ||
4cdcd100 | 1071 | # This must be Linux ELF. |
393e4e4d | 1072 | linux-gnu*) |
a7a8349d | 1073 | version_type=linux |
4cdcd100 | 1074 | library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' |
a7a8349d | 1075 | soname_spec='$libname.so.$major' |
553f653a | 1076 | finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' |
a7a8349d | 1077 | shlibpath_var=LD_LIBRARY_PATH |
553f653a JB |
1078 | |
1079 | if test -f /lib/ld.so.1; then | |
1080 | dynamic_linker='GNU ld.so' | |
1081 | else | |
1082 | # Only the GNU ld.so supports shared libraries on MkLinux. | |
1083 | case "$host_cpu" in | |
1084 | powerpc*) dynamic_linker=no ;; | |
1085 | *) dynamic_linker='Linux ld.so' ;; | |
1086 | esac | |
1087 | fi | |
a7a8349d MV |
1088 | ;; |
1089 | ||
393e4e4d | 1090 | netbsd* | openbsd*) |
a7a8349d | 1091 | version_type=sunos |
4cdcd100 | 1092 | library_names_spec='$libname.so.$versuffix' |
553f653a | 1093 | finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' |
a7a8349d MV |
1094 | shlibpath_var=LD_LIBRARY_PATH |
1095 | ;; | |
1096 | ||
93ad5c88 JB |
1097 | os2*) |
1098 | version_type=none | |
1099 | library_names_spec='$libname.dll' | |
1100 | dynamic_linker='OS/2 ld.exe' | |
1101 | ;; | |
1102 | ||
393e4e4d | 1103 | osf3* | osf4*) |
a7a8349d MV |
1104 | version_type=osf |
1105 | soname_spec='$libname.so' | |
4cdcd100 | 1106 | library_names_spec='$libname.so.$versuffix $libname.so' |
a7a8349d MV |
1107 | shlibpath_var=LD_LIBRARY_PATH |
1108 | ;; | |
1109 | ||
393e4e4d | 1110 | sco3.2v5*) |
96abf47d MD |
1111 | version_type=osf |
1112 | soname_spec='$libname.so.$major' | |
4cdcd100 | 1113 | library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' |
96abf47d MD |
1114 | shlibpath_var=LD_LIBRARY_PATH |
1115 | ;; | |
1116 | ||
393e4e4d | 1117 | solaris2*) |
a7a8349d | 1118 | version_type=linux |
4cdcd100 | 1119 | library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' |
a7a8349d MV |
1120 | soname_spec='$libname.so.$major' |
1121 | shlibpath_var=LD_LIBRARY_PATH | |
1122 | ;; | |
1123 | ||
393e4e4d | 1124 | sunos4*) |
a7a8349d | 1125 | version_type=sunos |
4cdcd100 | 1126 | library_names_spec='$libname.so.$versuffix' |
553f653a | 1127 | finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' |
a7a8349d MV |
1128 | shlibpath_var=LD_LIBRARY_PATH |
1129 | ;; | |
1130 | ||
93ad5c88 JB |
1131 | uts4*) |
1132 | version_type=linux | |
1133 | library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' | |
1134 | soname_spec='$libname.so.$major' | |
1135 | shlibpath_var=LD_LIBRARY_PATH | |
1136 | ;; | |
1137 | ||
a7a8349d MV |
1138 | *) |
1139 | dynamic_linker=no | |
a7a8349d MV |
1140 | ;; |
1141 | esac | |
93ad5c88 | 1142 | echo "$ac_t$dynamic_linker" |
553f653a | 1143 | test "$dynamic_linker" = no && can_build_shared=no |
a7a8349d | 1144 | |
96abf47d MD |
1145 | # FIXME need to add library stripping features |
1146 | # strip -x works for most platforms, though not for static libraries on NetBSD | |
1147 | # HP-UX requires "-r" for library stripping | |
1148 | striplib= | |
1149 | old_striplib= | |
1150 | ||
1151 | #echo $ac_n "checking for static library strip program... $ac_c" 1>&6 | |
1152 | #if test -n "$old_striplib"; then | |
93ad5c88 | 1153 | # echo "$ac_t$old_striplib" 1>&6 |
96abf47d | 1154 | #else |
93ad5c88 | 1155 | # echo "$ac_t"none 1>&6 |
96abf47d MD |
1156 | #fi |
1157 | ||
1158 | #if test "$can_build_shared" = yes; then | |
1159 | # echo $ac_n "checking for shared library strip program... $ac_c" 1>&6 | |
1160 | # | |
1161 | # if test -n "$striplib"; then | |
93ad5c88 | 1162 | # echo "$ac_t$striplib" 1>&6 |
96abf47d | 1163 | # else |
93ad5c88 | 1164 | # echo "$ac_t"none 1>&6 |
96abf47d MD |
1165 | # fi |
1166 | #fi | |
1167 | ||
a7a8349d MV |
1168 | # Report the consequences. |
1169 | echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 | |
1170 | ||
1171 | echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 | |
1172 | test "$can_build_shared" = "no" && enable_shared=no | |
1173 | ||
93ad5c88 JB |
1174 | # On AIX, shared libraries and static libraries use the same namespace, and |
1175 | # are all built from PIC. | |
4cdcd100 JB |
1176 | case "$host_os" in |
1177 | aix*) | |
1178 | test "$enable_shared" = yes && enable_static=no | |
1179 | if test -n "$RANLIB"; then | |
1180 | archive_cmds="$archive_cmds;\$RANLIB \$lib" | |
1181 | postinstall_cmds='$RANLIB $lib' | |
1182 | fi | |
1183 | ;; | |
1184 | esac | |
a7a8349d | 1185 | |
93ad5c88 | 1186 | echo "$ac_t$enable_shared" 1>&6 |
a7a8349d | 1187 | |
4cdcd100 JB |
1188 | # Make sure either enable_shared or enable_static is yes. |
1189 | test "$enable_shared" = yes || enable_static=yes | |
a7a8349d | 1190 | |
393e4e4d JB |
1191 | echo "checking whether to build static libraries... $enable_static" 1>&6 |
1192 | ||
93ad5c88 JB |
1193 | echo $ac_n "checking for objdir... $ac_c" 1>&6 |
1194 | rm -f .libs 2>/dev/null | |
1195 | mkdir .libs 2>/dev/null | |
1196 | if test -d .libs; then | |
1197 | objdir=.libs | |
1198 | else | |
1199 | # MS-DOS does not allow filenames that begin with a dot. | |
1200 | objdir=_libs | |
1201 | fi | |
1202 | rmdir .libs 2>/dev/null | |
1203 | echo "$ac_t$objdir" 1>&6 | |
1204 | ||
553f653a JB |
1205 | # Now quote all the things that may contain metacharacters. |
1206 | for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ | |
1207 | old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \ | |
1208 | link_static_flag no_builtin_flag export_dynamic_flag_spec \ | |
1209 | profile_flag_pattern library_names_spec soname_spec RANLIB \ | |
93ad5c88 JB |
1210 | old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ |
1211 | archive_cmds postinstall_cmds \ | |
1212 | allow_undefined_flag finish_cmds global_symbol_pipe \ | |
1213 | striplib old_striplib \ | |
553f653a JB |
1214 | hardcode_libdir_flag_spec hardcode_libdir_separator; do |
1215 | ||
93ad5c88 JB |
1216 | case "$var" in |
1217 | reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ | |
1218 | old_postinstall_cmds | archive_cmds | postinstall_cmds | finish_cmds) | |
1219 | # Double-quote double-evaled strings. | |
1220 | eval "$var=\`echo \"\$$var\" | sed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`" | |
1221 | ;; | |
1222 | *) | |
1223 | eval "$var=\`echo \"\$$var\" | sed \"\$sed_quote_subst\"\`" | |
1224 | ;; | |
1225 | esac | |
553f653a JB |
1226 | done |
1227 | ||
a7a8349d MV |
1228 | ofile=libtool |
1229 | trap "$rm $ofile; exit 1" 1 2 15 | |
1230 | echo creating $ofile | |
553f653a | 1231 | $rm $ofile |
a7a8349d MV |
1232 | cat <<EOF > $ofile |
1233 | #! /bin/sh | |
1234 | ||
1235 | # libtool - Provide generalized library-building support services. | |
1236 | # | |
1237 | # Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION | |
1238 | # This program was configured as follows, | |
1239 | # on host `(hostname || uname -n) 2>/dev/null | sed 1q`: | |
1240 | # | |
553f653a JB |
1241 | # CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\ |
1242 | # LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\ | |
a7a8349d MV |
1243 | # $0$ltconfig_args |
1244 | # | |
1245 | # Compiler and other test output produced by $progname, useful for | |
1246 | # debugging $progname, is in ./config.log if it exists. | |
1247 | ||
1248 | # The version of $progname that generated this script. | |
1249 | LTCONFIG_VERSION="$VERSION" | |
1250 | ||
93ad5c88 JB |
1251 | # Shell to use when invoking shell scripts. |
1252 | SHELL=${CONFIG_SHELL-/bin/sh} | |
1253 | ||
a7a8349d MV |
1254 | # Whether or not to build libtool libraries. |
1255 | build_libtool_libs=$enable_shared | |
1256 | ||
1257 | # Whether or not to build old-style libraries. | |
1258 | build_old_libs=$enable_static | |
1259 | ||
1260 | # The host system. | |
1261 | host_alias="$host_alias" | |
1262 | host="$host" | |
1263 | ||
4cdcd100 | 1264 | # The archiver. |
553f653a JB |
1265 | AR="$AR" |
1266 | ||
1267 | # The default C compiler. | |
1268 | CC="$CC" | |
4cdcd100 | 1269 | |
a7a8349d | 1270 | # The linker used to build libraries. |
553f653a JB |
1271 | LD="$LD" |
1272 | ||
1273 | # Whether we need hard or soft links. | |
1274 | LN_S="$LN_S" | |
1275 | ||
1276 | # A BSD-compatible nm program. | |
1277 | NM="$NM" | |
a7a8349d | 1278 | |
93ad5c88 JB |
1279 | # The name of the directory that contains temporary libtool files. |
1280 | objdir="$objdir" | |
1281 | ||
a7a8349d | 1282 | # How to create reloadable object files. |
553f653a JB |
1283 | reload_flag="$reload_flag" |
1284 | reload_cmds="$reload_cmds" | |
a7a8349d MV |
1285 | |
1286 | # How to pass a linker flag through the compiler. | |
553f653a | 1287 | wl="$wl" |
a7a8349d MV |
1288 | |
1289 | # Additional compiler flags for building library objects. | |
553f653a | 1290 | pic_flag="$pic_flag" |
a7a8349d MV |
1291 | |
1292 | # Compiler flag to prevent dynamic linking. | |
553f653a JB |
1293 | link_static_flag="$link_static_flag" |
1294 | ||
1295 | # Compiler flag to turn off builtin functions. | |
1296 | no_builtin_flag="$no_builtin_flag" | |
a7a8349d | 1297 | |
4cdcd100 | 1298 | # Compiler flag to allow reflexive dlopens. |
553f653a | 1299 | export_dynamic_flag_spec="$export_dynamic_flag_spec" |
4cdcd100 | 1300 | |
a7a8349d | 1301 | # Pattern to match compiler flags for creating libNAME_p libraries: |
553f653a | 1302 | profile_flag_pattern="$profile_flag_pattern" |
a7a8349d MV |
1303 | |
1304 | # Library versioning type. | |
1305 | version_type=$version_type | |
1306 | ||
1307 | # List of archive names. First name is the real one, the rest are links. | |
96abf47d | 1308 | # The last name is the one that the linker finds with -lNAME. |
553f653a | 1309 | library_names_spec="$library_names_spec" |
a7a8349d MV |
1310 | |
1311 | # The coded name of the library, if different from the real name. | |
553f653a | 1312 | soname_spec="$soname_spec" |
a7a8349d MV |
1313 | |
1314 | # Commands used to build and install an old-style archive. | |
553f653a JB |
1315 | RANLIB="$RANLIB" |
1316 | old_archive_cmds="$old_archive_cmds" | |
1317 | old_postinstall_cmds="$old_postinstall_cmds" | |
a7a8349d | 1318 | |
93ad5c88 JB |
1319 | # Create an old-style archive from a shared archive. |
1320 | old_archive_from_new_cmds="$old_archive_from_new_cmds" | |
1321 | ||
a7a8349d | 1322 | # Commands used to build and install a shared archive. |
553f653a JB |
1323 | archive_cmds="$archive_cmds" |
1324 | postinstall_cmds="$postinstall_cmds" | |
a7a8349d | 1325 | |
393e4e4d | 1326 | # Flag that allows shared libraries with undefined symbols to be built. |
553f653a | 1327 | allow_undefined_flag="$allow_undefined_flag" |
393e4e4d | 1328 | |
a7a8349d | 1329 | # Commands used to finish a libtool library installation in a directory. |
553f653a JB |
1330 | finish_cmds="$finish_cmds" |
1331 | ||
93ad5c88 | 1332 | # Take the output of nm and produce a listing of raw symbols and C names. |
553f653a | 1333 | global_symbol_pipe="$global_symbol_pipe" |
a7a8349d | 1334 | |
a7a8349d | 1335 | # How to strip a library file. |
553f653a JB |
1336 | striplib="$striplib" |
1337 | old_striplib="$old_striplib" | |
a7a8349d | 1338 | |
393e4e4d JB |
1339 | # This is the shared library runtime path variable. |
1340 | runpath_var=$runpath_var | |
1341 | ||
a7a8349d MV |
1342 | # This is the shared library path variable. |
1343 | shlibpath_var=$shlibpath_var | |
1344 | ||
96abf47d MD |
1345 | # How to hardcode a shared library path into an executable. |
1346 | hardcode_action=$hardcode_action | |
1347 | ||
1348 | # Flag to hardcode \$libdir into a binary during linking. | |
1349 | # This must work even if \$libdir does not exist. | |
553f653a | 1350 | hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec" |
4cdcd100 JB |
1351 | |
1352 | # Whether we need a single -rpath flag with a separated argument. | |
553f653a | 1353 | hardcode_libdir_separator="$hardcode_libdir_separator" |
96abf47d MD |
1354 | |
1355 | # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the | |
1356 | # resulting binary. | |
1357 | hardcode_direct=$hardcode_direct | |
a7a8349d MV |
1358 | |
1359 | # Set to yes if using the -LDIR flag during linking hardcodes DIR into the | |
1360 | # resulting binary. | |
1361 | hardcode_minus_L=$hardcode_minus_L | |
1362 | ||
393e4e4d JB |
1363 | # Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the |
1364 | # resulting binary. | |
1365 | hardcode_runpath_var=$hardcode_runpath_var | |
1366 | ||
1367 | # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into | |
96abf47d MD |
1368 | # the resulting binary. |
1369 | hardcode_shlibpath_var=$hardcode_shlibpath_var | |
1370 | ||
a7a8349d MV |
1371 | EOF |
1372 | ||
1373 | # Detect if we are using a relative or absolute path to ltmain.sh. | |
1374 | case "$ltmain" in | |
1375 | /*) cat <<EOF2 >> $ofile | |
1376 | # Execute the libtool backend. | |
1377 | . $ltmain | |
1378 | EOF2 | |
1379 | ;; | |
1380 | *) cat <<EOF3 >> $ofile | |
1381 | # Find the path to this script. | |
1382 | thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\` | |
1383 | test "X\$0" = "X\$thisdir" && thisdir=. | |
1384 | ||
1385 | # Execute the libtool backend. | |
1386 | . \$thisdir/$ltmain | |
1387 | EOF3 | |
1388 | ;; | |
1389 | esac | |
1390 | ||
1391 | echo 'exit 1' >> $ofile | |
1392 | ||
1393 | chmod +x $ofile | |
1394 | exit 0 | |
1395 | ||
1396 | # Local Variables: | |
1397 | # mode:shell-script | |
1398 | # sh-indentation:2 | |
1399 | # End: |