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