]>
Commit | Line | Data |
---|---|---|
6599da04 JM |
1 | #! /bin/sh |
2 | ||
3 | # ltconfig - Create a system-specific libtool. | |
4 | # When updating this script, search for LINENUM and fix line number refs. | |
5 | # Generated automatically from ltconfig.in by configure. | |
6 | # Copyright (C) 1996, 1997, Free Software Foundation, Inc. | |
7 | # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 | |
8 | # | |
9 | # This file is free software; you can redistribute it and/or modify it | |
10 | # under the terms of the GNU General Public License as published by | |
11 | # the Free Software Foundation; either version 2 of the License, or | |
12 | # (at your option) any later version. | |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, but | |
15 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | # General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU General Public License | |
20 | # along with this program; if not, write to the Free Software | |
21 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
22 | # | |
23 | # As a special exception to the GNU General Public License, if you | |
24 | # distribute this file as part of a program that contains a | |
25 | # configuration script generated by Autoconf, you may include it under | |
26 | # the same distribution terms that you use for the rest of that program. | |
27 | ||
28 | # A lot of this script is taken from autoconf-2.10. | |
29 | ||
30 | # The name of this program. | |
31 | progname=`echo "$0" | sed 's%^.*/%%'` | |
32 | ||
33 | # Constants: | |
34 | PROGRAM=ltconfig | |
35 | PACKAGE=libtool | |
36 | VERSION=1.0 | |
37 | ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' | |
38 | rm="rm -f" | |
39 | ||
40 | help="Try \`$progname --help' for more information." | |
41 | ||
42 | # Global variables: | |
43 | can_build_shared=yes | |
44 | enable_shared=yes | |
45 | # All known linkers require a `.a' archive for static linking. | |
46 | enable_static=yes | |
47 | ltmain= | |
48 | silent= | |
49 | srcdir= | |
50 | ac_config_guess= | |
51 | ac_config_sub= | |
52 | host= | |
53 | nonopt= | |
54 | verify_host=yes | |
55 | with_gcc=no | |
56 | with_gnu_ld=no | |
57 | ||
58 | old_AR="$AR" | |
59 | old_CC="$CC" | |
60 | old_CFLAGS="$CFLAGS" | |
61 | old_CPPFLAGS="$CPPFLAGS" | |
62 | old_LD="$LD" | |
63 | old_LN_S="$LN_S" | |
64 | old_RANLIB="$RANLIB" | |
65 | ||
66 | test -z "$AR" && AR=ar | |
67 | ||
68 | # Parse the command line options. | |
69 | args= | |
70 | prev= | |
71 | for option | |
72 | do | |
73 | case "$option" in | |
74 | -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; | |
75 | *) optarg= ;; | |
76 | esac | |
77 | ||
78 | # If the previous option needs an argument, assign it. | |
79 | if test -n "$prev"; then | |
80 | eval "$prev=\$option" | |
81 | prev= | |
82 | continue | |
83 | fi | |
84 | ||
85 | case "$option" in | |
86 | --help) cat <<EOM | |
87 | Usage: $progname [OPTION]... LTMAIN [HOST] | |
88 | ||
89 | Generate a system-specific libtool script. | |
90 | ||
91 | --disable-shared do not build shared libraries | |
92 | --disable-static do not build static libraries | |
93 | --help display this help and exit | |
94 | --no-verify do not verify that HOST is a valid host type | |
95 | --quiet same as \`--silent' | |
96 | --silent don't print informational messages | |
97 | --srcdir=DIR find \`config.guess' in DIR | |
98 | --version output version information and exit | |
99 | --with-gcc assume that the GNU C compiler will be used | |
100 | --with-gnu-ld assume that the C compiler uses the GNU linker | |
101 | ||
102 | LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool | |
103 | functionality. | |
104 | ||
105 | HOST is the canonical host system name [default=guessed]. | |
106 | EOM | |
107 | exit 0 | |
108 | ;; | |
109 | ||
110 | --disable-shared) enable_shared=no ;; | |
111 | ||
112 | --disable-static) enable_static=no ;; | |
113 | ||
114 | --quiet | --silent) silent=yes ;; | |
115 | ||
116 | --srcdir) prev=srcdir ;; | |
117 | --srcdir=*) srcdir="$optarg" ;; | |
118 | ||
119 | --no-verify) verify_host=no ;; | |
120 | ||
121 | --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;; | |
122 | ||
123 | --with-gcc) with_gcc=yes ;; | |
124 | --with-gnu-ld) with_gnu_ld=yes ;; | |
125 | ||
126 | -*) | |
127 | echo "$progname: unrecognized option \`$option'" 1>&2 | |
128 | echo "$help" 1>&2 | |
129 | exit 1 | |
130 | ;; | |
131 | ||
132 | *) | |
133 | if test -z "$ltmain"; then | |
134 | ltmain="$option" | |
135 | elif test -z "$host"; then | |
136 | # FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 | |
137 | # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then | |
138 | # echo "$progname: warning \`$option' is not a valid host type" 1>&2 | |
139 | # fi | |
140 | host="$option" | |
141 | else | |
142 | echo "$progname: too many arguments" 1>&2 | |
143 | echo "$help" 1>&2 | |
144 | exit 1 | |
145 | fi ;; | |
146 | esac | |
147 | done | |
148 | ||
149 | if test -z "$ltmain"; then | |
150 | echo "$progname: you must specify a LTMAIN file" 1>&2 | |
151 | echo "$help" 1>&2 | |
152 | exit 1 | |
153 | fi | |
154 | ||
155 | if test -f "$ltmain"; then : | |
156 | else | |
157 | echo "$progname: warning: \`$ltmain' does not exist" 1>&2 | |
158 | fi | |
159 | ||
160 | # Quote any args containing shell metacharacters. | |
161 | ltconfig_args= | |
162 | for arg | |
163 | do | |
164 | case "$arg" in | |
165 | *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) | |
166 | ltconfig_args="$ltconfig_args '$arg'" ;; | |
167 | *) ltconfig_args="$ltconfig_args $arg" ;; | |
168 | esac | |
169 | done | |
170 | ||
171 | # A relevant subset of AC_INIT. | |
172 | ||
173 | # File descriptor usage: | |
174 | # 0 standard input | |
175 | # 1 file creation | |
176 | # 2 errors and warnings | |
177 | # 3 some systems may open it to /dev/tty | |
178 | # 4 used on the Kubota Titan | |
179 | # 5 compiler messages saved in config.log | |
180 | # 6 checking for... messages and results | |
181 | if test "$silent" = yes; then | |
182 | exec 6>/dev/null | |
183 | else | |
184 | exec 6>&1 | |
185 | fi | |
186 | exec 5>>./config.log | |
187 | ||
188 | # NLS nuisances. | |
189 | # Only set LANG and LC_ALL to C if already set. | |
190 | # These must not be set unconditionally because not all systems understand | |
191 | # e.g. LANG=C (notably SCO). | |
192 | if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi | |
193 | if test "${LANG+set}" = set; then LANG=C; export LANG; fi | |
194 | ||
195 | if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then | |
196 | # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. | |
197 | if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then | |
198 | ac_n= ac_c=' | |
199 | ' ac_t=' ' | |
200 | else | |
201 | ac_n=-n ac_c= ac_t= | |
202 | fi | |
203 | else | |
204 | ac_n= ac_c='\c' ac_t= | |
205 | fi | |
206 | ||
207 | if test -z "$srcdir"; then | |
208 | # Assume the source directory is the same one as the path to ltmain.sh. | |
209 | srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'` | |
210 | test "$srcdir" = "$ltmain" && srcdir=. | |
211 | fi | |
212 | ||
213 | if test "$verify_host" = yes; then | |
214 | # Check for config.guess and config.sub. | |
215 | ac_aux_dir= | |
216 | for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do | |
217 | if test -f $ac_dir/config.guess; then | |
218 | ac_aux_dir=$ac_dir | |
219 | break | |
220 | fi | |
221 | done | |
222 | if test -z "$ac_aux_dir"; then | |
223 | echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 | |
224 | echo "$help" 1>&2 | |
225 | exit 1 | |
226 | fi | |
227 | ac_config_guess=$ac_aux_dir/config.guess | |
228 | ac_config_sub=$ac_aux_dir/config.sub | |
229 | ||
230 | # Make sure we can run config.sub. | |
231 | if $ac_config_sub sun4 >/dev/null 2>&1; then : | |
232 | else | |
233 | echo "$progname: cannot run $ac_config_sub" 1>&2 | |
234 | echo "$help" 1>&2 | |
235 | exit 1 | |
236 | fi | |
237 | ||
238 | echo $ac_n "checking host system type""... $ac_c" 1>&6 | |
239 | ||
240 | host_alias=$host | |
241 | case "$host_alias" in | |
242 | "") | |
243 | if host_alias=`$ac_config_guess`; then : | |
244 | else | |
245 | echo "$progname: cannot guess host type; you must specify one" 1>&2 | |
246 | echo "$help" 1>&2 | |
247 | exit 1 | |
248 | fi ;; | |
249 | esac | |
250 | host=`$ac_config_sub $host_alias` | |
251 | echo "$ac_t""$host" 1>&6 | |
252 | ||
253 | elif test -z "$host"; then | |
254 | echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 | |
255 | echo "$help" 1>&2 | |
256 | exit 1 | |
257 | else | |
258 | host_alias=$host | |
259 | fi | |
260 | ||
261 | # Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts. | |
262 | case "$host" in | |
263 | *-*-linux-gnu*) ;; | |
264 | *-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` | |
265 | esac | |
266 | ||
267 | host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` | |
268 | host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` | |
269 | host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` | |
270 | ||
271 | # Determine commands to create old-style static archives. | |
272 | old_archive_cmds='$AR cru $oldlib$oldobjs' | |
273 | old_postinstall_cmds='chmod 644 $oldlib' | |
274 | ||
275 | # If RANLIB is not set, then run the test. | |
276 | if test "${RANLIB+set}" != "set"; then | |
277 | result=no | |
278 | ||
279 | echo $ac_n "checking for ranlib... $ac_c" 1>&6 | |
280 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
281 | for dir in $PATH; do | |
282 | test -z "$dir" && dir=. | |
283 | if test -f $dir/ranlib; then | |
284 | RANLIB="ranlib" | |
285 | result="ranlib" | |
286 | break | |
287 | fi | |
288 | done | |
289 | IFS="$save_ifs" | |
290 | ||
291 | echo $ac_t "$result" 1>&6 | |
292 | fi | |
293 | ||
294 | if test -n "$RANLIB"; then | |
295 | old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib" | |
296 | old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib" | |
297 | fi | |
298 | ||
299 | # Check to see if we are using GCC. | |
300 | if test "$with_gcc" != yes || test -z "$CC"; then | |
301 | # If CC is not set, then try to find GCC or a usable CC. | |
302 | if test -z "$CC"; then | |
303 | echo $ac_n "checking for gcc... $ac_c" 1>&6 | |
304 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
305 | for dir in $PATH; do | |
306 | IFS="$save_ifs" | |
307 | test -z "$dir" && dir=. | |
308 | if test -f $dir/gcc; then | |
309 | CC="gcc" | |
310 | break | |
311 | fi | |
312 | done | |
313 | IFS="$save_ifs" | |
314 | ||
315 | if test -n "$CC"; then | |
316 | echo "$ac_t""$CC" 1>&6 | |
317 | else | |
318 | echo "$ac_t""no" 1>&6 | |
319 | fi | |
320 | fi | |
321 | ||
322 | # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". | |
323 | if test -z "$CC"; then | |
324 | echo $ac_n "checking for cc... $ac_c" 1>&6 | |
325 | IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" | |
326 | cc_rejected=no | |
327 | for dir in $PATH; do | |
328 | test -z "$dir" && dir=. | |
329 | if test -f $dir/cc; then | |
330 | if test "$dir/cc" = "/usr/ucb/cc"; then | |
331 | cc_rejected=yes | |
332 | continue | |
333 | fi | |
334 | CC="cc" | |
335 | break | |
336 | fi | |
337 | done | |
338 | IFS="$save_ifs" | |
339 | if test $cc_rejected = yes; then | |
340 | # We found a bogon in the path, so make sure we never use it. | |
341 | set dummy $CC | |
342 | shift | |
343 | if test $# -gt 0; then | |
344 | # We chose a different compiler from the bogus one. | |
345 | # However, it has the same name, so the bogon will be chosen | |
346 | # first if we set CC to just the name; use the full file name. | |
347 | shift | |
348 | set dummy "$dir/cc" "$@" | |
349 | shift | |
350 | CC="$@" | |
351 | fi | |
352 | fi | |
353 | ||
354 | if test -n "$CC"; then | |
355 | echo "$ac_t""$CC" 1>&6 | |
356 | else | |
357 | echo "$ac_t""no" 1>&6 | |
358 | fi | |
359 | ||
360 | if test -z "$CC"; then | |
361 | echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 | |
362 | exit 1 | |
363 | fi | |
364 | fi | |
365 | ||
366 | # Now see if the compiler is really GCC. | |
367 | with_gcc=no | |
368 | echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 | |
369 | ||
370 | trap "$rm conftest.c; exit 1" 1 2 15 | |
371 | $rm conftest.c | |
372 | cat > conftest.c <<EOF | |
373 | #ifdef __GNUC__ | |
374 | yes; | |
375 | #endif | |
376 | EOF | |
377 | # LINENUM | |
378 | if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then | |
379 | with_gcc=yes | |
380 | fi | |
381 | $rm conftest.c | |
382 | echo $ac_t "$with_gcc" 1>&6 | |
383 | fi | |
384 | ||
385 | # Allow CC to be a program name with arguments. | |
386 | set dummy $CC | |
387 | compiler="$2" | |
388 | ||
389 | echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 | |
390 | pic_flag= | |
391 | profile_flag_pattern= | |
392 | special_shlib_compile_flags= | |
393 | wl= | |
394 | link_static_flag= | |
395 | ||
396 | if test "$with_gcc" = yes; then | |
397 | pic_flag='-fPIC' | |
398 | profile_flag_pattern='-pg?' | |
399 | wl='-Wl,' | |
400 | link_static_flag='-static' | |
401 | else | |
402 | # PORTME Check for PIC flags for the system compiler. | |
403 | case "$host_os" in | |
404 | aix3* | aix4*) | |
405 | # FIXME All rs/6000 code is PIC, but is there any non-rs/6000 AIX platform? | |
406 | pic_flag= | |
407 | link_static_flag='-bnso -bI:/lib/syscalls.exp' | |
408 | ;; | |
409 | ||
410 | hpux9* | hpux10*) | |
411 | # FIXME is there a better link_static_flag that works with the bundled CC? | |
412 | wl='-Wl,' | |
413 | link_static_flag='${wl}-a ${wl}archive' | |
414 | pic_flag='+Z' | |
415 | ;; | |
416 | ||
417 | irix5* | irix6*) | |
418 | wl='-Wl,' | |
419 | link_static_flag='-non_shared' | |
420 | # PIC (with -KPIC) is the default. | |
421 | pic_flag= | |
422 | ;; | |
423 | ||
424 | osf3* | osf4*) | |
425 | # FIXME - pic_flag is probably required for hppa*-osf* and i860-osf* | |
426 | wl='-Wl,' | |
427 | link_static_flag='-non_shared' | |
428 | ;; | |
429 | ||
430 | sco3.2v5*) | |
431 | pic_flag='-Kpic' | |
432 | link_static_flag='-dn' | |
433 | special_shlib_compile_flags='-belf' | |
434 | ;; | |
435 | ||
436 | solaris2*) | |
437 | pic_flag='-KPIC' | |
438 | link_static_flag='-Bstatic' | |
439 | wl='-Wl,' | |
440 | ;; | |
441 | ||
442 | sunos4*) | |
443 | pic_flag='-PIC' | |
444 | link_static_flag='-Bstatic' | |
445 | wl='-Qoption ld ' | |
446 | ;; | |
447 | ||
448 | *) | |
449 | can_build_shared=no | |
450 | ;; | |
451 | esac | |
452 | fi | |
453 | ||
454 | case "$host_cpu" in | |
455 | rs6000 | powerpc | powerpcle) | |
456 | # Yippee! All RS/6000 and PowerPC code is position-independent. | |
457 | pic_flag= | |
458 | ;; | |
459 | esac | |
460 | ||
461 | if test -n "$pic_flag"; then | |
462 | echo $ac_t "$pic_flag" 1>&6 | |
463 | pic_flag=" $pic_flag" | |
464 | else | |
465 | echo $ac_t none 1>&6 | |
466 | fi | |
467 | ||
468 | # Check for any special shared library compilation flags. | |
469 | if test -n "$special_shlib_compile_flags"; then | |
470 | echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 | |
471 | if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : | |
472 | else | |
473 | echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 | |
474 | can_build_shared=no | |
475 | fi | |
476 | fi | |
477 | ||
478 | # See if we are using a broken GCC collect2 program. | |
479 | if test "$with_gcc" = yes; then | |
480 | echo $ac_n "checking for broken GCC collect2... $ac_c" 1>&6 | |
481 | ||
482 | # FIXME: Run a test here, instead of relying on the canonical system name. | |
483 | case "$host_os" in | |
484 | aix3*) | |
485 | can_build_shared=no | |
486 | echo $ac_t yes 1>&6 | |
487 | echo "$progname: to build shared libraries, set the CC env variable to \`xlc' and reconfigure" 1>&2 | |
488 | ;; | |
489 | *) | |
490 | echo $ac_t no 1>&6 | |
491 | ;; | |
492 | esac | |
493 | fi | |
494 | ||
495 | echo $ac_n "checking for $compiler option to statically link programs... $ac_c" 1>&6 | |
496 | if test -n "$link_static_flag"; then | |
497 | echo $ac_t "$link_static_flag" 1>&6 | |
498 | else | |
499 | echo $ac_t none 1>&6 | |
500 | fi | |
501 | ||
502 | if test -z "$LN_S"; then | |
503 | # Check to see if we can use ln -s, or we need hard links. | |
504 | echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 | |
505 | rm -f conftestdata | |
506 | if ln -s X conftestdata 2>/dev/null; then | |
507 | rm -f conftestdata | |
508 | LN_S="ln -s" | |
509 | else | |
510 | LN_S=ln | |
511 | fi | |
512 | if test "$LN_S" = "ln -s"; then | |
513 | echo "$ac_t"yes 1>&6 | |
514 | else | |
515 | echo "$ac_t"no 1>&6 | |
516 | fi | |
517 | fi | |
518 | ||
519 | if test "$with_gnu_ld" != yes || test -z "$LD"; then | |
520 | if test -z "$LD"; then | |
521 | if test "$with_gnu_ld" = yes; then | |
522 | echo $ac_n "checking for GNU ld... $ac_c" 1>&6 | |
523 | else | |
524 | echo $ac_n "checking for non-GNU ld... $ac_c" 1>&6 | |
525 | fi | |
526 | ||
527 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
528 | for ac_dir in $PATH; do | |
529 | test -z "$ac_dir" && ac_dir=. | |
530 | if test -f "$ac_dir/ld"; then | |
531 | LD="$ac_dir/ld" | |
532 | # Check to see if the program is GNU ld. I'd rather use --version, | |
533 | # but apparently some GNU ld's only accept -v. | |
534 | # Break only if it was the GNU/non-GNU ld that we prefer. | |
535 | if "$LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then | |
536 | test "$with_gnu_ld" = yes && break | |
537 | else | |
538 | test "$with_gnu_ld" != yes && break | |
539 | fi | |
540 | fi | |
541 | done | |
542 | IFS="$ac_save_ifs" | |
543 | ||
544 | if test -n "$LD"; then | |
545 | echo "$ac_t""$LD" 1>&6 | |
546 | else | |
547 | echo "$ac_t""no" 1>&6 | |
548 | fi | |
549 | ||
550 | if test -z "$LD"; then | |
551 | echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 | |
552 | exit 1 | |
553 | fi | |
554 | fi | |
555 | ||
556 | echo $ac_n "checking whether we are using GNU ld... $ac_c" 1>&6 | |
557 | # I'd rather use --version here, but apparently some GNU ld's only accept -v. | |
558 | if $LD -v 2>&1 </dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then | |
559 | with_gnu_ld=yes | |
560 | fi | |
561 | echo $ac_t "$with_gnu_ld" 1>&6 | |
562 | fi | |
563 | ||
564 | # See if the linker supports building shared libraries. | |
565 | echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 | |
566 | ||
567 | allow_undefined_flag= | |
568 | archive_cmds= | |
569 | export_dynamic_flag= | |
570 | hardcode_libdir_flag_spec= | |
571 | hardcode_libdir_separator= | |
572 | hardcode_direct=no | |
573 | hardcode_minus_L=no | |
574 | hardcode_runpath_var=no | |
575 | hardcode_shlibpath_var=unsupported | |
576 | runpath_var= | |
577 | ||
578 | ld_shlibs=yes | |
579 | if test "$with_gnu_ld" = yes; then | |
580 | # See if GNU ld supports shared libraries. | |
581 | ||
582 | case "$host_os" in | |
583 | sunos4*) | |
584 | ld_shlibs=yes | |
585 | hardcode_direct=yes | |
586 | hardcode_shlibpath_var=no | |
587 | ;; | |
588 | ||
589 | *) | |
590 | if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then | |
591 | runpath_var=LD_RUN_PATH | |
592 | hardcode_runpath_var=yes | |
593 | ld_shlibs=yes | |
594 | else | |
595 | ld_shlibs=no | |
596 | fi | |
597 | ;; | |
598 | esac | |
599 | ||
600 | if test "$ld_shlibs" = yes; then | |
601 | archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' | |
602 | hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir' | |
603 | export_dynamic_flag='${wl}-export-dynamic' | |
604 | fi | |
605 | else | |
606 | # PORTME fill in a description of your system's linker (not GNU ld) | |
607 | case "$host_os" in | |
608 | aix3*) | |
609 | allow_undefined_flag=unsupported | |
610 | archive_cmds='/usr/ucb/nm$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname' | |
611 | # Note: this linker hardcodes the directories in LIBPATH if there | |
612 | # are no directories specified by -L. | |
613 | hardcode_minus_L=yes | |
614 | ;; | |
615 | ||
616 | aix4*) | |
617 | allow_undefined_flag=unsupported | |
618 | archive_cmds='/bin/nm -B$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname' | |
619 | hardcode_direct=yes | |
620 | hardcode_minus_L=yes | |
621 | ;; | |
622 | ||
623 | # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor | |
624 | # support. Future versions do this automatically, but an explicit c++rt0.o | |
625 | # doesn't break anything, and helps significantly (at the cost of a little | |
626 | # extra space). | |
627 | freebsd2.2*) | |
628 | archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o' | |
629 | hardcode_direct=yes | |
630 | hardcode_minus_L=yes | |
631 | hardcode_shlibpath_var=no | |
632 | ;; | |
633 | ||
634 | # Unfortunately, older versions of FreeBSD 2 don't have this feature. | |
635 | freebsd2*) | |
636 | archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' | |
637 | hardcode_direct=yes | |
638 | hardcode_minus_L=yes | |
639 | hardcode_shlibpath_var=no | |
640 | ;; | |
641 | ||
642 | # FreeBSD 3, at last, uses gcc -shared to do shared libraries. | |
643 | freebsd3*) | |
644 | archive_cmds='$CC -shared -o $lib$libobjs$deplibs' | |
645 | hardcode_direct=yes | |
646 | hardcode_minusL=yes | |
647 | hardcode_shlibpath_var=no | |
648 | ;; | |
649 | ||
650 | hpux9*) | |
651 | archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib' | |
652 | hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' | |
653 | hardcode_direct=yes | |
654 | hardcode_minus_L=yes | |
655 | ;; | |
656 | ||
657 | hpux10*) | |
658 | archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' | |
659 | hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' | |
660 | hardcode_direct=yes | |
661 | hardcode_minus_L=yes | |
662 | ;; | |
663 | ||
664 | irix5* | irix6*) | |
665 | archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' | |
666 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' | |
667 | ;; | |
668 | ||
669 | netbsd* | openbsd*) | |
670 | # Tested with NetBSD 1.2 ld | |
671 | archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' | |
672 | hardcode_libdir_flag_spec='-R$libdir' | |
673 | hardcode_direct=yes | |
674 | hardcode_shlibpath_var=no | |
675 | ;; | |
676 | ||
677 | osf3* | osf4*) | |
678 | allow_undefined_flag=' -expect_unresolved' | |
679 | archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' | |
680 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' | |
681 | hardcode_libdir_separator=: | |
682 | ;; | |
683 | ||
684 | sco3.2v5*) | |
685 | archive_cmds='$LD -G -o $lib$libobjs$deplibs' | |
686 | hardcode_direct=yes | |
687 | ;; | |
688 | ||
689 | solaris2*) | |
690 | archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' | |
691 | hardcode_libdir_flag_spec='-R$libdir' | |
692 | hardcode_shlibpath_var=no | |
693 | ;; | |
694 | ||
695 | sunos4*) | |
696 | archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' | |
697 | hardcode_libdir_flag_spec='-L$libdir' | |
698 | hardcode_direct=yes | |
699 | hardcode_minus_L=yes | |
700 | hardcode_shlibpath_var=no | |
701 | ;; | |
702 | ||
703 | *) | |
704 | ld_shlibs=no | |
705 | can_build_shared=no | |
706 | ;; | |
707 | esac | |
708 | fi | |
709 | echo $ac_t "$ld_shlibs" 1>&6 | |
710 | ||
711 | # Check hardcoding attributes. | |
712 | echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 | |
713 | hardcode_action= | |
714 | if test -n "$hardcode_libdir_flag_spec" || \ | |
715 | test "$hardcode_runpath_var" = yes; then | |
716 | ||
717 | # We can hardcode non-existant directories. | |
718 | if test "$hardcode_direct" != no && \ | |
719 | test "$hardcode_minus_L" != no && \ | |
720 | test "$hardcode_shlibpath_var" != no; then | |
721 | ||
722 | # Linking always hardcodes the temporary library directory. | |
723 | hardcode_action=relink | |
724 | else | |
725 | # We can link without hardcoding, and we can hardcode nonexisting dirs. | |
726 | hardcode_action=immediate | |
727 | fi | |
728 | elif test "$hardcode_direct" != yes && \ | |
729 | test "$hardcode_minus_L" != yes && \ | |
730 | test "$hardcode_shlibpath_var" != yes; then | |
731 | # We can't hardcode anything. | |
732 | hardcode_action=unsupported | |
733 | else | |
734 | # We can only hardcode existing directories. | |
735 | hardcode_action=relink | |
736 | fi | |
737 | echo $ac_t "$hardcode_action" 1>&6 | |
738 | test "$hardcode_action" = unsupported && can_build_shared=no | |
739 | ||
740 | ||
741 | reload_flag= | |
742 | reload_cmds='$LD$reload_flag -o $output$reload_objs' | |
743 | echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 | |
744 | # PORTME Some linker may need a different reload flag. | |
745 | reload_flag='-r' | |
746 | echo $ac_t "$reload_flag" | |
747 | test -n "$reload_flag" && reload_flag=" $reload_flag" | |
748 | ||
749 | # PORTME Fill in your ld.so characteristics | |
750 | library_names_spec= | |
751 | soname_spec= | |
752 | postinstall_cmds= | |
753 | finish_cmds= | |
754 | shlibpath_var= | |
755 | version_type=none | |
756 | dynamic_linker="$host_os ld.so" | |
757 | ||
758 | echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 | |
759 | case "$host_os" in | |
760 | aix3* | aix4*) | |
761 | version_type=linux | |
762 | library_names_spec='$libname.so.$versuffix $libname.a' | |
763 | shlibpath_var=LIBPATH | |
764 | ||
765 | # AIX has no versioning support, so we append a major version to the name. | |
766 | soname_spec='$libname.so.$major' | |
767 | ;; | |
768 | ||
769 | freebsd2* | freebsd3*) | |
770 | version_type=sunos | |
771 | library_names_spec='$libname.so.$versuffix $libname.so' | |
772 | finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' | |
773 | shlibpath_var=LD_LIBRARY_PATH | |
774 | ;; | |
775 | ||
776 | gnu*) | |
777 | version_type=sunos | |
778 | library_names_spec='$libname.so.$versuffix' | |
779 | shlibpath_var=LD_LIBRARY_PATH | |
780 | ;; | |
781 | ||
782 | hpux9* | hpux10*) | |
783 | # Give a soname corresponding to the major version so that dld.sl refuses to | |
784 | # link against other versions. | |
785 | dynamic_linker="$host_os dld.sl" | |
786 | version_type=sunos | |
787 | shlibpath_var=SHLIB_PATH | |
788 | library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl' | |
789 | soname_spec='$libname.sl.$major' | |
790 | # HP-UX runs *really* slowly unless shared libraries are mode 555. | |
791 | postinstall_cmds='chmod 555 $lib' | |
792 | ;; | |
793 | ||
794 | irix5* | irix6*) | |
795 | version_type=osf | |
796 | soname_spec='$libname.so' | |
797 | library_names_spec='$libname.so.$versuffix $libname.so' | |
798 | shlibpath_var=LD_LIBRARY_PATH | |
799 | ;; | |
800 | ||
801 | # No shared lib support for Linux oldld, aout, or coff. | |
802 | linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) | |
803 | dynamic_linker=no | |
804 | ;; | |
805 | ||
806 | # This must be Linux ELF. | |
807 | linux-gnu*) | |
808 | version_type=linux | |
809 | library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' | |
810 | soname_spec='$libname.so.$major' | |
811 | finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' | |
812 | shlibpath_var=LD_LIBRARY_PATH | |
813 | ||
814 | if test -f /lib/ld.so.1; then | |
815 | dynamic_linker='GNU ld.so' | |
816 | else | |
817 | # Only the GNU ld.so supports shared libraries on MkLinux. | |
818 | case "$host_cpu" in | |
819 | powerpc*) dynamic_linker=no ;; | |
820 | *) dynamic_linker='Linux ld.so' ;; | |
821 | esac | |
822 | fi | |
823 | ;; | |
824 | ||
825 | netbsd* | openbsd*) | |
826 | version_type=sunos | |
827 | library_names_spec='$libname.so.$versuffix' | |
828 | finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' | |
829 | shlibpath_var=LD_LIBRARY_PATH | |
830 | ;; | |
831 | ||
832 | osf3* | osf4*) | |
833 | version_type=osf | |
834 | soname_spec='$libname.so' | |
835 | library_names_spec='$libname.so.$versuffix $libname.so' | |
836 | shlibpath_var=LD_LIBRARY_PATH | |
837 | ;; | |
838 | ||
839 | sco3.2v5*) | |
840 | version_type=osf | |
841 | soname_spec='$libname.so.$major' | |
842 | library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' | |
843 | shlibpath_var=LD_LIBRARY_PATH | |
844 | ;; | |
845 | ||
846 | solaris2*) | |
847 | version_type=linux | |
848 | library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' | |
849 | soname_spec='$libname.so.$major' | |
850 | shlibpath_var=LD_LIBRARY_PATH | |
851 | ;; | |
852 | ||
853 | sunos4*) | |
854 | version_type=sunos | |
855 | library_names_spec='$libname.so.$versuffix' | |
856 | finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' | |
857 | shlibpath_var=LD_LIBRARY_PATH | |
858 | ;; | |
859 | ||
860 | *) | |
861 | dynamic_linker=no | |
862 | ;; | |
863 | esac | |
864 | echo "$ac_t""$dynamic_linker" | |
865 | test "$dynamic_linker" = no && can_build_shared=no | |
866 | ||
867 | # FIXME need to add library stripping features | |
868 | # strip -x works for most platforms, though not for static libraries on NetBSD | |
869 | # HP-UX requires "-r" for library stripping | |
870 | striplib= | |
871 | old_striplib= | |
872 | ||
873 | #echo $ac_n "checking for static library strip program... $ac_c" 1>&6 | |
874 | #if test -n "$old_striplib"; then | |
875 | # echo $ac_t "$old_striplib" 1>&6 | |
876 | #else | |
877 | # echo $ac_t none 1>&6 | |
878 | #fi | |
879 | ||
880 | #if test "$can_build_shared" = yes; then | |
881 | # echo $ac_n "checking for shared library strip program... $ac_c" 1>&6 | |
882 | # | |
883 | # if test -n "$striplib"; then | |
884 | # echo $ac_t "$striplib" 1>&6 | |
885 | # else | |
886 | # echo $ac_t none 1>&6 | |
887 | # fi | |
888 | #fi | |
889 | ||
890 | # Report the consequences. | |
891 | echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 | |
892 | ||
893 | echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 | |
894 | test "$can_build_shared" = "no" && enable_shared=no | |
895 | ||
896 | # On AIX, shared libraries and static libraries use the same namespace. | |
897 | case "$host_os" in | |
898 | aix*) | |
899 | test "$enable_shared" = yes && enable_static=no | |
900 | if test -n "$RANLIB"; then | |
901 | archive_cmds="$archive_cmds;\$RANLIB \$lib" | |
902 | postinstall_cmds='$RANLIB $lib' | |
903 | fi | |
904 | ;; | |
905 | esac | |
906 | ||
907 | echo "$ac_t""$enable_shared" 1>&6 | |
908 | ||
909 | # Make sure either enable_shared or enable_static is yes. | |
910 | test "$enable_shared" = yes || enable_static=yes | |
911 | ||
912 | echo "checking whether to build static libraries... $enable_static" 1>&6 | |
913 | ||
914 | ofile=libtool | |
915 | trap "$rm $ofile; exit 1" 1 2 15 | |
916 | echo creating $ofile | |
917 | rm -fr $ofile | |
918 | cat <<EOF > $ofile | |
919 | #! /bin/sh | |
920 | ||
921 | # libtool - Provide generalized library-building support services. | |
922 | # | |
923 | # Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION | |
924 | # This program was configured as follows, | |
925 | # on host `(hostname || uname -n) 2>/dev/null | sed 1q`: | |
926 | # | |
927 | # CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\ | |
928 | # LD="$old_LD" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\ | |
929 | # $0$ltconfig_args | |
930 | # | |
931 | # Compiler and other test output produced by $progname, useful for | |
932 | # debugging $progname, is in ./config.log if it exists. | |
933 | ||
934 | # The version of $progname that generated this script. | |
935 | LTCONFIG_VERSION="$VERSION" | |
936 | ||
937 | # Whether or not to build libtool libraries. | |
938 | build_libtool_libs=$enable_shared | |
939 | ||
940 | # Whether or not to build old-style libraries. | |
941 | build_old_libs=$enable_static | |
942 | ||
943 | # The host system. | |
944 | host_alias="$host_alias" | |
945 | host="$host" | |
946 | ||
947 | # The archiver. | |
948 | AR='$AR' | |
949 | ||
950 | # The linker used to build libraries. | |
951 | LD='$LD' | |
952 | ||
953 | # Whether we need hard or soft links. | |
954 | LN_S='$LN_S' | |
955 | ||
956 | # How to create reloadable object files. | |
957 | reload_flag='$reload_flag' | |
958 | reload_cmds='$reload_cmds' | |
959 | ||
960 | # How to pass a linker flag through the compiler. | |
961 | wl='$wl' | |
962 | ||
963 | # Additional compiler flags for building library objects. | |
964 | pic_flag='$pic_flag' | |
965 | ||
966 | # Compiler flag to prevent dynamic linking. | |
967 | link_static_flag='$link_static_flag' | |
968 | ||
969 | # Compiler flag to allow reflexive dlopens. | |
970 | export_dynamic_flag='$export_dynamic_flag' | |
971 | ||
972 | # Pattern to match compiler flags for creating libNAME_p libraries: | |
973 | profile_flag_pattern='$profile_flag_pattern' | |
974 | ||
975 | # Library versioning type. | |
976 | version_type=$version_type | |
977 | ||
978 | # List of archive names. First name is the real one, the rest are links. | |
979 | # The last name is the one that the linker finds with -lNAME. | |
980 | library_names_spec='$library_names_spec' | |
981 | ||
982 | # The coded name of the library, if different from the real name. | |
983 | soname_spec='$soname_spec' | |
984 | ||
985 | # Commands used to build and install an old-style archive. | |
986 | RANLIB='$RANLIB' | |
987 | old_archive_cmds='$old_archive_cmds' | |
988 | old_postinstall_cmds='$old_postinstall_cmds' | |
989 | ||
990 | # Commands used to build and install a shared archive. | |
991 | archive_cmds='$archive_cmds' | |
992 | postinstall_cmds='$postinstall_cmds' | |
993 | ||
994 | # Flag that allows shared libraries with undefined symbols to be built. | |
995 | allow_undefined_flag='$allow_undefined_flag' | |
996 | ||
997 | # Commands used to finish a libtool library installation in a directory. | |
998 | finish_cmds='$finish_cmds' | |
999 | ||
1000 | # How to strip a library file. | |
1001 | striplib='$striplib' | |
1002 | old_striplib='$old_striplib' | |
1003 | ||
1004 | # This is the shared library runtime path variable. | |
1005 | runpath_var=$runpath_var | |
1006 | ||
1007 | # This is the shared library path variable. | |
1008 | shlibpath_var=$shlibpath_var | |
1009 | ||
1010 | # How to hardcode a shared library path into an executable. | |
1011 | hardcode_action=$hardcode_action | |
1012 | ||
1013 | # Flag to hardcode \$libdir into a binary during linking. | |
1014 | # This must work even if \$libdir does not exist. | |
1015 | hardcode_libdir_flag_spec='$hardcode_libdir_flag_spec' | |
1016 | ||
1017 | # Whether we need a single -rpath flag with a separated argument. | |
1018 | hardcode_libdir_separator='$hardcode_libdir_separator' | |
1019 | ||
1020 | # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the | |
1021 | # resulting binary. | |
1022 | hardcode_direct=$hardcode_direct | |
1023 | ||
1024 | # Set to yes if using the -LDIR flag during linking hardcodes DIR into the | |
1025 | # resulting binary. | |
1026 | hardcode_minus_L=$hardcode_minus_L | |
1027 | ||
1028 | # Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the | |
1029 | # resulting binary. | |
1030 | hardcode_runpath_var=$hardcode_runpath_var | |
1031 | ||
1032 | # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into | |
1033 | # the resulting binary. | |
1034 | hardcode_shlibpath_var=$hardcode_shlibpath_var | |
1035 | ||
1036 | EOF | |
1037 | ||
1038 | # Detect if we are using a relative or absolute path to ltmain.sh. | |
1039 | case "$ltmain" in | |
1040 | /*) cat <<EOF2 >> $ofile | |
1041 | # Execute the libtool backend. | |
1042 | . $ltmain | |
1043 | EOF2 | |
1044 | ;; | |
1045 | *) cat <<EOF3 >> $ofile | |
1046 | # Find the path to this script. | |
1047 | thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\` | |
1048 | test "X\$0" = "X\$thisdir" && thisdir=. | |
1049 | ||
1050 | # Execute the libtool backend. | |
1051 | . \$thisdir/$ltmain | |
1052 | EOF3 | |
1053 | ;; | |
1054 | esac | |
1055 | ||
1056 | echo 'exit 1' >> $ofile | |
1057 | ||
1058 | chmod +x $ofile | |
1059 | exit 0 | |
1060 | ||
1061 | # Local Variables: | |
1062 | # mode:shell-script | |
1063 | # sh-indentation:2 | |
1064 | # End: |