]> www.ginac.de Git - cln.git/blob - autoconf/aclocal.m4
672c1a8e1f65e4af1e2e18324dae506408855f1e
[cln.git] / autoconf / aclocal.m4
1 dnl local autoconf macros
2 dnl Bruno Haible 21.9.1997
3 dnl Marcus Daniels 10.4.1997
4 dnl
5 AC_PREREQ(2.13)dnl
6 dnl
7 dnl without AC_MSG_...:   with AC_MSG_... and caching:
8 dnl   AC_TRY_CPP          CL_CPP_CHECK
9 dnl   AC_TRY_COMPILE      CL_COMPILE_CHECK
10 dnl   AC_TRY_LINK         CL_LINK_CHECK
11 dnl   AC_TRY_RUN          CL_RUN_CHECK - would require cross-compiling support
12 dnl Usage:
13 dnl AC_TRY_CPP(INCLUDES,
14 dnl            ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
15 dnl CL_CPP_CHECK(ECHO-TEXT, CACHE-ID,
16 dnl              INCLUDES,
17 dnl              ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
18 dnl AC_TRY_xxx(INCLUDES, FUNCTION-BODY,
19 dnl            ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
20 dnl CL_xxx_CHECK(ECHO-TEXT, CACHE-ID,
21 dnl              INCLUDES, FUNCTION-BODY,
22 dnl              ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
23 dnl
24 define(CL_CPP_CHECK,
25 [AC_MSG_CHECKING(for $1)
26 AC_CACHE_VAL($2,[
27 AC_TRY_CPP([$3], $2=yes, $2=no)
28 ])
29 AC_MSG_RESULT([$]$2)
30 if test [$]$2 = yes; then
31   ifelse([$4], , :, [$4])
32 ifelse([$5], , , [else
33   $5
34 ])dnl
35 fi
36 ])dnl
37 dnl
38 define(CL_COMPILE_CHECK,
39 [AC_MSG_CHECKING(for $1)
40 AC_CACHE_VAL($2,[
41 AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no)
42 ])
43 AC_MSG_RESULT([$]$2)
44 if test [$]$2 = yes; then
45   ifelse([$5], , :, [$5])
46 ifelse([$6], , , [else
47   $6
48 ])dnl
49 fi
50 ])dnl
51 dnl
52 define(CL_LINK_CHECK,
53 [AC_MSG_CHECKING(for $1)
54 AC_CACHE_VAL($2,[
55 AC_TRY_LINK([$3],[$4], $2=yes, $2=no)
56 ])
57 AC_MSG_RESULT([$]$2)
58 if test [$]$2 = yes; then
59   ifelse([$5], , :, [$5])
60 ifelse([$6], , , [else
61   $6
62 ])dnl
63 fi
64 ])dnl
65 dnl
66 dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
67 define(CL_PROTO,
68 [AC_MSG_CHECKING([for $1 declaration])
69 AC_CACHE_VAL(cl_cv_proto_[$1], [$2
70 cl_cv_proto_$1="$3"])
71 cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'`
72 AC_MSG_RESULTPROTO([$]cl_cv_proto_$1)
73 ])dnl
74 dnl
75 dnl CL_PROTO_RET(INCLUDES, DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
76 define(CL_PROTO_RET,
77 [AC_TRY_COMPILE([$1]
78 AC_LANG_EXTERN[$2
79 ], [], $3="$4", $3="$5")
80 ])dnl
81 dnl
82 dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
83 define(CL_PROTO_TRY,
84 [AC_TRY_COMPILE([$1]
85 AC_LANG_EXTERN
86 [#if defined(__STDC__) || defined(__cplusplus)
87 $2
88 #else
89 $3
90 #endif
91 ], [], [$4], [$5])
92 ])dnl
93 dnl
94 dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID)
95 define(CL_PROTO_CONST,
96 [CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")]
97 )dnl
98 dnl
99 dnl CL_SILENT(ACTION)
100 dnl performs ACTION, with AC_MSG_CHECKING and AC_MSG_RESULT being defined away.
101 define(CL_SILENT,
102 [pushdef([AC_MSG_CHECKING],[:])dnl
103 pushdef([AC_CHECKING],[:])dnl
104 pushdef([AC_MSG_RESULT],[:])dnl
105 pushdef([AC_MSG_RESULTPROTO],[:])dnl
106 $1[]dnl
107 popdef([AC_MSG_RESULTPROTO])dnl
108 popdef([AC_MSG_RESULT])dnl
109 popdef([AC_CHECKING])dnl
110 popdef([AC_MSG_CHECKING])dnl
111 ])dnl
112 dnl
113 AC_DEFUN(CL_AS_UNDERSCORE,
114 [AC_BEFORE([$0], [CL_GLOBAL_CONSTRUCTORS])
115 AC_CACHE_CHECK(for underscore in external names, cl_cv_prog_as_underscore, [
116 cat > conftest.c <<EOF
117 int foo() { return 0; }
118 EOF
119 # look for the assembly language name in the .s file
120 AC_TRY_COMMAND(${CC-cc} -S conftest.c) >/dev/null 2>&1
121 if grep _foo conftest.s >/dev/null ; then
122   cl_cv_prog_as_underscore=yes
123 else
124   cl_cv_prog_as_underscore=no
125 fi
126 rm -f conftest*
127 ])
128 if test $cl_cv_prog_as_underscore = yes; then
129   AS_UNDERSCORE=true
130   AC_DEFINE(ASM_UNDERSCORE)
131 else
132   AS_UNDERSCORE=false
133 fi
134 AC_SUBST(AS_UNDERSCORE)dnl
135 ])dnl
136 dnl
137 AC_DEFUN(CL_PROG_RANLIB, [AC_CHECK_PROG(RANLIB, ranlib, ranlib, true)])dnl
138 dnl
139 AC_DEFUN(CL_PROG_INSTALL,
140 [dnl This is mostly copied from AC_PROG_INSTALL.
141 # Find a good install program.  We prefer a C program (faster),
142 # so one script is as good as another.  But avoid the broken or
143 # incompatible versions:
144 # SysV /etc/install, /usr/sbin/install
145 # SunOS /usr/etc/install
146 # IRIX /sbin/install
147 # AIX /bin/install
148 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
149 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
150 # ./install, which can be erroneously created by make from ./install.sh.
151 AC_MSG_CHECKING(for a BSD compatible install)
152 if test -z "$INSTALL"; then
153 AC_CACHE_VAL(cl_cv_path_install,
154 [  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
155   for ac_dir in $PATH; do
156     # Account for people who put trailing slashes in PATH elements.
157     case "$ac_dir/" in
158     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
159     *)
160       # OSF1 and SCO ODT 3.0 have their own names for install.
161       for ac_prog in ginstall installbsd scoinst install; do
162         if test -f $ac_dir/$ac_prog; then
163           if test $ac_prog = install &&
164             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
165             # AIX install.  It has an incompatible calling convention.
166             # OSF/1 installbsd also uses dspmsg, but is usable.
167             :
168           else
169             if test $ac_prog = installbsd &&
170               grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then
171               # AIX installbsd doesn't work without option "-g".
172               :
173             else
174               cl_cv_path_install="$ac_dir/$ac_prog -c"
175               break 2
176             fi
177           fi
178         fi
179       done
180       ;;
181     esac
182   done
183   IFS="$ac_save_ifs"
184   # As a last resort, use cp.
185   test -z "$cl_cv_path_install" && cl_cv_path_install="cp"
186 ])dnl
187   INSTALL="$cl_cv_path_install"
188 fi
189 dnl We do special magic for INSTALL instead of AC_SUBST, to get
190 dnl relative paths right. 
191 AC_MSG_RESULT($INSTALL)
192 AC_SUBST(INSTALL)dnl
193 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
194 # It thinks the first close brace ends the variable substitution.
195 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='$(INSTALL)'
196 AC_SUBST(INSTALL_PROGRAM)dnl
197 if test -z "$INSTALL_DATA"; then
198   case "$INSTALL" in
199     cp | */cp ) INSTALL_DATA='$(INSTALL)' ;;
200     * )         INSTALL_DATA='$(INSTALL) -m 644' ;;
201   esac
202 fi
203 AC_SUBST(INSTALL_DATA)dnl
204 ])dnl
205 dnl
206 AC_DEFUN(CL_CANONICAL_HOST,
207 [AC_REQUIRE([AC_PROG_CC]) dnl Actually: AC_REQUIRE([CL_CC_WORKS])
208 dnl Set ac_aux_dir before the cache check, because AM_PROG_LIBTOOL needs it.
209 ac_aux_dir=${srcdir}/$1
210 AC_CACHE_CHECK(host system type, cl_cv_host, [
211 dnl A substitute for AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh.
212 ac_config_guess=$ac_aux_dir/config.guess
213 ac_config_sub=$ac_aux_dir/config.sub
214 dnl Mostly copied from AC_CANONICAL_HOST.
215 # Make sure we can run config.sub.
216 if $ac_config_sub sun4 >/dev/null 2>&1; then :
217 else AC_MSG_ERROR(can not run $ac_config_sub)
218 fi
219 host_alias=$host
220 case "$host_alias" in
221 NONE)
222   case $nonopt in
223   NONE) dnl config.guess needs to compile things
224         host_alias=`export CC; $ac_config_guess` ;;
225   *)    host_alias=$nonopt ;;
226   esac ;;
227 esac
228 # Don't fail just because the system is not listed in GNU's database.
229 if test -n "$host_alias"; then
230   host=`$ac_config_sub $host_alias`
231 else
232   host=unknown-unknown-unknown
233 fi
234 cl_cv_host="$host"
235 ])
236 host="$cl_cv_host"
237 changequote(,)dnl
238 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
239 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
240 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
241 changequote([,])dnl
242 AC_SUBST(host)dnl
243 AC_SUBST(host_cpu)dnl
244 AC_SUBST(host_vendor)dnl
245 AC_SUBST(host_os)dnl
246 ])dnl
247 dnl
248 AC_DEFUN(CL_CANONICAL_HOST_CPU,
249 [AC_REQUIRE([CL_CANONICAL_HOST])AC_REQUIRE([AC_PROG_CC])
250 case "$host_cpu" in
251 changequote(,)dnl
252   i[4567]86 )
253     host_cpu=i386
254     ;;
255   alphaev[4-7] | alphaev56 | alphapca5[67] )
256     host_cpu=alpha
257     ;;
258   hppa1.0 | hppa1.1 | hppa2.0 )
259     host_cpu=hppa
260     ;;
261   powerpc )
262     host_cpu=rs6000
263     ;;
264   c1 | c2 | c32 | c34 | c38 | c4 )
265     host_cpu=convex
266     ;;
267 changequote([,])dnl
268   mips )
269     AC_CACHE_CHECK([for 64-bit MIPS], cl_cv_host_mips64, [
270 AC_EGREP_CPP(yes,
271 [#if defined(_MIPS_SZLONG)
272 #if (_MIPS_SZLONG == 64)
273 /* We should also check for (_MIPS_SZPTR == 64), but gcc keeps this at 32. */
274   yes
275 #endif
276 #endif
277 ], cl_cv_host_mips64=yes, cl_cv_host_mips64=no)
278 ])
279 if test $cl_cv_host_mips64 = yes; then
280   host_cpu=mips64
281 fi
282     ;;
283 dnl UltraSPARCs running Linux have `uname -m` = "sparc64", but the C compiler
284 dnl still generates 32-bit code.
285   sparc | sparc64 )
286     AC_CACHE_CHECK([for 64-bit SPARC], cl_cv_host_sparc64, [
287 AC_EGREP_CPP(yes,
288 [#if defined(__sparcv9) || defined(__arch64__)
289   yes
290 #endif
291 ], cl_cv_host_sparc64=yes, cl_cv_host_sparc64=no)
292 ])
293 if test $cl_cv_host_sparc64 = yes; then
294   host_cpu=sparc64
295 else
296   host_cpu=sparc
297 fi
298     ;;
299 esac
300 dnl was AC_DEFINE_UNQUOTED(__${host_cpu}__) but KAI C++ 3.2d doesn't like this
301 cat >> confdefs.h <<EOF
302 #ifndef __${host_cpu}__
303 #define __${host_cpu}__ 1
304 #endif
305 EOF
306 ])dnl
307 dnl
308 AC_DEFUN(CL_LONGLONG,
309 [AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [
310 AC_TRY_RUN([int main()
311 {
312 /* long longs don't work right with gcc-2.7.2 on m68k */
313 /* long longs don't work right with gcc-2.7.2 on rs6000: avcall/tests.c gets
314    miscompiled. */
315 #ifdef __GNUC__
316 #if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc))
317 #if (__GNUC__ == 2)
318 #if (__GNUC_MINOR__ <= 7)
319   exit(1);
320 #endif
321 #endif
322 #endif
323 #endif
324   { long x = 944938507; long y = 737962842; long z = 162359677;
325     exit(!(((long long) x)*((long long) y)>>32 == z));
326   }
327 }],
328 cl_cv_c_longlong=yes, cl_cv_c_longlong=no,
329 dnl When cross-compiling, don't assume anything.
330 cl_cv_c_longlong="guessing no")
331 ])
332 case "$cl_cv_c_longlong" in
333   *yes) AC_DEFINE(HAVE_LONGLONG) ;;
334   *no) ;;
335 esac
336 ])dnl
337 dnl
338 AC_DEFUN(CL_LONGDOUBLE,
339 [AC_CACHE_CHECK(for long double type, cl_cv_c_longdouble, [
340 AC_TRY_RUN([int main()
341 { long double x = 2.7182818284590452354L; x = x*x; exit (x==0.0L); }],
342 cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no,
343 dnl When cross-compiling, don't assume anything.
344 cl_cv_c_longdouble="guessing no")
345 ])
346 case "$cl_cv_c_longdouble" in
347   *yes) AC_DEFINE(HAVE_LONGDOUBLE) ;;
348   *no) ;;
349 esac
350 ])dnl
351 dnl
352 AC_DEFUN(CL_TEMPLATE_NULL,
353 [CL_COMPILE_CHECK([working template<>], cl_cv_c_templatenull,
354 [template <class T> class c {}; template <> class c<int> { int x; };], ,
355 AC_DEFINE(HAVE_TEMPLATE_NULL))
356 ])dnl
357 dnl
358 AC_DEFUN(CL_UNISTD_H,
359 [AC_CHECK_HEADERS(unistd.h)]
360 )dnl
361 dnl
362 AC_DEFUN(CL_ALLOCA,
363 [# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
364 # for constant arguments.  Useless!
365 CL_LINK_CHECK(working alloca.h, cl_cv_header_alloca_h,
366 [#include <alloca.h>], [char *p = (char *) alloca(2 * sizeof(int));],
367 AC_DEFINE(HAVE_ALLOCA_H))dnl
368 decl="#ifdef __GNUC__
369 #define alloca __builtin_alloca
370 #else
371 #ifdef _MSC_VER
372 #include <malloc.h>
373 #define alloca _alloca
374 #else
375 #ifdef HAVE_ALLOCA_H
376 #include <alloca.h>
377 #else
378 #ifdef _AIX
379  #pragma alloca
380 #else
381 #ifndef alloca
382 char *alloca ();
383 #endif
384 #endif
385 #endif
386 #endif
387 #endif
388 "
389 CL_LINK_CHECK([alloca], cl_cv_func_alloca,
390 $decl, [char *p = (char *) alloca(1);],
391  , [alloca_missing=1])dnl
392 if test -n "$alloca_missing"; then
393   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
394   # that cause trouble.  Some versions do not even contain alloca or
395   # contain a buggy version.  If you still want to use their alloca,
396   # use ar to extract alloca.o from them instead of compiling alloca.c.
397   ALLOCA=alloca.${ac_objext}
398   AC_DEFINE(NO_ALLOCA)
399 fi
400 AC_SUBST(ALLOCA)dnl
401 ])dnl
402 dnl
403 AC_DEFUN(CL_FPU_CONTROL,
404 [dnl Check for Linux with <fpu_control.h> and fpu_control_t or __setfpucw().
405 dnl glibc versions since October 1998 define fpu_control_t. Earlier versions
406 dnl define and declare __setfpucw(). Very early Linux libc versions have none,
407 dnl and __fpu_control is of type `unsigned short'.
408 CL_COMPILE_CHECK([fpu_control_t], cl_cv_type_fpu_control_t,
409 [#include <fpu_control.h>], [fpu_control_t x;],
410 AC_DEFINE(HAVE_FPU_CONTROL_T))
411 CL_COMPILE_CHECK([__setfpucw], cl_cv_func_setfpucw,
412 [#include <fpu_control.h>], [__setfpucw(_FPU_IEEE);],
413 AC_DEFINE(HAVE_SETFPUCW))
414 ])dnl
415 dnl
416 AC_DEFUN(CL_PERROR,
417 [AC_MSG_CHECKING(for perror declaration)
418 AC_CACHE_VAL(cl_cv_proto_perror, [
419 AC_TRY_COMPILE([
420 /* Some systems declare perror() in <errno.h>, some in <stdio.h>, some don't
421    declare it at all. */
422 #include <stdio.h>
423 #include <errno.h>
424 ]AC_LANG_EXTERN[double perror ();], [],
425 cl_cv_proto_perror=no, cl_cv_proto_perror=yes)
426 ])
427 AC_MSG_RESULT([$cl_cv_proto_perror])
428 if test $cl_cv_proto_perror = yes; then
429 AC_DEFINE(HAVE_PERROR_DECL)
430 fi
431 ])dnl
432 dnl
433 AC_DEFUN(CL_RUSAGE,
434 [AC_CHECK_HEADERS(sys/resource.h sys/times.h)dnl
435 if test $ac_cv_header_sys_resource_h = yes; then
436   dnl HAVE_SYS_RESOURCE_H defined
437   CL_LINK_CHECK([getrusage], cl_cv_func_getrusage,
438 [#include <sys/types.h> /* NetBSD 1.0 needs this */
439 #include <sys/time.h>
440 #include <sys/resource.h>],
441     [struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec;],
442     AC_DEFINE(HAVE_GETRUSAGE))dnl
443   if test $cl_cv_func_getrusage = yes; then
444     CL_PROTO([getrusage], [
445     CL_PROTO_TRY([
446 #include <stdlib.h>
447 #ifdef HAVE_UNISTD_H
448 #include <unistd.h>
449 #endif
450 #include <sys/types.h> /* NetBSD 1.0 needs this */
451 #include <sys/time.h>
452 #include <sys/resource.h>
453 ],
454 [int getrusage (int who, struct rusage * rusage);],
455 [int getrusage();],
456 [cl_cv_proto_getrusage_arg1="int"],
457 [cl_cv_proto_getrusage_arg1="enum __rusage_who"])
458 ], [extern int getrusage ($cl_cv_proto_getrusage_arg1, struct rusage *);])
459     AC_DEFINE_UNQUOTED(RUSAGE_WHO_T,$cl_cv_proto_getrusage_arg1)
460   fi
461 fi
462 ])dnl
463 dnl
464 AC_DEFUN(CL_GETTIMEOFDAY,
465 [AC_BEFORE([$0], [CL_TIMES_CLOCK])
466 AC_CHECK_FUNCS(gettimeofday)dnl
467 if test $ac_cv_func_gettimeofday = yes; then
468 dnl HAVE_GETTIMEOFDAY is defined
469 CL_PROTO([gettimeofday], [
470 CL_PROTO_TRY([
471 #include <sys/types.h>
472 #include <sys/time.h>
473 ], [int gettimeofday (struct timeval * tp, struct timezone * tzp);],
474 [int gettimeofday();],
475 cl_cv_proto_gettimeofday_dots=no
476 cl_cv_proto_gettimeofday_arg2="struct timezone *",
477 CL_PROTO_TRY([
478 #include <sys/types.h>
479 #include <sys/time.h>
480 ], [int gettimeofday (struct timeval * tp, void * tzp);],
481 [int gettimeofday();],
482 cl_cv_proto_gettimeofday_dots=no
483 cl_cv_proto_gettimeofday_arg2="void *",
484 cl_cv_proto_gettimeofday_dots=yes
485 cl_cv_proto_gettimeofday_arg2="..."))
486 ], [extern int gettimeofday (struct timeval *, $cl_cv_proto_gettimeofday_arg2);])
487 if test $cl_cv_proto_gettimeofday_dots = yes; then
488 AC_DEFINE(GETTIMEOFDAY_DOTS)
489 else
490 AC_DEFINE_UNQUOTED(GETTIMEOFDAY_TZP_T,$cl_cv_proto_gettimeofday_arg2)
491 fi
492 fi
493 ])dnl
494 dnl
495 AC_DEFUN(CL_FTIME,
496 [AC_BEFORE([$0], [CL_TIMES_CLOCK])
497 AC_CHECK_FUNCS(ftime)])dnl
498 dnl
499 AC_DEFUN(CL_TIMES_CLOCK,
500 [AC_REQUIRE([CL_GETTIMEOFDAY])dnl
501 AC_REQUIRE([CL_FTIME])dnl
502 if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no; then
503 AC_CHECK_FUNC(times, , no_times=1)dnl
504 if test -z "$no_times"; then
505 AC_CACHE_CHECK(for times return value, cl_cv_func_times_return, [
506 AC_TRY_RUN([
507 #include <sys/types.h>
508 #include <time.h> /* needed for CLK_TCK */
509 #ifndef CLK_TCK
510 #include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
511 #endif
512 #include <sys/times.h>
513 int main ()
514 { struct tms buffer;
515   clock_t result1;
516   clock_t result2;
517   int ticks;
518   result1 = times(&buffer);
519   if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1);
520   sleep(1);
521   result2 = times(&buffer);
522   if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1);
523   ticks = result2 - result1;
524   exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2)));
525 }], cl_cv_func_times_return=yes, cl_cv_func_times_return=no,
526 dnl When cross-compiling, don't assume anything.
527 cl_cv_func_times_return="guessing no")
528 ])
529 case "$cl_cv_func_times_return" in
530   *yes) AC_DEFINE(HAVE_TIMES_CLOCK) ;;
531   *no)  ;;
532 esac
533 fi
534 fi
535 ])dnl
536 dnl
537 AC_DEFUN(CL_GLOBAL_CONSTRUCTORS,
538 [AC_REQUIRE([CL_AS_UNDERSCORE])dnl
539 if test -n "$GCC"; then
540 AC_CACHE_CHECK(for the global constructors function prefix,
541 cl_cv_cplusplus_ctorprefix, [
542 cat > conftest.cc << EOF
543 struct foo { foo (); };
544 foo foobar;
545 EOF
546 # look for the assembly language name in the .s file
547 AC_TRY_COMMAND(${CXX-g++} $CXXFLAGS -S conftest.cc) >/dev/null 2>&1
548 if grep '_GLOBAL_\$I\$foobar' conftest.s >/dev/null ; then
549   cl_cv_cplusplus_ctorprefix='_GLOBAL_$I$'
550 else
551   if grep '_GLOBAL_\.I\.foobar' conftest.s >/dev/null ; then
552     cl_cv_cplusplus_ctorprefix='_GLOBAL_.I.'
553   else
554     if grep '_GLOBAL__I_foobar' conftest.s >/dev/null ; then
555       cl_cv_cplusplus_ctorprefix='_GLOBAL__I_'
556     else
557       cl_cv_cplusplus_ctorprefix=unknown
558     fi
559   fi
560 fi
561 rm -f conftest*
562 ])
563 if test "$cl_cv_cplusplus_ctorprefix" '!=' unknown; then
564   ac_value='"'"$cl_cv_cplusplus_ctorprefix"'"'
565   AC_DEFINE_UNQUOTED(CL_GLOBAL_CONSTRUCTOR_PREFIX,$ac_value)
566   ac_value=`echo "$ac_value" | sed -e 's,I,D,'`
567   AC_DEFINE_UNQUOTED(CL_GLOBAL_DESTRUCTOR_PREFIX,$ac_value)
568 dnl Check whether the global constructors/destructors functions are file-scope
569 dnl only by default. This is the case in egcs-1.1.2 or newer.
570 AC_CACHE_CHECK(whether the global constructors function need to be exported,
571 cl_cv_cplusplus_ctorexport, [
572 cat > conftest1.cc << EOF
573 struct foo { foo (); };
574 foo foobar;
575 EOF
576 cat > conftest2.cc << EOF
577 #include "confdefs.h"
578 #ifdef ASM_UNDERSCORE
579 #define ASM_UNDERSCORE_PREFIX "_"
580 #else
581 #define ASM_UNDERSCORE_PREFIX ""
582 #endif
583 struct foo { foo (); };
584 foo::foo () {}
585 extern "C" void ctor (void) __asm__ (ASM_UNDERSCORE_PREFIX CL_GLOBAL_CONSTRUCTOR_PREFIX "foobar");
586 int main() { ctor(); return 0; }
587 EOF
588 if AC_TRY_COMMAND(${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest1.cc conftest2.cc $LIBS 1>&5) >/dev/null 2>&1 && test -s conftest${ac_exeext}; then
589   cl_cv_cplusplus_ctorexport=no
590 else
591   cl_cv_cplusplus_ctorexport=yes
592 fi
593 rm -f conftest*
594 ])
595 if test "$cl_cv_cplusplus_ctorexport" = yes; then
596   AC_DEFINE(CL_NEED_GLOBALIZE_CTORDTOR)
597 fi
598 fi
599 fi
600 ])dnl
601 dnl
602 AC_DEFUN(CL_CHAR_UNSIGNED,
603 [dnl This is mostly copied from AC_C_CHAR_UNSIGNED.
604 AC_CACHE_CHECK(whether characters are unsigned, ac_cv_c_char_unsigned, [
605 if test $ac_cv_prog_gcc = yes; then
606   # GCC predefines this symbol on systems where it applies.
607 AC_EGREP_CPP(yes,
608 [#ifdef __CHAR_UNSIGNED__
609   yes
610 #endif
611 ], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no)
612 else
613 AC_TRY_RUN(
614 [/* volatile prevents gcc2 from optimizing the test away on sparcs.  */
615 #if !defined(__STDC__) || __STDC__ != 1
616 #define volatile
617 #endif
618 int main() {
619   volatile char c = 255; exit(c < 0);
620 }], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no,
621 ac_cv_c_char_unsigned="guessing no")
622 fi])
623 if test $ac_cv_prog_gcc = no; then
624   # GCC defines __CHAR_UNSIGNED__ by itself, no need to fix up.
625   case "$ac_cv_c_char_unsigned" in
626     *yes) AC_DEFINE(__CHAR_UNSIGNED__) ;;
627     *no) ;;
628   esac
629 fi
630 ])dnl
631 dnl
632 AC_DEFUN(CL_BOOL,
633 [AC_LANG_SAVE()
634 AC_LANG_CPLUSPLUS()
635 CL_COMPILE_CHECK([bool type], cl_cv_cplusplus_bool, , [bool x;],
636 AC_DEFINE(HAVE_BOOL), AC_DEFINE(bool,int))dnl
637 AC_LANG_RESTORE()
638 ])dnl
639 dnl
640 AC_DEFUN(CL_MACHINE,
641 [AC_REQUIRE([AC_PROG_CC])dnl
642 AC_REQUIRE([CL_CHAR_UNSIGNED])dnl
643 cl_machine_file_c=$2
644 cl_machine_file_h=$3
645 if test $cross_compiling = no; then
646 if test -z "$[$4]"; then
647 AC_CHECKING(for [$1])
648 cat > conftest.$ac_ext <<EOF
649 #include "confdefs.h"
650 EOF
651 cat "$cl_machine_file_c" >> conftest.$ac_ext
652 AC_TRY_EVAL(ac_link)
653 if test -s conftest; then
654   echo "creating $cl_machine_file_h"
655   ./conftest > conftest.h
656   if cmp -s "$cl_machine_file_h" conftest.h 2>/dev/null; then
657     # The file exists and we would not be changing it
658     rm -f conftest.h
659   else
660     rm -f "$cl_machine_file_h"
661     mv conftest.h "$cl_machine_file_h"
662   fi
663   [$4]=1
664 else
665   echo "creation of $cl_machine_file_h failed"
666 fi
667 rm -f conftest*
668 fi
669 else
670 echo "cross-compiling - cannot create $cl_machine_file_h"
671 fi
672 ])dnl
673 dnl
674
675 # Is the gmp header file new enough? (should be implemented with an argument)
676 AC_DEFUN(CL_GMP_H_VERSION,
677 [AC_CACHE_CHECK([for recent enough gmp.h], cl_cv_new_gmp_h, [
678   AC_TRY_CPP([#include <gmp.h>
679 #if !defined(__GNU_MP_VERSION) || (__GNU_MP_VERSION < 3)
680  #error "ancient gmp.h"
681 #endif],
682 cl_cv_new_gmp_h="yes", cl_cv_new_gmp_h="no")
683 ])])dnl
684
685 # Does libgmp provide some functionality introduced in version 3.0?
686 AC_DEFUN(CL_GMP_CHECK,
687 [AC_CACHE_CHECK([for working libgmp], cl_cv_new_libgmp, [
688     SAVELIBS=$LIBS
689     LIBS="$LIBS -lgmp"
690     AC_TRY_LINK([#include <gmp.h>],[mpn_divexact_by3(0,0,0)],
691 cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no"; LIBS=$SAVELIBS)
692 ])])
693
694 # What is sizeof(mp_limb_t)?  (It has to match sizeof(uintD) later.)
695 AC_DEFUN(CL_GMP_SET_UINTD,
696 [AC_CACHE_CHECK([how large gmp demands uintD to be], cl_cv_gmp_set_uintd, [
697     AC_TRY_RUN([#include <stdio.h>
698 #include <gmp.h>
699 int main() {
700     FILE *f=fopen("conftestval", "w");
701     if (!f) return(1);
702     if (sizeof(mp_limb_t) > sizeof(long))
703         fprintf(f, "long long");
704     else if (sizeof(mp_limb_t) == sizeof(long))
705         fprintf(f, "long");
706     else if (sizeof(mp_limb_t) == sizeof(int))
707         fprintf(f, "int");
708     else return(1);
709     return(0);
710 }], cl_cv_gmp_set_uintd=`cat conftestval`; \
711     cl_gmp_demands="GMP_DEMANDS_UINTD_`echo ${cl_cv_gmp_set_uintd} | sed -e 'y/ gilnot/_GILNOT/'`"; 
712     AC_DEFINE_UNQUOTED($cl_gmp_demands),
713     AC_MSG_ERROR([CLN can't handle the result]),dnl
714     AC_MSG_ERROR([cross-compiling - cannot determine]))
715 ])])
716
717 # =============================================================================
718 # libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
719 ## Copyright 1996, 1997, 1998, 1999, 2000, 2001
720 ## Free Software Foundation, Inc.
721 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
722 ##
723 ## This program is free software; you can redistribute it and/or modify
724 ## it under the terms of the GNU General Public License as published by
725 ## the Free Software Foundation; either version 2 of the License, or
726 ## (at your option) any later version.
727 ##
728 ## This program is distributed in the hope that it will be useful, but
729 ## WITHOUT ANY WARRANTY; without even the implied warranty of
730 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
731 ## General Public License for more details.
732 ##
733 ## You should have received a copy of the GNU General Public License
734 ## along with this program; if not, write to the Free Software
735 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
736 ##
737 ## As a special exception to the GNU General Public License, if you
738 ## distribute this file as part of a program that contains a
739 ## configuration script generated by Autoconf, you may include it under
740 ## the same distribution terms that you use for the rest of that program.
741
742 # The next line was added by Bruno Haible 2001-06-08.
743 undefine([symbols])
744
745 # serial 46 AC_PROG_LIBTOOL
746 AC_DEFUN([AC_PROG_LIBTOOL],
747 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
748
749 # This can be used to rebuild libtool when needed
750 LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
751
752 # Always use our own libtool.
753 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
754 AC_SUBST(LIBTOOL)dnl
755
756 # Prevent multiple expansion
757 define([AC_PROG_LIBTOOL], [])
758 ])
759
760 AC_DEFUN([AC_LIBTOOL_SETUP],
761 [AC_PREREQ(2.13)dnl
762 AC_REQUIRE([AC_ENABLE_SHARED])dnl
763 AC_REQUIRE([AC_ENABLE_STATIC])dnl
764 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
765 AC_REQUIRE([AC_CANONICAL_HOST])dnl
766 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
767 AC_REQUIRE([AC_PROG_CC])dnl
768 AC_REQUIRE([AC_PROG_LD])dnl
769 AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
770 AC_REQUIRE([AC_PROG_NM])dnl
771 AC_REQUIRE([AC_PROG_LN_S])dnl
772 AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
773 AC_REQUIRE([AC_OBJEXT])dnl
774 AC_REQUIRE([AC_EXEEXT])dnl
775 dnl
776
777 _LT_AC_PROG_ECHO_BACKSLASH
778 # Only perform the check for file, if the check method requires it
779 case $deplibs_check_method in
780 file_magic*)
781   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
782     AC_PATH_MAGIC
783   fi
784   ;;
785 esac
786
787 AC_CHECK_TOOL(RANLIB, ranlib, :)
788 AC_CHECK_TOOL(STRIP, strip, :)
789
790 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
791 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
792 enable_win32_dll=yes, enable_win32_dll=no)
793
794 AC_ARG_ENABLE(libtool-lock,
795   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
796 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
797
798 # Some flags need to be propagated to the compiler or linker for good
799 # libtool support.
800 case $host in
801 *-*-irix6*)
802   # Find out which ABI we are using.
803   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
804   if AC_TRY_EVAL(ac_compile); then
805     case `/usr/bin/file conftest.$ac_objext` in
806     *32-bit*)
807       LD="${LD-ld} -32"
808       ;;
809     *N32*)
810       LD="${LD-ld} -n32"
811       ;;
812     *64-bit*)
813       LD="${LD-ld} -64"
814       ;;
815     esac
816   fi
817   rm -rf conftest*
818   ;;
819
820 *-*-sco3.2v5*)
821   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
822   SAVE_CFLAGS="$CFLAGS"
823   CFLAGS="$CFLAGS -belf"
824   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
825     [AC_LANG_SAVE
826      AC_LANG_C
827      AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
828      AC_LANG_RESTORE])
829   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
830     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
831     CFLAGS="$SAVE_CFLAGS"
832   fi
833   ;;
834
835 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
836 [*-*-cygwin* | *-*-mingw* | *-*-pw32*)
837   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
838   AC_CHECK_TOOL(AS, as, false)
839   AC_CHECK_TOOL(OBJDUMP, objdump, false)
840
841   # recent cygwin and mingw systems supply a stub DllMain which the user
842   # can override, but on older systems we have to supply one
843   AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
844     [AC_TRY_LINK([],
845       [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
846       DllMain (0, 0, 0);],
847       [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
848
849   case $host/$CC in
850   *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
851     # old mingw systems require "-dll" to link a DLL, while more recent ones
852     # require "-mdll"
853     SAVE_CFLAGS="$CFLAGS"
854     CFLAGS="$CFLAGS -mdll"
855     AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
856       [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
857     CFLAGS="$SAVE_CFLAGS" ;;
858   *-*-cygwin* | *-*-pw32*)
859     # cygwin systems need to pass --dll to the linker, and not link
860     # crt.o which will require a WinMain@16 definition.
861     lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
862   esac
863   ;;
864   ])
865 esac
866
867 _LT_AC_LTCONFIG_HACK
868
869 ])
870
871 # _LT_AC_CHECK_DLFCN
872 # --------------------
873 AC_DEFUN(_LT_AC_CHECK_DLFCN,
874 [AC_CHECK_HEADERS(dlfcn.h)
875 ])# _LT_AC_CHECK_DLFCN
876
877 # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
878 # ---------------------------------
879 AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
880 [AC_REQUIRE([AC_CANONICAL_HOST])
881 AC_REQUIRE([AC_PROG_NM])
882 AC_REQUIRE([AC_OBJEXT])
883 # Check for command to grab the raw symbol name followed by C symbol from nm.
884 AC_MSG_CHECKING([command to parse $NM output])
885 AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
886
887 # These are sane defaults that work on at least a few old systems.
888 # [They come from Ultrix.  What could be older than Ultrix?!! ;)]
889
890 # Character class describing NM global symbol codes.
891 [symcode='[BCDEGRST]']
892
893 # Regexp to match symbols that can be accessed directly from C.
894 [sympat='\([_A-Za-z][_A-Za-z0-9]*\)']
895
896 # Transform the above into a raw symbol and a C symbol.
897 symxfrm='\1 \2\3 \3'
898
899 # Transform an extracted symbol line into a proper C declaration
900 lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
901
902 # Define system-specific variables.
903 case $host_os in
904 aix*)
905   [symcode='[BCDT]']
906   ;;
907 cygwin* | mingw* | pw32*)
908   [symcode='[ABCDGISTW]']
909   ;;
910 hpux*) # Its linker distinguishes data from code symbols
911   lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
912   ;;
913 irix*)
914   [symcode='[BCDEGRST]']
915   ;;
916 solaris* | sysv5*)
917   [symcode='[BDT]']
918   ;;
919 sysv4)
920   [symcode='[DFNSTU]']
921   ;;
922 esac
923
924 # Handle CRLF in mingw tool chain
925 opt_cr=
926 case $host_os in
927 mingw*)
928   opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
929   ;;
930 esac
931
932 # If we're using GNU nm, then use its standard symbol codes.
933 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
934   [symcode='[ABCDGISTW]']
935 fi
936
937 # Try without a prefix undercore, then with it.
938 for ac_symprfx in "" "_"; do
939
940   # Write the raw and C identifiers.
941 [lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[        ]\($symcode$symcode*\)[         ][      ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"]
942
943   # Check to see that the pipe works correctly.
944   pipe_works=no
945   rm -f conftest*
946   cat > conftest.$ac_ext <<EOF
947 #ifdef __cplusplus
948 extern "C" {
949 #endif
950 char nm_test_var;
951 void nm_test_func(){}
952 #ifdef __cplusplus
953 }
954 #endif
955 int main(){nm_test_var='a';nm_test_func();return(0);}
956 EOF
957
958   if AC_TRY_EVAL(ac_compile); then
959     # Now try to grab the symbols.
960     nlist=conftest.nm
961     if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
962       # Try sorting and uniquifying the output.
963       if sort "$nlist" | uniq > "$nlist"T; then
964         mv -f "$nlist"T "$nlist"
965       else
966         rm -f "$nlist"T
967       fi
968
969       # Make sure that we snagged all the symbols we need.
970       if egrep ' nm_test_var$' "$nlist" >/dev/null; then
971         if egrep ' nm_test_func$' "$nlist" >/dev/null; then
972           cat <<EOF > conftest.$ac_ext
973 #ifdef __cplusplus
974 extern "C" {
975 #endif
976
977 EOF
978           # Now generate the symbol file.
979           eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
980
981           cat <<EOF >> conftest.$ac_ext
982 #if defined (__STDC__) && __STDC__
983 # define lt_ptr_t void *
984 #else
985 # define lt_ptr_t char *
986 # define const
987 #endif
988
989 /* The mapping between symbol names and symbols. */
990 const struct {
991   const char *name;
992   lt_ptr_t address;
993 }
994 [lt_preloaded_symbols[] =]
995 {
996 EOF
997           sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" >> conftest.$ac_ext
998           cat <<\EOF >> conftest.$ac_ext
999   {0, (lt_ptr_t) 0}
1000 };
1001
1002 #ifdef __cplusplus
1003 }
1004 #endif
1005 EOF
1006           # Now try linking the two files.
1007           mv conftest.$ac_objext conftstm.$ac_objext
1008           save_LIBS="$LIBS"
1009           save_CFLAGS="$CFLAGS"
1010           LIBS="conftstm.$ac_objext"
1011           CFLAGS="$CFLAGS$no_builtin_flag"
1012           if AC_TRY_EVAL(ac_link) && test -s conftest; then
1013             pipe_works=yes
1014           fi
1015           LIBS="$save_LIBS"
1016           CFLAGS="$save_CFLAGS"
1017         else
1018           echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
1019         fi
1020       else
1021         echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
1022       fi
1023     else
1024       echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
1025     fi
1026   else
1027     echo "$progname: failed program was:" >&AC_FD_CC
1028     cat conftest.$ac_ext >&5
1029   fi
1030   rm -f conftest* conftst*
1031
1032   # Do not use the global_symbol_pipe unless it works.
1033   if test "$pipe_works" = yes; then
1034     break
1035   else
1036     lt_cv_sys_global_symbol_pipe=
1037   fi
1038 done
1039 ])
1040 global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
1041 if test -z "$lt_cv_sys_global_symbol_pipe"; then
1042   global_symbol_to_cdecl=
1043 else
1044   global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
1045 fi
1046 if test -z "$global_symbol_pipe$global_symbol_to_cdecl"; then
1047   AC_MSG_RESULT(failed)
1048 else
1049   AC_MSG_RESULT(ok)
1050 fi
1051 ]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
1052
1053 # _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
1054 # ---------------------------------
1055 AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
1056 [# Find the correct PATH separator.  Usually this is `:', but
1057 # DJGPP uses `;' like DOS.
1058 if test "X${PATH_SEPARATOR+set}" != Xset; then
1059   UNAME=${UNAME-`uname 2>/dev/null`}
1060   case X$UNAME in
1061     *-DOS) lt_cv_sys_path_separator=';' ;;
1062     *)     lt_cv_sys_path_separator=':' ;;
1063   esac
1064 fi
1065 ])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
1066
1067 # _LT_AC_PROG_ECHO_BACKSLASH
1068 # --------------------------
1069 # Add some code to the start of the generated configure script which
1070 # will find an echo command which doesn;t interpret backslashes.
1071 AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
1072 [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
1073                               [AC_DIVERT_PUSH(NOTICE)])
1074 _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
1075
1076 # Check that we are running under the correct shell.
1077 SHELL=${CONFIG_SHELL-/bin/sh}
1078
1079 case X$ECHO in
1080 X*--fallback-echo)
1081   # Remove one level of quotation (which was required for Make).
1082   ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
1083   ;;
1084 esac
1085
1086 echo=${ECHO-echo}
1087 if test "X[$]1" = X--no-reexec; then
1088   # Discard the --no-reexec flag, and continue.
1089   shift
1090 elif test "X[$]1" = X--fallback-echo; then
1091   # Avoid inline document here, it may be left over
1092   :
1093 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
1094   # Yippee, $echo works!
1095   :
1096 else
1097   # Restart under the correct shell.
1098   exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
1099 fi
1100
1101 if test "X[$]1" = X--fallback-echo; then
1102   # used as fallback echo
1103   shift
1104   cat <<EOF
1105 $*
1106 EOF
1107   exit 0
1108 fi
1109
1110 # The HP-UX ksh and POSIX shell print the target directory to stdout
1111 # if CDPATH is set.
1112 if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
1113
1114 if test -z "$ECHO"; then
1115 if test "X${echo_test_string+set}" != Xset; then
1116 # find a string as large as possible, as long as the shell can cope with it
1117   for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
1118     # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
1119     if (echo_test_string="`eval $cmd`") 2>/dev/null &&
1120        echo_test_string="`eval $cmd`" &&
1121        (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
1122     then
1123       break
1124     fi
1125   done
1126 fi
1127
1128 if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
1129    echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
1130    test "X$echo_testing_string" = "X$echo_test_string"; then
1131   :
1132 else
1133   # The Solaris, AIX, and Digital Unix default echo programs unquote
1134   # backslashes.  This makes it impossible to quote backslashes using
1135   #   echo "$something" | sed 's/\\/\\\\/g'
1136   #
1137   # So, first we look for a working echo in the user's PATH.
1138
1139   IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
1140   for dir in $PATH /usr/ucb; do
1141     if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
1142        test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
1143        echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
1144        test "X$echo_testing_string" = "X$echo_test_string"; then
1145       echo="$dir/echo"
1146       break
1147     fi
1148   done
1149   IFS="$save_ifs"
1150
1151   if test "X$echo" = Xecho; then
1152     # We didn't find a better echo, so look for alternatives.
1153     if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
1154        echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
1155        test "X$echo_testing_string" = "X$echo_test_string"; then
1156       # This shell has a builtin print -r that does the trick.
1157       echo='print -r'
1158     elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
1159          test "X$CONFIG_SHELL" != X/bin/ksh; then
1160       # If we have ksh, try running configure again with it.
1161       ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
1162       export ORIGINAL_CONFIG_SHELL
1163       CONFIG_SHELL=/bin/ksh
1164       export CONFIG_SHELL
1165       exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
1166     else
1167       # Try using printf.
1168       echo='printf %s\n'
1169       if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
1170          echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
1171          test "X$echo_testing_string" = "X$echo_test_string"; then
1172         # Cool, printf works
1173         :
1174       elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
1175            test "X$echo_testing_string" = 'X\t' &&
1176            echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
1177            test "X$echo_testing_string" = "X$echo_test_string"; then
1178         CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
1179         export CONFIG_SHELL
1180         SHELL="$CONFIG_SHELL"
1181         export SHELL
1182         echo="$CONFIG_SHELL [$]0 --fallback-echo"
1183       elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
1184            test "X$echo_testing_string" = 'X\t' &&
1185            echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
1186            test "X$echo_testing_string" = "X$echo_test_string"; then
1187         echo="$CONFIG_SHELL [$]0 --fallback-echo"
1188       else
1189         # maybe with a smaller string...
1190         prev=:
1191
1192         for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
1193           if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
1194           then
1195             break
1196           fi
1197           prev="$cmd"
1198         done
1199
1200         if test "$prev" != 'sed 50q "[$]0"'; then
1201           echo_test_string=`eval $prev`
1202           export echo_test_string
1203           exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
1204         else
1205           # Oops.  We lost completely, so just stick with echo.
1206           echo=echo
1207         fi
1208       fi
1209     fi
1210   fi
1211 fi
1212 fi
1213
1214 # Copy echo and quote the copy suitably for passing to libtool from
1215 # the Makefile, instead of quoting the original, which is used later.
1216 ECHO=$echo
1217 if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
1218    ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
1219 fi
1220
1221 AC_SUBST(ECHO)
1222 AC_DIVERT_POP
1223 ])# _LT_AC_PROG_ECHO_BACKSLASH
1224
1225 # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
1226 #                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
1227 # ------------------------------------------------------------------
1228 AC_DEFUN(_LT_AC_TRY_DLOPEN_SELF,
1229 [if test "$cross_compiling" = yes; then :
1230   [$4]
1231 else
1232   AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
1233   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1234   lt_status=$lt_dlunknown
1235   cat > conftest.$ac_ext <<EOF
1236 [#line __oline__ "configure"
1237 #include "confdefs.h"
1238
1239 #if HAVE_DLFCN_H
1240 #include <dlfcn.h>
1241 #endif
1242
1243 #include <stdio.h>
1244
1245 #ifdef RTLD_GLOBAL
1246 #  define LT_DLGLOBAL           RTLD_GLOBAL
1247 #else
1248 #  ifdef DL_GLOBAL
1249 #    define LT_DLGLOBAL         DL_GLOBAL
1250 #  else
1251 #    define LT_DLGLOBAL         0
1252 #  endif
1253 #endif
1254
1255 /* We may have to define LT_DLLAZY_OR_NOW in the command line if we
1256    find out it does not work in some platform. */
1257 #ifndef LT_DLLAZY_OR_NOW
1258 #  ifdef RTLD_LAZY
1259 #    define LT_DLLAZY_OR_NOW            RTLD_LAZY
1260 #  else
1261 #    ifdef DL_LAZY
1262 #      define LT_DLLAZY_OR_NOW          DL_LAZY
1263 #    else
1264 #      ifdef RTLD_NOW
1265 #        define LT_DLLAZY_OR_NOW        RTLD_NOW
1266 #      else
1267 #        ifdef DL_NOW
1268 #          define LT_DLLAZY_OR_NOW      DL_NOW
1269 #        else
1270 #          define LT_DLLAZY_OR_NOW      0
1271 #        endif
1272 #      endif
1273 #    endif
1274 #  endif
1275 #endif
1276
1277 #ifdef __cplusplus
1278 extern "C" void exit (int);
1279 #endif
1280
1281 void fnord() { int i=42;}
1282 int main ()
1283 {
1284   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
1285   int status = $lt_dlunknown;
1286
1287   if (self)
1288     {
1289       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
1290       else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
1291       /* dlclose (self); */
1292     }
1293
1294     exit (status);
1295 }]
1296 EOF
1297   if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
1298     (./conftest; exit; ) 2>/dev/null
1299     lt_status=$?
1300     case x$lt_status in
1301       x$lt_dlno_uscore) $1 ;;
1302       x$lt_dlneed_uscore) $2 ;;
1303       x$lt_unknown|x*) $3 ;;
1304     esac
1305   else :
1306     # compilation failed
1307     $3
1308   fi
1309 fi
1310 rm -fr conftest*
1311 ])# _LT_AC_TRY_DLOPEN_SELF
1312
1313 # AC_LIBTOOL_DLOPEN_SELF
1314 # -------------------
1315 AC_DEFUN(AC_LIBTOOL_DLOPEN_SELF,
1316 [if test "x$enable_dlopen" != xyes; then
1317   enable_dlopen=unknown
1318   enable_dlopen_self=unknown
1319   enable_dlopen_self_static=unknown
1320 else
1321   lt_cv_dlopen=no
1322   lt_cv_dlopen_libs=
1323
1324   case $host_os in
1325   beos*)
1326     lt_cv_dlopen="load_add_on"
1327     lt_cv_dlopen_libs=
1328     lt_cv_dlopen_self=yes
1329     ;;
1330
1331   cygwin* | mingw* | pw32*)
1332     lt_cv_dlopen="LoadLibrary"
1333     lt_cv_dlopen_libs=
1334    ;;
1335
1336   *)
1337     AC_CHECK_LIB(dl, dlopen,  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
1338       [AC_CHECK_FUNC(dlopen, lt_cv_dlopen="dlopen",
1339         [AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load",
1340           [AC_CHECK_LIB(svld, dlopen,
1341             [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
1342             [AC_CHECK_LIB(dld, shl_load,
1343               [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
1344             ])
1345           ])
1346         ])
1347       ])
1348     ;;
1349   esac
1350
1351   if test "x$lt_cv_dlopen" != xno; then
1352     enable_dlopen=yes
1353   else
1354     enable_dlopen=no
1355   fi
1356
1357   case $lt_cv_dlopen in
1358   dlopen)
1359     save_CPPFLAGS="$CPPFLAGS"
1360     AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
1361     test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1362
1363     save_LDFLAGS="$LDFLAGS"
1364     eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
1365
1366     save_LIBS="$LIBS"
1367     LIBS="$lt_cv_dlopen_libs $LIBS"
1368
1369     AC_CACHE_CHECK([whether a program can dlopen itself],
1370           lt_cv_dlopen_self, [dnl
1371           _LT_AC_TRY_DLOPEN_SELF(
1372             lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
1373             lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
1374     ])
1375
1376     if test "x$lt_cv_dlopen_self" = xyes; then
1377       LDFLAGS="$LDFLAGS $link_static_flag"
1378       AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
1379           lt_cv_dlopen_self_static, [dnl
1380           _LT_AC_TRY_DLOPEN_SELF(
1381             lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
1382             lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
1383       ])
1384     fi
1385
1386     CPPFLAGS="$save_CPPFLAGS"
1387     LDFLAGS="$save_LDFLAGS"
1388     LIBS="$save_LIBS"
1389     ;;
1390   esac
1391
1392   case $lt_cv_dlopen_self in
1393   yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
1394   *) enable_dlopen_self=unknown ;;
1395   esac
1396
1397   case $lt_cv_dlopen_self_static in
1398   yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
1399   *) enable_dlopen_self_static=unknown ;;
1400   esac
1401 fi
1402 ])# AC_LIBTOOL_DLOPEN_SELF
1403
1404 AC_DEFUN([_LT_AC_LTCONFIG_HACK],
1405 [AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
1406 # Sed substitution that helps us do robust quoting.  It backslashifies
1407 # metacharacters that are still active within double-quoted strings.
1408 Xsed='sed -e s/^X//'
1409 [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
1410
1411 # Same as above, but do not quote variable references.
1412 [double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
1413
1414 # Sed substitution to delay expansion of an escaped shell variable in a
1415 # double_quote_subst'ed string.
1416 delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
1417
1418 # Constants:
1419 rm="rm -f"
1420
1421 # Global variables:
1422 default_ofile=libtool
1423 can_build_shared=yes
1424
1425 # All known linkers require a `.a' archive for static linking (except M$VC,
1426 # which needs '.lib').
1427 libext=a
1428 ltmain="$ac_aux_dir/ltmain.sh"
1429 ofile="$default_ofile"
1430 with_gnu_ld="$lt_cv_prog_gnu_ld"
1431 need_locks="$enable_libtool_lock"
1432
1433 old_CC="$CC"
1434 old_CFLAGS="$CFLAGS"
1435
1436 # Set sane defaults for various variables
1437 test -z "$AR" && AR=ar
1438 test -z "$AR_FLAGS" && AR_FLAGS=cru
1439 test -z "$AS" && AS=as
1440 test -z "$CC" && CC=cc
1441 test -z "$DLLTOOL" && DLLTOOL=dlltool
1442 test -z "$LD" && LD=ld
1443 test -z "$LN_S" && LN_S="ln -s"
1444 test -z "$MAGIC_CMD" && MAGIC_CMD=file
1445 test -z "$NM" && NM=nm
1446 test -z "$OBJDUMP" && OBJDUMP=objdump
1447 test -z "$RANLIB" && RANLIB=:
1448 test -z "$STRIP" && STRIP=:
1449 test -z "$ac_objext" && ac_objext=o
1450
1451 if test x"$host" != x"$build"; then
1452   ac_tool_prefix=${host_alias}-
1453 else
1454   ac_tool_prefix=
1455 fi
1456
1457 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
1458 case $host_os in
1459 linux-gnu*) ;;
1460 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
1461 esac
1462
1463 case $host_os in
1464 aix3*)
1465   # AIX sometimes has problems with the GCC collect2 program.  For some
1466   # reason, if we set the COLLECT_NAMES environment variable, the problems
1467   # vanish in a puff of smoke.
1468   if test "X${COLLECT_NAMES+set}" != Xset; then
1469     COLLECT_NAMES=
1470     export COLLECT_NAMES
1471   fi
1472   ;;
1473 esac
1474
1475 # Determine commands to create old-style static archives.
1476 old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
1477 old_postinstall_cmds='chmod 644 $oldlib'
1478 old_postuninstall_cmds=
1479
1480 if test -n "$RANLIB"; then
1481   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
1482   old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
1483 fi
1484
1485 # Allow CC to be a program name with arguments.
1486 set dummy $CC
1487 compiler="[$]2"
1488
1489 ## FIXME: this should be a separate macro
1490 ##
1491 AC_MSG_CHECKING([for objdir])
1492 rm -f .libs 2>/dev/null
1493 mkdir .libs 2>/dev/null
1494 if test -d .libs; then
1495   objdir=.libs
1496 else
1497   # MS-DOS does not allow filenames that begin with a dot.
1498   objdir=_libs
1499 fi
1500 rmdir .libs 2>/dev/null
1501 AC_MSG_RESULT($objdir)
1502 ##
1503 ## END FIXME
1504
1505
1506 ## FIXME: this should be a separate macro
1507 ##
1508 AC_ARG_WITH(pic, 
1509 [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
1510 pic_mode="$withval", pic_mode=default)
1511 test -z "$pic_mode" && pic_mode=default
1512
1513 # We assume here that the value for lt_cv_prog_cc_pic will not be cached
1514 # in isolation, and that seeing it set (from the cache) indicates that
1515 # the associated values are set (in the cache) correctly too.
1516 AC_MSG_CHECKING([for $compiler option to produce PIC])
1517 AC_CACHE_VAL(lt_cv_prog_cc_pic,
1518 [ lt_cv_prog_cc_pic=
1519   lt_cv_prog_cc_shlib=
1520   lt_cv_prog_cc_wl=
1521   lt_cv_prog_cc_static=
1522   lt_cv_prog_cc_no_builtin=
1523   lt_cv_prog_cc_can_build_shared=$can_build_shared
1524
1525   if test "$GCC" = yes; then
1526     lt_cv_prog_cc_wl='-Wl,'
1527     lt_cv_prog_cc_static='-static'
1528
1529     case $host_os in
1530     aix*)
1531       # Below there is a dirty hack to force normal static linking with -ldl
1532       # The problem is because libdl dynamically linked with both libc and
1533       # libC (AIX C++ library), which obviously doesn't included in libraries
1534       # list by gcc. This cause undefined symbols with -static flags.
1535       # This hack allows C programs to be linked with "-static -ldl", but
1536       # we not sure about C++ programs.
1537       lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
1538       ;;
1539     amigaos*)
1540       # FIXME: we need at least 68020 code to build shared libraries, but
1541       # adding the `-m68020' flag to GCC prevents building anything better,
1542       # like `-m68040'.
1543       lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
1544       ;;
1545     beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
1546       # PIC is the default for these OSes.
1547       ;;
1548     darwin* | rhapsody*)
1549       # PIC is the default on this platform
1550       # Common symbols not allowed in MH_DYLIB files
1551       lt_cv_prog_cc_pic='-fno-common'
1552       ;;
1553     cygwin* | mingw* | pw32* | os2*)
1554       # This hack is so that the source file can tell whether it is being
1555       # built for inclusion in a dll (and should export symbols for example).
1556       lt_cv_prog_cc_pic='-DDLL_EXPORT'
1557       ;;
1558     sysv4*MP*)
1559       if test -d /usr/nec; then
1560          lt_cv_prog_cc_pic=-Kconform_pic
1561       fi
1562       ;;
1563     *)
1564       lt_cv_prog_cc_pic='-fPIC'
1565       ;;
1566     esac
1567   else
1568     # PORTME Check for PIC flags for the system compiler.
1569     case $host_os in
1570     aix3* | aix4* | aix5*)
1571       # All AIX code is PIC.
1572       if test "$host_cpu" = ia64; then
1573         # AIX 5 now supports IA64 processor
1574         lt_cv_prog_cc_static='-Bstatic'
1575         lt_cv_prog_cc_wl='-Wl,'
1576       else
1577         lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
1578       fi
1579       ;;
1580
1581     hpux9* | hpux10* | hpux11*)
1582       # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
1583       lt_cv_prog_cc_wl='-Wl,'
1584       lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
1585       lt_cv_prog_cc_pic='+Z'
1586       ;;
1587
1588     irix5* | irix6*)
1589       lt_cv_prog_cc_wl='-Wl,'
1590       lt_cv_prog_cc_static='-non_shared'
1591       # PIC (with -KPIC) is the default.
1592       ;;
1593
1594     cygwin* | mingw* | pw32* | os2*)
1595       # This hack is so that the source file can tell whether it is being
1596       # built for inclusion in a dll (and should export symbols for example).
1597       lt_cv_prog_cc_pic='-DDLL_EXPORT'
1598       ;;
1599
1600     newsos6)
1601       lt_cv_prog_cc_pic='-KPIC'
1602       lt_cv_prog_cc_static='-Bstatic'
1603       ;;
1604
1605     osf3* | osf4* | osf5*)
1606       # All OSF/1 code is PIC.
1607       lt_cv_prog_cc_wl='-Wl,'
1608       lt_cv_prog_cc_static='-non_shared'
1609       ;;
1610
1611     sco3.2v5*)
1612       lt_cv_prog_cc_pic='-Kpic'
1613       lt_cv_prog_cc_static='-dn'
1614       lt_cv_prog_cc_shlib='-belf'
1615       ;;
1616
1617     solaris*)
1618       lt_cv_prog_cc_pic='-KPIC'
1619       lt_cv_prog_cc_static='-Bstatic'
1620       lt_cv_prog_cc_wl='-Wl,'
1621       ;;
1622
1623     sunos4*)
1624       lt_cv_prog_cc_pic='-PIC'
1625       lt_cv_prog_cc_static='-Bstatic'
1626       lt_cv_prog_cc_wl='-Qoption ld '
1627       ;;
1628
1629     sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
1630       lt_cv_prog_cc_pic='-KPIC'
1631       lt_cv_prog_cc_static='-Bstatic'
1632       if test "x$host_vendor" = xsni; then
1633         lt_cv_prog_cc_wl='-LD'
1634       else
1635         lt_cv_prog_cc_wl='-Wl,'
1636       fi
1637       ;;
1638
1639     uts4*)
1640       lt_cv_prog_cc_pic='-pic'
1641       lt_cv_prog_cc_static='-Bstatic'
1642       ;;
1643
1644     sysv4*MP*)
1645       if test -d /usr/nec ;then
1646         lt_cv_prog_cc_pic='-Kconform_pic'
1647         lt_cv_prog_cc_static='-Bstatic'
1648       fi
1649       ;;
1650
1651     *)
1652       lt_cv_prog_cc_can_build_shared=no
1653       ;;
1654     esac
1655   fi
1656 ])
1657 if test -z "$lt_cv_prog_cc_pic"; then
1658   AC_MSG_RESULT([none])
1659 else
1660   AC_MSG_RESULT([$lt_cv_prog_cc_pic])
1661
1662   # Check to make sure the pic_flag actually works.
1663   AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works])
1664   AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl
1665     save_CFLAGS="$CFLAGS"
1666     CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
1667     AC_TRY_COMPILE([], [], [dnl
1668       case $host_os in
1669       hpux9* | hpux10* | hpux11*)
1670         # On HP-UX, both CC and GCC only warn that PIC is supported... then
1671         # they create non-PIC objects.  So, if there were any warnings, we
1672         # assume that PIC is not supported.
1673         if test -s conftest.err; then
1674           lt_cv_prog_cc_pic_works=no
1675         else
1676           lt_cv_prog_cc_pic_works=yes
1677         fi
1678         ;;
1679       *)
1680         lt_cv_prog_cc_pic_works=yes
1681         ;;
1682       esac
1683     ], [dnl
1684       lt_cv_prog_cc_pic_works=no
1685     ])
1686     CFLAGS="$save_CFLAGS"
1687   ])
1688
1689   if test "X$lt_cv_prog_cc_pic_works" = Xno; then
1690     lt_cv_prog_cc_pic=
1691     lt_cv_prog_cc_can_build_shared=no
1692   else
1693     lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
1694   fi
1695
1696   AC_MSG_RESULT([$lt_cv_prog_cc_pic_works])
1697 fi
1698 ##
1699 ## END FIXME
1700
1701 # Check for any special shared library compilation flags.
1702 if test -n "$lt_cv_prog_cc_shlib"; then
1703   AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries])
1704   if echo "$old_CC $old_CFLAGS " | [egrep -e "[         ]$lt_cv_prog_cc_shlib[  ]"] >/dev/null; then :
1705   else
1706    AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure])
1707     lt_cv_prog_cc_can_build_shared=no
1708   fi
1709 fi
1710
1711 ## FIXME: this should be a separate macro
1712 ##
1713 AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works])
1714 AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl
1715   lt_cv_prog_cc_static_works=no
1716   save_LDFLAGS="$LDFLAGS"
1717   LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
1718   AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes])
1719   LDFLAGS="$save_LDFLAGS"
1720 ])
1721
1722 # Belt *and* braces to stop my trousers falling down:
1723 test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
1724 AC_MSG_RESULT([$lt_cv_prog_cc_static_works])
1725
1726 pic_flag="$lt_cv_prog_cc_pic"
1727 special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
1728 wl="$lt_cv_prog_cc_wl"
1729 link_static_flag="$lt_cv_prog_cc_static"
1730 no_builtin_flag="$lt_cv_prog_cc_no_builtin"
1731 can_build_shared="$lt_cv_prog_cc_can_build_shared"
1732 ##
1733 ## END FIXME
1734
1735
1736 ## FIXME: this should be a separate macro
1737 ##
1738 # Check to see if options -o and -c are simultaneously supported by compiler
1739 AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext])
1740 AC_CACHE_VAL([lt_cv_compiler_c_o], [
1741 $rm -r conftest 2>/dev/null
1742 mkdir conftest
1743 cd conftest
1744 echo "int some_variable = 0;" > conftest.$ac_ext
1745 mkdir out
1746 # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
1747 # that will create temporary files in the current directory regardless of
1748 # the output directory.  Thus, making CWD read-only will cause this test
1749 # to fail, enabling locking or at least warning the user not to do parallel
1750 # builds.
1751 chmod -w .
1752 save_CFLAGS="$CFLAGS"
1753 CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
1754 compiler_c_o=no
1755 if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
1756   # The compiler can only warn and ignore the option if not recognized
1757   # So say no if there are warnings
1758   if test -s out/conftest.err; then
1759     lt_cv_compiler_c_o=no
1760   else
1761     lt_cv_compiler_c_o=yes
1762   fi
1763 else
1764   # Append any errors to the config.log.
1765   cat out/conftest.err 1>&AC_FD_CC
1766   lt_cv_compiler_c_o=no
1767 fi
1768 CFLAGS="$save_CFLAGS"
1769 chmod u+w .
1770 $rm conftest* out/*
1771 rmdir out
1772 cd ..
1773 rmdir conftest
1774 $rm -r conftest 2>/dev/null
1775 ])
1776 compiler_c_o=$lt_cv_compiler_c_o
1777 AC_MSG_RESULT([$compiler_c_o])
1778
1779 if test x"$compiler_c_o" = x"yes"; then
1780   # Check to see if we can write to a .lo
1781   AC_MSG_CHECKING([if $compiler supports -c -o file.lo])
1782   AC_CACHE_VAL([lt_cv_compiler_o_lo], [
1783   lt_cv_compiler_o_lo=no
1784   save_CFLAGS="$CFLAGS"
1785   CFLAGS="$CFLAGS -c -o conftest.lo"
1786   AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
1787     # The compiler can only warn and ignore the option if not recognized
1788     # So say no if there are warnings
1789     if test -s conftest.err; then
1790       lt_cv_compiler_o_lo=no
1791     else
1792       lt_cv_compiler_o_lo=yes
1793     fi
1794   ])
1795   CFLAGS="$save_CFLAGS"
1796   ])
1797   compiler_o_lo=$lt_cv_compiler_o_lo
1798   AC_MSG_RESULT([$compiler_c_lo])
1799 else
1800   compiler_o_lo=no
1801 fi
1802 ##
1803 ## END FIXME
1804
1805 ## FIXME: this should be a separate macro
1806 ##
1807 # Check to see if we can do hard links to lock some files if needed
1808 hard_links="nottested"
1809 if test "$compiler_c_o" = no && test "$need_locks" != no; then
1810   # do not overwrite the value of need_locks provided by the user
1811   AC_MSG_CHECKING([if we can lock with hard links])
1812   hard_links=yes
1813   $rm conftest*
1814   ln conftest.a conftest.b 2>/dev/null && hard_links=no
1815   touch conftest.a
1816   ln conftest.a conftest.b 2>&5 || hard_links=no
1817   ln conftest.a conftest.b 2>/dev/null && hard_links=no
1818   AC_MSG_RESULT([$hard_links])
1819   if test "$hard_links" = no; then
1820     AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
1821     need_locks=warn
1822   fi
1823 else
1824   need_locks=no
1825 fi
1826 ##
1827 ## END FIXME
1828
1829 ## FIXME: this should be a separate macro
1830 ##
1831 if test "$GCC" = yes; then
1832   # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
1833   AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions])
1834   echo "int some_variable = 0;" > conftest.$ac_ext
1835   save_CFLAGS="$CFLAGS"
1836   CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
1837   compiler_rtti_exceptions=no
1838   AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
1839     # The compiler can only warn and ignore the option if not recognized
1840     # So say no if there are warnings
1841     if test -s conftest.err; then
1842       compiler_rtti_exceptions=no
1843     else
1844       compiler_rtti_exceptions=yes
1845     fi
1846   ])
1847   CFLAGS="$save_CFLAGS"
1848   AC_MSG_RESULT([$compiler_rtti_exceptions])
1849
1850   if test "$compiler_rtti_exceptions" = "yes"; then
1851     no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
1852   else
1853     no_builtin_flag=' -fno-builtin'
1854   fi
1855 fi
1856 ##
1857 ## END FIXME
1858
1859 ## FIXME: this should be a separate macro
1860 ##
1861 # See if the linker supports building shared libraries.
1862 AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries])
1863
1864 allow_undefined_flag=
1865 no_undefined_flag=
1866 need_lib_prefix=unknown
1867 need_version=unknown
1868 # when you set need_version to no, make sure it does not cause -set_version
1869 # flags to be left without arguments
1870 archive_cmds=
1871 archive_expsym_cmds=
1872 old_archive_from_new_cmds=
1873 old_archive_from_expsyms_cmds=
1874 export_dynamic_flag_spec=
1875 whole_archive_flag_spec=
1876 thread_safe_flag_spec=
1877 hardcode_into_libs=no
1878 hardcode_libdir_flag_spec=
1879 hardcode_libdir_separator=
1880 hardcode_direct=no
1881 hardcode_minus_L=no
1882 hardcode_shlibpath_var=unsupported
1883 runpath_var=
1884 link_all_deplibs=unknown
1885 always_export_symbols=no
1886 export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
1887 # include_expsyms should be a list of space-separated symbols to be *always*
1888 # included in the symbol list
1889 include_expsyms=
1890 # exclude_expsyms can be an egrep regular expression of symbols to exclude
1891 # it will be wrapped by ` (' and `)$', so one must not match beginning or
1892 # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
1893 # as well as any symbol that contains `d'.
1894 exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
1895 # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
1896 # platforms (ab)use it in PIC code, but their linkers get confused if
1897 # the symbol is explicitly referenced.  Since portable code cannot
1898 # rely on this symbol name, it's probably fine to never include it in
1899 # preloaded symbol tables.
1900 extract_expsyms_cmds=
1901
1902 case $host_os in
1903 cygwin* | mingw* | pw32* )
1904   # FIXME: the MSVC++ port hasn't been tested in a loooong time
1905   # When not using gcc, we currently assume that we are using
1906   # Microsoft Visual C++.
1907   if test "$GCC" != yes; then
1908     with_gnu_ld=no
1909   fi
1910   ;;
1911
1912 esac
1913
1914 ld_shlibs=yes
1915 if test "$with_gnu_ld" = yes; then
1916   # If archive_cmds runs LD, not CC, wlarc should be empty
1917   wlarc='${wl}'
1918
1919   # See if GNU ld supports shared libraries.
1920   case $host_os in
1921   aix3* | aix4* | aix5*)
1922     # On AIX, the GNU linker is very broken
1923     # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
1924     ld_shlibs=no
1925     cat <<EOF 1>&2
1926
1927 *** Warning: the GNU linker, at least up to release 2.9.1, is reported
1928 *** to be unable to reliably create shared libraries on AIX.
1929 *** Therefore, libtool is disabling shared libraries support.  If you
1930 *** really care for shared libraries, you may want to modify your PATH
1931 *** so that a non-GNU linker is found, and then restart.
1932
1933 EOF
1934     ;;
1935
1936   amigaos*)
1937     archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
1938     hardcode_libdir_flag_spec='-L$libdir'
1939     hardcode_minus_L=yes
1940
1941     # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
1942     # that the semantics of dynamic libraries on AmigaOS, at least up
1943     # to version 4, is to share data among multiple programs linked
1944     # with the same dynamic library.  Since this doesn't match the
1945     # behavior of shared libraries on other platforms, we can use
1946     # them.
1947     ld_shlibs=no
1948     ;;
1949
1950   beos*)
1951     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
1952       allow_undefined_flag=unsupported
1953       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
1954       # support --undefined.  This deserves some investigation.  FIXME
1955       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1956     else
1957       ld_shlibs=no
1958     fi
1959     ;;
1960
1961   cygwin* | mingw* | pw32*)
1962     # hardcode_libdir_flag_spec is actually meaningless, as there is
1963     # no search path for DLLs.
1964     hardcode_libdir_flag_spec='-L$libdir'
1965     allow_undefined_flag=unsupported
1966     always_export_symbols=yes
1967
1968     extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
1969       sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
1970       test -f $output_objdir/impgen.exe || (cd $output_objdir && \
1971       if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
1972       else $CC -o impgen impgen.c ; fi)~
1973       $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
1974
1975     old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
1976
1977     # cygwin and mingw dlls have different entry points and sets of symbols
1978     # to exclude.
1979     # FIXME: what about values for MSVC?
1980     dll_entry=__cygwin_dll_entry@12
1981     dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
1982     case $host_os in
1983     mingw*)
1984       # mingw values
1985       dll_entry=_DllMainCRTStartup@12
1986       dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
1987       ;;
1988     esac
1989
1990     # mingw and cygwin differ, and it's simplest to just exclude the union
1991     # of the two symbol sets.
1992     dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
1993
1994     # recent cygwin and mingw systems supply a stub DllMain which the user
1995     # can override, but on older systems we have to supply one (in ltdll.c)
1996     if test "x$lt_cv_need_dllmain" = "xyes"; then
1997       ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
1998       ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < [$]0 > $output_objdir/$soname-ltdll.c~
1999         test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
2000     else
2001       ltdll_obj=
2002       ltdll_cmds=
2003     fi
2004
2005     # Extract the symbol export list from an `--export-all' def file,
2006     # then regenerate the def file from the symbol export list, so that
2007     # the compiled dll only exports the symbol export list.
2008     # Be careful not to strip the DATA tag left be newer dlltools.
2009     export_symbols_cmds="$ltdll_cmds"'
2010       $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
2011       [sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//"] < $output_objdir/$soname-def > $export_symbols'
2012
2013     # If the export-symbols file already is a .def file (1st line
2014     # is EXPORTS), use it as is.
2015     # If DATA tags from a recent dlltool are present, honour them!
2016     archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
2017         cp $export_symbols $output_objdir/$soname-def;
2018       else
2019         echo EXPORTS > $output_objdir/$soname-def;
2020         _lt_hint=1;
2021         cat $export_symbols | while read symbol; do
2022          set dummy \$symbol;
2023          case \[$]# in
2024            2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
2025            *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
2026          esac;
2027          _lt_hint=`expr 1 + \$_lt_hint`;
2028         done;
2029       fi~
2030       '"$ltdll_cmds"'
2031       $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
2032       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
2033       $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
2034       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
2035       $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
2036     ;;
2037
2038   netbsd*)
2039     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
2040       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
2041       wlarc=
2042     else
2043       archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
2044       archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
2045     fi
2046     ;;
2047
2048   solaris* | sysv5*)
2049     if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
2050       ld_shlibs=no
2051       cat <<EOF 1>&2
2052
2053 *** Warning: The releases 2.8.* of the GNU linker cannot reliably
2054 *** create shared libraries on Solaris systems.  Therefore, libtool
2055 *** is disabling shared libraries support.  We urge you to upgrade GNU
2056 *** binutils to release 2.9.1 or newer.  Another option is to modify
2057 *** your PATH or compiler configuration so that the native linker is
2058 *** used, and then restart.
2059
2060 EOF
2061     elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
2062       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
2063       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
2064     else
2065       ld_shlibs=no
2066     fi
2067     ;;
2068
2069   sunos4*)
2070     archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
2071     wlarc=
2072     hardcode_direct=yes
2073     hardcode_shlibpath_var=no
2074     ;;
2075
2076   *)
2077     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
2078       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
2079       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
2080     else
2081       ld_shlibs=no
2082     fi
2083     ;;
2084   esac
2085
2086   if test "$ld_shlibs" = yes; then
2087     runpath_var=LD_RUN_PATH
2088     hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
2089     export_dynamic_flag_spec='${wl}--export-dynamic'
2090     case $host_os in
2091     cygwin* | mingw* | pw32*)
2092       # dlltool doesn't understand --whole-archive et. al.
2093       whole_archive_flag_spec=
2094       ;;
2095     *)
2096       # ancient GNU ld didn't support --whole-archive et. al.
2097       if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
2098         whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
2099       else
2100         whole_archive_flag_spec=
2101       fi
2102       ;;
2103     esac
2104   fi
2105 else
2106   # PORTME fill in a description of your system's linker (not GNU ld)
2107   case $host_os in
2108   aix3*)
2109     allow_undefined_flag=unsupported
2110     always_export_symbols=yes
2111     archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
2112     # Note: this linker hardcodes the directories in LIBPATH if there
2113     # are no directories specified by -L.
2114     hardcode_minus_L=yes
2115     if test "$GCC" = yes && test -z "$link_static_flag"; then
2116       # Neither direct hardcoding nor static linking is supported with a
2117       # broken collect2.
2118       hardcode_direct=unsupported
2119     fi
2120     ;;
2121
2122   aix4* | aix5*)
2123     # When large executables or shared objects are built, AIX ld can
2124     # have problems creating the table of contents.  If linking a library
2125     # or program results in "error TOC overflow" add -mminimal-toc to
2126     # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
2127     # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
2128
2129     archive_cmds=''
2130     hardcode_libdir_separator=':'
2131     if test "$GCC" = yes; then
2132       collect2name=`${CC} -print-prog-name=collect2`
2133       if test -f "$collect2name" && \
2134          strings "$collect2name" | grep resolve_lib_name >/dev/null
2135       then
2136         # We have reworked collect2
2137         hardcode_direct=yes
2138       else
2139         # We have old collect2
2140         hardcode_direct=unsupported
2141         # It fails to find uninstalled libraries when the uninstalled
2142         # path is not listed in the libpath.  Setting hardcode_minus_L
2143         # to unsupported forces relinking
2144         hardcode_minus_L=yes
2145         hardcode_libdir_flag_spec='-L$libdir'
2146         hardcode_libdir_separator=
2147       fi
2148       shared_flag='-shared'
2149     else
2150       if test "$host_cpu" = ia64; then
2151         shared_flag='-G'
2152       else
2153         shared_flag='${wl}-bM:SRE'
2154       fi
2155       hardcode_direct=yes
2156     fi
2157
2158     if test "$host_cpu" = ia64; then
2159       # On IA64, the linker does run time linking by default, so we don't
2160       # have to do anything special.
2161       aix_use_runtimelinking=no
2162       exp_sym_flag='-Bexport'
2163       no_entry_flag=""
2164     else
2165       # Test if we are trying to use run time linking, or normal AIX style linking.
2166       # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
2167       aix_use_runtimelinking=no
2168       for ld_flag in $LDFLAGS; do
2169         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
2170           aix_use_runtimelinking=yes
2171           break
2172         fi
2173       done
2174       exp_sym_flag='-bexport'
2175       no_entry_flag='-bnoentry'
2176     fi
2177     # It seems that -bexpall can do strange things, so it is better to
2178     # generate a list of symbols to export.
2179     always_export_symbols=yes
2180     if test "$aix_use_runtimelinking" = yes; then
2181       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
2182       allow_undefined_flag=' -Wl,-G'
2183       archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
2184     else
2185       if test "$host_cpu" = ia64; then
2186         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
2187        allow_undefined_flag="-znodefs"
2188         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
2189       else
2190         hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
2191         # Warning - without using the other run time loading flags, -berok will
2192         #           link without error, but may produce a broken library.
2193         allow_undefined_flag='${wl}-berok"
2194         # This is a bit strange, but is similar to how AIX traditionally builds
2195         # it's shared libraries.
2196         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
2197       fi
2198     fi
2199     ;;
2200
2201   amigaos*)
2202     archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
2203     hardcode_libdir_flag_spec='-L$libdir'
2204     hardcode_minus_L=yes
2205     # see comment about different semantics on the GNU ld section
2206     ld_shlibs=no
2207     ;;
2208
2209   cygwin* | mingw* | pw32*)
2210     # When not using gcc, we currently assume that we are using
2211     # Microsoft Visual C++.
2212     # hardcode_libdir_flag_spec is actually meaningless, as there is
2213     # no search path for DLLs.
2214     hardcode_libdir_flag_spec=' '
2215     allow_undefined_flag=unsupported
2216     # Tell ltmain to make .lib files, not .a files.
2217     libext=lib
2218     # FIXME: Setting linknames here is a bad hack.
2219     archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
2220     # The linker will automatically build a .lib file if we build a DLL.
2221     old_archive_from_new_cmds='true'
2222     # FIXME: Should let the user specify the lib program.
2223     old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
2224     fix_srcfile_path='`cygpath -w "$srcfile"`'
2225     ;;
2226
2227   darwin* | rhapsody*)
2228     allow_undefined_flag='-undefined suppress'
2229     # FIXME: Relying on posixy $() will cause problems for
2230     #        cross-compilation, but unfortunately the echo tests do not
2231     #        yet detect zsh echo's removal of \ escapes.
2232     archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && echo $verstring)'
2233     # We need to add '_' to the symbols in $export_symbols first
2234     #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
2235     hardcode_direct=yes
2236     hardcode_shlibpath_var=no
2237     whole_archive_flag_spec='-all_load $convenience'
2238     ;;
2239
2240   freebsd1*)
2241     ld_shlibs=no
2242     ;;
2243
2244   # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
2245   # support.  Future versions do this automatically, but an explicit c++rt0.o
2246   # does not break anything, and helps significantly (at the cost of a little
2247   # extra space).
2248   freebsd2.2*)
2249     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
2250     hardcode_libdir_flag_spec='-R$libdir'
2251     hardcode_direct=yes
2252     hardcode_shlibpath_var=no
2253     ;;
2254
2255   # Unfortunately, older versions of FreeBSD 2 do not have this feature.
2256   freebsd2*)
2257     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
2258     hardcode_direct=yes
2259     hardcode_minus_L=yes
2260     hardcode_shlibpath_var=no
2261     ;;
2262
2263   # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
2264   freebsd*)
2265     archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
2266     hardcode_libdir_flag_spec='-R$libdir'
2267     hardcode_direct=yes
2268     hardcode_shlibpath_var=no
2269     ;;
2270
2271   hpux9* | hpux10* | hpux11*)
2272     case $host_os in
2273     hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
2274     *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
2275     esac
2276     hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
2277     hardcode_libdir_separator=:
2278     hardcode_direct=yes
2279     hardcode_minus_L=yes # Not in the search PATH, but as the default
2280                          # location of the library.
2281     export_dynamic_flag_spec='${wl}-E'
2282     ;;
2283
2284   irix5* | irix6*)
2285     if test "$GCC" = yes; then
2286       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
2287     else
2288       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
2289     fi
2290     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2291     hardcode_libdir_separator=:
2292     link_all_deplibs=yes
2293     ;;
2294
2295   netbsd*)
2296     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
2297       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
2298     else
2299       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
2300     fi
2301     hardcode_libdir_flag_spec='-R$libdir'
2302     hardcode_direct=yes
2303     hardcode_shlibpath_var=no
2304     ;;
2305
2306   newsos6)
2307     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
2308     hardcode_direct=yes
2309     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2310     hardcode_libdir_separator=:
2311     hardcode_shlibpath_var=no
2312     ;;
2313
2314   openbsd*)
2315     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
2316     hardcode_libdir_flag_spec='-R$libdir'
2317     hardcode_direct=yes
2318     hardcode_shlibpath_var=no
2319     ;;
2320
2321   os2*)
2322     hardcode_libdir_flag_spec='-L$libdir'
2323     hardcode_minus_L=yes
2324     allow_undefined_flag=unsupported
2325     archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
2326     old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
2327     ;;
2328
2329   osf3*)
2330     if test "$GCC" = yes; then
2331       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
2332       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
2333     else
2334       allow_undefined_flag=' -expect_unresolved \*'
2335       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
2336     fi
2337     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2338     hardcode_libdir_separator=:
2339     ;;
2340
2341   osf4* | osf5*)        # as osf3* with the addition of -msym flag
2342     if test "$GCC" = yes; then
2343       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
2344       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
2345       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2346     else
2347       allow_undefined_flag=' -expect_unresolved \*'
2348       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
2349       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
2350       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
2351
2352       #Both c and cxx compiler support -rpath directly
2353       hardcode_libdir_flag_spec='-rpath $libdir'
2354     fi
2355     hardcode_libdir_separator=:
2356     ;;
2357
2358   sco3.2v5*)
2359     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2360     hardcode_shlibpath_var=no
2361     runpath_var=LD_RUN_PATH
2362     hardcode_runpath_var=yes
2363     ;;
2364
2365   solaris*)
2366     no_undefined_flag=' -z defs'
2367     # $CC -shared without GNU ld will not create a library from C++
2368     # object files and a static libstdc++, better avoid it by now
2369     archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
2370     archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
2371                 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
2372     hardcode_libdir_flag_spec='-R$libdir'
2373     hardcode_shlibpath_var=no
2374     case $host_os in
2375     [solaris2.[0-5] | solaris2.[0-5].*]) ;;
2376     *) # Supported since Solaris 2.6 (maybe 2.5.1?)
2377       whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
2378     esac
2379     link_all_deplibs=yes
2380     ;;
2381
2382   sunos4*)
2383     if test "x$host_vendor" = xsequent; then
2384       # Use $CC to link under sequent, because it throws in some extra .o
2385       # files that make .init and .fini sections work.
2386       archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
2387     else
2388       archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
2389     fi
2390     hardcode_libdir_flag_spec='-L$libdir'
2391     hardcode_direct=yes
2392     hardcode_minus_L=yes
2393     hardcode_shlibpath_var=no
2394     ;;
2395
2396   sysv4)
2397     if test "x$host_vendor" = xsno; then
2398       archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linkopts'
2399       hardcode_direct=yes # is this really true???
2400     else
2401       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2402       hardcode_direct=no #Motorola manual says yes, but my tests say they lie
2403     fi
2404     runpath_var='LD_RUN_PATH'
2405     hardcode_shlibpath_var=no
2406     ;;
2407
2408   sysv4.3*)
2409     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2410     hardcode_shlibpath_var=no
2411     export_dynamic_flag_spec='-Bexport'
2412     ;;
2413
2414   sysv5*)
2415     no_undefined_flag=' -z text'
2416     # $CC -shared without GNU ld will not create a library from C++
2417     # object files and a static libstdc++, better avoid it by now
2418     archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
2419     archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
2420                 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
2421     hardcode_libdir_flag_spec=
2422     hardcode_shlibpath_var=no
2423     runpath_var='LD_RUN_PATH'
2424     ;;
2425
2426   uts4*)
2427     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2428     hardcode_libdir_flag_spec='-L$libdir'
2429     hardcode_shlibpath_var=no
2430     ;;
2431
2432   dgux*)
2433     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2434     hardcode_libdir_flag_spec='-L$libdir'
2435     hardcode_shlibpath_var=no
2436     ;;
2437
2438   sysv4*MP*)
2439     if test -d /usr/nec; then
2440       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2441       hardcode_shlibpath_var=no
2442       runpath_var=LD_RUN_PATH
2443       hardcode_runpath_var=yes
2444       ld_shlibs=yes
2445     fi
2446     ;;
2447
2448   sysv4.2uw2*)
2449     archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
2450     hardcode_direct=yes
2451     hardcode_minus_L=no
2452     hardcode_shlibpath_var=no
2453     hardcode_runpath_var=yes
2454     runpath_var=LD_RUN_PATH
2455     ;;
2456
2457   sysv5uw7* | unixware7*)
2458     no_undefined_flag='${wl}-z ${wl}text'
2459     if test "$GCC" = yes; then
2460       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
2461     else
2462       archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
2463     fi
2464     runpath_var='LD_RUN_PATH'
2465     hardcode_shlibpath_var=no
2466     ;;
2467
2468   *)
2469     ld_shlibs=no
2470     ;;
2471   esac
2472 fi
2473 AC_MSG_RESULT([$ld_shlibs])
2474 test "$ld_shlibs" = no && can_build_shared=no
2475 ##
2476 ## END FIXME
2477
2478 ## FIXME: this should be a separate macro
2479 ##
2480 # Check hardcoding attributes.
2481 AC_MSG_CHECKING([how to hardcode library paths into programs])
2482 hardcode_action=
2483 if test -n "$hardcode_libdir_flag_spec" || \
2484    test -n "$runpath_var"; then
2485
2486   # We can hardcode non-existant directories.
2487   if test "$hardcode_direct" != no &&
2488      # If the only mechanism to avoid hardcoding is shlibpath_var, we
2489      # have to relink, otherwise we might link with an installed library
2490      # when we should be linking with a yet-to-be-installed one
2491      ## test "$hardcode_shlibpath_var" != no &&
2492      test "$hardcode_minus_L" != no; then
2493     # Linking always hardcodes the temporary library directory.
2494     hardcode_action=relink
2495   else
2496     # We can link without hardcoding, and we can hardcode nonexisting dirs.
2497     hardcode_action=immediate
2498   fi
2499 else
2500   # We cannot hardcode anything, or else we can only hardcode existing
2501   # directories.
2502   hardcode_action=unsupported
2503 fi
2504 AC_MSG_RESULT([$hardcode_action])
2505 ##
2506 ## END FIXME
2507
2508 ## FIXME: this should be a separate macro
2509 ##
2510 striplib=
2511 old_striplib=
2512 AC_MSG_CHECKING([whether stripping libraries is possible])
2513 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
2514   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
2515   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
2516   AC_MSG_RESULT([yes])
2517 else
2518   AC_MSG_RESULT([no])
2519 fi
2520 ##
2521 ## END FIXME
2522
2523 reload_cmds='$LD$reload_flag -o $output$reload_objs'
2524 test -z "$deplibs_check_method" && deplibs_check_method=unknown
2525
2526 ## FIXME: this should be a separate macro
2527 ##
2528 # PORTME Fill in your ld.so characteristics
2529 AC_MSG_CHECKING([dynamic linker characteristics])
2530 library_names_spec=
2531 libname_spec='lib$name'
2532 soname_spec=
2533 postinstall_cmds=
2534 postuninstall_cmds=
2535 finish_cmds=
2536 finish_eval=
2537 shlibpath_var=
2538 shlibpath_overrides_runpath=unknown
2539 version_type=none
2540 dynamic_linker="$host_os ld.so"
2541 sys_lib_dlsearch_path_spec="/lib /usr/lib"
2542 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
2543
2544 case $host_os in
2545 aix3*)
2546   version_type=linux
2547   library_names_spec='${libname}${release}.so$versuffix $libname.a'
2548   shlibpath_var=LIBPATH
2549
2550   # AIX has no versioning support, so we append a major version to the name.
2551   soname_spec='${libname}${release}.so$major'
2552   ;;
2553
2554 aix4* | aix5*)
2555   version_type=linux
2556   if test "$host_cpu" = ia64; then
2557     # AIX 5 supports IA64
2558     library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
2559     shlibpath_var=LD_LIBRARY_PATH
2560   else
2561     # With GCC up to 2.95.x, collect2 would create an import file
2562     # for dependence libraries.  The import file would start with
2563     # the line `#! .'.  This would cause the generated library to
2564     # depend on `.', always an invalid library.  This was fixed in
2565     # development snapshots of GCC prior to 3.0.
2566     case $host_os in
2567       [ aix4 | aix4.[01] | aix4.[01].*)]
2568       if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
2569            echo ' yes '
2570            echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
2571         :
2572       else
2573         can_build_shared=no
2574       fi
2575       ;;
2576     esac
2577     # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
2578     # soname into executable. Probably we can add versioning support to
2579     # collect2, so additional links can be useful in future.
2580     if test "$aix_use_runtimelinking" = yes; then
2581       # If using run time linking (on AIX 4.2 or later) use lib<name>.so instead of
2582       # lib<name>.a to let people know that these are not typical AIX shared libraries.
2583       library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2584     else
2585       # We preserve .a as extension for shared libraries through AIX4.2
2586       # and later when we are not doing run time linking.
2587       library_names_spec='${libname}${release}.a $libname.a'
2588       soname_spec='${libname}${release}.so$major'
2589     fi
2590     shlibpath_var=LIBPATH
2591     deplibs_check_method=pass_all
2592   fi
2593   ;;
2594
2595 amigaos*)
2596   library_names_spec='$libname.ixlibrary $libname.a'
2597   # Create ${libname}_ixlibrary.a entries in /sys/libs.
2598   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'
2599   ;;
2600
2601 beos*)
2602   library_names_spec='${libname}.so'
2603   dynamic_linker="$host_os ld.so"
2604   shlibpath_var=LIBRARY_PATH
2605   ;;
2606
2607 bsdi4*)
2608   version_type=linux
2609   need_version=no
2610   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2611   soname_spec='${libname}${release}.so$major'
2612   finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
2613   shlibpath_var=LD_LIBRARY_PATH
2614   sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
2615   sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
2616   export_dynamic_flag_spec=-rdynamic
2617   # the default ld.so.conf also contains /usr/contrib/lib and
2618   # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
2619   # libtool to hard-code these into programs
2620   ;;
2621
2622 cygwin* | mingw* | pw32*)
2623   version_type=windows
2624   need_version=no
2625   need_lib_prefix=no
2626   case $GCC,$host_os in
2627   yes,cygwin*)
2628     library_names_spec='$libname.dll.a'
2629     soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll'
2630     postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
2631       dldir=$destdir/`dirname \$dlpath`~
2632       test -d \$dldir || mkdir -p \$dldir~
2633       $install_prog .libs/$dlname \$dldir/$dlname'
2634     postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
2635       dlpath=$dir/\$dldll~
2636        $rm \$dlpath'
2637     ;;
2638   yes,mingw*)
2639     library_names_spec='${libname}`echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll'
2640     sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
2641     ;;
2642   yes,pw32*)
2643     library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
2644     ;;
2645   *)
2646     library_names_spec='${libname}`echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll $libname.lib'
2647     ;;
2648   esac
2649   dynamic_linker='Win32 ld.exe'
2650   # FIXME: first we should search . and the directory the executable is in
2651   shlibpath_var=PATH
2652   ;;
2653
2654 darwin* | rhapsody*)
2655   dynamic_linker="$host_os dyld"
2656   version_type=darwin
2657   need_lib_prefix=no
2658   need_version=no
2659   # FIXME: Relying on posixy $() will cause problems for
2660   #        cross-compilation, but unfortunately the echo tests do not
2661   #        yet detect zsh echo's removal of \ escapes.
2662   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)'
2663   soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
2664   shlibpath_overrides_runpath=yes
2665   shlibpath_var=DYLD_LIBRARY_PATH
2666   ;;
2667
2668 freebsd1*)
2669   dynamic_linker=no
2670   ;;
2671
2672 freebsd*)
2673   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
2674   version_type=freebsd-$objformat
2675   case $version_type in
2676     freebsd-elf*)
2677       library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
2678       need_version=no
2679       need_lib_prefix=no
2680       ;;
2681     freebsd-*)
2682       library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
2683       need_version=yes
2684       ;;
2685   esac
2686   shlibpath_var=LD_LIBRARY_PATH
2687   case $host_os in
2688   freebsd2*)
2689     shlibpath_overrides_runpath=yes
2690     ;;
2691   *)
2692     shlibpath_overrides_runpath=no
2693     hardcode_into_libs=yes
2694     ;;
2695   esac
2696   ;;
2697
2698 gnu*)
2699   version_type=linux
2700   need_lib_prefix=no
2701   need_version=no
2702   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
2703   soname_spec='${libname}${release}.so$major'
2704   shlibpath_var=LD_LIBRARY_PATH
2705   hardcode_into_libs=yes
2706   ;;
2707
2708 hpux9* | hpux10* | hpux11*)
2709   # Give a soname corresponding to the major version so that dld.sl refuses to
2710   # link against other versions.
2711   dynamic_linker="$host_os dld.sl"
2712   version_type=sunos
2713   need_lib_prefix=no
2714   need_version=no
2715   shlibpath_var=SHLIB_PATH
2716   shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
2717   library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
2718   soname_spec='${libname}${release}.sl$major'
2719   # HP-UX runs *really* slowly unless shared libraries are mode 555.
2720   postinstall_cmds='chmod 555 $lib'
2721   ;;
2722
2723 irix5* | irix6*)
2724   version_type=irix
2725   need_lib_prefix=no
2726   need_version=no
2727   soname_spec='${libname}${release}.so$major'
2728   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
2729   case $host_os in
2730   irix5*)
2731     libsuff= shlibsuff=
2732     ;;
2733   *)
2734     case $LD in # libtool.m4 will add one of these switches to LD
2735     *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
2736     *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
2737     *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
2738     *) libsuff= shlibsuff= libmagic=never-match;;
2739     esac
2740     ;;
2741   esac
2742   shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
2743   shlibpath_overrides_runpath=no
2744   sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
2745   sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
2746   ;;
2747
2748 # No shared lib support for Linux oldld, aout, or coff.
2749 linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
2750   dynamic_linker=no
2751   ;;
2752
2753 # This must be Linux ELF.
2754 linux-gnu*)
2755   version_type=linux
2756   need_lib_prefix=no
2757   need_version=no
2758   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2759   soname_spec='${libname}${release}.so$major'
2760   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
2761   shlibpath_var=LD_LIBRARY_PATH
2762   shlibpath_overrides_runpath=no
2763   # This implies no fast_install, which is unacceptable.
2764   # Some rework will be needed to allow for fast_install
2765   # before this can be enabled.
2766   hardcode_into_libs=yes
2767
2768   # We used to test for /lib/ld.so.1 and disable shared libraries on
2769   # powerpc, because MkLinux only supported shared libraries with the
2770   # GNU dynamic linker.  Since this was broken with cross compilers,
2771   # most powerpc-linux boxes support dynamic linking these days and
2772   # people can always --disable-shared, the test was removed, and we
2773   # assume the GNU/Linux dynamic linker is in use.
2774   dynamic_linker='GNU/Linux ld.so'
2775   ;;
2776
2777 netbsd*)
2778   version_type=sunos
2779   need_lib_prefix=no
2780   need_version=no
2781   if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
2782     library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
2783     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
2784     dynamic_linker='NetBSD (a.out) ld.so'
2785   else
2786     library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
2787     soname_spec='${libname}${release}.so$major'
2788     dynamic_linker='NetBSD ld.elf_so'
2789   fi
2790   shlibpath_var=LD_LIBRARY_PATH
2791   shlibpath_overrides_runpath=yes
2792   hardcode_into_libs=yes
2793   ;;
2794
2795 newsos6)
2796   version_type=linux
2797   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2798   shlibpath_var=LD_LIBRARY_PATH
2799   shlibpath_overrides_runpath=yes
2800   ;;
2801
2802 openbsd*)
2803   version_type=sunos
2804   if test "$with_gnu_ld" = yes; then
2805     need_lib_prefix=no
2806     need_version=no
2807   fi
2808   library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
2809   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
2810   shlibpath_var=LD_LIBRARY_PATH
2811   ;;
2812
2813 os2*)
2814   libname_spec='$name'
2815   need_lib_prefix=no
2816   library_names_spec='$libname.dll $libname.a'
2817   dynamic_linker='OS/2 ld.exe'
2818   shlibpath_var=LIBPATH
2819   ;;
2820
2821 osf3* | osf4* | osf5*)
2822   version_type=osf
2823   need_version=no
2824   soname_spec='${libname}${release}.so'
2825   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
2826   shlibpath_var=LD_LIBRARY_PATH
2827   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
2828   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
2829   ;;
2830
2831 sco3.2v5*)
2832   version_type=osf
2833   soname_spec='${libname}${release}.so$major'
2834   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2835   shlibpath_var=LD_LIBRARY_PATH
2836   ;;
2837
2838 solaris*)
2839   version_type=linux
2840   need_lib_prefix=no
2841   need_version=no
2842   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2843   soname_spec='${libname}${release}.so$major'
2844   shlibpath_var=LD_LIBRARY_PATH
2845   shlibpath_overrides_runpath=yes
2846   hardcode_into_libs=yes
2847   # ldd complains unless libraries are executable
2848   postinstall_cmds='chmod +x $lib'
2849   ;;
2850
2851 sunos4*)
2852   version_type=sunos
2853   library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
2854   finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
2855   shlibpath_var=LD_LIBRARY_PATH
2856   shlibpath_overrides_runpath=yes
2857   if test "$with_gnu_ld" = yes; then
2858     need_lib_prefix=no
2859   fi
2860   need_version=yes
2861   ;;
2862
2863 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
2864   version_type=linux
2865   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2866   soname_spec='${libname}${release}.so$major'
2867   shlibpath_var=LD_LIBRARY_PATH
2868   case $host_vendor in
2869     sni)
2870       shlibpath_overrides_runpath=no
2871       ;;
2872     motorola)
2873       need_lib_prefix=no
2874       need_version=no
2875       shlibpath_overrides_runpath=no
2876       sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
2877       ;;
2878   esac
2879   ;;
2880
2881 uts4*)
2882   version_type=linux
2883   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2884   soname_spec='${libname}${release}.so$major'
2885   shlibpath_var=LD_LIBRARY_PATH
2886   ;;
2887
2888 dgux*)
2889   version_type=linux
2890   need_lib_prefix=no
2891   need_version=no
2892   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2893   soname_spec='${libname}${release}.so$major'
2894   shlibpath_var=LD_LIBRARY_PATH
2895   ;;
2896
2897 sysv4*MP*)
2898   if test -d /usr/nec ;then
2899     version_type=linux
2900     library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
2901     soname_spec='$libname.so.$major'
2902     shlibpath_var=LD_LIBRARY_PATH
2903   fi
2904   ;;
2905
2906 *)
2907   dynamic_linker=no
2908   ;;
2909 esac
2910 AC_MSG_RESULT([$dynamic_linker])
2911 test "$dynamic_linker" = no && can_build_shared=no
2912 ##
2913 ## END FIXME
2914
2915 ## FIXME: this should be a separate macro
2916 ##
2917 # Report the final consequences.
2918 AC_MSG_CHECKING([if libtool supports shared libraries])
2919 AC_MSG_RESULT([$can_build_shared])
2920 ##
2921 ## END FIXME
2922
2923 if test "$hardcode_action" = relink; then
2924   # Fast installation is not supported
2925   enable_fast_install=no
2926 elif test "$shlibpath_overrides_runpath" = yes ||
2927      test "$enable_shared" = no; then
2928   # Fast installation is not necessary
2929   enable_fast_install=needless
2930 fi
2931
2932 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
2933 if test "$GCC" = yes; then
2934   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
2935 fi
2936
2937 AC_LIBTOOL_DLOPEN_SELF
2938
2939 ## FIXME: this should be a separate macro
2940 ##
2941 if test "$enable_shared" = yes && test "$GCC" = yes; then
2942   case $archive_cmds in
2943   *'~'*)
2944     # FIXME: we may have to deal with multi-command sequences.
2945     ;;
2946   '$CC '*)
2947     # Test whether the compiler implicitly links with -lc since on some
2948     # systems, -lgcc has to come before -lc. If gcc already passes -lc
2949     # to ld, don't add -lc before -lgcc.
2950     AC_MSG_CHECKING([whether -lc should be explicitly linked in])
2951     AC_CACHE_VAL([lt_cv_archive_cmds_need_lc],
2952     [$rm conftest*
2953     echo 'static int dummy;' > conftest.$ac_ext
2954
2955     if AC_TRY_EVAL(ac_compile); then
2956       soname=conftest
2957       lib=conftest
2958       libobjs=conftest.$ac_objext
2959       deplibs=
2960       wl=$lt_cv_prog_cc_wl
2961       compiler_flags=-v
2962       linker_flags=-v
2963       verstring=
2964       output_objdir=.
2965       libname=conftest
2966       save_allow_undefined_flag=$allow_undefined_flag
2967       allow_undefined_flag=
2968       if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
2969       then
2970         lt_cv_archive_cmds_need_lc=no
2971       else
2972         lt_cv_archive_cmds_need_lc=yes
2973       fi
2974       allow_undefined_flag=$save_allow_undefined_flag
2975     else
2976       cat conftest.err 1>&5
2977     fi])
2978     AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc])
2979     ;;
2980   esac
2981 fi
2982 need_lc=${lt_cv_archive_cmds_need_lc-yes}
2983 ##
2984 ## END FIXME
2985
2986 ## FIXME: this should be a separate macro
2987 ##
2988 # The second clause should only fire when bootstrapping the
2989 # libtool distribution, otherwise you forgot to ship ltmain.sh
2990 # with your package, and you will get complaints that there are
2991 # no rules to generate ltmain.sh.
2992 if test -f "$ltmain"; then
2993   :
2994 else
2995   # If there is no Makefile yet, we rely on a make rule to execute
2996   # `config.status --recheck' to rerun these tests and create the
2997   # libtool script then.
2998   test -f Makefile && make "$ltmain"
2999 fi
3000
3001 if test -f "$ltmain"; then
3002   trap "$rm \"${ofile}T\"; exit 1" 1 2 15
3003   $rm -f "${ofile}T"
3004
3005   echo creating $ofile
3006
3007   # Now quote all the things that may contain metacharacters while being
3008   # careful not to overquote the AC_SUBSTed values.  We take copies of the
3009   # variables and quote the copies for generation of the libtool script.
3010   for var in echo old_CC old_CFLAGS \
3011     AR AR_FLAGS CC LD LN_S NM SHELL \
3012     reload_flag reload_cmds wl \
3013     pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
3014     thread_safe_flag_spec whole_archive_flag_spec libname_spec \
3015     library_names_spec soname_spec \
3016     RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
3017     old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
3018     postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
3019     old_striplib striplib file_magic_cmd export_symbols_cmds \
3020     deplibs_check_method allow_undefined_flag no_undefined_flag \
3021     finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
3022     hardcode_libdir_flag_spec hardcode_libdir_separator  \
3023     sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
3024     compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
3025
3026     case $var in
3027     reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
3028     old_postinstall_cmds | old_postuninstall_cmds | \
3029     export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
3030     extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
3031     postinstall_cmds | postuninstall_cmds | \
3032     finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
3033       # Double-quote double-evaled strings.
3034       eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
3035       ;;
3036     *)
3037       eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
3038       ;;
3039     esac
3040   done
3041
3042   cat <<__EOF__ > "${ofile}T"
3043 #! $SHELL
3044
3045 # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
3046 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
3047 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
3048 #
3049 # Copyright (C) 1996-2000 Free Software Foundation, Inc.
3050 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
3051 #
3052 # This program is free software; you can redistribute it and/or modify
3053 # it under the terms of the GNU General Public License as published by
3054 # the Free Software Foundation; either version 2 of the License, or
3055 # (at your option) any later version.
3056 #
3057 # This program is distributed in the hope that it will be useful, but
3058 # WITHOUT ANY WARRANTY; without even the implied warranty of
3059 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3060 # General Public License for more details.
3061 #
3062 # You should have received a copy of the GNU General Public License
3063 # along with this program; if not, write to the Free Software
3064 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3065 #
3066 # As a special exception to the GNU General Public License, if you
3067 # distribute this file as part of a program that contains a
3068 # configuration script generated by Autoconf, you may include it under
3069 # the same distribution terms that you use for the rest of that program.
3070
3071 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
3072 Xsed="sed -e s/^X//"
3073
3074 # The HP-UX ksh and POSIX shell print the target directory to stdout
3075 # if CDPATH is set.
3076 if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
3077
3078 # ### BEGIN LIBTOOL CONFIG
3079
3080 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
3081
3082 # Shell to use when invoking shell scripts.
3083 SHELL=$lt_SHELL
3084
3085 # Whether or not to build shared libraries.
3086 build_libtool_libs=$enable_shared
3087
3088 # Whether or not to add -lc for building shared libraries.
3089 build_libtool_need_lc=$need_lc
3090
3091 # Whether or not to build static libraries.
3092 build_old_libs=$enable_static
3093
3094 # Whether or not to optimize for fast installation.
3095 fast_install=$enable_fast_install
3096
3097 # The host system.
3098 host_alias=$host_alias
3099 host=$host
3100
3101 # An echo program that does not interpret backslashes.
3102 echo=$lt_echo
3103
3104 # The archiver.
3105 AR=$lt_AR
3106 AR_FLAGS=$lt_AR_FLAGS
3107
3108 # The default C compiler.
3109 CC=$lt_CC
3110
3111 # Is the compiler the GNU C compiler?
3112 with_gcc=$GCC
3113
3114 # The linker used to build libraries.
3115 LD=$lt_LD
3116
3117 # Whether we need hard or soft links.
3118 LN_S=$lt_LN_S
3119
3120 # A BSD-compatible nm program.
3121 NM=$lt_NM
3122
3123 # A symbol stripping program
3124 STRIP=$STRIP
3125
3126 # Used to examine libraries when file_magic_cmd begins "file"
3127 MAGIC_CMD=$MAGIC_CMD
3128
3129 # Used on cygwin: DLL creation program.
3130 DLLTOOL="$DLLTOOL"
3131
3132 # Used on cygwin: object dumper.
3133 OBJDUMP="$OBJDUMP"
3134
3135 # Used on cygwin: assembler.
3136 AS="$AS"
3137
3138 # The name of the directory that contains temporary libtool files.
3139 objdir=$objdir
3140
3141 # How to create reloadable object files.
3142 reload_flag=$lt_reload_flag
3143 reload_cmds=$lt_reload_cmds
3144
3145 # How to pass a linker flag through the compiler.
3146 wl=$lt_wl
3147
3148 # Object file suffix (normally "o").
3149 objext="$ac_objext"
3150
3151 # Old archive suffix (normally "a").
3152 libext="$libext"
3153
3154 # Executable file suffix (normally "").
3155 exeext="$exeext"
3156
3157 # Additional compiler flags for building library objects.
3158 pic_flag=$lt_pic_flag
3159 pic_mode=$pic_mode
3160
3161 # Does compiler simultaneously support -c and -o options?
3162 compiler_c_o=$lt_compiler_c_o
3163
3164 # Can we write directly to a .lo ?
3165 compiler_o_lo=$lt_compiler_o_lo
3166
3167 # Must we lock files when doing compilation ?
3168 need_locks=$lt_need_locks
3169
3170 # Do we need the lib prefix for modules?
3171 need_lib_prefix=$need_lib_prefix
3172
3173 # Do we need a version for libraries?
3174 need_version=$need_version
3175
3176 # Whether dlopen is supported.
3177 dlopen_support=$enable_dlopen
3178
3179 # Whether dlopen of programs is supported.
3180 dlopen_self=$enable_dlopen_self
3181
3182 # Whether dlopen of statically linked programs is supported.
3183 dlopen_self_static=$enable_dlopen_self_static
3184
3185 # Compiler flag to prevent dynamic linking.
3186 link_static_flag=$lt_link_static_flag
3187
3188 # Compiler flag to turn off builtin functions.
3189 no_builtin_flag=$lt_no_builtin_flag
3190
3191 # Compiler flag to allow reflexive dlopens.
3192 export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
3193
3194 # Compiler flag to generate shared objects directly from archives.
3195 whole_archive_flag_spec=$lt_whole_archive_flag_spec
3196
3197 # Compiler flag to generate thread-safe objects.
3198 thread_safe_flag_spec=$lt_thread_safe_flag_spec
3199
3200 # Library versioning type.
3201 version_type=$version_type
3202
3203 # Format of library name prefix.
3204 libname_spec=$lt_libname_spec
3205
3206 # List of archive names.  First name is the real one, the rest are links.
3207 # The last name is the one that the linker finds with -lNAME.
3208 library_names_spec=$lt_library_names_spec
3209
3210 # The coded name of the library, if different from the real name.
3211 soname_spec=$lt_soname_spec
3212
3213 # Commands used to build and install an old-style archive.
3214 RANLIB=$lt_RANLIB
3215 old_archive_cmds=$lt_old_archive_cmds
3216 old_postinstall_cmds=$lt_old_postinstall_cmds
3217 old_postuninstall_cmds=$lt_old_postuninstall_cmds
3218
3219 # Create an old-style archive from a shared archive.
3220 old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
3221
3222 # Create a temporary old-style archive to link instead of a shared archive.
3223 old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
3224
3225 # Commands used to build and install a shared archive.
3226 archive_cmds=$lt_archive_cmds
3227 archive_expsym_cmds=$lt_archive_expsym_cmds
3228 postinstall_cmds=$lt_postinstall_cmds
3229 postuninstall_cmds=$lt_postuninstall_cmds
3230
3231 # Commands to strip libraries.
3232 old_striplib=$lt_old_striplib
3233 striplib=$lt_striplib
3234
3235 # Method to check whether dependent libraries are shared objects.
3236 deplibs_check_method=$lt_deplibs_check_method
3237
3238 # Command to use when deplibs_check_method == file_magic.
3239 file_magic_cmd=$lt_file_magic_cmd
3240
3241 # Flag that allows shared libraries with undefined symbols to be built.
3242 allow_undefined_flag=$lt_allow_undefined_flag
3243
3244 # Flag that forces no undefined symbols.
3245 no_undefined_flag=$lt_no_undefined_flag
3246
3247 # Commands used to finish a libtool library installation in a directory.
3248 finish_cmds=$lt_finish_cmds
3249
3250 # Same as above, but a single script fragment to be evaled but not shown.
3251 finish_eval=$lt_finish_eval
3252
3253 # Take the output of nm and produce a listing of raw symbols and C names.
3254 global_symbol_pipe=$lt_global_symbol_pipe
3255
3256 # Transform the output of nm in a proper C declaration
3257 global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
3258
3259 # This is the shared library runtime path variable.
3260 runpath_var=$runpath_var
3261
3262 # This is the shared library path variable.
3263 shlibpath_var=$shlibpath_var
3264
3265 # Is shlibpath searched before the hard-coded library search path?
3266 shlibpath_overrides_runpath=$shlibpath_overrides_runpath
3267
3268 # How to hardcode a shared library path into an executable.
3269 hardcode_action=$hardcode_action
3270
3271 # Whether we should hardcode library paths into libraries.
3272 hardcode_into_libs=$hardcode_into_libs
3273
3274 # Flag to hardcode \$libdir into a binary during linking.
3275 # This must work even if \$libdir does not exist.
3276 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
3277
3278 # Whether we need a single -rpath flag with a separated argument.
3279 hardcode_libdir_separator=$lt_hardcode_libdir_separator
3280
3281 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
3282 # resulting binary.
3283 hardcode_direct=$hardcode_direct
3284
3285 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
3286 # resulting binary.
3287 hardcode_minus_L=$hardcode_minus_L
3288
3289 # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
3290 # the resulting binary.
3291 hardcode_shlibpath_var=$hardcode_shlibpath_var
3292
3293 # Variables whose values should be saved in libtool wrapper scripts and
3294 # restored at relink time.
3295 variables_saved_for_relink="$variables_saved_for_relink"
3296
3297 # Whether libtool must link a program against all its dependency libraries.
3298 link_all_deplibs=$link_all_deplibs
3299
3300 # Compile-time system search path for libraries
3301 sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
3302
3303 # Run-time system search path for libraries
3304 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
3305
3306 # Fix the shell variable \$srcfile for the compiler.
3307 fix_srcfile_path="$fix_srcfile_path"
3308
3309 # Set to yes if exported symbols are required.
3310 always_export_symbols=$always_export_symbols
3311
3312 # The commands to list exported symbols.
3313 export_symbols_cmds=$lt_export_symbols_cmds
3314
3315 # The commands to extract the exported symbol list from a shared archive.
3316 extract_expsyms_cmds=$lt_extract_expsyms_cmds
3317
3318 # Symbols that should not be listed in the preloaded symbols.
3319 exclude_expsyms=$lt_exclude_expsyms
3320
3321 # Symbols that must always be exported.
3322 include_expsyms=$lt_include_expsyms
3323
3324 # ### END LIBTOOL CONFIG
3325
3326 __EOF__
3327
3328   case $host_os in
3329   aix3*)
3330     cat <<\EOF >> "${ofile}T"
3331
3332 # AIX sometimes has problems with the GCC collect2 program.  For some
3333 # reason, if we set the COLLECT_NAMES environment variable, the problems
3334 # vanish in a puff of smoke.
3335 if test "X${COLLECT_NAMES+set}" != Xset; then
3336   COLLECT_NAMES=
3337   export COLLECT_NAMES
3338 fi
3339 EOF
3340     ;;
3341   esac
3342
3343   case $host_os in
3344   cygwin* | mingw* | pw32* | os2*)
3345     cat <<'EOF' >> "${ofile}T"
3346       # This is a source program that is used to create dlls on Windows
3347       # Don't remove nor modify the starting and closing comments
3348 # /* ltdll.c starts here */
3349 # #define WIN32_LEAN_AND_MEAN
3350 # #include <windows.h>
3351 # #undef WIN32_LEAN_AND_MEAN
3352 # #include <stdio.h>
3353 #
3354 # #ifndef __CYGWIN__
3355 # #  ifdef __CYGWIN32__
3356 # #    define __CYGWIN__ __CYGWIN32__
3357 # #  endif
3358 # #endif
3359 #
3360 # #ifdef __cplusplus
3361 # extern "C" {
3362 # #endif
3363 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
3364 # #ifdef __cplusplus
3365 # }
3366 # #endif
3367 #
3368 # #ifdef __CYGWIN__
3369 # #include <cygwin/cygwin_dll.h>
3370 # DECLARE_CYGWIN_DLL( DllMain );
3371 # #endif
3372 # HINSTANCE __hDllInstance_base;
3373 #
3374 # BOOL APIENTRY
3375 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
3376 # {
3377 #   __hDllInstance_base = hInst;
3378 #   return TRUE;
3379 # }
3380 # /* ltdll.c ends here */
3381         # This is a source program that is used to create import libraries
3382         # on Windows for dlls which lack them. Don't remove nor modify the
3383         # starting and closing comments
3384 # /* impgen.c starts here */
3385 # /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
3386 #
3387 #  This file is part of GNU libtool.
3388 #
3389 #  This program is free software; you can redistribute it and/or modify
3390 #  it under the terms of the GNU General Public License as published by
3391 #  the Free Software Foundation; either version 2 of the License, or
3392 #  (at your option) any later version.
3393 #
3394 #  This program is distributed in the hope that it will be useful,
3395 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
3396 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3397 #  GNU General Public License for more details.
3398 #
3399 #  You should have received a copy of the GNU General Public License
3400 #  along with this program; if not, write to the Free Software
3401 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3402 #  */
3403 #
3404 # #include <stdio.h>            /* for printf() */
3405 # #include <unistd.h>           /* for open(), lseek(), read() */
3406 # #include <fcntl.h>            /* for O_RDONLY, O_BINARY */
3407 # #include <string.h>           /* for strdup() */
3408 #
3409 # /* O_BINARY isn't required (or even defined sometimes) under Unix */
3410 # #ifndef O_BINARY
3411 # #define O_BINARY 0
3412 # #endif
3413 #
3414 # static unsigned int
3415 # pe_get16 (fd, offset)
3416 #      int fd;
3417 #      int offset;
3418 # {
3419 #   unsigned char b[2];
3420 #   lseek (fd, offset, SEEK_SET);
3421 #   read (fd, b, 2);
3422 #   return b[0] + (b[1]<<8);
3423 # }
3424 #
3425 # static unsigned int
3426 # pe_get32 (fd, offset)
3427 #     int fd;
3428 #     int offset;
3429 # {
3430 #   unsigned char b[4];
3431 #   lseek (fd, offset, SEEK_SET);
3432 #   read (fd, b, 4);
3433 #   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
3434 # }
3435 #
3436 # static unsigned int
3437 # pe_as32 (ptr)
3438 #      void *ptr;
3439 # {
3440 #   unsigned char *b = ptr;
3441 #   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
3442 # }
3443 #
3444 # int
3445 # main (argc, argv)
3446 #     int argc;
3447 #     char *argv[];
3448 # {
3449 #     int dll;
3450 #     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
3451 #     unsigned long export_rva, export_size, nsections, secptr, expptr;
3452 #     unsigned long name_rvas, nexp;
3453 #     unsigned char *expdata, *erva;
3454 #     char *filename, *dll_name;
3455 #
3456 #     filename = argv[1];
3457 #
3458 #     dll = open(filename, O_RDONLY|O_BINARY);
3459 #     if (dll < 1)
3460 #       return 1;
3461 #
3462 #     dll_name = filename;
3463 #
3464 #     for (i=0; filename[i]; i++)
3465 #       if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
3466 #           dll_name = filename + i +1;
3467 #
3468 #     pe_header_offset = pe_get32 (dll, 0x3c);
3469 #     opthdr_ofs = pe_header_offset + 4 + 20;
3470 #     num_entries = pe_get32 (dll, opthdr_ofs + 92);
3471 #
3472 #     if (num_entries < 1) /* no exports */
3473 #       return 1;
3474 #
3475 #     export_rva = pe_get32 (dll, opthdr_ofs + 96);
3476 #     export_size = pe_get32 (dll, opthdr_ofs + 100);
3477 #     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
3478 #     secptr = (pe_header_offset + 4 + 20 +
3479 #             pe_get16 (dll, pe_header_offset + 4 + 16));
3480 #
3481 #     expptr = 0;
3482 #     for (i = 0; i < nsections; i++)
3483 #     {
3484 #       char sname[8];
3485 #       unsigned long secptr1 = secptr + 40 * i;
3486 #       unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
3487 #       unsigned long vsize = pe_get32 (dll, secptr1 + 16);
3488 #       unsigned long fptr = pe_get32 (dll, secptr1 + 20);
3489 #       lseek(dll, secptr1, SEEK_SET);
3490 #       read(dll, sname, 8);
3491 #       if (vaddr <= export_rva && vaddr+vsize > export_rva)
3492 #       {
3493 #           expptr = fptr + (export_rva - vaddr);
3494 #           if (export_rva + export_size > vaddr + vsize)
3495 #               export_size = vsize - (export_rva - vaddr);
3496 #           break;
3497 #       }
3498 #     }
3499 #
3500 #     expdata = (unsigned char*)malloc(export_size);
3501 #     lseek (dll, expptr, SEEK_SET);
3502 #     read (dll, expdata, export_size);
3503 #     erva = expdata - export_rva;
3504 #
3505 #     nexp = pe_as32 (expdata+24);
3506 #     name_rvas = pe_as32 (expdata+32);
3507 #
3508 #     printf ("EXPORTS\n");
3509 #     for (i = 0; i<nexp; i++)
3510 #     {
3511 #       unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
3512 #       printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
3513 #     }
3514 #
3515 #     return 0;
3516 # }
3517 # /* impgen.c ends here */
3518
3519 EOF
3520     ;;
3521   esac
3522
3523   # We use sed instead of cat because bash on DJGPP gets confused if
3524   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
3525   # text mode, it properly converts lines to CR/LF.  This bash problem
3526   # is reportedly fixed, but why not run on old versions too?
3527   sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
3528
3529   mv -f "${ofile}T" "$ofile" || \
3530     (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
3531   chmod +x "$ofile"
3532 fi
3533 ##
3534 ## END FIXME
3535
3536 ])# _LT_AC_LTCONFIG_HACK
3537
3538 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
3539 AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
3540
3541 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
3542 AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
3543
3544 # AC_ENABLE_SHARED - implement the --enable-shared flag
3545 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
3546 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
3547 #   `yes'.
3548 AC_DEFUN([AC_ENABLE_SHARED],
3549 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
3550 AC_ARG_ENABLE(shared,
3551 changequote(<<, >>)dnl
3552 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
3553 changequote([, ])dnl
3554 [p=${PACKAGE-default}
3555 case $enableval in
3556 yes) enable_shared=yes ;;
3557 no) enable_shared=no ;;
3558 *)
3559   enable_shared=no
3560   # Look at the argument we got.  We use all the common list separators.
3561   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
3562   for pkg in $enableval; do
3563     if test "X$pkg" = "X$p"; then
3564       enable_shared=yes
3565     fi
3566   done
3567   IFS="$ac_save_ifs"
3568   ;;
3569 esac],
3570 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
3571 ])
3572
3573 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
3574 AC_DEFUN([AC_DISABLE_SHARED],
3575 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
3576 AC_ENABLE_SHARED(no)])
3577
3578 # AC_ENABLE_STATIC - implement the --enable-static flag
3579 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
3580 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
3581 #   `yes'.
3582 AC_DEFUN([AC_ENABLE_STATIC],
3583 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
3584 AC_ARG_ENABLE(static,
3585 changequote(<<, >>)dnl
3586 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
3587 changequote([, ])dnl
3588 [p=${PACKAGE-default}
3589 case $enableval in
3590 yes) enable_static=yes ;;
3591 no) enable_static=no ;;
3592 *)
3593   enable_static=no
3594   # Look at the argument we got.  We use all the common list separators.
3595   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
3596   for pkg in $enableval; do
3597     if test "X$pkg" = "X$p"; then
3598       enable_static=yes
3599     fi
3600   done
3601   IFS="$ac_save_ifs"
3602   ;;
3603 esac],
3604 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
3605 ])
3606
3607 # AC_DISABLE_STATIC - set the default static flag to --disable-static
3608 AC_DEFUN([AC_DISABLE_STATIC],
3609 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
3610 AC_ENABLE_STATIC(no)])
3611
3612
3613 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
3614 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
3615 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
3616 #   `yes'.
3617 AC_DEFUN([AC_ENABLE_FAST_INSTALL],
3618 [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
3619 AC_ARG_ENABLE(fast-install,
3620 changequote(<<, >>)dnl
3621 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
3622 changequote([, ])dnl
3623 [p=${PACKAGE-default}
3624 case $enableval in
3625 yes) enable_fast_install=yes ;;
3626 no) enable_fast_install=no ;;
3627 *)
3628   enable_fast_install=no
3629   # Look at the argument we got.  We use all the common list separators.
3630   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
3631   for pkg in $enableval; do
3632     if test "X$pkg" = "X$p"; then
3633       enable_fast_install=yes
3634     fi
3635   done
3636   IFS="$ac_save_ifs"
3637   ;;
3638 esac],
3639 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
3640 ])
3641
3642 # AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
3643 AC_DEFUN([AC_DISABLE_FAST_INSTALL],
3644 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
3645 AC_ENABLE_FAST_INSTALL(no)])
3646
3647 # AC_LIBTOOL_PICMODE - implement the --with-pic flag
3648 # Usage: AC_LIBTOOL_PICMODE[(MODE)]
3649 #   Where MODE is either `yes' or `no'.  If omitted, it defaults to
3650 #   `both'.
3651 AC_DEFUN([AC_LIBTOOL_PICMODE],
3652 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
3653 pic_mode=ifelse($#,1,$1,default)])
3654
3655
3656 # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
3657 AC_DEFUN([AC_PATH_TOOL_PREFIX],
3658 [AC_MSG_CHECKING([for $1])
3659 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
3660 [case $MAGIC_CMD in
3661   /*)
3662   lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
3663   ;;
3664   ?:/*)
3665   lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
3666   ;;
3667   *)
3668   ac_save_MAGIC_CMD="$MAGIC_CMD"
3669   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
3670 dnl $ac_dummy forces splitting on constant user-supplied paths.
3671 dnl POSIX.2 word splitting is done only on the output of word expansions,
3672 dnl not every word.  This closes a longstanding sh security hole.
3673   ac_dummy="ifelse([$2], , $PATH, [$2])"
3674   for ac_dir in $ac_dummy; do
3675     test -z "$ac_dir" && ac_dir=.
3676     if test -f $ac_dir/$1; then
3677       lt_cv_path_MAGIC_CMD="$ac_dir/$1"
3678       if test -n "$file_magic_test_file"; then
3679         case $deplibs_check_method in
3680         "file_magic "*)
3681           file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
3682           MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
3683           if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
3684             egrep "$file_magic_regex" > /dev/null; then
3685             :
3686           else
3687             cat <<EOF 1>&2
3688
3689 *** Warning: the command libtool uses to detect shared libraries,
3690 *** $file_magic_cmd, produces output that libtool cannot recognize.
3691 *** The result is that libtool may fail to recognize shared libraries
3692 *** as such.  This will affect the creation of libtool libraries that
3693 *** depend on shared libraries, but programs linked with such libtool
3694 *** libraries will work regardless of this problem.  Nevertheless, you
3695 *** may want to report the problem to your system manager and/or to
3696 *** bug-libtool@gnu.org
3697
3698 EOF
3699           fi ;;
3700         esac
3701       fi
3702       break
3703     fi
3704   done
3705   IFS="$ac_save_ifs"
3706   MAGIC_CMD="$ac_save_MAGIC_CMD"
3707   ;;
3708 esac])
3709 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
3710 if test -n "$MAGIC_CMD"; then
3711   AC_MSG_RESULT($MAGIC_CMD)
3712 else
3713   AC_MSG_RESULT(no)
3714 fi
3715 ])
3716
3717
3718 # AC_PATH_MAGIC - find a file program which can recognise a shared library
3719 AC_DEFUN([AC_PATH_MAGIC],
3720 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
3721 AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
3722 if test -z "$lt_cv_path_MAGIC_CMD"; then
3723   if test -n "$ac_tool_prefix"; then
3724     AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
3725   else
3726     MAGIC_CMD=:
3727   fi
3728 fi
3729 ])
3730
3731
3732 # AC_PROG_LD - find the path to the GNU or non-GNU linker
3733 AC_DEFUN([AC_PROG_LD],
3734 [AC_ARG_WITH(gnu-ld,
3735 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
3736 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
3737 AC_REQUIRE([AC_PROG_CC])dnl
3738 AC_REQUIRE([AC_CANONICAL_HOST])dnl
3739 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
3740 ac_prog=ld
3741 if test "$GCC" = yes; then
3742   # Check if gcc -print-prog-name=ld gives a path.
3743   AC_MSG_CHECKING([for ld used by GCC])
3744   case $host in
3745   *-*-mingw*)
3746     # gcc leaves a trailing carriage return which upsets mingw
3747     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
3748   *)
3749     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
3750   esac
3751   case $ac_prog in
3752     # Accept absolute paths.
3753     [[\\/]* | [A-Za-z]:[\\/]*)]
3754       [re_direlt='/[^/][^/]*/\.\./']
3755       # Canonicalize the path of ld
3756       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
3757       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
3758         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
3759       done
3760       test -z "$LD" && LD="$ac_prog"
3761       ;;
3762   "")
3763     # If it fails, then pretend we aren't using GCC.
3764     ac_prog=ld
3765     ;;
3766   *)
3767     # If it is relative, then search for the first ld in PATH.
3768     with_gnu_ld=unknown
3769     ;;
3770   esac
3771 elif test "$with_gnu_ld" = yes; then
3772   AC_MSG_CHECKING([for GNU ld])
3773 else
3774   AC_MSG_CHECKING([for non-GNU ld])
3775 fi
3776 AC_CACHE_VAL(lt_cv_path_LD,
3777 [if test -z "$LD"; then
3778   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
3779   for ac_dir in $PATH; do
3780     test -z "$ac_dir" && ac_dir=.
3781     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
3782       lt_cv_path_LD="$ac_dir/$ac_prog"
3783       # Check to see if the program is GNU ld.  I'd rather use --version,
3784       # but apparently some GNU ld's only accept -v.
3785       # Break only if it was the GNU/non-GNU ld that we prefer.
3786       if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
3787         test "$with_gnu_ld" != no && break
3788       else
3789         test "$with_gnu_ld" != yes && break
3790       fi
3791     fi
3792   done
3793   IFS="$ac_save_ifs"
3794 else
3795   lt_cv_path_LD="$LD" # Let the user override the test with a path.
3796 fi])
3797 LD="$lt_cv_path_LD"
3798 if test -n "$LD"; then
3799   AC_MSG_RESULT($LD)
3800 else
3801   AC_MSG_RESULT(no)
3802 fi
3803 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
3804 AC_PROG_LD_GNU
3805 ])
3806
3807 # AC_PROG_LD_GNU -
3808 AC_DEFUN([AC_PROG_LD_GNU],
3809 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
3810 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
3811 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
3812   lt_cv_prog_gnu_ld=yes
3813 else
3814   lt_cv_prog_gnu_ld=no
3815 fi])
3816 with_gnu_ld=$lt_cv_prog_gnu_ld
3817 ])
3818
3819 # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
3820 #   -- PORTME Some linkers may need a different reload flag.
3821 AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
3822 [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
3823 [lt_cv_ld_reload_flag='-r'])
3824 reload_flag=$lt_cv_ld_reload_flag
3825 test -n "$reload_flag" && reload_flag=" $reload_flag"
3826 ])
3827
3828 # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
3829 #  -- PORTME fill in with the dynamic library characteristics
3830 AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
3831 [AC_CACHE_CHECK([how to recognise dependant libraries],
3832 lt_cv_deplibs_check_method,
3833 [lt_cv_file_magic_cmd='$MAGIC_CMD'
3834 lt_cv_file_magic_test_file=
3835 lt_cv_deplibs_check_method='unknown'
3836 # Need to set the preceding variable on all platforms that support
3837 # interlibrary dependencies.
3838 # 'none' -- dependencies not supported.
3839 # `unknown' -- same as none, but documents that we really don't know.
3840 # 'pass_all' -- all dependencies passed with no checks.
3841 # 'test_compile' -- check by making test program.
3842 # ['file_magic [regex]'] -- check by looking for files in library path
3843 # which responds to the $file_magic_cmd with a given egrep regex.
3844 # If you have `file' or equivalent on your system and you're not sure
3845 # whether `pass_all' will *always* work, you probably want this one.
3846
3847 case $host_os in
3848 aix4* | aix5*)
3849   lt_cv_deplibs_check_method=pass_all
3850   ;;
3851
3852 beos*)
3853   lt_cv_deplibs_check_method=pass_all
3854   ;;
3855
3856 bsdi4*)
3857   [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
3858   lt_cv_file_magic_cmd='/usr/bin/file -L'
3859   lt_cv_file_magic_test_file=/shlib/libc.so
3860   ;;
3861
3862 cygwin* | mingw* | pw32*)
3863   lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
3864   lt_cv_file_magic_cmd='$OBJDUMP -f'
3865   ;;
3866
3867 darwin* | rhapsody*)
3868   lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
3869   lt_cv_file_magic_cmd='/usr/bin/file -L'
3870   case "$host_os" in
3871   rhapsody* | darwin1.[012])
3872     lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
3873     ;;
3874   *) # Darwin 1.3 on
3875     lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
3876     ;;
3877   esac
3878   ;;
3879
3880 freebsd*)
3881   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
3882     case $host_cpu in
3883     i*86 )
3884       # Not sure whether the presence of OpenBSD here was a mistake.
3885       # Let's accept both of them until this is cleared up.
3886       [lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
3887       lt_cv_file_magic_cmd=/usr/bin/file
3888       lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
3889       ;;
3890     esac
3891   else
3892     lt_cv_deplibs_check_method=pass_all
3893   fi
3894   ;;
3895
3896 gnu*)
3897   lt_cv_deplibs_check_method=pass_all
3898   ;;
3899
3900 hpux10.20*|hpux11*)
3901   [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
3902   lt_cv_file_magic_cmd=/usr/bin/file
3903   lt_cv_file_magic_test_file=/usr/lib/libc.sl
3904   ;;
3905
3906 irix5* | irix6*)
3907   case $host_os in
3908   irix5*)
3909     # this will be overridden with pass_all, but let us keep it just in case
3910     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
3911     ;;
3912   *)
3913     case $LD in
3914     *-32|*"-32 ") libmagic=32-bit;;
3915     *-n32|*"-n32 ") libmagic=N32;;
3916     *-64|*"-64 ") libmagic=64-bit;;
3917     *) libmagic=never-match;;
3918     esac
3919     # this will be overridden with pass_all, but let us keep it just in case
3920     [lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
3921     ;;
3922   esac
3923   lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
3924   lt_cv_deplibs_check_method=pass_all
3925   ;;
3926
3927 # This must be Linux ELF.
3928 linux-gnu*)
3929   case $host_cpu in
3930   alpha* | i*86 | powerpc* | sparc* | ia64* )
3931     lt_cv_deplibs_check_method=pass_all ;;
3932   *)
3933     # glibc up to 2.1.1 does not perform some relocations on ARM
3934     [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;]
3935   esac
3936   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
3937   ;;
3938
3939 netbsd*)
3940   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
3941     [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
3942   else
3943     [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$']
3944   fi
3945   ;;
3946
3947 newos6*)
3948   [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
3949   lt_cv_file_magic_cmd=/usr/bin/file
3950   lt_cv_file_magic_test_file=/usr/lib/libnls.so
3951   ;;
3952
3953 osf3* | osf4* | osf5*)
3954   # this will be overridden with pass_all, but let us keep it just in case
3955   lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
3956   lt_cv_file_magic_test_file=/shlib/libc.so
3957   lt_cv_deplibs_check_method=pass_all
3958   ;;
3959
3960 sco3.2v5*)
3961   lt_cv_deplibs_check_method=pass_all
3962   ;;
3963
3964 solaris*)
3965   lt_cv_deplibs_check_method=pass_all
3966   lt_cv_file_magic_test_file=/lib/libc.so
3967   ;;
3968
3969 [sysv5uw[78]* | sysv4*uw2*)]
3970   lt_cv_deplibs_check_method=pass_all
3971   ;;
3972
3973 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
3974   case $host_vendor in
3975   motorola)
3976     [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
3977     lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
3978     ;;
3979   ncr)
3980     lt_cv_deplibs_check_method=pass_all
3981     ;;
3982   sequent)
3983     lt_cv_file_magic_cmd='/bin/file'
3984     [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )']
3985     ;;
3986   sni)
3987     lt_cv_file_magic_cmd='/bin/file'
3988     [lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"]
3989     lt_cv_file_magic_test_file=/lib/libc.so
3990     ;;
3991   esac
3992   ;;
3993 esac
3994 ])
3995 file_magic_cmd=$lt_cv_file_magic_cmd
3996 deplibs_check_method=$lt_cv_deplibs_check_method
3997 ])
3998
3999
4000 # AC_PROG_NM - find the path to a BSD-compatible name lister
4001 AC_DEFUN([AC_PROG_NM],
4002 [AC_MSG_CHECKING([for BSD-compatible nm])
4003 AC_CACHE_VAL(lt_cv_path_NM,
4004 [if test -n "$NM"; then
4005   # Let the user override the test.
4006   lt_cv_path_NM="$NM"
4007 else
4008   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
4009   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
4010     test -z "$ac_dir" && ac_dir=.
4011     tmp_nm=$ac_dir/${ac_tool_prefix}nm
4012     if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
4013       # Check to see if the nm accepts a BSD-compat flag.
4014       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
4015       #   nm: unknown option "B" ignored
4016       # Tru64's nm complains that /dev/null is an invalid object file
4017       if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
4018         lt_cv_path_NM="$tmp_nm -B"
4019         break
4020       elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
4021         lt_cv_path_NM="$tmp_nm -p"
4022         break
4023       else
4024         lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
4025         continue # so that we can try to find one that supports BSD flags
4026       fi
4027     fi
4028   done
4029   IFS="$ac_save_ifs"
4030   test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
4031 fi])
4032 NM="$lt_cv_path_NM"
4033 AC_MSG_RESULT([$NM])
4034 ])
4035
4036 # AC_CHECK_LIBM - check for math library
4037 AC_DEFUN([AC_CHECK_LIBM],
4038 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
4039 LIBM=
4040 case $host in
4041 *-*-beos* | *-*-cygwin* | *-*-pw32*)
4042   # These system don't have libm
4043   ;;
4044 *-ncr-sysv4.3*)
4045   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
4046   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
4047   ;;
4048 *)
4049   AC_CHECK_LIB(m, main, LIBM="-lm")
4050   ;;
4051 esac
4052 ])
4053
4054 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
4055 # the libltdl convenience library and INCLTDL to the include flags for
4056 # the libltdl header and adds --enable-ltdl-convenience to the
4057 # configure arguments.  Note that LIBLTDL and INCLTDL are not
4058 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
4059 # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
4060 # with '${top_builddir}/' and INCLTDL will be prefixed with
4061 # '${top_srcdir}/' (note the single quotes!).  If your package is not
4062 # flat and you're not using automake, define top_builddir and
4063 # top_srcdir appropriately in the Makefiles.
4064 AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
4065 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
4066   case $enable_ltdl_convenience in
4067   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
4068   "") enable_ltdl_convenience=yes
4069       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
4070   esac
4071   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
4072   INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
4073 ])
4074
4075 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
4076 # the libltdl installable library and INCLTDL to the include flags for
4077 # the libltdl header and adds --enable-ltdl-install to the configure
4078 # arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
4079 # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
4080 # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
4081 # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
4082 # with '${top_srcdir}/' (note the single quotes!).  If your package is
4083 # not flat and you're not using automake, define top_builddir and
4084 # top_srcdir appropriately in the Makefiles.
4085 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
4086 AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
4087 [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
4088   AC_CHECK_LIB(ltdl, main,
4089   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
4090   [if test x"$enable_ltdl_install" = xno; then
4091      AC_MSG_WARN([libltdl not installed, but installation disabled])
4092    else
4093      enable_ltdl_install=yes
4094    fi
4095   ])
4096   if test x"$enable_ltdl_install" = x"yes"; then
4097     ac_configure_args="$ac_configure_args --enable-ltdl-install"
4098     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
4099     INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
4100   else
4101     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
4102     LIBLTDL="-lltdl"
4103     INCLTDL=
4104   fi
4105 ])
4106
4107 # old names
4108 AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
4109 AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
4110 AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
4111 AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
4112 AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
4113 AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
4114 AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
4115
4116 # This is just to silence aclocal about the macro not being used
4117 ifelse([AC_DISABLE_FAST_INSTALL])