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