1130803Smarcel#! /bin/sh
2130803Smarcel
3130803Smarcel# ltconfig - Create a system-specific libtool.
4130803Smarcel# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5130803Smarcel# Free Software Foundation, Inc.
6130803Smarcel# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7130803Smarcel#
8130803Smarcel# This file is free software; you can redistribute it and/or modify it
9130803Smarcel# under the terms of the GNU General Public License as published by
10130803Smarcel# the Free Software Foundation; either version 2 of the License, or
11130803Smarcel# (at your option) any later version.
12130803Smarcel#
13130803Smarcel# This program is distributed in the hope that it will be useful, but
14130803Smarcel# WITHOUT ANY WARRANTY; without even the implied warranty of
15130803Smarcel# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16130803Smarcel# General Public License for more details.
17130803Smarcel#
18130803Smarcel# You should have received a copy of the GNU General Public License
19130803Smarcel# along with this program; if not, write to the Free Software
20130803Smarcel# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21130803Smarcel#
22130803Smarcel# As a special exception to the GNU General Public License, if you
23130803Smarcel# distribute this file as part of a program that contains a
24130803Smarcel# configuration script generated by Autoconf, you may include it under
25130803Smarcel# the same distribution terms that you use for the rest of that program.
26130803Smarcel
27130803Smarcel# A lot of this script is taken from autoconf-2.10.
28130803Smarcel
29130803Smarcel# Check that we are running under the correct shell.
30130803SmarcelSHELL=${CONFIG_SHELL-/bin/sh}
31130803Smarcelecho=echo
32130803Smarcelif test "X$1" = X--no-reexec; then
33130803Smarcel  # Discard the --no-reexec flag, and continue.
34130803Smarcel  shift
35130803Smarcelelif test "X$1" = X--fallback-echo; then
36130803Smarcel  # Avoid inline document here, it may be left over
37130803Smarcel  :
38130803Smarcelelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
39130803Smarcel  # Yippee, $echo works!
40130803Smarcel  :
41130803Smarcelelse
42130803Smarcel  # Restart under the correct shell.
43130803Smarcel  exec "$SHELL" "$0" --no-reexec ${1+"$@"}
44130803Smarcelfi
45130803Smarcel
46130803Smarcelif test "X$1" = X--fallback-echo; then
47130803Smarcel  # used as fallback echo
48130803Smarcel  shift
49130803Smarcel  cat <<EOF
50130803Smarcel$*
51130803SmarcelEOF
52130803Smarcel  exit 0
53130803Smarcelfi
54130803Smarcel
55130803Smarcel# Find the correct PATH separator.  Usually this is `:', but
56130803Smarcel# DJGPP uses `;' like DOS.
57130803Smarcelif test "X${PATH_SEPARATOR+set}" != Xset; then
58130803Smarcel  UNAME=${UNAME-`uname 2>/dev/null`}
59130803Smarcel  case X$UNAME in
60130803Smarcel    *-DOS) PATH_SEPARATOR=';' ;;
61130803Smarcel    *)     PATH_SEPARATOR=':' ;;
62130803Smarcel  esac
63130803Smarcelfi
64130803Smarcel
65130803Smarcel# The HP-UX ksh and POSIX shell print the target directory to stdout
66130803Smarcel# if CDPATH is set.
67130803Smarcelif test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
68130803Smarcel
69130803Smarcelif test "X${echo_test_string+set}" != Xset; then
70130803Smarcel  # find a string as large as possible, as long as the shell can cope with it
71130803Smarcel  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
72130803Smarcel    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
73130803Smarcel    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
74130803Smarcel       echo_test_string="`eval $cmd`" &&
75130803Smarcel       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
76130803Smarcel      break
77130803Smarcel    fi
78130803Smarcel  done
79130803Smarcelfi
80130803Smarcel
81130803Smarcelif test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
82130803Smarcel   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
83130803Smarcel   test "X$echo_testing_string" = "X$echo_test_string"; then
84130803Smarcel  :
85130803Smarcelelse
86130803Smarcel  # The Solaris, AIX, and Digital Unix default echo programs unquote
87130803Smarcel  # backslashes.  This makes it impossible to quote backslashes using
88130803Smarcel  #   echo "$something" | sed 's/\\/\\\\/g'
89130803Smarcel  #
90130803Smarcel  # So, first we look for a working echo in the user's PATH.
91130803Smarcel
92130803Smarcel  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
93130803Smarcel  for dir in $PATH /usr/ucb; do
94130803Smarcel    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
95130803Smarcel       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
96130803Smarcel       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
97130803Smarcel       test "X$echo_testing_string" = "X$echo_test_string"; then
98130803Smarcel      echo="$dir/echo"
99130803Smarcel      break
100130803Smarcel    fi
101130803Smarcel  done
102130803Smarcel  IFS="$save_ifs"
103130803Smarcel
104130803Smarcel  if test "X$echo" = Xecho; then
105130803Smarcel    # We didn't find a better echo, so look for alternatives.
106130803Smarcel    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
107130803Smarcel       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
108130803Smarcel       test "X$echo_testing_string" = "X$echo_test_string"; then
109130803Smarcel      # This shell has a builtin print -r that does the trick.
110130803Smarcel      echo='print -r'
111130803Smarcel    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
112130803Smarcel	 test "X$CONFIG_SHELL" != X/bin/ksh; then
113130803Smarcel      # If we have ksh, try running ltconfig again with it.
114130803Smarcel      ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
115130803Smarcel      export ORIGINAL_CONFIG_SHELL
116130803Smarcel      CONFIG_SHELL=/bin/ksh
117130803Smarcel      export CONFIG_SHELL
118130803Smarcel      exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
119130803Smarcel    else
120130803Smarcel      # Try using printf.
121130803Smarcel      echo='printf %s\n'
122130803Smarcel      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
123130803Smarcel	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
124130803Smarcel	 test "X$echo_testing_string" = "X$echo_test_string"; then
125130803Smarcel	# Cool, printf works
126130803Smarcel	:
127130803Smarcel      elif echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` &&
128130803Smarcel	   test "X$echo_testing_string" = 'X\t' &&
129130803Smarcel	   echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
130130803Smarcel	   test "X$echo_testing_string" = "X$echo_test_string"; then
131130803Smarcel	CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
132130803Smarcel	export CONFIG_SHELL
133130803Smarcel	SHELL="$CONFIG_SHELL"
134130803Smarcel	export SHELL
135130803Smarcel	echo="$CONFIG_SHELL $0 --fallback-echo"
136130803Smarcel      elif echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` &&
137130803Smarcel	   test "X$echo_testing_string" = 'X\t' &&
138130803Smarcel	   echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
139130803Smarcel	   test "X$echo_testing_string" = "X$echo_test_string"; then
140130803Smarcel	echo="$CONFIG_SHELL $0 --fallback-echo"
141130803Smarcel      else
142130803Smarcel	# maybe with a smaller string...
143130803Smarcel	prev=:
144130803Smarcel
145130803Smarcel	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
146130803Smarcel	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
147130803Smarcel	    break
148130803Smarcel	  fi
149130803Smarcel	  prev="$cmd"
150130803Smarcel	done
151130803Smarcel
152130803Smarcel	if test "$prev" != 'sed 50q "$0"'; then
153130803Smarcel	  echo_test_string=`eval $prev`
154130803Smarcel	  
155130803Smarcel	  export echo_test_string
156130803Smarcel	  exec "${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}}" "$0" ${1+"$@"}
157130803Smarcel	else
158130803Smarcel	  # Oops.  We lost completely, so just stick with echo.
159130803Smarcel	  echo=echo
160130803Smarcel	fi
161130803Smarcel      fi
162130803Smarcel    fi
163130803Smarcel  fi
164130803Smarcelfi
165130803Smarcel
166130803Smarcel# Sed substitution that helps us do robust quoting.  It backslashifies
167130803Smarcel# metacharacters that are still active within double-quoted strings.
168130803SmarcelXsed='sed -e s/^X//'
169130803Smarcelsed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
170130803Smarcel
171130803Smarcel# Same as above, but do not quote variable references.
172130803Smarceldouble_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
173130803Smarcel
174130803Smarcel# Sed substitution to delay expansion of an escaped shell variable in a
175130803Smarcel# double_quote_subst'ed string.
176130803Smarceldelay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
177130803Smarcel
178130803Smarcel# The name of this program.
179130803Smarcelprogname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
180130803Smarcel
181130803Smarcel# Constants:
182130803SmarcelPROGRAM=ltconfig
183130803SmarcelPACKAGE=libtool
184130803SmarcelVERSION=1.4a-GCC3.0
185130803SmarcelTIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)"
186130803Smarcelac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
187130803Smarcelac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
188130803Smarcelrm="rm -f"
189130803Smarcel
190130803Smarcelhelp="Try \`$progname --help' for more information."
191130803Smarcel
192130803Smarcel# Global variables:
193130803Smarceldefault_ofile=libtool
194130803Smarcelcan_build_shared=yes
195130803Smarcelenable_shared=yes
196130803Smarcel# All known linkers require a `.a' archive for static linking (except M$VC,
197130803Smarcel# which needs '.lib').
198130803Smarcelenable_static=yes
199130803Smarcelenable_fast_install=yes
200130803Smarcelenable_dlopen=unknown
201130803Smarcelenable_win32_dll=no
202130803Smarcelpic_mode=default
203130803Smarcelltmain=
204130803Smarcelsilent=
205130803Smarcelsrcdir=
206130803Smarcelac_config_guess=
207130803Smarcelac_config_sub=
208130803Smarcelhost=
209130803Smarcelbuild=NONE
210130803Smarcelnonopt=NONE
211130803Smarcelofile="$default_ofile"
212130803Smarcelverify_host=yes
213130803Smarceltagname=
214130803Smarcelwith_gcc=no
215130803Smarcelwith_gnu_ld=no
216130803Smarcelneed_locks=yes
217130803Smarcelac_ext=c
218130803Smarcellibext=a
219130803Smarcelcache_file=
220130803Smarcelmax_cmd_len=
221130803Smarcel
222130803Smarcel## Dependencies to place before and after the object being linked:
223130803Smarcelpredep_objects=
224130803Smarcelpostdep_objects=
225130803Smarcelpredeps=
226130803Smarcelpostdeps=
227130803Smarcelcompiler_lib_search_path=
228130803Smarcel
229130803Smarcel## Link characteristics:
230130803Smarcelallow_undefined_flag=
231130803Smarcelno_undefined_flag=
232130803Smarcelneed_lib_prefix=unknown
233130803Smarcelneed_version=unknown
234130803Smarcel# when you set need_version to no, make sure it does not cause -set_version
235130803Smarcel# flags to be left without arguments
236130803Smarcelarchive_cmds=
237130803Smarcelarchive_expsym_cmds=
238130803Smarcelold_archive_from_new_cmds=
239130803Smarcelold_archive_from_expsyms_cmds=
240130803Smarcelstriplib=
241130803Smarcelold_striplib=
242130803Smarcelexport_dynamic_flag_spec=
243130803Smarcelwhole_archive_flag_spec=
244130803Smarcelthread_safe_flag_spec=
245130803Smarcelhardcode_into_libs=no
246130803Smarcelhardcode_libdir_flag_spec=
247130803Smarcelhardcode_libdir_separator=
248130803Smarcelhardcode_direct=no
249130803Smarcelhardcode_minus_L=no
250130803Smarcelhardcode_shlibpath_var=unsupported
251130803Smarcelrunpath_var=
252130803Smarcellink_all_deplibs=unknown
253130803Smarcelalways_export_symbols=no
254130803Smarcelexport_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
255130803Smarcel# include_expsyms should be a list of space-separated symbols to be *always*
256130803Smarcel# included in the symbol list
257130803Smarcelinclude_expsyms=
258130803Smarcel# exclude_expsyms can be an egrep regular expression of symbols to exclude
259130803Smarcel# it will be wrapped by ` (' and `)$', so one must not match beginning or
260130803Smarcel# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
261130803Smarcel# as well as any symbol that contains `d'.
262130803Smarcelexclude_expsyms="_GLOBAL_OFFSET_TABLE_"
263130803Smarcel# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
264130803Smarcel# platforms (ab)use it in PIC code, but their linkers get confused if
265130803Smarcel# the symbol is explicitly referenced.  Since portable code cannot
266130803Smarcel# rely on this symbol name, it's probably fine to never include it in
267130803Smarcel# preloaded symbol tables.
268130803Smarcelextract_expsyms_cmds=
269130803Smarcel
270130803Smarcel## Tools:
271130803Smarcelold_AR="$AR"
272130803Smarcelold_AR_FLAGS="$AR_FLAGS"
273130803Smarcelold_CC="$CC"
274130803Smarcelold_CFLAGS="$CFLAGS"
275130803Smarcelold_CPPFLAGS="$CPPFLAGS"
276130803Smarcelold_LDFLAGS="$LDFLAGS"
277130803Smarcelold_LIBS="$LIBS"
278130803Smarcelold_MAGIC_CMD="$MAGIC_CMD"
279130803Smarcelold_LD="$LD"
280130803Smarcelold_LN_S="$LN_S"
281130803Smarcelold_LTCC="$LTCC"
282130803Smarcelold_NM="$NM"
283130803Smarcelold_RANLIB="$RANLIB"
284130803Smarcelold_STRIP="$STRIP"
285130803Smarcelold_AS="$AS"
286130803Smarcelold_DLLTOOL="$DLLTOOL"
287130803Smarcelold_OBJDUMP="$OBJDUMP"
288130803Smarcelold_OBJEXT="$OBJEXT"
289130803Smarcelold_EXEEXT="$EXEEXT"
290130803Smarcelold_reload_flag="$reload_flag"
291130803Smarcelold_deplibs_check_method="$deplibs_check_method"
292130803Smarcelold_file_magic_cmd="$file_magic_cmd"
293130803Smarcel
294130803Smarcel# Parse the command line options.
295130803Smarcelargs=
296130803Smarcelprev=
297130803Smarcelfor option
298130803Smarceldo
299130803Smarcel  case $option in
300130803Smarcel  -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
301130803Smarcel  *) optarg= ;;
302130803Smarcel  esac
303130803Smarcel
304130803Smarcel  # If the previous option needs an argument, assign it.
305130803Smarcel  if test -n "$prev"; then
306130803Smarcel    eval "$prev=\$option"
307130803Smarcel    prev=
308130803Smarcel    continue
309130803Smarcel  fi
310130803Smarcel
311130803Smarcel  case $option in
312130803Smarcel  --help) cat <<EOM
313130803SmarcelUsage: $progname [OPTION]... LTMAIN [HOST]
314130803Smarcel
315130803SmarcelGenerate a system-specific libtool script.
316130803Smarcel
317130803Smarcel    --build                configure for building on BUILD [BUILD=HOST]
318130803Smarcel    --debug                enable verbose shell tracing
319130803Smarcel    --disable-shared       do not build shared libraries
320130803Smarcel    --disable-static       do not build static libraries
321130803Smarcel    --disable-fast-install do not optimize for fast installation
322130803Smarcel    --enable-dlopen        enable dlopen support
323130803Smarcel    --enable-win32-dll     enable building dlls on win32 hosts
324130803Smarcel    --help                 display this help and exit
325130803Smarcel    --no-verify            do not verify that HOST is a valid host type
326130803Smarcel-o, --output=FILE          specify the output file [default=$default_ofile]
327130803Smarcel    --quiet                same as \`--silent'
328130803Smarcel    --silent               do not print informational messages
329130803Smarcel    --srcdir=DIR           find \`config.guess' in DIR
330130803Smarcel    --version              output version information and exit
331130803Smarcel    --add-tag=TAG          append an alternate configuration
332130803Smarcel    --with-gcc             assume that the GNU C compiler will be used
333130803Smarcel    --with-gnu-ld          assume that the C compiler uses the GNU linker
334130803Smarcel    --prefer-pic           try to use only PIC objects
335130803Smarcel    --prefer-non-pic       try to use only non-PIC objects
336130803Smarcel    --disable-lock         disable file locking
337130803Smarcel    --cache-file=FILE      configure cache file
338130803Smarcel
339130803SmarcelLTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
340130803Smarcelthat provides basic libtool functionality.
341130803Smarcel
342130803SmarcelHOST is the canonical host system name [default=guessed].
343130803SmarcelEOM
344130803Smarcel  exit 0
345130803Smarcel  ;;
346130803Smarcel
347130803Smarcel  --build) prev=build ;;
348130803Smarcel  --build=*) build="$optarg" ;;
349130803Smarcel
350130803Smarcel  --debug)
351130803Smarcel    echo "$progname: enabling shell trace mode"
352130803Smarcel    set -x
353130803Smarcel    ;;
354130803Smarcel
355130803Smarcel  --disable-shared) enable_shared=no ;;
356130803Smarcel
357130803Smarcel  --disable-static) enable_static=no ;;
358130803Smarcel
359130803Smarcel  --disable-fast-install) enable_fast_install=no ;;
360130803Smarcel
361130803Smarcel  --enable-dlopen) enable_dlopen=yes ;;
362130803Smarcel
363130803Smarcel  --enable-win32-dll) enable_win32_dll=yes ;;
364130803Smarcel
365130803Smarcel  --quiet | --silent) silent=yes ;;
366130803Smarcel
367130803Smarcel  --srcdir) prev=srcdir ;;
368130803Smarcel  --srcdir=*) srcdir="$optarg" ;;
369130803Smarcel
370130803Smarcel  --no-verify) verify_host=no ;;
371130803Smarcel
372130803Smarcel  --output | -o) prev=ofile ;;
373130803Smarcel  --output=*) ofile="$optarg" ;;
374130803Smarcel
375130803Smarcel  --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
376130803Smarcel
377130803Smarcel  --add-tag) prev=tagname ;;
378130803Smarcel  --add-tag=*) tagname="$optarg" ;;
379130803Smarcel
380130803Smarcel  --with-gcc) with_gcc=yes ;;
381130803Smarcel  --with-gnu-ld) with_gnu_ld=yes ;;
382130803Smarcel
383130803Smarcel  --prefer-pic) pic_mode=yes ;;
384130803Smarcel  --prefer-non-pic) pic_mode=no ;;
385130803Smarcel
386130803Smarcel  --disable-lock) need_locks=no ;;
387130803Smarcel
388130803Smarcel  --cache-file=*) cache_file="$optarg" ;;
389130803Smarcel
390130803Smarcel  -*)
391130803Smarcel    echo "$progname: unrecognized option \`$option'" 1>&2
392130803Smarcel    echo "$help" 1>&2
393130803Smarcel    exit 1
394130803Smarcel    ;;
395130803Smarcel
396130803Smarcel  *)
397130803Smarcel    if test -z "$ltmain"; then
398130803Smarcel      ltmain="$option"
399130803Smarcel    elif test -z "$host"; then
400130803Smarcel# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
401130803Smarcel#      if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
402130803Smarcel#        echo "$progname: warning \`$option' is not a valid host type" 1>&2
403130803Smarcel#      fi
404130803Smarcel      host="$option"
405130803Smarcel    else
406130803Smarcel      echo "$progname: too many arguments" 1>&2
407130803Smarcel      echo "$help" 1>&2
408130803Smarcel      exit 1
409130803Smarcel    fi ;;
410130803Smarcel  esac
411130803Smarceldone
412130803Smarcel
413130803Smarcelif test -z "$ltmain"; then
414130803Smarcel  echo "$progname: you must specify a LTMAIN file" 1>&2
415130803Smarcel  echo "$help" 1>&2
416130803Smarcel  exit 1
417130803Smarcelfi
418130803Smarcel
419130803Smarcelif test ! -f "$ltmain"; then
420130803Smarcel  echo "$progname: \`$ltmain' does not exist" 1>&2
421130803Smarcel  echo "$help" 1>&2
422130803Smarcel  exit 1
423130803Smarcelfi
424130803Smarcel
425130803Smarcelif test -n "$tagname"; then
426130803Smarcel  # Check whether tagname contains only valid characters
427130803Smarcel  case `$echo "X$tagname" | $Xsed -e 's/[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]//g'` in
428130803Smarcel  "") ;;
429130803Smarcel  *)
430130803Smarcel    echo "$progname: invalid tag name: $tagname" 1>&2
431130803Smarcel    exit 1
432130803Smarcel    ;;
433130803Smarcel  esac
434130803Smarcel
435130803Smarcel  if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$ofile" > /dev/null; then
436130803Smarcel    echo "$progname: tag name $tagname already exists" 1>&2
437130803Smarcel    exit 1
438130803Smarcel  fi
439130803Smarcel
440130803Smarcel  if test ! -f "$ofile"; then
441130803Smarcel    echo "$progname: warning: output file \`$ofile' does not exist" 1>&2
442130803Smarcel  fi
443130803Smarcel
444130803Smarcel  if test -z "$LTCC"; then
445130803Smarcel    eval "`$SHELL $ofile --config | grep '^LTCC='`"
446130803Smarcel    if test -z "$LTCC"; then
447130803Smarcel      echo "$progname: warning: output file \`$ofile' does not look like a libtool script" 1>&2
448130803Smarcel    else
449130803Smarcel      echo "$progname: warning: using \`LTCC=$LTCC', extracted from \`$ofile'" 1>&2
450130803Smarcel    fi
451130803Smarcel  fi
452130803Smarcelfi
453130803Smarcel
454130803Smarcel# Quote any args containing shell metacharacters.
455130803Smarcelltconfig_args=
456130803Smarcelfor arg
457130803Smarceldo
458130803Smarcel  case $arg in
459130803Smarcel  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
460130803Smarcel  ltconfig_args="$ltconfig_args '$arg'" ;;
461130803Smarcel  *) ltconfig_args="$ltconfig_args $arg" ;;
462130803Smarcel  esac
463130803Smarceldone
464130803Smarcel
465130803Smarcel# A relevant subset of AC_INIT.
466130803Smarcel
467130803Smarcel# File descriptor usage:
468130803Smarcel# 0 standard input
469130803Smarcel# 1 file creation
470130803Smarcel# 2 errors and warnings
471130803Smarcel# 3 some systems may open it to /dev/tty
472130803Smarcel# 4 used on the Kubota Titan
473130803Smarcel# 5 compiler messages saved in config.log
474130803Smarcel# 6 checking for... messages and results
475130803Smarcelif test "$silent" = yes; then
476130803Smarcel  exec 6>/dev/null
477130803Smarcelelse
478130803Smarcel  exec 6>&1
479130803Smarcelfi
480130803Smarcelexec 5>>./config.log
481130803Smarcel
482130803Smarcel# NLS nuisances.
483130803Smarcel# Only set LANG and LC_ALL to C if already set.
484130803Smarcel# These must not be set unconditionally because not all systems understand
485130803Smarcel# e.g. LANG=C (notably SCO).
486130803Smarcelif test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
487130803Smarcelif test "X${LANG+set}"   = Xset; then LANG=C;   export LANG;   fi
488130803Smarcel
489130803Smarcelif test -n "$cache_file" && test -r "$cache_file" && test -f "$cache_file"; then
490130803Smarcel  echo "loading cache $cache_file within ltconfig"
491130803Smarcel  . $cache_file
492130803Smarcelfi
493130803Smarcel
494130803Smarcelif (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
495130803Smarcel  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
496130803Smarcel  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
497130803Smarcel    ac_n= ac_c='
498130803Smarcel' ac_t='	'
499130803Smarcel  else
500130803Smarcel    ac_n=-n ac_c= ac_t=
501130803Smarcel  fi
502130803Smarcelelse
503130803Smarcel  ac_n= ac_c='\c' ac_t=
504130803Smarcelfi
505130803Smarcel
506130803Smarcelif test -z "$srcdir"; then
507130803Smarcel  # Assume the source directory is the same one as the path to LTMAIN.
508130803Smarcel  srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
509130803Smarcel  test "$srcdir" = "$ltmain" && srcdir=.
510130803Smarcelfi
511130803Smarcel
512130803Smarceltrap "$rm conftest*; exit 1" 1 2 15
513130803Smarcelif test "$verify_host" = yes; then
514130803Smarcel  # Check for config.guess and config.sub.
515130803Smarcel  ac_aux_dir=
516130803Smarcel  for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
517130803Smarcel    if test -f $ac_dir/config.guess; then
518130803Smarcel      ac_aux_dir=$ac_dir
519130803Smarcel      break
520130803Smarcel    fi
521130803Smarcel  done
522130803Smarcel  if test -z "$ac_aux_dir"; then
523130803Smarcel    echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
524130803Smarcel    echo "$help" 1>&2
525130803Smarcel    exit 1
526130803Smarcel  fi
527130803Smarcel  ac_config_guess=$ac_aux_dir/config.guess
528130803Smarcel  ac_config_sub=$ac_aux_dir/config.sub
529130803Smarcel
530130803Smarcel  # Make sure we can run config.sub.
531130803Smarcel  if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
532130803Smarcel  else
533130803Smarcel    echo "$progname: cannot run $ac_config_sub" 1>&2
534130803Smarcel    echo "$help" 1>&2
535130803Smarcel    exit 1
536130803Smarcel  fi
537130803Smarcel
538130803Smarcel  echo $ac_n "checking host system type""... $ac_c" 1>&6
539130803Smarcel
540130803Smarcel  host_alias=$host
541130803Smarcel  case $host_alias in
542130803Smarcel  "")
543130803Smarcel    # Force config.guess to use the C compiler.
544130803Smarcel    # CC_FOR_BUILD overrides the CC variable in config.guess but I had
545130803Smarcel    # problems with it so do it this way for now.
546130803Smarcel    CC="$LTCC"
547130803Smarcel
548130803Smarcel    if host_alias=`$SHELL $ac_config_guess`; then :
549130803Smarcel    else
550130803Smarcel      echo "$progname: cannot guess host type; you must specify one" 1>&2
551130803Smarcel      echo "$help" 1>&2
552130803Smarcel      exit 1
553130803Smarcel    fi
554130803Smarcel
555130803Smarcel    # Restore the C compiler.
556130803Smarcel    CC="$old_CC"
557130803Smarcel    ;;
558130803Smarcel  esac
559130803Smarcel  host=`$SHELL $ac_config_sub $host_alias`
560130803Smarcel  echo "$ac_t$host" 1>&6
561130803Smarcel
562130803Smarcel  # Make sure the host verified.
563130803Smarcel  test -z "$host" && exit 1
564130803Smarcel
565130803Smarcel  # Check for the build system type
566130803Smarcel  echo $ac_n "checking build system type... $ac_c" 1>&6
567130803Smarcel
568130803Smarcel  build_alias=$build
569130803Smarcel  case $build_alias in
570130803Smarcel  NONE)
571130803Smarcel    case $nonopt in
572130803Smarcel    NONE) build_alias=$host_alias ;;
573130803Smarcel    *) build_alias=$nonopt ;;
574130803Smarcel    esac ;;
575130803Smarcel  esac
576130803Smarcel
577130803Smarcel  build=`$SHELL $ac_config_sub $build_alias`
578130803Smarcel  build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
579130803Smarcel  build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
580130803Smarcel  build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
581130803Smarcel  echo "$ac_t""$build" 1>&6
582130803Smarcel
583130803Smarcelelif test -z "$host"; then
584130803Smarcel  echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
585130803Smarcel  echo "$help" 1>&2
586130803Smarcel  exit 1
587130803Smarcelelse
588130803Smarcel  host_alias=$host
589130803Smarcel  build_alias=$host_alias
590130803Smarcel  build=$host
591130803Smarcelfi
592130803Smarcel
593130803Smarcelif test x"$host" != x"$build"; then
594130803Smarcel  ac_tool_prefix=${host_alias}-
595130803Smarcelelse
596130803Smarcel  ac_tool_prefix=
597130803Smarcelfi
598130803Smarcel
599130803Smarcelhost_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
600130803Smarcelhost_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
601130803Smarcelhost_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
602130803Smarcel
603130803Smarcel# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
604130803Smarcelcase $host_os in
605130803Smarcellinux-gnu*) ;;
606130803Smarcellinux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
607130803Smarcelesac
608130803Smarcel
609130803Smarcelcase $host_os in
610130803Smarcelaix3*)
611130803Smarcel  # AIX sometimes has problems with the GCC collect2 program.  For some
612130803Smarcel  # reason, if we set the COLLECT_NAMES environment variable, the problems
613130803Smarcel  # vanish in a puff of smoke.
614130803Smarcel  if test "X${COLLECT_NAMES+set}" != Xset; then
615130803Smarcel    COLLECT_NAMES=
616130803Smarcel    export COLLECT_NAMES
617130803Smarcel  fi
618130803Smarcel  ;;
619130803Smarcelesac
620130803Smarcel
621130803Smarcel# Determine commands to create old-style static archives.
622130803Smarcelold_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
623130803Smarcelold_postinstall_cmds='chmod 644 $oldlib'
624130803Smarcelold_postuninstall_cmds=
625130803Smarcel
626130803Smarcelif test -n "$RANLIB"; then
627130803Smarcel  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
628130803Smarcel  old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
629130803Smarcelfi
630130803Smarcel
631130803Smarcel# Source the script associated with the $tagname tag configuration.
632130803Smarcelif test -n "$tagname"; then
633130803Smarcel  . $ltmain
634130803Smarcelelse
635130803Smarcel  # FIXME:  We should use a variable here
636130803Smarcel  # Configure for a C compiler
637130803Smarcel  . $srcdir/ltcf-c.sh
638130803Smarcelfi
639130803Smarcel
640130803Smarcel# Set sane defaults for various variables
641130803Smarceltest -z "$AR" && AR=ar
642130803Smarceltest -z "$AR_FLAGS" && AR_FLAGS=cru
643130803Smarceltest -z "$AS" && AS=as
644130803Smarceltest -z "$CC" && CC=cc
645130803Smarceltest -z "$DLLTOOL" && DLLTOOL=dlltool
646130803Smarceltest -z "$MAGIC_CMD" && MAGIC_CMD=file
647130803Smarceltest -z "$LD" && LD=ld
648130803Smarceltest -z "$LN_S" && LN_S="ln -s"
649130803Smarceltest -z "$NM" && NM=nm
650130803Smarceltest -z "$OBJDUMP" && OBJDUMP=objdump
651130803Smarceltest -z "$RANLIB" && RANLIB=:
652130803Smarceltest -z "$STRIP" && STRIP=:
653130803Smarceltest -z "$objext" && objext=o
654130803Smarcel
655130803Smarcelecho $ac_n "checking for objdir... $ac_c" 1>&6
656130803Smarcelrm -f .libs 2>/dev/null
657130803Smarcelmkdir .libs 2>/dev/null
658130803Smarcelif test -d .libs; then
659130803Smarcel  objdir=.libs
660130803Smarcelelse
661130803Smarcel  # MS-DOS does not allow filenames that begin with a dot.
662130803Smarcel  objdir=_libs
663130803Smarcelfi
664130803Smarcelrmdir .libs 2>/dev/null
665130803Smarcelecho "$ac_t$objdir" 1>&6
666130803Smarcel
667130803Smarcel# If no C compiler was specified, use CC.
668130803SmarcelLTCC=${LTCC-"$CC"}
669130803Smarcel
670130803Smarcel# Allow CC to be a program name with arguments.
671130803Smarcelset dummy $CC
672130803Smarcelcompiler="$2"
673130803Smarcel
674130803Smarcel# We assume here that the value for ac_cv_prog_cc_pic will not be cached
675130803Smarcel# in isolation, and that seeing it set (from the cache) indicates that
676130803Smarcel# the associated values are set (in the cache) correctly too.
677130803Smarcelecho $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
678130803Smarcelecho "$progname:678:checking for $compiler option to produce PIC" 1>&5
679130803Smarcel
680130803Smarcelif test -z "$ac_cv_prog_cc_pic"; then
681130803Smarcel  echo "$ac_t"none 1>&6
682130803Smarcelelse
683130803Smarcel  echo "$ac_t""$ac_cv_prog_cc_pic" 1>&6
684130803Smarcel
685130803Smarcel  # Check to make sure the pic_flag actually works.
686130803Smarcel  echo $ac_n "checking if $compiler PIC flag $ac_cv_prog_cc_pic works... $ac_c" 1>&6
687130803Smarcel  echo "$progname:687:checking that $compiler PIC flag $ac_cv_prog_cc_pic works." 1>&5
688130803Smarcel  if test "X${ac_cv_prog_cc_pic_works+set}" = Xset && \
689130803Smarcel     test "X${ac_cv_prog_cc_pic_works}" != X; then
690130803Smarcel    echo $ac_n "(cached) $ac_c" 1>&6
691130803Smarcel  else
692130803Smarcel    ac_cv_prog_cc_pic_works=yes
693130803Smarcel    $rm conftest*
694130803Smarcel    echo $lt_simple_compile_test_code > conftest.$ac_ext
695130803Smarcel    save_CFLAGS="$CFLAGS"
696130803Smarcel    CFLAGS="$CFLAGS $ac_cv_prog_cc_pic -DPIC"
697130803Smarcel    if { (eval echo $progname:697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
698130803Smarcel      # Append any warnings to the config.log.
699130803Smarcel      cat conftest.err 1>&5
700130803Smarcel
701130803Smarcel      case $host_os in
702130803Smarcel      hpux9* | hpux10* | hpux11*)
703130803Smarcel	# On HP-UX, both CC and GCC only warn that PIC is supported... then
704130803Smarcel	# they create non-PIC objects.  So, if there were any warnings, we
705130803Smarcel	# assume that PIC is not supported.
706130803Smarcel	if test -s conftest.err; then
707130803Smarcel	  ac_cv_prog_cc_pic_works=no
708130803Smarcel	  ac_cv_prog_cc_can_build_shared=no
709130803Smarcel	  ac_cv_prog_cc_pic=
710130803Smarcel	else
711130803Smarcel	  ac_cv_prog_cc_pic_works=yes
712130803Smarcel	  ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic"
713130803Smarcel	fi
714130803Smarcel	;;
715130803Smarcel      *)
716130803Smarcel	ac_cv_prog_cc_pic_works=yes
717130803Smarcel	ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic"
718130803Smarcel	;;
719130803Smarcel      esac
720130803Smarcel    else
721130803Smarcel      # Append any errors to the config.log.
722130803Smarcel      cat conftest.err 1>&5
723130803Smarcel      ac_cv_prog_cc_pic_works=no
724130803Smarcel      ac_cv_prog_cc_can_build_shared=no
725130803Smarcel      ac_cv_prog_cc_pic=
726130803Smarcel    fi
727130803Smarcel    CFLAGS="$save_CFLAGS"
728130803Smarcel    $rm conftest*
729130803Smarcel  fi
730130803Smarcel  # Belt *and* braces to stop my trousers falling down:
731130803Smarcel  if test "X$ac_cv_prog_cc_pic_works" = Xno; then
732130803Smarcel    ac_cv_prog_cc_pic=
733130803Smarcel    ac_cv_prog_cc_can_build_shared=no
734130803Smarcel  fi
735130803Smarcel  echo "$ac_t""$ac_cv_prog_cc_pic_works" 1>&6
736130803Smarcelfi
737130803Smarcel
738130803Smarcel# Check for any special shared library compilation flags.
739130803Smarcelif test -n "$ac_cv_prog_cc_shlib"; then
740130803Smarcel  echo "$progname: warning: \`$CC' requires \`$ac_cv_prog_cc_shlib' to build shared libraries" 1>&2
741130803Smarcel  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$ac_cv_prog_cc_shlib[ 	]" >/dev/null; then :
742130803Smarcel  else
743130803Smarcel    echo "$progname: add \`$ac_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2
744130803Smarcel    ac_cv_prog_cc_can_build_shared=no
745130803Smarcel  fi
746130803Smarcelfi
747130803Smarcel
748130803Smarcelecho $ac_n "checking if $compiler static flag $ac_cv_prog_cc_static works... $ac_c" 1>&6
749130803Smarcelecho "$progname:749: checking if $compiler static flag $ac_cv_prog_cc_static works" >&5
750130803Smarcelif test "X${ac_cv_prog_cc_static_works+set}" = Xset && \
751130803Smarcel   test "X${ac_cv_prog_cc_static_works}" != X; then
752130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
753130803Smarcelelse
754130803Smarcel  $rm conftest*
755130803Smarcel  echo $lt_simple_link_test_code > conftest.$ac_ext
756130803Smarcel  save_LDFLAGS="$LDFLAGS"
757130803Smarcel  LDFLAGS="$LDFLAGS $ac_cv_prog_cc_static"
758130803Smarcel  if { (eval echo $progname:758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
759130803Smarcel    ac_cv_prog_cc_static_works=yes
760130803Smarcel  else
761130803Smarcel    ac_cv_prog_cc_static_works=no
762130803Smarcel    ac_cv_prog_cc_static=
763130803Smarcel  fi
764130803Smarcel  LDFLAGS="$save_LDFLAGS"
765130803Smarcel  $rm conftest*
766130803Smarcelfi
767130803Smarcel# Belt *and* braces to stop my trousers falling down:
768130803Smarcelif test "X$ac_cv_prog_cc_static_works" = Xno; then
769130803Smarcel  ac_cv_prog_cc_static=
770130803Smarcelfi
771130803Smarcelecho "$ac_t""$ac_cv_prog_cc_static_works" 1>&6
772130803Smarcelpic_flag="$ac_cv_prog_cc_pic"
773130803Smarcelspecial_shlib_compile_flags="$ac_cv_prog_cc_shlib"
774130803Smarcelwl="$ac_cv_prog_cc_wl"
775130803Smarcellink_static_flag="$ac_cv_prog_cc_static"
776130803Smarcelno_builtin_flag="$ac_cv_prog_cc_no_builtin"
777130803Smarcelcan_build_shared="$ac_cv_prog_cc_can_build_shared"
778130803Smarcel
779130803Smarcel# find the maximum length of command line arguments
780130803Smarcelecho "$progname:780: finding the maximum length of command line arguments" 1>&5
781130803Smarcelecho $ac_n "finding the maximum length of command line arguments... $ac_c" 1>&6
782130803Smarcelif test "${lt_cv_sys_max_cmd_len+set}" = set; then
783130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
784130803Smarcelelse
785130803Smarcel  i=0
786130803Smarcel  testring="ABCD"
787130803Smarcel  # If test is not a shell built-in, we'll probably end up computing a
788130803Smarcel  # maximum length that is only half of the actual maximum length, but
789130803Smarcel  # we can't tell.
790130803Smarcel  while test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
791130803Smarcel             = "XX$testring" &&
792130803Smarcel          new_result=`expr "X$testring" : ".*" 2>&1` &&
793130803Smarcel          lt_cv_sys_max_cmd_len=$new_result &&
794130803Smarcel          test $i != 17 # 1/2 MB should be enough
795130803Smarcel  do
796130803Smarcel    i=`expr $i + 1`
797130803Smarcel    testring=$testring$testring
798130803Smarcel  done
799130803Smarcel  testring=
800130803Smarcel  # add a significant safety factor because C++ compilers can tack on massive amounts
801130803Smarcel  # of additional arguments before passing them to the linker.  1/4 should be good.
802130803Smarcel  len=`expr $lt_cv_sys_max_cmd_len \/ 4`
803130803Smarcel  lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len - $len`
804130803Smarcelfi
805130803Smarcelecho "$progname:@lineno@: result: $lt_cv_sys_max_cmd_len" 1>&5
806130803Smarcelecho "${ac_t}$lt_cv_sys_max_cmd_len" 1>&6
807130803Smarcel
808130803Smarcelif test -n $lt_cv_sys_max_cmd_len ; then
809130803Smarcel  max_cmd_len=$lt_cv_sys_max_cmd_len
810130803Smarcelelse
811130803Smarcel  max_cmd_len=none
812130803Smarcelfi
813130803Smarcel
814130803Smarcel# Check to see if options -o and -c are simultaneously supported by compiler
815130803Smarcelecho $ac_n "checking if $compiler supports -c -o file.$objext... $ac_c" 1>&6
816130803Smarcelif test "${lt_cv_compiler_c_o+set}" = set; then
817130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
818130803Smarcelelse
819130803Smarcel  $rm -r conftest 2>/dev/null
820130803Smarcel  mkdir conftest
821130803Smarcel  cd conftest
822130803Smarcel  $rm conftest*
823130803Smarcel  echo $lt_simple_compile_test_code > conftest.$ac_ext
824130803Smarcel  mkdir out
825130803Smarcel  # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
826130803Smarcel  # that will create temporary files in the current directory regardless of
827130803Smarcel  # the output directory.  Thus, making CWD read-only will cause this test
828130803Smarcel  # to fail, enabling locking or at least warning the user not to do parallel
829130803Smarcel  # builds.
830130803Smarcel  chmod -w .
831130803Smarcel  save_CFLAGS="$CFLAGS"
832130803Smarcel  CFLAGS="$CFLAGS -o out/conftest2.$objext"
833130803Smarcel  echo "$progname:833: checking if $compiler supports -c -o file.$objext" >&5
834130803Smarcel  if { (eval echo $progname:834: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$objext; then
835130803Smarcel
836130803Smarcel    # The compiler can only warn and ignore the option if not recognized
837130803Smarcel    # So say no if there are warnings
838130803Smarcel      if test -s out/conftest.err; then
839130803Smarcel        lt_cv_compiler_c_o=no
840130803Smarcel      else
841130803Smarcel        lt_cv_compiler_c_o=yes
842130803Smarcel      fi
843130803Smarcel  else
844130803Smarcel    # Append any errors to the config.log.
845130803Smarcel    cat out/conftest.err 1>&5
846130803Smarcel    lt_cv_compiler_c_o=no
847130803Smarcel  fi
848130803Smarcel  CFLAGS="$save_CFLAGS"
849130803Smarcel  chmod u+w .
850130803Smarcel  $rm conftest* out/*
851130803Smarcel  rmdir out
852130803Smarcel  cd ..
853130803Smarcel  rmdir conftest
854130803Smarcel  $rm -r conftest 2>/dev/null
855130803Smarcelfi
856130803Smarcelcompiler_c_o=$lt_cv_compiler_c_o
857130803Smarcelecho "${ac_t}$compiler_c_o" 1>&6
858130803Smarcel
859130803Smarcel# Check to see if we can do hard links to lock some files if needed
860130803Smarcelhard_links="nottested"
861130803Smarcelif test "$compiler_c_o" = no && test "$need_locks" != no; then
862130803Smarcel  # do not overwrite the value of need_locks provided by the user
863130803Smarcel  echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
864130803Smarcel  hard_links=yes
865130803Smarcel  $rm conftest*
866130803Smarcel  ln conftest.a conftest.b 2>/dev/null && hard_links=no
867130803Smarcel  touch conftest.a
868130803Smarcel  ln conftest.a conftest.b 2>&5 || hard_links=no
869130803Smarcel  ln conftest.a conftest.b 2>/dev/null && hard_links=no
870130803Smarcel  echo "$ac_t$hard_links" 1>&6
871130803Smarcel  $rm conftest*
872130803Smarcel  if test "$hard_links" = no; then
873130803Smarcel    echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
874130803Smarcel    need_locks=warn
875130803Smarcel  fi
876130803Smarcelelse
877130803Smarcel  need_locks=no
878130803Smarcelfi
879130803Smarcel
880130803Smarcelif test "$with_gcc" = yes; then
881130803Smarcel  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
882130803Smarcel  echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
883130803Smarcel  $rm conftest*
884130803Smarcel  echo $lt_simple_compile_test_code > conftest.$ac_ext
885130803Smarcel  save_CFLAGS="$CFLAGS"
886130803Smarcel  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
887130803Smarcel  echo "$progname:887: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
888130803Smarcel  if { (eval echo $progname:888: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
889130803Smarcel
890130803Smarcel    # The compiler can only warn and ignore the option if not recognized
891130803Smarcel    # So say no if there are warnings
892130803Smarcel      if test -s conftest.err; then
893130803Smarcel	echo "$ac_t"no 1>&6
894130803Smarcel	compiler_rtti_exceptions=no
895130803Smarcel      else
896130803Smarcel	echo "$ac_t"yes 1>&6
897130803Smarcel	compiler_rtti_exceptions=yes
898130803Smarcel      fi
899130803Smarcel  else
900130803Smarcel    # Append any errors to the config.log.
901130803Smarcel    cat conftest.err 1>&5
902130803Smarcel    compiler_rtti_exceptions=no
903130803Smarcel    echo "$ac_t"no 1>&6
904130803Smarcel  fi
905130803Smarcel  CFLAGS="$save_CFLAGS"
906130803Smarcel  $rm conftest*
907130803Smarcel
908130803Smarcel  if test "$compiler_rtti_exceptions" = "yes"; then
909130803Smarcel    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
910130803Smarcel  else
911130803Smarcel    no_builtin_flag=' -fno-builtin'
912130803Smarcel  fi
913130803Smarcel  
914130803Smarcelfi
915130803Smarcel
916130803Smarcel# See if the linker supports building shared libraries.
917130803Smarcelecho $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
918130803Smarcel
919130803Smarcelecho "$ac_t$ld_shlibs" 1>&6
920130803Smarceltest "$ld_shlibs" = no && can_build_shared=no
921130803Smarcel
922130803Smarcel# Check hardcoding attributes.
923130803Smarcelecho $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
924130803Smarcelhardcode_action=
925130803Smarcelif test -n "$hardcode_libdir_flag_spec" || \
926130803Smarcel   test -n "$runpath_var"; then
927130803Smarcel
928130803Smarcel  # We can hardcode non-existant directories.
929130803Smarcel  if test "$hardcode_direct" != no &&
930130803Smarcel     # If the only mechanism to avoid hardcoding is shlibpath_var, we
931130803Smarcel     # have to relink, otherwise we might link with an installed library
932130803Smarcel     # when we should be linking with a yet-to-be-installed one
933130803Smarcel     ## test "$hardcode_shlibpath_var" != no &&
934130803Smarcel     test "$hardcode_minus_L" != no; then
935130803Smarcel    # Linking always hardcodes the temporary library directory.
936130803Smarcel    hardcode_action=relink
937130803Smarcel  else
938130803Smarcel    # We can link without hardcoding, and we can hardcode nonexisting dirs.
939130803Smarcel    hardcode_action=immediate
940130803Smarcel  fi
941130803Smarcelelse
942130803Smarcel  # We cannot hardcode anything, or else we can only hardcode existing
943130803Smarcel  # directories.
944130803Smarcel  hardcode_action=unsupported
945130803Smarcelfi
946130803Smarcelecho "$ac_t$hardcode_action" 1>&6
947130803Smarcel
948130803Smarcelecho $ac_n "checking whether stripping libraries is possible... $ac_c" 1>&6
949130803Smarcelif test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
950130803Smarcel  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
951130803Smarcel  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
952130803Smarcel  echo "${ac_t}yes" 1>&6
953130803Smarcelelse
954130803Smarcel  echo "${ac_t}no" 1>&6
955130803Smarcelfi
956130803Smarcel
957130803Smarcelcase $reload_flag in
958130803Smarcel"" | " "*) ;;
959130803Smarcel*) reload_flag=" $reload_flag" ;;
960130803Smarcelesac
961130803Smarcelreload_cmds='$LD$reload_flag -o $output$reload_objs'
962130803Smarceltest -z "$deplibs_check_method" && deplibs_check_method=unknown
963130803Smarcel
964130803Smarcel# PORTME Fill in your ld.so characteristics
965130803Smarcellibrary_names_spec=
966130803Smarcellibname_spec='lib$name'
967130803Smarcelsoname_spec=
968130803Smarcelpostinstall_cmds=
969130803Smarcelpostuninstall_cmds=
970130803Smarcelfinish_cmds=
971130803Smarcelfinish_eval=
972130803Smarcelshlibpath_var=
973130803Smarcelshlibpath_overrides_runpath=unknown
974130803Smarcelversion_type=none
975130803Smarceldynamic_linker="$host_os ld.so"
976130803Smarcelsys_lib_dlsearch_path_spec="/lib /usr/lib"
977130803Smarcelsys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
978130803Smarcel
979130803Smarcelecho $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
980130803Smarcelcase $host_os in
981130803Smarcelaix3*)
982130803Smarcel  version_type=linux
983130803Smarcel  library_names_spec='${libname}${release}.so$versuffix $libname.a'
984130803Smarcel  shlibpath_var=LIBPATH
985130803Smarcel
986130803Smarcel  # AIX 3 has no versioning support, so we append a major version to the name.
987130803Smarcel  soname_spec='${libname}${release}.so$major'
988130803Smarcel  ;;
989130803Smarcel
990130803Smarcelaix4* | aix5*)
991130803Smarcel  version_type=linux
992130803Smarcel  if test "$host_cpu" = ia64; then
993130803Smarcel    # AIX 5 supports IA64
994130803Smarcel    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
995130803Smarcel    shlibpath_var=LD_LIBRARY_PATH
996130803Smarcel  else
997130803Smarcel    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
998130803Smarcel    # soname into executable. Probably we can add versioning support to
999130803Smarcel    # collect2, so additional links can be useful in future.
1000130803Smarcel    # We preserve .a as extension for shared libraries though AIX4.2
1001130803Smarcel    # and later linker supports .so
1002130803Smarcel    if test "$aix_use_runtimelinking" = yes; then
1003130803Smarcel      # If using run time linking (on AIX 4.2 or later) use lib<name>.so instead of
1004130803Smarcel      # lib<name>.a to let people know that these are not typical AIX shared libraries.
1005130803Smarcel      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1006130803Smarcel    else
1007130803Smarcel      # We preserve .a as extension for shared libraries though AIX4.2
1008130803Smarcel      # and later when we are not doing run time linking.
1009130803Smarcel      library_names_spec='${libname}${release}.a $libname.a'
1010130803Smarcel      soname_spec='${libname}${release}.so$major'
1011130803Smarcel    fi
1012130803Smarcel    # If we're using GNU nm, then we don't want the "-C" option.
1013130803Smarcel    # -C means demangle to AIX nm, but means don't demangle with GNU nm
1014130803Smarcel    if $NM -V 2>&1 | egrep '(GNU)' > /dev/null; then
1015130803Smarcel      export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
1016130803Smarcel    else
1017130803Smarcel      export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
1018130803Smarcel    fi
1019130803Smarcel    shlibpath_var=LIBPATH
1020130803Smarcel    deplibs_check_method=pass_all
1021130803Smarcel    case $host_os in
1022130803Smarcel    aix4 | aix4.[01] | aix4.[01].*)
1023130803Smarcel      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
1024130803Smarcel	   echo ' yes '
1025130803Smarcel	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
1026130803Smarcel	:
1027130803Smarcel      else
1028130803Smarcel	# With GCC up to 2.95.x, collect2 would create an import file
1029130803Smarcel	# for dependence libraries.  The import file would start with
1030130803Smarcel	# the line `#! .'.  This would cause the generated library to
1031130803Smarcel	# depend on `.', always an invalid library.  This was fixed in
1032130803Smarcel	# development snapshots of GCC prior to 3.0.
1033130803Smarcel        can_build_shared=no
1034130803Smarcel      fi
1035130803Smarcel      ;;
1036130803Smarcel    esac
1037130803Smarcel  fi
1038130803Smarcel  ;;
1039130803Smarcel
1040130803Smarcelamigaos*)
1041130803Smarcel  library_names_spec='$libname.ixlibrary $libname.a'
1042130803Smarcel  # Create ${libname}_ixlibrary.a entries in /sys/libs.
1043130803Smarcel  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'
1044130803Smarcel  ;;
1045130803Smarcel
1046130803Smarcelbeos*)
1047130803Smarcel  library_names_spec='${libname}.so'
1048130803Smarcel  dynamic_linker="$host_os ld.so"
1049130803Smarcel  shlibpath_var=LIBRARY_PATH
1050130803Smarcel  lt_cv_dlopen="load_add_on"
1051130803Smarcel  lt_cv_dlopen_libs=
1052130803Smarcel  lt_cv_dlopen_self=yes
1053130803Smarcel  ;;
1054130803Smarcel
1055130803Smarcelbsdi4*)
1056130803Smarcel  version_type=linux
1057130803Smarcel  need_version=no
1058130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1059130803Smarcel  soname_spec='${libname}${release}.so$major'
1060130803Smarcel  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
1061130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1062130803Smarcel  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
1063130803Smarcel  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
1064130803Smarcel  export_dynamic_flag_spec=-rdynamic
1065130803Smarcel  # the default ld.so.conf also contains /usr/contrib/lib and
1066130803Smarcel  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
1067130803Smarcel  # libtool to hard-code these into programs
1068130803Smarcel  ;;
1069130803Smarcel
1070130803Smarcelcygwin* | mingw* | pw32*)
1071130803Smarcel  version_type=windows
1072130803Smarcel  need_version=no
1073130803Smarcel  need_lib_prefix=no
1074130803Smarcel  case $with_gcc,$host_os in
1075130803Smarcel  yes,cygwin*)
1076130803Smarcel    library_names_spec='$libname.dll.a'
1077130803Smarcel    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll'
1078130803Smarcel    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i; echo \$dlname'\''`~
1079130803Smarcel      dldir=$destdir/`dirname \$dlpath`~
1080130803Smarcel      test -d \$dldir || mkdir -p \$dldir~
1081130803Smarcel      $install_prog .libs/$dlname \$dldir/$dlname'
1082130803Smarcel    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
1083130803Smarcel      dlpath=$dir/\$dldll; $rm \$dlpath'
1084130803Smarcel    ;;
1085130803Smarcel  yes,mingw*)
1086130803Smarcel    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
1087130803Smarcel    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
1088130803Smarcel    ;;
1089130803Smarcel  yes,pw32*)
1090130803Smarcel    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
1091130803Smarcel;;
1092130803Smarcel  *)
1093130803Smarcel    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
1094130803Smarcel    ;;
1095130803Smarcel  esac
1096130803Smarcel  dynamic_linker='Win32 ld.exe'
1097130803Smarcel  # FIXME: first we should search . and the directory the executable is in
1098130803Smarcel  shlibpath_var=PATH
1099130803Smarcel  lt_cv_dlopen="LoadLibrary"
1100130803Smarcel  lt_cv_dlopen_libs=
1101130803Smarcel  ;;
1102130803Smarcel
1103130803Smarceldarwin* | rhapsody*)
1104130803Smarcel  dynamic_linker="$host_os dyld"
1105130803Smarcel  version_type=darwin
1106130803Smarcel  need_lib_prefix=no
1107130803Smarcel  need_version=no
1108130803Smarcel  library_names_spec='${libname}${release}${versuffix}.`test .$module = .yes && echo so || echo dylib` ${libname}${release}${major}.$`test .$module = .yes && echo so || echo dylib` ${libname}.`test .$module = .yes && echo so || echo dylib`'
1109130803Smarcel  soname_spec='${libname}${release}${major}.`test .$module = .yes && echo so || echo dylib`'
1110130803Smarcel  shlibpath_overrides_runpath=yes
1111130803Smarcel  shlibpath_var=DYLD_LIBRARY_PATH
1112130803Smarcel  ;;
1113130803Smarcel
1114130803Smarcelfreebsd*-gnu*)
1115130803Smarcel  version_type=linux
1116130803Smarcel  need_lib_prefix=no
1117130803Smarcel  need_version=no
1118130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
1119130803Smarcel  soname_spec='${libname}${release}.so${major}'
1120130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1121130803Smarcel  shlibpath_overrides_runpath=no
1122130803Smarcel  hardcode_into_libs=yes
1123130803Smarcel  dynamic_linker='GNU/FreeBSD ld.so'
1124130803Smarcel  ;;
1125130803Smarcel
1126130803Smarcelfreebsd1*)
1127130803Smarcel  dynamic_linker=no
1128130803Smarcel  ;;
1129130803Smarcel
1130130803Smarcelfreebsd*)
1131130803Smarcel  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
1132130803Smarcel  version_type=freebsd-$objformat
1133130803Smarcel  case $version_type in
1134130803Smarcel    freebsd-elf*)
1135130803Smarcel      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
1136130803Smarcel      need_version=no
1137130803Smarcel      need_lc=no
1138130803Smarcel      need_lib_prefix=no
1139130803Smarcel      ;;
1140130803Smarcel    freebsd-*)
1141130803Smarcel      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
1142130803Smarcel      need_version=yes
1143130803Smarcel      ;;
1144130803Smarcel  esac
1145130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1146130803Smarcel  case $host_os in
1147130803Smarcel  freebsd2*)
1148130803Smarcel    shlibpath_overrides_runpath=yes
1149130803Smarcel    ;;
1150130803Smarcel  *)
1151130803Smarcel    shlibpath_overrides_runpath=no
1152130803Smarcel    hardcode_into_libs=yes
1153130803Smarcel    ;;
1154130803Smarcel  esac
1155130803Smarcel  ;;
1156130803Smarcel
1157130803Smarcelgnu*)
1158130803Smarcel  version_type=linux
1159130803Smarcel  need_lib_prefix=no
1160130803Smarcel  need_version=no
1161130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
1162130803Smarcel  soname_spec='${libname}${release}.so$major'
1163130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1164130803Smarcel  hardcode_into_libs=yes
1165130803Smarcel  ;;
1166130803Smarcel
1167130803Smarcelhpux9* | hpux10* | hpux11*)
1168130803Smarcel  # Give a soname corresponding to the major version so that dld.sl refuses to
1169130803Smarcel  # link against other versions.
1170130803Smarcel  version_type=sunos
1171130803Smarcel  need_lib_prefix=no
1172130803Smarcel  need_version=no
1173130803Smarcel  case "$host_cpu" in
1174130803Smarcel  ia64*)
1175130803Smarcel    dynamic_linker="$host_os dld.so"
1176130803Smarcel    shlibpath_var=LD_LIBRARY_PATH
1177130803Smarcel    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1178130803Smarcel    soname_spec='${libname}${release}.so$major'
1179130803Smarcel    shlibpath_var=LD_LIBRARY_PATH
1180130803Smarcel    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
1181130803Smarcel    if test "X$HPUX_IA64_MODE" = X32; then
1182130803Smarcel      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
1183130803Smarcel    else
1184130803Smarcel      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
1185130803Smarcel    fi
1186130803Smarcel    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
1187130803Smarcel    ;;
1188130803Smarcel  *)
1189130803Smarcel    dynamic_linker="$host_os dld.sl"
1190130803Smarcel    shlibpath_var=SHLIB_PATH
1191130803Smarcel    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
1192130803Smarcel    library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
1193130803Smarcel    soname_spec='${libname}${release}.sl$major'
1194130803Smarcel    ;;
1195130803Smarcel  esac
1196130803Smarcel  # HP-UX runs *really* slowly unless shared libraries are mode 555.
1197130803Smarcel  postinstall_cmds='chmod 555 $lib'
1198130803Smarcel  ;;
1199130803Smarcel
1200130803Smarcelirix5* | irix6*)
1201130803Smarcel  if test "$with_gnu_ld" = yes; then
1202130803Smarcel    version_type=linux
1203130803Smarcel  else
1204130803Smarcel    version_type=irix
1205130803Smarcel  fi
1206130803Smarcel  version_type=irix
1207130803Smarcel  need_lib_prefix=no
1208130803Smarcel  need_version=no
1209130803Smarcel  soname_spec='${libname}${release}.so$major'
1210130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
1211130803Smarcel  case $host_os in
1212130803Smarcel  irix5*)
1213130803Smarcel    libsuff= shlibsuff=
1214130803Smarcel    ;;
1215130803Smarcel  *)
1216130803Smarcel    case $LD in # libtool.m4 will add one of these switches to LD
1217130803Smarcel    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
1218130803Smarcel      libsuff= shlibsuff= libmagic=32-bit;;
1219130803Smarcel    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
1220130803Smarcel      libsuff=32 shlibsuff=N32 libmagic=N32;;
1221130803Smarcel    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
1222130803Smarcel      libsuff=64 shlibsuff=64 libmagic=64-bit;;
1223130803Smarcel    *) libsuff= shlibsuff= libmagic=never-match;;
1224130803Smarcel    esac
1225130803Smarcel    ;;
1226130803Smarcel  esac
1227130803Smarcel  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
1228130803Smarcel  shlibpath_overrides_runpath=no
1229130803Smarcel  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
1230130803Smarcel  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
1231130803Smarcel  ;;
1232130803Smarcel
1233130803Smarcel# No shared lib support for Linux oldld, aout, or coff.
1234130803Smarcellinux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
1235130803Smarcel  dynamic_linker=no
1236130803Smarcel  ;;
1237130803Smarcel
1238130803Smarcel# This must be Linux ELF.
1239130803Smarcellinux-gnu*)
1240130803Smarcel  version_type=linux
1241130803Smarcel  need_lib_prefix=no
1242130803Smarcel  need_version=no
1243130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1244130803Smarcel  soname_spec='${libname}${release}.so$major'
1245130803Smarcel  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
1246130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1247130803Smarcel  shlibpath_overrides_runpath=no
1248130803Smarcel  # This implies no fast_install, which is unacceptable.
1249130803Smarcel  # Some rework will be needed to allow for fast_install
1250130803Smarcel  # before this can be enabled.
1251130803Smarcel  hardcode_into_libs=yes
1252130803Smarcel
1253130803Smarcel  # We used to test for /lib/ld.so.1 and disable shared libraries on
1254130803Smarcel  # powerpc, because MkLinux only supported shared libraries with the
1255130803Smarcel  # GNU dynamic linker.  Since this was broken with cross compilers,
1256130803Smarcel  # most powerpc-linux boxes support dynamic linking these days and
1257130803Smarcel  # people can always --disable-shared, the test was removed, and we
1258130803Smarcel  # assume the GNU/Linux dynamic linker is in use.
1259130803Smarcel  dynamic_linker='GNU/Linux ld.so'
1260130803Smarcel  ;;
1261130803Smarcel
1262130803Smarcelnetbsd*)
1263130803Smarcel  need_lib_prefix=no
1264130803Smarcel  need_version=no
1265130803Smarcel  version_type=sunos
1266130803Smarcel  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
1267130803Smarcel    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
1268130803Smarcel    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
1269130803Smarcel    dynamic_linker='NetBSD (a.out) ld.so'
1270130803Smarcel  else
1271130803Smarcel    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
1272130803Smarcel    soname_spec='${libname}${release}.so$major'
1273130803Smarcel    dynamic_linker='NetBSD ld.elf_so'
1274130803Smarcel  fi
1275130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1276130803Smarcel  shlibpath_overrides_runpath=yes
1277130803Smarcel  hardcode_into_libs=yes
1278130803Smarcel  ;;
1279130803Smarcel
1280130803Smarcelnewsos6)
1281130803Smarcel  version_type=linux
1282130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1283130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1284130803Smarcel  shlibpath_overrides_runpath=yes
1285130803Smarcel  ;;
1286130803Smarcel
1287130803Smarcelopenbsd*)
1288130803Smarcel  version_type=sunos
1289130803Smarcel  if test "$with_gnu_ld" = yes; then
1290130803Smarcel    need_lib_prefix=no
1291130803Smarcel    need_version=no
1292130803Smarcel  fi
1293130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
1294130803Smarcel  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
1295130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1296130803Smarcel  ;;
1297130803Smarcel
1298130803Smarcelos2*)
1299130803Smarcel  libname_spec='$name'
1300130803Smarcel  need_lib_prefix=no
1301130803Smarcel  library_names_spec='$libname.dll $libname.a'
1302130803Smarcel  dynamic_linker='OS/2 ld.exe'
1303130803Smarcel  shlibpath_var=LIBPATH
1304130803Smarcel  ;;
1305130803Smarcel
1306130803Smarcelosf3* | osf4* | osf5*)
1307130803Smarcel  version_type=osf
1308130803Smarcel  need_version=no
1309130803Smarcel  soname_spec='${libname}${release}.so'
1310130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
1311130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1312130803Smarcel  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
1313130803Smarcel  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
1314130803Smarcel  ;;
1315130803Smarcel
1316130803Smarcelsco3.2v5*)
1317130803Smarcel  version_type=osf
1318130803Smarcel  soname_spec='${libname}${release}.so$major'
1319130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1320130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1321130803Smarcel  ;;
1322130803Smarcel
1323130803Smarcelsolaris*)
1324130803Smarcel  version_type=linux
1325130803Smarcel  need_lib_prefix=no
1326130803Smarcel  need_version=no
1327130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1328130803Smarcel  soname_spec='${libname}${release}.so$major'
1329130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1330130803Smarcel  shlibpath_overrides_runpath=yes
1331130803Smarcel  hardcode_into_libs=yes
1332130803Smarcel  # ldd complains unless libraries are executable
1333130803Smarcel  postinstall_cmds='chmod +x $lib'
1334130803Smarcel  ;;
1335130803Smarcel
1336130803Smarcelsunos4*)
1337130803Smarcel  version_type=sunos
1338130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
1339130803Smarcel  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
1340130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1341130803Smarcel  shlibpath_overrides_runpath=yes
1342130803Smarcel  if test "$with_gnu_ld" = yes; then
1343130803Smarcel    need_lib_prefix=no
1344130803Smarcel  fi
1345130803Smarcel  need_version=yes
1346130803Smarcel  ;;
1347130803Smarcel
1348130803Smarcelsysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
1349130803Smarcel  version_type=linux
1350130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1351130803Smarcel  soname_spec='${libname}${release}.so$major'
1352130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1353130803Smarcel  case $host_vendor in
1354130803Smarcel    motorola)
1355130803Smarcel      need_lib_prefix=no
1356130803Smarcel      need_version=no
1357130803Smarcel      shlibpath_overrides_runpath=no
1358130803Smarcel      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
1359130803Smarcel      ;;
1360130803Smarcel  esac
1361130803Smarcel  ;;
1362130803Smarcel
1363130803Smarceluts4*)
1364130803Smarcel  version_type=linux
1365130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1366130803Smarcel  soname_spec='${libname}${release}.so$major'
1367130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1368130803Smarcel  ;;
1369130803Smarcel
1370130803Smarceldgux*)
1371130803Smarcel  version_type=linux
1372130803Smarcel  need_lib_prefix=no
1373130803Smarcel  need_version=no
1374130803Smarcel  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
1375130803Smarcel  soname_spec='${libname}${release}.so$major'
1376130803Smarcel  shlibpath_var=LD_LIBRARY_PATH
1377130803Smarcel  ;;
1378130803Smarcel
1379130803Smarcelsysv4*MP*)
1380130803Smarcel  if test -d /usr/nec ;then
1381130803Smarcel    version_type=linux
1382130803Smarcel    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
1383130803Smarcel    soname_spec='$libname.so.$major'
1384130803Smarcel    shlibpath_var=LD_LIBRARY_PATH
1385130803Smarcel  fi
1386130803Smarcel  ;;
1387130803Smarcel
1388130803Smarcel*)
1389130803Smarcel  dynamic_linker=no
1390130803Smarcel  ;;
1391130803Smarcelesac
1392130803Smarcelecho "$ac_t$dynamic_linker" 1>&6
1393130803Smarceltest "$dynamic_linker" = no && can_build_shared=no
1394130803Smarcel
1395130803Smarcel# Check for command to grab the raw symbol name followed by C symbol from nm.
1396130803Smarcelecho $ac_n "checking command to parse $NM output... $ac_c" 1>&6
1397130803Smarcel
1398130803Smarcel# These are sane defaults that work on at least a few old systems.
1399130803Smarcel# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
1400130803Smarcel
1401130803Smarcel# Character class describing NM global symbol codes.
1402130803Smarcelsymcode='[BCDEGRST]'
1403130803Smarcel
1404130803Smarcel# Regexp to match symbols that can be accessed directly from C.
1405130803Smarcelsympat='\([_A-Za-z][_A-Za-z0-9]*\)'
1406130803Smarcel
1407130803Smarcel# Transform the above into a raw symbol and a C symbol.
1408130803Smarcelsymxfrm='\1 \2\3 \3'
1409130803Smarcel
1410130803Smarcel# Transform an extracted symbol line into a proper C declaration
1411130803Smarcelglobal_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
1412130803Smarcel
1413130803Smarcel# Define system-specific variables.
1414130803Smarcelcase $host_os in
1415130803Smarcelaix*)
1416130803Smarcel  symcode='[BCDT]'
1417130803Smarcel  ;;
1418130803Smarcelcygwin* | mingw* | pw32*)
1419130803Smarcel  symcode='[ABCDGISTW]'
1420130803Smarcel  ;;
1421130803Smarcelhpux*) # Its linker distinguishes data from code symbols
1422130803Smarcel  global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
1423130803Smarcel  ;;
1424130803Smarcelirix*)
1425130803Smarcel  symcode='[BCDEGRST]'
1426130803Smarcel  ;;
1427130803Smarcelsolaris* | sysv5*)
1428130803Smarcel  symcode='[BDT]'
1429130803Smarcel  ;;
1430130803Smarcelsysv4)
1431130803Smarcel  symcode='[DFNSTU]'
1432130803Smarcel  ;;
1433130803Smarcelesac
1434130803Smarcel
1435130803Smarcel# Handle CRLF in mingw tool chain
1436130803Smarcelopt_cr=
1437130803Smarcelcase $host_os in
1438130803Smarcelmingw*)
1439130803Smarcel  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
1440130803Smarcel  ;;
1441130803Smarcelesac
1442130803Smarcel
1443130803Smarcel# If we're using GNU nm, then use its standard symbol codes.
1444130803Smarcelif $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
1445130803Smarcel  symcode='[ABCDGISTW]'
1446130803Smarcelfi
1447130803Smarcel
1448130803Smarcel# Try without a prefix undercore, then with it.
1449130803Smarcelfor ac_symprfx in "" "_"; do
1450130803Smarcel
1451130803Smarcel  # Write the raw and C identifiers.
1452130803Smarcel  global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
1453130803Smarcel
1454130803Smarcel  # Check to see that the pipe works correctly.
1455130803Smarcel  pipe_works=no
1456130803Smarcel  $rm conftest*
1457130803Smarcel  cat > conftest.$ac_ext <<EOF
1458130803Smarcel#ifdef __cplusplus
1459130803Smarcelextern "C" {
1460130803Smarcel#endif
1461130803Smarcelchar nm_test_var;
1462130803Smarcelvoid nm_test_func(){}
1463130803Smarcel#ifdef __cplusplus
1464130803Smarcel}
1465130803Smarcel#endif
1466130803Smarcelint main(){nm_test_var='a';nm_test_func();return(0);}
1467130803SmarcelEOF
1468130803Smarcel
1469130803Smarcel  echo "$progname:1431: checking if global_symbol_pipe works" >&5
1470130803Smarcel  if { (eval echo $progname:1432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
1471130803Smarcel    # Now try to grab the symbols.
1472130803Smarcel    nlist=conftest.nm
1473130803Smarcel    if { echo "$progname:1435: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
1474130803Smarcel
1475130803Smarcel      # Try sorting and uniquifying the output.
1476130803Smarcel      if sort "$nlist" | uniq > "$nlist"T; then
1477130803Smarcel	mv -f "$nlist"T "$nlist"
1478130803Smarcel      else
1479130803Smarcel	rm -f "$nlist"T
1480130803Smarcel      fi
1481130803Smarcel
1482130803Smarcel      # Make sure that we snagged all the symbols we need.
1483130803Smarcel      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
1484130803Smarcel	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
1485130803Smarcel	  cat <<EOF > conftest.$ac_ext
1486130803Smarcel#ifdef __cplusplus
1487130803Smarcelextern "C" {
1488130803Smarcel#endif
1489130803Smarcel
1490130803SmarcelEOF
1491130803Smarcel	  # Now generate the symbol file.
1492130803Smarcel	  eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
1493130803Smarcel
1494130803Smarcel	  cat <<EOF >> conftest.$ac_ext
1495130803Smarcel#if defined (__STDC__) && __STDC__
1496130803Smarcel# define lt_ptr_t void *
1497130803Smarcel#else
1498130803Smarcel# define lt_ptr_t char *
1499130803Smarcel# define const
1500130803Smarcel#endif
1501130803Smarcel
1502130803Smarcel/* The mapping between symbol names and symbols. */
1503130803Smarcelconst struct {
1504130803Smarcel  const char *name;
1505130803Smarcel  lt_ptr_t address;
1506130803Smarcel}
1507130803Smarcellt_preloaded_symbols[] =
1508130803Smarcel{
1509130803SmarcelEOF
1510130803Smarcel 	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" >> conftest.$ac_ext
1511130803Smarcel	  cat <<\EOF >> conftest.$ac_ext
1512130803Smarcel  {0, (lt_ptr_t) 0}
1513130803Smarcel};
1514130803Smarcel
1515130803Smarcel#ifdef __cplusplus
1516130803Smarcel}
1517130803Smarcel#endif
1518130803SmarcelEOF
1519130803Smarcel	  # Now try linking the two files.
1520130803Smarcel	  mv conftest.$objext conftstm.$objext
1521130803Smarcel	  save_LIBS="$LIBS"
1522130803Smarcel	  save_CFLAGS="$CFLAGS"
1523130803Smarcel	  LIBS="conftstm.$objext"
1524130803Smarcel	  CFLAGS="$CFLAGS$no_builtin_flag"
1525130803Smarcel	  if { (eval echo $progname:1487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1526130803Smarcel	    pipe_works=yes
1527130803Smarcel	  else
1528130803Smarcel	    echo "$progname: failed program was:" >&5
1529130803Smarcel	    cat conftest.$ac_ext >&5
1530130803Smarcel	  fi
1531130803Smarcel	  LIBS="$save_LIBS"
1532130803Smarcel	else
1533130803Smarcel	  echo "cannot find nm_test_func in $nlist" >&5
1534130803Smarcel	fi
1535130803Smarcel      else
1536130803Smarcel	echo "cannot find nm_test_var in $nlist" >&5
1537130803Smarcel      fi
1538130803Smarcel    else
1539130803Smarcel      echo "cannot run $global_symbol_pipe" >&5
1540130803Smarcel    fi
1541130803Smarcel  else
1542130803Smarcel    echo "$progname: failed program was:" >&5
1543130803Smarcel    cat conftest.$ac_ext >&5
1544130803Smarcel  fi
1545130803Smarcel  $rm conftest* conftst*
1546130803Smarcel
1547130803Smarcel  # Do not use the global_symbol_pipe unless it works.
1548130803Smarcel  if test "$pipe_works" = yes; then
1549130803Smarcel    break
1550130803Smarcel  else
1551130803Smarcel    global_symbol_pipe=
1552130803Smarcel  fi
1553130803Smarceldone
1554130803Smarcelif test "$pipe_works" = yes; then
1555130803Smarcel  echo "${ac_t}ok" 1>&6
1556130803Smarcelelse
1557130803Smarcel  echo "${ac_t}failed" 1>&6
1558130803Smarcelfi
1559130803Smarcel
1560130803Smarcelif test -z "$global_symbol_pipe"; then
1561130803Smarcel  global_symbol_to_cdecl=
1562130803Smarcelfi
1563130803Smarcel
1564130803Smarcel# Report the final consequences.
1565130803Smarcelecho "checking if libtool supports shared libraries... $can_build_shared" 1>&6
1566130803Smarcel
1567130803Smarcel# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
1568130803Smarcel# configure.in, otherwise build static only libraries.
1569130803Smarcelcase $host_os in
1570130803Smarcelcygwin* | mingw* | pw32* | os2*)
1571130803Smarcel  if test x$can_build_shared = xyes; then
1572130803Smarcel    test x$enable_win32_dll = xno && can_build_shared=no
1573130803Smarcel    echo "checking if package supports dlls... $can_build_shared" 1>&6
1574130803Smarcel  fi
1575130803Smarcel;;
1576130803Smarcelesac
1577130803Smarcel
1578130803Smarcelecho $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
1579130803Smarceltest "$can_build_shared" = "no" && enable_shared=no
1580130803Smarcel
1581130803Smarcel# On AIX, shared libraries and static libraries use the same namespace, and
1582130803Smarcel# are all built from PIC.
1583130803Smarcelcase $host_os in
1584130803Smarcelaix3*)
1585130803Smarcel  test "$enable_shared" = yes && enable_static=no
1586130803Smarcel  if test -n "$RANLIB"; then
1587130803Smarcel    archive_cmds="$archive_cmds~\$RANLIB \$lib"
1588130803Smarcel    postinstall_cmds='$RANLIB $lib'
1589130803Smarcel  fi
1590130803Smarcel  ;;
1591130803Smarcel
1592130803Smarcelaix4*)
1593130803Smarcel  test "$enable_shared" = yes && enable_static=no
1594130803Smarcel  ;;
1595130803Smarcelesac
1596130803Smarcel
1597130803Smarcelecho "$ac_t$enable_shared" 1>&6
1598130803Smarcel
1599130803Smarcel# Make sure either enable_shared or enable_static is yes.
1600130803Smarceltest "$enable_shared" = yes || enable_static=yes
1601130803Smarcel
1602130803Smarcelecho "checking whether to build static libraries... $enable_static" 1>&6
1603130803Smarcel
1604130803Smarcelif test "$hardcode_action" = relink; then
1605130803Smarcel  # Fast installation is not supported
1606130803Smarcel  enable_fast_install=no
1607130803Smarcelelif test "$shlibpath_overrides_runpath" = yes ||
1608130803Smarcel     test "$enable_shared" = no; then
1609130803Smarcel  # Fast installation is not necessary
1610130803Smarcel  enable_fast_install=needless
1611130803Smarcelfi
1612130803Smarcel
1613130803Smarcelvariables_saved_for_relink="PATH $shlibpath_var $runpath_var"
1614130803Smarcelif test "$with_gcc" = yes; then
1615130803Smarcel  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
1616130803Smarcelfi
1617130803Smarcel
1618130803Smarcel# Check whether we must set pic_mode to default
1619130803Smarceltest -z "$pic_flag" && pic_mode=default
1620130803Smarcel
1621130803Smarcelif test "x$enable_dlopen" != xyes; then
1622130803Smarcel  enable_dlopen=unknown
1623130803Smarcel  enable_dlopen_self=unknown
1624130803Smarcel  enable_dlopen_self_static=unknown
1625130803Smarcelelse
1626130803Smarcelif test "X${lt_cv_dlopen+set}" != Xset; then
1627130803Smarcel  lt_cv_dlopen=no lt_cv_dlopen_libs=
1628130803Smarcelecho $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
1629130803Smarcelecho "$progname:1591: checking for dlopen in -ldl" >&5
1630130803Smarcelif test "X${ac_cv_lib_dl_dlopen+set}" = Xset; then
1631130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1632130803Smarcelelse
1633130803Smarcel  ac_save_LIBS="$LIBS"
1634130803SmarcelLIBS="-ldl  $LIBS"
1635130803Smarcelcat > conftest.$ac_ext <<EOF
1636130803Smarcel#line 1598 "ltconfig"
1637130803Smarcel/* Override any gcc2 internal prototype to avoid an error.  */
1638130803Smarcel/* We use char because int might match the return type of a gcc2
1639130803Smarcel    builtin and then its argument prototype would still apply.  */
1640130803Smarcel#ifdef __cplusplus
1641130803Smarcelextern "C"
1642130803Smarcel#endif
1643130803Smarcelchar dlopen();
1644130803Smarcel
1645130803Smarcelint main() {
1646130803Smarceldlopen()
1647130803Smarcel; return 0; }
1648130803SmarcelEOF
1649130803Smarcelif { (eval echo $progname:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1650130803Smarcel  rm -rf conftest*
1651130803Smarcel  ac_cv_lib_dl_dlopen=yes
1652130803Smarcelelse
1653130803Smarcel  echo "$progname: failed program was:" >&5
1654130803Smarcel  cat conftest.$ac_ext >&5
1655130803Smarcel  rm -rf conftest*
1656130803Smarcel  ac_cv_lib_dl_dlopen=no
1657130803Smarcelfi
1658130803Smarcelrm -f conftest*
1659130803SmarcelLIBS="$ac_save_LIBS"
1660130803Smarcel
1661130803Smarcelfi
1662130803Smarcelif test "X$ac_cv_lib_dl_dlopen" = Xyes; then
1663130803Smarcel  echo "$ac_t""yes" 1>&6
1664130803Smarcel  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
1665130803Smarcelelse
1666130803Smarcel  echo "$ac_t""no" 1>&6
1667130803Smarcelecho $ac_n "checking for dlopen""... $ac_c" 1>&6
1668130803Smarcelecho "$progname:1630: checking for dlopen" >&5
1669130803Smarcelif test "X${ac_cv_func_dlopen+set}" = Xset; then
1670130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1671130803Smarcelelse
1672130803Smarcel  cat > conftest.$ac_ext <<EOF
1673130803Smarcel#line 1635 "ltconfig"
1674130803Smarcel/* System header to define __stub macros and hopefully few prototypes,
1675130803Smarcel    which can conflict with char dlopen(); below.  */
1676130803Smarcel#include <assert.h>
1677130803Smarcel/* Override any gcc2 internal prototype to avoid an error.  */
1678130803Smarcel/* We use char because int might match the return type of a gcc2
1679130803Smarcel    builtin and then its argument prototype would still apply.  */
1680130803Smarcel#ifdef __cplusplus
1681130803Smarcelextern "C"
1682130803Smarcel#endif
1683130803Smarcelchar dlopen();
1684130803Smarcel
1685130803Smarcelint main() {
1686130803Smarcel
1687130803Smarcel/* The GNU C library defines this for functions which it implements
1688130803Smarcel    to always fail with ENOSYS.  Some functions are actually named
1689130803Smarcel    something starting with __ and the normal name is an alias.  */
1690130803Smarcel#if defined (__stub_dlopen) || defined (__stub___dlopen)
1691130803Smarcelchoke me
1692130803Smarcel#else
1693130803Smarceldlopen();
1694130803Smarcel#endif
1695130803Smarcel
1696130803Smarcel; return 0; }
1697130803SmarcelEOF
1698130803Smarcelif { (eval echo $progname:1660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1699130803Smarcel  rm -rf conftest*
1700130803Smarcel  ac_cv_func_dlopen=yes
1701130803Smarcelelse
1702130803Smarcel  echo "$progname: failed program was:" >&5
1703130803Smarcel  cat conftest.$ac_ext >&5
1704130803Smarcel  rm -rf conftest*
1705130803Smarcel  ac_cv_func_dlopen=no
1706130803Smarcelfi
1707130803Smarcelrm -f conftest*
1708130803Smarcelfi
1709130803Smarcelif test "X$ac_cv_func_dlopen" = Xyes; then
1710130803Smarcel  echo "$ac_t""yes" 1>&6
1711130803Smarcel  lt_cv_dlopen="dlopen"
1712130803Smarcelelse
1713130803Smarcel  echo "$ac_t""no" 1>&6
1714130803Smarcelecho $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
1715130803Smarcelecho "$progname:1677: checking for dlopen in -lsvld" >&5
1716130803Smarcelif test "X${ac_cv_lib_svld_dlopen+set}" = Xset; then
1717130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1718130803Smarcelelse
1719130803Smarcel  ac_save_LIBS="$LIBS"
1720130803SmarcelLIBS="-lsvld  $LIBS"
1721130803Smarcelcat > conftest.$ac_ext <<EOF
1722130803Smarcel#line 1684 "ltconfig"
1723130803Smarcel/* Override any gcc2 internal prototype to avoid an error.  */
1724130803Smarcel/* We use char because int might match the return type of a gcc2
1725130803Smarcel    builtin and then its argument prototype would still apply.  */
1726130803Smarcel#ifdef __cplusplus
1727130803Smarcelextern "C"
1728130803Smarcel#endif
1729130803Smarcelchar dlopen();
1730130803Smarcel
1731130803Smarcelint main() {
1732130803Smarceldlopen()
1733130803Smarcel; return 0; }
1734130803SmarcelEOF
1735130803Smarcelif { (eval echo $progname:1697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1736130803Smarcel  rm -rf conftest*
1737130803Smarcel  ac_cv_lib_svld_dlopen=yes
1738130803Smarcelelse
1739130803Smarcel  echo "$progname: failed program was:" >&5
1740130803Smarcel  cat conftest.$ac_ext >&5
1741130803Smarcel  rm -rf conftest*
1742130803Smarcel  ac_cv_lib_svld_dlopen=no
1743130803Smarcelfi
1744130803Smarcelrm -f conftest*
1745130803SmarcelLIBS="$ac_save_LIBS"
1746130803Smarcel
1747130803Smarcelfi
1748130803Smarcelif test "X$ac_cv_lib_svld_dlopen" = Xyes; then
1749130803Smarcel  echo "$ac_t""yes" 1>&6
1750130803Smarcel  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
1751130803Smarcelelse
1752130803Smarcel  echo "$ac_t""no" 1>&6
1753130803Smarcelecho $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
1754130803Smarcelecho "$progname:1716: checking for dld_link in -ldld" >&5
1755130803Smarcelif test "X${ac_cv_lib_dld_dld_link+set}" = Xset; then
1756130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1757130803Smarcelelse
1758130803Smarcel  ac_save_LIBS="$LIBS"
1759130803SmarcelLIBS="-ldld  $LIBS"
1760130803Smarcelcat > conftest.$ac_ext <<EOF
1761130803Smarcel#line 1723 "ltconfig"
1762130803Smarcel/* Override any gcc2 internal prototype to avoid an error.  */
1763130803Smarcel/* We use char because int might match the return type of a gcc2
1764130803Smarcel    builtin and then its argument prototype would still apply.  */
1765130803Smarcel#ifdef __cplusplus
1766130803Smarcelextern "C"
1767130803Smarcel#endif
1768130803Smarcelchar dld_link();
1769130803Smarcel
1770130803Smarcelint main() {
1771130803Smarceldld_link()
1772130803Smarcel; return 0; }
1773130803SmarcelEOF
1774130803Smarcelif { (eval echo $progname:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1775130803Smarcel  rm -rf conftest*
1776130803Smarcel  ac_cv_lib_dld_dld_link=yes
1777130803Smarcelelse
1778130803Smarcel  echo "$progname: failed program was:" >&5
1779130803Smarcel  cat conftest.$ac_ext >&5
1780130803Smarcel  rm -rf conftest*
1781130803Smarcel  ac_cv_lib_dld_dld_link=no
1782130803Smarcelfi
1783130803Smarcelrm -f conftest*
1784130803SmarcelLIBS="$ac_save_LIBS"
1785130803Smarcel
1786130803Smarcelfi
1787130803Smarcelif test "X$ac_cv_lib_dld_dld_link" = Xyes; then
1788130803Smarcel  echo "$ac_t""yes" 1>&6
1789130803Smarcel  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
1790130803Smarcelelse
1791130803Smarcel  echo "$ac_t""no" 1>&6
1792130803Smarcelecho $ac_n "checking for shl_load""... $ac_c" 1>&6
1793130803Smarcelecho "$progname:1755: checking for shl_load" >&5
1794130803Smarcelif test "X${ac_cv_func_shl_load+set}" = Xset; then
1795130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1796130803Smarcelelse
1797130803Smarcel  cat > conftest.$ac_ext <<EOF
1798130803Smarcel#line 1760 "ltconfig"
1799130803Smarcel/* System header to define __stub macros and hopefully few prototypes,
1800130803Smarcel    which can conflict with char shl_load(); below.  */
1801130803Smarcel#include <assert.h>
1802130803Smarcel/* Override any gcc2 internal prototype to avoid an error.  */
1803130803Smarcel/* We use char because int might match the return type of a gcc2
1804130803Smarcel    builtin and then its argument prototype would still apply.  */
1805130803Smarcel#ifdef __cplusplus
1806130803Smarcelextern "C"
1807130803Smarcel#endif
1808130803Smarcelchar shl_load();
1809130803Smarcel
1810130803Smarcelint main() {
1811130803Smarcel
1812130803Smarcel/* The GNU C library defines this for functions which it implements
1813130803Smarcel    to always fail with ENOSYS.  Some functions are actually named
1814130803Smarcel    something starting with __ and the normal name is an alias.  */
1815130803Smarcel#if defined (__stub_shl_load) || defined (__stub___shl_load)
1816130803Smarcelchoke me
1817130803Smarcel#else
1818130803Smarcelshl_load();
1819130803Smarcel#endif
1820130803Smarcel
1821130803Smarcel; return 0; }
1822130803SmarcelEOF
1823130803Smarcelif { (eval echo $progname:1785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1824130803Smarcel  rm -rf conftest*
1825130803Smarcel  ac_cv_func_shl_load=yes
1826130803Smarcelelse
1827130803Smarcel  echo "$progname: failed program was:" >&5
1828130803Smarcel  cat conftest.$ac_ext >&5
1829130803Smarcel  rm -rf conftest*
1830130803Smarcel  ac_cv_func_shl_load=no
1831130803Smarcelfi
1832130803Smarcelrm -f conftest*
1833130803Smarcelfi
1834130803Smarcel
1835130803Smarcelif test "X$ac_cv_func_shl_load" = Xyes; then
1836130803Smarcel  echo "$ac_t""yes" 1>&6
1837130803Smarcel  lt_cv_dlopen="shl_load"
1838130803Smarcelelse
1839130803Smarcel  echo "$ac_t""no" 1>&6
1840130803Smarcelecho $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
1841130803Smarcelecho "$progname:1803: checking for shl_load in -ldld" >&5
1842130803Smarcelif test "X${ac_cv_lib_dld_shl_load+set}" = Xset; then
1843130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1844130803Smarcelelse
1845130803Smarcel  ac_save_LIBS="$LIBS"
1846130803SmarcelLIBS="-ldld  $LIBS"
1847130803Smarcelcat > conftest.$ac_ext <<EOF
1848130803Smarcel#line 1810 "ltconfig"
1849130803Smarcel#include "confdefs.h"
1850130803Smarcel/* Override any gcc2 internal prototype to avoid an error.  */
1851130803Smarcel/* We use char because int might match the return type of a gcc2
1852130803Smarcel    builtin and then its argument prototype would still apply.  */
1853130803Smarcel#ifdef __cplusplus
1854130803Smarcelextern "C"
1855130803Smarcel#endif
1856130803Smarcelchar shl_load();
1857130803Smarcel
1858130803Smarcelint main() {
1859130803Smarcelshl_load()
1860130803Smarcel; return 0; }
1861130803SmarcelEOF
1862130803Smarcelif { (eval echo $progname:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1863130803Smarcel  rm -rf conftest*
1864130803Smarcel  ac_cv_lib_dld_shl_load=yes
1865130803Smarcelelse
1866130803Smarcel  echo "$progname: failed program was:" >&5
1867130803Smarcel  cat conftest.$ac_ext >&5
1868130803Smarcel  rm -rf conftest*
1869130803Smarcel  ac_cv_lib_dld_shl_load=no
1870130803Smarcelfi
1871130803Smarcelrm -f conftest*
1872130803SmarcelLIBS="$ac_save_LIBS"
1873130803Smarcel
1874130803Smarcelfi
1875130803Smarcelif test "X$ac_cv_lib_dld_shl_load" = Xyes; then
1876130803Smarcel  echo "$ac_t""yes" 1>&6
1877130803Smarcel  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
1878130803Smarcelelse
1879130803Smarcel  echo "$ac_t""no" 1>&6
1880130803Smarcelfi
1881130803Smarcel
1882130803Smarcel
1883130803Smarcelfi
1884130803Smarcel
1885130803Smarcel
1886130803Smarcelfi
1887130803Smarcel
1888130803Smarcel
1889130803Smarcelfi
1890130803Smarcel
1891130803Smarcel
1892130803Smarcelfi
1893130803Smarcel
1894130803Smarcelfi
1895130803Smarcel
1896130803Smarcelfi
1897130803Smarcel
1898130803Smarcel  if test "x$lt_cv_dlopen" != xno; then
1899130803Smarcel    enable_dlopen=yes
1900130803Smarcel  else
1901130803Smarcel    enable_dlopen=no
1902130803Smarcel  fi
1903130803Smarcel
1904130803Smarcel  case $lt_cv_dlopen in
1905130803Smarcel  dlopen)
1906130803Smarcelfor ac_hdr in dlfcn.h; do
1907130803Smarcelac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1908130803Smarcelecho $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1909130803Smarcelecho "$progname:1871: checking for $ac_hdr" >&5
1910130803Smarcelif eval "test \"`echo 'X$''{'ac_cv_header_$ac_safe'+set}'`\" = Xset"; then
1911130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1912130803Smarcelelse
1913130803Smarcel  cat > conftest.$ac_ext <<EOF
1914130803Smarcel#line 1876 "ltconfig"
1915130803Smarcel#include <$ac_hdr>
1916130803Smarcelint fnord = 0;
1917130803Smarcelint main () { return(0); }
1918130803SmarcelEOF
1919130803Smarcelac_try="$ac_compile >/dev/null 2>conftest.out"
1920130803Smarcel{ (eval echo $progname:1882: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1921130803Smarcelac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1922130803Smarcelif test -z "$ac_err"; then
1923130803Smarcel  rm -rf conftest*
1924130803Smarcel  eval "ac_cv_header_$ac_safe=yes"
1925130803Smarcelelse
1926130803Smarcel  echo "$ac_err" >&5
1927130803Smarcel  echo "$progname: failed program was:" >&5
1928130803Smarcel  cat conftest.$ac_ext >&5
1929130803Smarcel  rm -rf conftest*
1930130803Smarcel  eval "ac_cv_header_$ac_safe=no"
1931130803Smarcelfi
1932130803Smarcelrm -f conftest*
1933130803Smarcelfi
1934130803Smarcelif eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1935130803Smarcel  echo "$ac_t""yes" 1>&6
1936130803Smarcelelse
1937130803Smarcel  echo "$ac_t""no" 1>&6
1938130803Smarcelfi
1939130803Smarceldone
1940130803Smarcel
1941130803Smarcel    if test "x$ac_cv_header_dlfcn_h" = xyes; then
1942130803Smarcel      CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1943130803Smarcel    fi
1944130803Smarcel    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
1945130803Smarcel    LIBS="$lt_cv_dlopen_libs $LIBS"
1946130803Smarcel
1947130803Smarcel  echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
1948130803Smarcelecho "$progname:1910: checking whether a program can dlopen itself" >&5
1949130803Smarcelif test "X${lt_cv_dlopen_self+set}" = Xset; then
1950130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
1951130803Smarcelelse
1952130803Smarcel  if test "$cross_compiling" = yes; then
1953130803Smarcel    lt_cv_dlopen_self=cross
1954130803Smarcel  else
1955130803Smarcel    cat > conftest.$ac_ext <<EOF
1956130803Smarcel#line 1918 "ltconfig"
1957130803Smarcel
1958130803Smarcel#if HAVE_DLFCN_H
1959130803Smarcel#include <dlfcn.h>
1960130803Smarcel#endif
1961130803Smarcel
1962130803Smarcel#include <stdio.h>
1963130803Smarcel
1964130803Smarcel#ifdef RTLD_GLOBAL
1965130803Smarcel# define LTDL_GLOBAL	RTLD_GLOBAL
1966130803Smarcel#else
1967130803Smarcel# ifdef DL_GLOBAL
1968130803Smarcel#  define LTDL_GLOBAL	DL_GLOBAL
1969130803Smarcel# else
1970130803Smarcel#  define LTDL_GLOBAL	0
1971130803Smarcel# endif
1972130803Smarcel#endif
1973130803Smarcel
1974130803Smarcel/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
1975130803Smarcel   find out it does not work in some platform. */
1976130803Smarcel#ifndef LTDL_LAZY_OR_NOW
1977130803Smarcel# ifdef RTLD_LAZY
1978130803Smarcel#  define LTDL_LAZY_OR_NOW	RTLD_LAZY
1979130803Smarcel# else
1980130803Smarcel#  ifdef DL_LAZY
1981130803Smarcel#   define LTDL_LAZY_OR_NOW	DL_LAZY
1982130803Smarcel#  else
1983130803Smarcel#   ifdef RTLD_NOW
1984130803Smarcel#    define LTDL_LAZY_OR_NOW	RTLD_NOW
1985130803Smarcel#   else
1986130803Smarcel#    ifdef DL_NOW
1987130803Smarcel#     define LTDL_LAZY_OR_NOW	DL_NOW
1988130803Smarcel#    else
1989130803Smarcel#     define LTDL_LAZY_OR_NOW	0
1990130803Smarcel#    endif
1991130803Smarcel#   endif
1992130803Smarcel#  endif
1993130803Smarcel# endif
1994130803Smarcel#endif
1995130803Smarcel
1996130803Smarcelvoid fnord() { int i=42; }
1997130803Smarcelint main() {
1998130803Smarcel    void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
1999130803Smarcel    if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
2000130803Smarcel               if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
2001130803Smarcel
2002130803SmarcelEOF
2003130803Smarcelif { (eval echo $progname:1965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
2004130803Smarcelthen
2005130803Smarcel  lt_cv_dlopen_self=yes
2006130803Smarcelelse
2007130803Smarcel  echo "$progname: failed program was:" >&5
2008130803Smarcel  cat conftest.$ac_ext >&5
2009130803Smarcel  rm -fr conftest*
2010130803Smarcel  lt_cv_dlopen_self=no
2011130803Smarcelfi
2012130803Smarcelrm -fr conftest*
2013130803Smarcelfi
2014130803Smarcel
2015130803Smarcelfi
2016130803Smarcel
2017130803Smarcelecho "$ac_t""$lt_cv_dlopen_self" 1>&6
2018130803Smarcel
2019130803Smarcel  if test "$lt_cv_dlopen_self" = yes; then
2020130803Smarcel    LDFLAGS="$LDFLAGS $link_static_flag"
2021130803Smarcel  echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
2022130803Smarcelecho "$progname:1984: checking whether a statically linked program can dlopen itself" >&5
2023130803Smarcelif test "X${lt_cv_dlopen_self_static+set}" = Xset; then
2024130803Smarcel  echo $ac_n "(cached) $ac_c" 1>&6
2025130803Smarcelelse
2026130803Smarcel  if test "$cross_compiling" = yes; then
2027130803Smarcel    lt_cv_dlopen_self_static=cross
2028130803Smarcel  else
2029130803Smarcel    cat > conftest.$ac_ext <<EOF
2030130803Smarcel#line 1992 "ltconfig"
2031130803Smarcel
2032130803Smarcel#if HAVE_DLFCN_H
2033130803Smarcel#include <dlfcn.h>
2034130803Smarcel#endif
2035130803Smarcel
2036130803Smarcel#include <stdio.h>
2037130803Smarcel
2038130803Smarcel#ifdef RTLD_GLOBAL
2039130803Smarcel# define LTDL_GLOBAL	RTLD_GLOBAL
2040130803Smarcel#else
2041130803Smarcel# ifdef DL_GLOBAL
2042130803Smarcel#  define LTDL_GLOBAL	DL_GLOBAL
2043130803Smarcel# else
2044130803Smarcel#  define LTDL_GLOBAL	0
2045130803Smarcel# endif
2046130803Smarcel#endif
2047130803Smarcel
2048130803Smarcel/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
2049130803Smarcel   find out it does not work in some platform. */
2050130803Smarcel#ifndef LTDL_LAZY_OR_NOW
2051130803Smarcel# ifdef RTLD_LAZY
2052130803Smarcel#  define LTDL_LAZY_OR_NOW	RTLD_LAZY
2053130803Smarcel# else
2054130803Smarcel#  ifdef DL_LAZY
2055130803Smarcel#   define LTDL_LAZY_OR_NOW	DL_LAZY
2056130803Smarcel#  else
2057130803Smarcel#   ifdef RTLD_NOW
2058130803Smarcel#    define LTDL_LAZY_OR_NOW	RTLD_NOW
2059130803Smarcel#   else
2060130803Smarcel#    ifdef DL_NOW
2061130803Smarcel#     define LTDL_LAZY_OR_NOW	DL_NOW
2062130803Smarcel#    else
2063130803Smarcel#     define LTDL_LAZY_OR_NOW	0
2064130803Smarcel#    endif
2065130803Smarcel#   endif
2066130803Smarcel#  endif
2067130803Smarcel# endif
2068130803Smarcel#endif
2069130803Smarcel
2070130803Smarcelvoid fnord() { int i=42; }
2071130803Smarcelint main() {
2072130803Smarcel    void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
2073130803Smarcel    if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
2074130803Smarcel    if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
2075130803Smarcel
2076130803SmarcelEOF
2077130803Smarcelif { (eval echo $progname:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
2078130803Smarcelthen
2079130803Smarcel  lt_cv_dlopen_self_static=yes
2080130803Smarcelelse
2081130803Smarcel  echo "$progname: failed program was:" >&5
2082130803Smarcel  cat conftest.$ac_ext >&5
2083130803Smarcel  rm -fr conftest*
2084130803Smarcel  lt_cv_dlopen_self_static=no
2085130803Smarcelfi
2086130803Smarcelrm -fr conftest*
2087130803Smarcelfi
2088130803Smarcel
2089130803Smarcelfi
2090130803Smarcel
2091130803Smarcelecho "$ac_t""$lt_cv_dlopen_self_static" 1>&6
2092130803Smarcelfi
2093130803Smarcel    ;;
2094130803Smarcel  esac
2095130803Smarcel
2096130803Smarcel  case $lt_cv_dlopen_self in
2097130803Smarcel  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
2098130803Smarcel  *) enable_dlopen_self=unknown ;;
2099130803Smarcel  esac
2100130803Smarcel
2101130803Smarcel  case $lt_cv_dlopen_self_static in
2102130803Smarcel  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
2103130803Smarcel  *) enable_dlopen_self_static=unknown ;;
2104130803Smarcel  esac
2105130803Smarcelfi
2106130803Smarcel
2107130803Smarcel# Copy echo and quote the copy, instead of the original, because it is
2108130803Smarcel# used later.
2109130803Smarcelltecho="$echo"
2110130803Smarcelif test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
2111130803Smarcel   ltecho="$CONFIG_SHELL \$0 --fallback-echo"
2112130803Smarcelfi
2113130803SmarcelLTSHELL="$SHELL"
2114130803Smarcel
2115130803SmarcelLTCONFIG_VERSION="$VERSION"
2116130803Smarcel
2117130803Smarcel# Only quote variables if we're using ltmain.sh.
2118130803Smarcelcase $ltmain in
2119130803Smarcel*.sh)
2120130803Smarcel  # Now quote all the things that may contain metacharacters.
2121130803Smarcel  for var in ltecho old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \
2122130803Smarcel    old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \
2123130803Smarcel    old_LN_S old_NM old_RANLIB old_STRIP \
2124130803Smarcel    old_AS old_DLLTOOL old_OBJDUMP \
2125130803Smarcel    old_OBJEXT old_EXEEXT old_reload_flag \
2126130803Smarcel    old_deplibs_check_method old_file_magic_cmd \
2127130803Smarcel    AR AR_FLAGS CC LTCC LD LN_S NM LTSHELL LTCONFIG_VERSION \
2128130803Smarcel    reload_flag reload_cmds wl \
2129130803Smarcel    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
2130130803Smarcel    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
2131130803Smarcel    library_names_spec soname_spec \
2132130803Smarcel    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
2133130803Smarcel    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
2134130803Smarcel    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
2135130803Smarcel    predep_objects postdep_objects predeps postdeps compiler_lib_search_path \
2136130803Smarcel    old_striplib striplib file_magic_cmd export_symbols_cmds \
2137130803Smarcel    deplibs_check_method allow_undefined_flag no_undefined_flag \
2138130803Smarcel    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
2139130803Smarcel    hardcode_libdir_flag_spec hardcode_libdir_separator  \
2140130803Smarcel    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
2141130803Smarcel    compiler_c_o need_locks exclude_expsyms include_expsyms; do
2142130803Smarcel
2143130803Smarcel    case $var in
2144130803Smarcel    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
2145130803Smarcel    old_postinstall_cmds | old_postuninstall_cmds | \
2146130803Smarcel    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
2147130803Smarcel    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
2148130803Smarcel    postinstall_cmds | postuninstall_cmds | \
2149130803Smarcel    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
2150130803Smarcel      # Double-quote double-evaled strings.
2151130803Smarcel      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ### testsuite: skip nested quoting test
2152130803Smarcel      ;;
2153130803Smarcel    *)
2154130803Smarcel      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ### testsuite: skip nested quoting test
2155130803Smarcel      ;;
2156130803Smarcel    esac
2157130803Smarcel  done
2158130803Smarcel
2159130803Smarcel  case $ltecho in
2160130803Smarcel  *'\$0 --fallback-echo"')
2161130803Smarcel    ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
2162130803Smarcel    ;;
2163130803Smarcel  esac
2164130803Smarcel
2165130803Smarcel  if test -z "$tagname"; then
2166130803Smarcel    trap "$rm \"$ofile\"; exit 1" 1 2 15
2167130803Smarcel    echo "creating $ofile"
2168130803Smarcel    $rm "$ofile"
2169130803Smarcel    cat <<EOF > "$ofile"
2170130803Smarcel#! $SHELL
2171130803Smarcel
2172130803Smarcel# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
2173130803Smarcel# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
2174130803Smarcel# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
2175130803Smarcel#
2176130803Smarcel# Copyright (C) 1996-2000 Free Software Foundation, Inc.
2177130803Smarcel# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
2178130803Smarcel#
2179130803Smarcel# This program is free software; you can redistribute it and/or modify
2180130803Smarcel# it under the terms of the GNU General Public License as published by
2181130803Smarcel# the Free Software Foundation; either version 2 of the License, or
2182130803Smarcel# (at your option) any later version.
2183130803Smarcel#
2184130803Smarcel# This program is distributed in the hope that it will be useful, but
2185130803Smarcel# WITHOUT ANY WARRANTY; without even the implied warranty of
2186130803Smarcel# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2187130803Smarcel# General Public License for more details.
2188130803Smarcel#
2189130803Smarcel# You should have received a copy of the GNU General Public License
2190130803Smarcel# along with this program; if not, write to the Free Software
2191130803Smarcel# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2192130803Smarcel#
2193130803Smarcel# As a special exception to the GNU General Public License, if you
2194130803Smarcel# distribute this file as part of a program that contains a
2195130803Smarcel# configuration script generated by Autoconf, you may include it under
2196130803Smarcel# the same distribution terms that you use for the rest of that program.
2197130803Smarcel
2198130803Smarcel# Sed that helps us avoid accidentally triggering echo(1) options like -n.
2199130803SmarcelXsed="sed -e s/^X//"
2200130803Smarcel
2201130803Smarcel# The HP-UX ksh and POSIX shell print the target directory to stdout
2202130803Smarcel# if CDPATH is set.
2203130803Smarcelif test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
2204130803Smarcel
2205130803Smarcel# The names of the tagged configurations supported by this script.
2206130803Smarcelavailable_tags=
2207130803Smarcel
2208130803Smarcel### BEGIN LIBTOOL CONFIG
2209130803SmarcelEOF
2210130803Smarcel  else
2211130803Smarcel    echo "appending configuration tag \"$tagname\" to $ofile"
2212130803Smarcel    echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
2213130803Smarcel  fi
2214130803Smarcel  cfgfile="$ofile"
2215130803Smarcel  ;;
2216130803Smarcel
2217130803Smarcel*)
2218130803Smarcel  # Double-quote the variables that need it (for aesthetics).
2219130803Smarcel  for var in old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \
2220130803Smarcel    old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \
2221130803Smarcel    old_LN_S old_NM old_RANLIB old_STRIP \
2222130803Smarcel    old_AS old_DLLTOOL old_OBJDUMP \
2223130803Smarcel    old_OBJEXT old_EXEEXT old_reload_flag \
2224130803Smarcel    old_deplibs_check_method old_file_magic_cmd; do
2225130803Smarcel    eval "$var=\\\"\$var\\\""
2226130803Smarcel  done
2227130803Smarcel
2228130803Smarcel  # Just create a config file.
2229130803Smarcel  cfgfile="$ofile.cfg"
2230130803Smarcel  if test -z "$tagname"; then
2231130803Smarcel    trap "$rm \"$cfgfile\"; exit 1" 1 2 15
2232130803Smarcel    echo "creating $cfgfile"
2233130803Smarcel    $rm "$cfgfile"
2234130803Smarcel    cat <<EOF > "$cfgfile"
2235130803Smarcel# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
2236130803Smarcel# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
2237130803Smarcel
2238130803Smarcel### BEGIN LIBTOOL CONFIG
2239130803SmarcelEOF
2240130803Smarcel  else
2241130803Smarcel    echo "appending to $cfgfile"
2242130803Smarcel    echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
2243130803Smarcel  fi
2244130803Smarcel  ;;
2245130803Smarcelesac
2246130803Smarcel
2247130803Smarcelcat <<EOF >> "$cfgfile"
2248130803Smarcel# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
2249130803Smarcel#
2250130803Smarcel# AR=$old_AR AR_FLAGS=$old_AR_FLAGS LTCC=$old_LTCC CC=$old_CC \\
2251130803Smarcel# CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
2252130803Smarcel# MAGIC_CMD=$old_MAGIC_CMD LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
2253130803Smarcel# LN_S=$old_LN_S NM=$old_NM RANLIB=$old_RANLIB STRIP=$old_STRIP \\
2254130803Smarcel# AS=$old_AS DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP \\
2255130803Smarcel# objext=$old_OBJEXT exeext=$old_EXEEXT reload_flag=$old_reload_flag \\
2256130803Smarcel# deplibs_check_method=$old_deplibs_check_method \\
2257130803Smarcel# file_magic_cmd=$old_file_magic_cmd \\
2258130803Smarcel#   $0$ltconfig_args
2259130803Smarcel#
2260130803Smarcel# Compiler and other test output produced by $progname, useful for
2261130803Smarcel# debugging $progname, is in ./config.log if it exists.
2262130803Smarcel
2263130803Smarcel# The version of $progname that generated this script.
2264130803SmarcelLTCONFIG_VERSION=$LTCONFIG_VERSION
2265130803Smarcel
2266130803Smarcel# Shell to use when invoking shell scripts.
2267130803SmarcelSHELL=$LTSHELL
2268130803Smarcel
2269130803Smarcel# Whether or not to build shared libraries.
2270130803Smarcelbuild_libtool_libs=$enable_shared
2271130803Smarcel
2272130803Smarcel# Whether or not to add -lc for building shared libraries.
2273130803Smarcelbuild_libtool_need_lc=$need_lc
2274130803Smarcel
2275130803Smarcel# Whether or not to build static libraries.
2276130803Smarcelbuild_old_libs=$enable_static
2277130803Smarcel
2278130803Smarcel# Whether or not to optimize for fast installation.
2279130803Smarcelfast_install=$enable_fast_install
2280130803Smarcel
2281130803Smarcel# The host system.
2282130803Smarcelhost_alias=$host_alias
2283130803Smarcelhost=$host
2284130803Smarcel
2285130803Smarcel# An echo program that does not interpret backslashes.
2286130803Smarcelecho=$ltecho
2287130803Smarcel
2288130803Smarcel# The archiver.
2289130803SmarcelAR=$AR
2290130803SmarcelAR_FLAGS=$AR_FLAGS
2291130803Smarcel
2292130803Smarcel# A C compiler.
2293130803SmarcelLTCC=$LTCC
2294130803Smarcel
2295130803Smarcel# A language-specific compiler.
2296130803SmarcelCC=$CC
2297130803Smarcel
2298130803Smarcel# Is the compiler the GNU C compiler?
2299130803Smarcelwith_gcc=$with_gcc
2300130803Smarcel
2301130803Smarcel# The linker used to build libraries.
2302130803SmarcelLD=$LD
2303130803Smarcel
2304130803Smarcel# Whether we need hard or soft links.
2305130803SmarcelLN_S=$LN_S
2306130803Smarcel
2307130803Smarcel# A BSD-compatible nm program.
2308130803SmarcelNM=$NM
2309130803Smarcel
2310130803Smarcel# A symbol stripping program
2311130803SmarcelSTRIP=$STRIP
2312130803Smarcel
2313130803Smarcel# Used to examine libraries when file_magic_cmd begins "file"
2314130803SmarcelMAGIC_CMD=$MAGIC_CMD
2315130803Smarcel
2316130803Smarcel# Used on cygwin: DLL creation program.
2317130803SmarcelDLLTOOL="$DLLTOOL"
2318130803Smarcel
2319130803Smarcel# Used on cygwin: object dumper.
2320130803SmarcelOBJDUMP="$OBJDUMP"
2321130803Smarcel
2322130803Smarcel# Used on cygwin: assembler.
2323130803SmarcelAS="$AS"
2324130803Smarcel
2325130803Smarcel# The name of the directory that contains temporary libtool files.
2326130803Smarcelobjdir=$objdir
2327130803Smarcel
2328130803Smarcel# How to create reloadable object files.
2329130803Smarcelreload_flag=$reload_flag
2330130803Smarcelreload_cmds=$reload_cmds
2331130803Smarcel
2332130803Smarcel# How to pass a linker flag through the compiler.
2333130803Smarcelwl=$wl
2334130803Smarcel
2335130803Smarcel# Object file suffix (normally "o").
2336130803Smarcelobjext="$objext"
2337130803Smarcel
2338130803Smarcel# Old archive suffix (normally "a").
2339130803Smarcellibext="$libext"
2340130803Smarcel
2341130803Smarcel# Executable file suffix (normally "").
2342130803Smarcelexeext="$exeext"
2343130803Smarcel
2344130803Smarcel# Additional compiler flags for building library objects.
2345130803Smarcelpic_flag=$pic_flag
2346130803Smarcelpic_mode=$pic_mode
2347130803Smarcel
2348130803Smarcel# What is the maximum length of a command?
2349130803Smarcelmax_cmd_len=$max_cmd_len
2350130803Smarcel
2351130803Smarcel# Does compiler simultaneously support -c and -o options?
2352130803Smarcelcompiler_c_o=$compiler_c_o
2353130803Smarcel
2354130803Smarcel# Must we lock files when doing compilation ?
2355130803Smarcelneed_locks=$need_locks
2356130803Smarcel
2357130803Smarcel# Do we need the lib prefix for modules?
2358130803Smarcelneed_lib_prefix=$need_lib_prefix
2359130803Smarcel
2360130803Smarcel# Do we need a version for libraries?
2361130803Smarcelneed_version=$need_version
2362130803Smarcel
2363130803Smarcel# Whether dlopen is supported.
2364130803Smarceldlopen_support=$enable_dlopen
2365130803Smarcel
2366130803Smarcel# Whether dlopen of programs is supported.
2367130803Smarceldlopen_self=$enable_dlopen_self
2368130803Smarcel
2369130803Smarcel# Whether dlopen of statically linked programs is supported.
2370130803Smarceldlopen_self_static=$enable_dlopen_self_static
2371130803Smarcel
2372130803Smarcel# Compiler flag to prevent dynamic linking.
2373130803Smarcellink_static_flag=$link_static_flag
2374130803Smarcel
2375130803Smarcel# Compiler flag to turn off builtin functions.
2376130803Smarcelno_builtin_flag=$no_builtin_flag
2377130803Smarcel
2378130803Smarcel# Compiler flag to allow reflexive dlopens.
2379130803Smarcelexport_dynamic_flag_spec=$export_dynamic_flag_spec
2380130803Smarcel
2381130803Smarcel# Compiler flag to generate shared objects directly from archives.
2382130803Smarcelwhole_archive_flag_spec=$whole_archive_flag_spec
2383130803Smarcel
2384130803Smarcel# Compiler flag to generate thread-safe objects.
2385130803Smarcelthread_safe_flag_spec=$thread_safe_flag_spec
2386130803Smarcel
2387130803Smarcel# Library versioning type.
2388130803Smarcelversion_type=$version_type
2389130803Smarcel
2390130803Smarcel# Format of library name prefix.
2391130803Smarcellibname_spec=$libname_spec
2392130803Smarcel
2393130803Smarcel# List of archive names.  First name is the real one, the rest are links.
2394130803Smarcel# The last name is the one that the linker finds with -lNAME.
2395130803Smarcellibrary_names_spec=$library_names_spec
2396130803Smarcel
2397130803Smarcel# The coded name of the library, if different from the real name.
2398130803Smarcelsoname_spec=$soname_spec
2399130803Smarcel
2400130803Smarcel# Commands used to build and install an old-style archive.
2401130803SmarcelRANLIB=$RANLIB
2402130803Smarcelold_archive_cmds=$old_archive_cmds
2403130803Smarcelold_postinstall_cmds=$old_postinstall_cmds
2404130803Smarcelold_postuninstall_cmds=$old_postuninstall_cmds
2405130803Smarcel
2406130803Smarcel# Create an old-style archive from a shared archive.
2407130803Smarcelold_archive_from_new_cmds=$old_archive_from_new_cmds
2408130803Smarcel
2409130803Smarcel# Create a temporary old-style archive to link instead of a shared archive.
2410130803Smarcelold_archive_from_expsyms_cmds=$old_archive_from_expsyms_cmds
2411130803Smarcel
2412130803Smarcel# Commands used to build and install a shared archive.
2413130803Smarcelarchive_cmds=$archive_cmds
2414130803Smarcelarchive_expsym_cmds=$archive_expsym_cmds
2415130803Smarcelpostinstall_cmds=$postinstall_cmds
2416130803Smarcelpostuninstall_cmds=$postuninstall_cmds
2417130803Smarcel
2418130803Smarcel# Commands to strip libraries.
2419130803Smarcelold_striplib=$old_striplib
2420130803Smarcelstriplib=$striplib
2421130803Smarcel
2422130803Smarcel# Dependencies to place before the objects being linked to create a
2423130803Smarcel# shared library.
2424130803Smarcelpredep_objects=$predep_objects
2425130803Smarcel
2426130803Smarcel# Dependencies to place after the objects being linked to create a
2427130803Smarcel# shared library.
2428130803Smarcelpostdep_objects=$postdep_objects
2429130803Smarcel
2430130803Smarcel# Dependencies to place before the objects being linked to create a
2431130803Smarcel# shared library.
2432130803Smarcelpredeps=$predeps
2433130803Smarcel
2434130803Smarcel# Dependencies to place after the objects being linked to create a
2435130803Smarcel# shared library.
2436130803Smarcelpostdeps=$postdeps
2437130803Smarcel
2438130803Smarcel# The library search path used internally by the compiler when linking
2439130803Smarcel# a shared library.
2440130803Smarcelcompiler_lib_search_path=$compiler_lib_search_path
2441130803Smarcel
2442130803Smarcel# Method to check whether dependent libraries are shared objects.
2443130803Smarceldeplibs_check_method=$deplibs_check_method
2444130803Smarcel
2445130803Smarcel# Command to use when deplibs_check_method == file_magic.
2446130803Smarcelfile_magic_cmd=$file_magic_cmd
2447130803Smarcel
2448130803Smarcel# Flag that allows shared libraries with undefined symbols to be built.
2449130803Smarcelallow_undefined_flag=$allow_undefined_flag
2450130803Smarcel
2451130803Smarcel# Flag that forces no undefined symbols.
2452130803Smarcelno_undefined_flag=$no_undefined_flag
2453130803Smarcel
2454130803Smarcel# Commands used to finish a libtool library installation in a directory.
2455130803Smarcelfinish_cmds=$finish_cmds
2456130803Smarcel
2457130803Smarcel# Same as above, but a single script fragment to be evaled but not shown.
2458130803Smarcelfinish_eval=$finish_eval
2459130803Smarcel
2460130803Smarcel# Take the output of nm and produce a listing of raw symbols and C names.
2461130803Smarcelglobal_symbol_pipe=$global_symbol_pipe
2462130803Smarcel
2463130803Smarcel# Transform the output of nm in a proper C declaration
2464130803Smarcelglobal_symbol_to_cdecl=$global_symbol_to_cdecl
2465130803Smarcel
2466130803Smarcel# This is the shared library runtime path variable.
2467130803Smarcelrunpath_var=$runpath_var
2468130803Smarcel
2469130803Smarcel# This is the shared library path variable.
2470130803Smarcelshlibpath_var=$shlibpath_var
2471130803Smarcel
2472130803Smarcel# Is shlibpath searched before the hard-coded library search path?
2473130803Smarcelshlibpath_overrides_runpath=$shlibpath_overrides_runpath
2474130803Smarcel
2475130803Smarcel# How to hardcode a shared library path into an executable.
2476130803Smarcelhardcode_action=$hardcode_action
2477130803Smarcel
2478130803Smarcel# Whether we should hardcode library paths into libraries.
2479130803Smarcelhardcode_into_libs=$hardcode_into_libs
2480130803Smarcel
2481130803Smarcel# Flag to hardcode \$libdir into a binary during linking.
2482130803Smarcel# This must work even if \$libdir does not exist.
2483130803Smarcelhardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
2484130803Smarcel
2485130803Smarcel# Whether we need a single -rpath flag with a separated argument.
2486130803Smarcelhardcode_libdir_separator=$hardcode_libdir_separator
2487130803Smarcel
2488130803Smarcel# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
2489130803Smarcel# resulting binary.
2490130803Smarcelhardcode_direct=$hardcode_direct
2491130803Smarcel
2492130803Smarcel# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
2493130803Smarcel# resulting binary.
2494130803Smarcelhardcode_minus_L=$hardcode_minus_L
2495130803Smarcel
2496130803Smarcel# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
2497130803Smarcel# the resulting binary.
2498130803Smarcelhardcode_shlibpath_var=$hardcode_shlibpath_var
2499130803Smarcel
2500130803Smarcel# Variables whose values should be saved in libtool wrapper scripts and
2501130803Smarcel# restored at relink time.
2502130803Smarcelvariables_saved_for_relink="$variables_saved_for_relink"
2503130803Smarcel
2504130803Smarcel# Whether libtool must link a program against all its dependency libraries.
2505130803Smarcellink_all_deplibs=$link_all_deplibs
2506130803Smarcel
2507130803Smarcel# Compile-time system search path for libraries
2508130803Smarcelsys_lib_search_path_spec=$sys_lib_search_path_spec
2509130803Smarcel
2510130803Smarcel# Run-time system search path for libraries
2511130803Smarcelsys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
2512130803Smarcel
2513130803Smarcel# Fix the shell variable \$srcfile for the compiler.
2514130803Smarcelfix_srcfile_path="$fix_srcfile_path"
2515130803Smarcel
2516130803Smarcel# Set to yes if exported symbols are required.
2517130803Smarcelalways_export_symbols=$always_export_symbols
2518130803Smarcel
2519130803Smarcel# The commands to list exported symbols.
2520130803Smarcelexport_symbols_cmds=$export_symbols_cmds
2521130803Smarcel
2522130803Smarcel# The commands to extract the exported symbol list from a shared archive.
2523130803Smarcelextract_expsyms_cmds=$extract_expsyms_cmds
2524130803Smarcel
2525130803Smarcel# Symbols that should not be listed in the preloaded symbols.
2526130803Smarcelexclude_expsyms=$exclude_expsyms
2527130803Smarcel
2528130803Smarcel# Symbols that must always be exported.
2529130803Smarcelinclude_expsyms=$include_expsyms
2530130803Smarcel
2531130803SmarcelEOF
2532130803Smarcel
2533130803Smarcelif test -z "$tagname"; then
2534130803Smarcel  echo '### END LIBTOOL CONFIG' >> "$ofile"
2535130803Smarcelelse
2536130803Smarcel  echo "### END LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
2537130803Smarcelfi
2538130803Smarcel
2539130803Smarcelcase $ltmain in
2540130803Smarcel*.sh)
2541130803Smarcel  echo >> "$ofile"
2542130803Smarcel  if test -z "$tagname"; then
2543130803Smarcel    case $host_os in
2544130803Smarcel    aix3*)
2545130803Smarcel      cat <<\EOF >> "$ofile"
2546130803Smarcel
2547130803Smarcel# AIX sometimes has problems with the GCC collect2 program.  For some
2548130803Smarcel# reason, if we set the COLLECT_NAMES environment variable, the problems
2549130803Smarcel# vanish in a puff of smoke.
2550130803Smarcelif test "X${COLLECT_NAMES+set}" != Xset; then
2551130803Smarcel  COLLECT_NAMES=
2552130803Smarcel  export COLLECT_NAMES
2553130803Smarcelfi
2554130803SmarcelEOF
2555130803Smarcel      ;;
2556130803Smarcel    esac
2557130803Smarcel    case $host in
2558130803Smarcel    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2559130803Smarcel      cat <<'EOF' >> "$ofile"
2560130803Smarcel      # This is a source program that is used to create dlls on Windows
2561130803Smarcel      # Don't remove nor modify the starting and closing comments
2562130803Smarcel# /* ltdll.c starts here */
2563130803Smarcel# #define WIN32_LEAN_AND_MEAN
2564130803Smarcel# #include <windows.h>
2565130803Smarcel# #undef WIN32_LEAN_AND_MEAN
2566130803Smarcel# #include <stdio.h>
2567130803Smarcel#
2568130803Smarcel# #ifndef __CYGWIN__
2569130803Smarcel# #  ifdef __CYGWIN32__
2570130803Smarcel# #    define __CYGWIN__ __CYGWIN32__
2571130803Smarcel# #  endif
2572130803Smarcel# #endif
2573130803Smarcel#
2574130803Smarcel# #ifdef __cplusplus
2575130803Smarcel# extern "C" {
2576130803Smarcel# #endif
2577130803Smarcel# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
2578130803Smarcel# #ifdef __cplusplus
2579130803Smarcel# }
2580130803Smarcel# #endif
2581130803Smarcel#
2582130803Smarcel# #ifdef __CYGWIN__
2583130803Smarcel# #include <cygwin/cygwin_dll.h>
2584130803Smarcel# DECLARE_CYGWIN_DLL( DllMain );
2585130803Smarcel# #endif
2586130803Smarcel# HINSTANCE __hDllInstance_base;
2587130803Smarcel#
2588130803Smarcel# BOOL APIENTRY
2589130803Smarcel# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
2590130803Smarcel# {
2591130803Smarcel#   __hDllInstance_base = hInst;
2592130803Smarcel#   return TRUE;
2593130803Smarcel# }
2594130803Smarcel# /* ltdll.c ends here */
2595130803Smarcel      # This is a source program that is used to create import libraries
2596130803Smarcel      # on Windows for dlls which lack them. Don't remove nor modify the
2597130803Smarcel      # starting and closing comments
2598130803Smarcel# /* impgen.c starts here */
2599130803Smarcel# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
2600130803Smarcel#
2601130803Smarcel#  This file is part of GNU libtool.
2602130803Smarcel#
2603130803Smarcel#  This program is free software; you can redistribute it and/or modify
2604130803Smarcel#  it under the terms of the GNU General Public License as published by
2605130803Smarcel#  the Free Software Foundation; either version 2 of the License, or
2606130803Smarcel#  (at your option) any later version.
2607130803Smarcel#
2608130803Smarcel#  This program is distributed in the hope that it will be useful,
2609130803Smarcel#  but WITHOUT ANY WARRANTY; without even the implied warranty of
2610130803Smarcel#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2611130803Smarcel#  GNU General Public License for more details.
2612130803Smarcel#
2613130803Smarcel#  You should have received a copy of the GNU General Public License
2614130803Smarcel#  along with this program; if not, write to the Free Software
2615130803Smarcel#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2616130803Smarcel#  */
2617130803Smarcel#
2618130803Smarcel#  #include <stdio.h>		/* for printf() */
2619130803Smarcel#  #include <unistd.h>		/* for open(), lseek(), read() */
2620130803Smarcel#  #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
2621130803Smarcel#  #include <string.h>		/* for strdup() */
2622130803Smarcel#
2623130803Smarcel#  /* O_BINARY isn't required (or even defined sometimes) under Unix */
2624130803Smarcel#  #ifndef O_BINARY
2625130803Smarcel#  #define O_BINARY 0
2626130803Smarcel#  #endif
2627130803Smarcel#
2628130803Smarcel#  static unsigned int
2629130803Smarcel#  pe_get16 (fd, offset)
2630130803Smarcel#       int fd;
2631130803Smarcel#       int offset;
2632130803Smarcel#  {
2633130803Smarcel#    unsigned char b[2];
2634130803Smarcel#    lseek (fd, offset, SEEK_SET);
2635130803Smarcel#    read (fd, b, 2);
2636130803Smarcel#    return b[0] + (b[1]<<8);
2637130803Smarcel#  }
2638130803Smarcel#
2639130803Smarcel#  static unsigned int
2640130803Smarcel#  pe_get32 (fd, offset)
2641130803Smarcel#      int fd;
2642130803Smarcel#      int offset;
2643130803Smarcel#  {
2644130803Smarcel#    unsigned char b[4];
2645130803Smarcel#    lseek (fd, offset, SEEK_SET);
2646130803Smarcel#    read (fd, b, 4);
2647130803Smarcel#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
2648130803Smarcel#  }
2649130803Smarcel#
2650130803Smarcel#  static unsigned int
2651130803Smarcel#  pe_as32 (ptr)
2652130803Smarcel#       void *ptr;
2653130803Smarcel#  {
2654130803Smarcel#    unsigned char *b = ptr;
2655130803Smarcel#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
2656130803Smarcel#  }
2657130803Smarcel#
2658130803Smarcel#  int
2659130803Smarcel#  main (argc, argv)
2660130803Smarcel#      int argc;
2661130803Smarcel#      char *argv[];
2662130803Smarcel#  {
2663130803Smarcel#      int dll;
2664130803Smarcel#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
2665130803Smarcel#      unsigned long export_rva, export_size, nsections, secptr, expptr;
2666130803Smarcel#      unsigned long name_rvas, nexp;
2667130803Smarcel#      unsigned char *expdata, *erva;
2668130803Smarcel#      char *filename, *dll_name;
2669130803Smarcel#
2670130803Smarcel#      filename = argv[1];
2671130803Smarcel#
2672130803Smarcel#      dll = open(filename, O_RDONLY|O_BINARY);
2673130803Smarcel#      if (dll < 1)
2674130803Smarcel#  	return 1;
2675130803Smarcel#
2676130803Smarcel#      dll_name = filename;
2677130803Smarcel#
2678130803Smarcel#      for (i=0; filename[i]; i++)
2679130803Smarcel#  	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
2680130803Smarcel#  	    dll_name = filename + i +1;
2681130803Smarcel#
2682130803Smarcel#      pe_header_offset = pe_get32 (dll, 0x3c);
2683130803Smarcel#      opthdr_ofs = pe_header_offset + 4 + 20;
2684130803Smarcel#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
2685130803Smarcel#
2686130803Smarcel#      if (num_entries < 1) /* no exports */
2687130803Smarcel#  	return 1;
2688130803Smarcel#
2689130803Smarcel#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
2690130803Smarcel#      export_size = pe_get32 (dll, opthdr_ofs + 100);
2691130803Smarcel#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
2692130803Smarcel#      secptr = (pe_header_offset + 4 + 20 +
2693130803Smarcel#  	      pe_get16 (dll, pe_header_offset + 4 + 16));
2694130803Smarcel#
2695130803Smarcel#      expptr = 0;
2696130803Smarcel#      for (i = 0; i < nsections; i++)
2697130803Smarcel#      {
2698130803Smarcel#  	char sname[8];
2699130803Smarcel#  	unsigned long secptr1 = secptr + 40 * i;
2700130803Smarcel#  	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
2701130803Smarcel#  	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
2702130803Smarcel#  	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
2703130803Smarcel#  	lseek(dll, secptr1, SEEK_SET);
2704130803Smarcel#  	read(dll, sname, 8);
2705130803Smarcel#  	if (vaddr <= export_rva && vaddr+vsize > export_rva)
2706130803Smarcel#  	{
2707130803Smarcel#  	    expptr = fptr + (export_rva - vaddr);
2708130803Smarcel#  	    if (export_rva + export_size > vaddr + vsize)
2709130803Smarcel#  		export_size = vsize - (export_rva - vaddr);
2710130803Smarcel#  	    break;
2711130803Smarcel#  	}
2712130803Smarcel#      }
2713130803Smarcel#
2714130803Smarcel#      expdata = (unsigned char*)malloc(export_size);
2715130803Smarcel#      lseek (dll, expptr, SEEK_SET);
2716130803Smarcel#      read (dll, expdata, export_size);
2717130803Smarcel#      erva = expdata - export_rva;
2718130803Smarcel#
2719130803Smarcel#      nexp = pe_as32 (expdata+24);
2720130803Smarcel#      name_rvas = pe_as32 (expdata+32);
2721130803Smarcel#
2722130803Smarcel#      printf ("EXPORTS\n");
2723130803Smarcel#      for (i = 0; i<nexp; i++)
2724130803Smarcel#      {
2725130803Smarcel#  	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
2726130803Smarcel#  	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
2727130803Smarcel#      }
2728130803Smarcel#
2729130803Smarcel#      return 0;
2730130803Smarcel#  }
2731130803Smarcel# /* impgen.c ends here */
2732130803Smarcel
2733130803SmarcelEOF
2734130803Smarcel    ;;
2735130803Smarcel  esac
2736130803Smarcel
2737130803Smarcel
2738130803Smarcel    # Append the ltmain.sh script.
2739130803Smarcel    sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
2740130803Smarcel    # We use sed instead of cat because bash on DJGPP gets confused if
2741130803Smarcel    # if finds mixed CR/LF and LF-only lines.  Since sed operates in
2742130803Smarcel    # text mode, it properly converts lines to CR/LF.  This bash problem
2743130803Smarcel    # is reportedly fixed, but why not run on old versions too?
2744130803Smarcel
2745130803Smarcel    chmod +x "$ofile"
2746130803Smarcel  fi
2747130803Smarcel  ;;
2748130803Smarcel
2749130803Smarcel*)
2750130803Smarcel  # Compile the libtool program.
2751130803Smarcel  echo "FIXME: would compile $ltmain"
2752130803Smarcel  ;;
2753130803Smarcelesac
2754130803Smarcel
2755130803Smarcel# Update the list of available tags.
2756130803Smarcelif test -n "$tagname"; then
2757130803Smarcel
2758130803Smarcel  # Extract list of available tagged configurations in $ofile.
2759130803Smarcel  # Note that this assumes the entire list is on one line.
2760130803Smarcel  available_tags=`grep "^available_tags=" $ofile | sed -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
2761130803Smarcel
2762130803Smarcel  # Append the new tag name to the list of available tags.
2763130803Smarcel  available_tags="$available_tags $tagname"
2764130803Smarcel
2765130803Smarcel  # Now substitute the updated of available tags.
2766130803Smarcel  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' ${ofile} > ${ofile}.new"; then
2767130803Smarcel    mv ${ofile}.new ${ofile}
2768130803Smarcel    chmod +x "$ofile"
2769130803Smarcel  else
2770130803Smarcel    rm -f ${ofile}.new
2771130803Smarcel    echo "$progname: unable to update list of available tagged configurations."
2772130803Smarcel    exit 1
2773130803Smarcel  fi
2774130803Smarcelfi
2775130803Smarcel
2776130803Smarcel# Don't cache tagged configuration!
2777130803Smarceltest -n "$cache_file" && test -z "$tagname" || exit 0
2778130803Smarcel
2779130803Smarcel# AC_CACHE_SAVE
2780130803Smarceltrap '' 1 2 15
2781130803Smarcelcat > confcache <<\EOF
2782130803Smarcel# This file is a shell script that caches the results of configure
2783130803Smarcel# tests run on this system so they can be shared between configure
2784130803Smarcel# scripts and configure runs.  It is not useful on other systems.
2785130803Smarcel# If it contains results you don't want to keep, you may remove or edit it.
2786130803Smarcel#
2787130803Smarcel# By default, configure uses ./config.cache as the cache file,
2788130803Smarcel# creating it if it does not exist already.  You can give configure
2789130803Smarcel# the --cache-file=FILE option to use a different cache file; that is
2790130803Smarcel# what configure does when it calls configure scripts in
2791130803Smarcel# subdirectories, so they share the cache.
2792130803Smarcel# Giving --cache-file=/dev/null disables caching, for debugging configure.
2793130803Smarcel# config.status only pays attention to the cache file if you give it the
2794130803Smarcel# --recheck option to rerun configure.
2795130803Smarcel#
2796130803SmarcelEOF
2797130803Smarcel# The following way of writing the cache mishandles newlines in values,
2798130803Smarcel# but we know of no workaround that is simple, portable, and efficient.
2799130803Smarcel# So, don't put newlines in cache variables' values.
2800130803Smarcel# Ultrix sh set writes to stderr and can't be redirected directly,
2801130803Smarcel# and sets the high bit in the cache file unless we assign to the vars.
2802130803Smarcel(set) 2>&1 |
2803130803Smarcel  case `(ac_space=' '; set | grep ac_space) 2>&1` in
2804130803Smarcel  *ac_space=\ *)
2805130803Smarcel    # `set' does not quote correctly, so add quotes (double-quote substitution
2806130803Smarcel    # turns \\\\ into \\, and sed turns \\ into \).
2807130803Smarcel    sed -n \
2808130803Smarcel      -e "s/'/'\\\\''/g" \
2809130803Smarcel      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
2810130803Smarcel    ;;
2811130803Smarcel  *)
2812130803Smarcel    # `set' quotes correctly as required by POSIX, so do not add quotes.
2813130803Smarcel    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
2814130803Smarcel    ;;
2815130803Smarcel  esac >> confcache
2816130803Smarcelif cmp -s $cache_file confcache; then
2817130803Smarcel  :
2818130803Smarcelelse
2819130803Smarcel  if test -w $cache_file; then
2820130803Smarcel    echo "updating cache $cache_file"
2821130803Smarcel    cat confcache > $cache_file
2822130803Smarcel  else
2823130803Smarcel    echo "not updating unwritable cache $cache_file"
2824130803Smarcel  fi
2825130803Smarcelfi
2826130803Smarcelrm -f confcache
2827130803Smarcel
2828130803Smarcelexit 0
2829130803Smarcel
2830130803Smarcel# Local Variables:
2831130803Smarcel# mode:shell-script
2832130803Smarcel# sh-indentation:2
2833130803Smarcel# End:
2834