]> Pileus Git - ~andy/gtk/blob - acinclude.m4
acinclude.m4 config.guess config.sub ltconfig upgrade to libtool 1.2f
[~andy/gtk] / acinclude.m4
1 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
2 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
3 ## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2 of the License, or
8 ## (at your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 ##
19 ## As a special exception to the GNU General Public License, if you
20 ## distribute this file as part of a program that contains a
21 ## configuration script generated by Autoconf, you may include it under
22 ## the same distribution terms that you use for the rest of that program.
23
24 # serial 35 AC_PROG_LIBTOOL
25 AC_DEFUN(AC_PROG_LIBTOOL,
26 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
27
28 # Save cache, so that ltconfig can load it
29 AC_CACHE_SAVE
30
31 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
32 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
33 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
34 DLLTOOL="$DLLTOOL" AS="$AS" \
35 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
36 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
37 || AC_MSG_ERROR([libtool configure failed])
38
39 # Reload cache, that may have been modified by ltconfig
40 AC_CACHE_LOAD
41
42 # This can be used to rebuild libtool when needed
43 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
44
45 # Always use our own libtool.
46 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
47 AC_SUBST(LIBTOOL)dnl
48
49 # Redirect the config.log output again, so that the ltconfig log is not
50 # clobbered by the next message.
51 exec 5>>./config.log
52 ])
53
54 AC_DEFUN(AC_LIBTOOL_SETUP,
55 [AC_PREREQ(2.13)dnl
56 AC_REQUIRE([AC_ENABLE_SHARED])dnl
57 AC_REQUIRE([AC_ENABLE_STATIC])dnl
58 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
59 AC_REQUIRE([AC_CANONICAL_HOST])dnl
60 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
61 AC_REQUIRE([AC_PROG_RANLIB])dnl
62 AC_REQUIRE([AC_PROG_CC])dnl
63 AC_REQUIRE([AC_PROG_LD])dnl
64 AC_REQUIRE([AC_PROG_NM])dnl
65 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
66 AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl
67 AC_REQUIRE([AC_PROG_LN_S])dnl
68 dnl
69
70 # Check for any special flags to pass to ltconfig.
71 libtool_flags="--cache-file=$cache_file"
72 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
73 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
74 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
75 test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen"
76 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
77 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
78 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
79
80 # Some flags need to be propagated to the compiler or linker for good
81 # libtool support.
82 case "$host" in
83 *-*-irix6*)
84   # Find out which ABI we are using.
85   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
86   if AC_TRY_EVAL(ac_compile); then
87     case "`/usr/bin/file conftest.o`" in
88     *32-bit*)
89       LD="${LD-ld} -32"
90       ;;
91     *N32*)
92       LD="${LD-ld} -n32"
93       ;;
94     *64-bit*)
95       LD="${LD-ld} -64"
96       ;;
97     esac
98   fi
99   rm -rf conftest*
100   ;;
101
102 *-*-sco3.2v5*)
103   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
104   SAVE_CFLAGS="$CFLAGS"
105   CFLAGS="$CFLAGS -belf"
106   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
107     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
108   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
109     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
110     CFLAGS="$SAVE_CFLAGS"
111   fi
112   ;;
113
114 *-*-cygwin*)
115   AC_SYS_LIBTOOL_CYGWIN
116   ;;
117
118 esac
119
120 # enable the --disable-libtool-lock switch
121
122 AC_ARG_ENABLE(libtool-lock,
123 [  --disable-libtool-lock  force libtool not to do file locking],
124 need_locks=$enableval,
125 need_locks=yes)
126
127 if test x"$need_locks" = xno; then
128   libtool_flags="$libtool_flags --disable-lock"
129 fi
130 ])
131
132 # AC_LIBTOOL_DLOPEN - check for dlopen support
133 AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes])
134
135 # AC_ENABLE_SHARED - implement the --enable-shared flag
136 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
137 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
138 #   `yes'.
139 AC_DEFUN(AC_ENABLE_SHARED,
140 [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
141 AC_ARG_ENABLE(shared,
142 changequote(<<, >>)dnl
143 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
144 changequote([, ])dnl
145 [p=${PACKAGE-default}
146 case "$enableval" in
147 yes) enable_shared=yes ;;
148 no) enable_shared=no ;;
149 *)
150   enable_shared=no
151   # Look at the argument we got.  We use all the common list separators.
152   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
153   for pkg in $enableval; do
154     if test "X$pkg" = "X$p"; then
155       enable_shared=yes
156     fi
157   done
158   IFS="$ac_save_ifs"
159   ;;
160 esac],
161 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
162 ])
163
164 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
165 AC_DEFUN(AC_DISABLE_SHARED,
166 [AC_ENABLE_SHARED(no)])
167
168 # AC_ENABLE_STATIC - implement the --enable-static flag
169 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
170 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
171 #   `yes'.
172 AC_DEFUN(AC_ENABLE_STATIC,
173 [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
174 AC_ARG_ENABLE(static,
175 changequote(<<, >>)dnl
176 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
177 changequote([, ])dnl
178 [p=${PACKAGE-default}
179 case "$enableval" in
180 yes) enable_static=yes ;;
181 no) enable_static=no ;;
182 *)
183   enable_static=no
184   # Look at the argument we got.  We use all the common list separators.
185   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
186   for pkg in $enableval; do
187     if test "X$pkg" = "X$p"; then
188       enable_static=yes
189     fi
190   done
191   IFS="$ac_save_ifs"
192   ;;
193 esac],
194 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
195 ])
196
197 # AC_DISABLE_STATIC - set the default static flag to --disable-static
198 AC_DEFUN(AC_DISABLE_STATIC,
199 [AC_ENABLE_STATIC(no)])
200
201
202 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
203 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
204 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
205 #   `yes'.
206 AC_DEFUN(AC_ENABLE_FAST_INSTALL,
207 [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
208 AC_ARG_ENABLE(fast-install,
209 changequote(<<, >>)dnl
210 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
211 changequote([, ])dnl
212 [p=${PACKAGE-default}
213 case "$enableval" in
214 yes) enable_fast_install=yes ;;
215 no) enable_fast_install=no ;;
216 *)
217   enable_fast_install=no
218   # Look at the argument we got.  We use all the common list separators.
219   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
220   for pkg in $enableval; do
221     if test "X$pkg" = "X$p"; then
222       enable_fast_install=yes
223     fi
224   done
225   IFS="$ac_save_ifs"
226   ;;
227 esac],
228 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
229 ])
230
231 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
232 AC_DEFUN(AC_DISABLE_FAST_INSTALL,
233 [AC_ENABLE_FAST_INSTALL(no)])
234
235
236 # AC_PROG_LD - find the path to the GNU or non-GNU linker
237 AC_DEFUN(AC_PROG_LD,
238 [AC_ARG_WITH(gnu-ld,
239 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
240 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
241 AC_REQUIRE([AC_PROG_CC])dnl
242 AC_REQUIRE([AC_CANONICAL_HOST])dnl
243 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
244 ac_prog=ld
245 if test "$ac_cv_prog_gcc" = yes; then
246   # Check if gcc -print-prog-name=ld gives a path.
247   AC_MSG_CHECKING([for ld used by GCC])
248   ac_prog=`($CC -print-prog-name=ld) 2>&5`
249   case "$ac_prog" in
250     # Accept absolute paths.
251 changequote(,)dnl
252     /* | [A-Za-z]:[\\/]*)
253       re_direlt='/[^/][^/]*/\.\./'
254 changequote([,])dnl
255       # Canonicalize the path of ld
256       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
257       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
258         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
259       done
260       test -z "$LD" && LD="$ac_prog"
261       ;;
262   "")
263     # If it fails, then pretend we aren't using GCC.
264     ac_prog=ld
265     ;;
266   *)
267     # If it is relative, then search for the first ld in PATH.
268     with_gnu_ld=unknown
269     ;;
270   esac
271 elif test "$with_gnu_ld" = yes; then
272   AC_MSG_CHECKING([for GNU ld])
273 else
274   AC_MSG_CHECKING([for non-GNU ld])
275 fi
276 AC_CACHE_VAL(ac_cv_path_LD,
277 [if test -z "$LD"; then
278   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
279   for ac_dir in $PATH; do
280     test -z "$ac_dir" && ac_dir=.
281     if test -f "$ac_dir/$ac_prog"; then
282       ac_cv_path_LD="$ac_dir/$ac_prog"
283       # Check to see if the program is GNU ld.  I'd rather use --version,
284       # but apparently some GNU ld's only accept -v.
285       # Break only if it was the GNU/non-GNU ld that we prefer.
286       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
287         test "$with_gnu_ld" != no && break
288       else
289         test "$with_gnu_ld" != yes && break
290       fi
291     fi
292   done
293   IFS="$ac_save_ifs"
294 else
295   ac_cv_path_LD="$LD" # Let the user override the test with a path.
296 fi])
297 LD="$ac_cv_path_LD"
298 if test -n "$LD"; then
299   AC_MSG_RESULT($LD)
300 else
301   AC_MSG_RESULT(no)
302 fi
303 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
304 AC_SUBST(LD)
305 AC_PROG_LD_GNU
306 ])
307
308 AC_DEFUN(AC_PROG_LD_GNU,
309 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
310 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
311 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
312   ac_cv_prog_gnu_ld=yes
313 else
314   ac_cv_prog_gnu_ld=no
315 fi])
316 ])
317
318 # AC_PROG_NM - find the path to a BSD-compatible name lister
319 AC_DEFUN(AC_PROG_NM,
320 [AC_MSG_CHECKING([for BSD-compatible nm])
321 AC_CACHE_VAL(ac_cv_path_NM,
322 [if test -n "$NM"; then
323   # Let the user override the test.
324   ac_cv_path_NM="$NM"
325 else
326   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
327   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
328     test -z "$ac_dir" && ac_dir=.
329     if test -f $ac_dir/nm; then
330       # Check to see if the nm accepts a BSD-compat flag.
331       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
332       #   nm: unknown option "B" ignored
333       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
334         ac_cv_path_NM="$ac_dir/nm -B"
335         break
336       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
337         ac_cv_path_NM="$ac_dir/nm -p"
338         break
339       else
340         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
341         continue # so that we can try to find one that supports BSD flags
342       fi
343     fi
344   done
345   IFS="$ac_save_ifs"
346   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
347 fi])
348 NM="$ac_cv_path_NM"
349 AC_MSG_RESULT([$NM])
350 AC_SUBST(NM)
351 ])
352
353 # AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
354 # by C symbol name from nm.
355 AC_DEFUN(AC_SYS_NM_PARSE,
356 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
357 AC_REQUIRE([AC_PROG_NM])dnl
358 # Check for command to grab the raw symbol name followed by C symbol from nm.
359 AC_MSG_CHECKING([command to parse $NM output])
360 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
361 [# These are sane defaults that work on at least a few old systems.
362 # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
363
364 changequote(,)dnl
365 # Character class describing NM global symbol codes.
366 ac_symcode='[BCDEGRST]'
367
368 # Regexp to match symbols that can be accessed directly from C.
369 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
370
371 # Transform the above into a raw symbol and a C symbol.
372 ac_symxfrm='\1 \2\3 \3'
373
374 # Transform an extracted symbol line into a proper C declaration
375 ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
376
377 # Define system-specific variables.
378 case "$host_os" in
379 aix*)
380   ac_symcode='[BCDT]'
381   ;;
382 cygwin* | mingw*)
383   ac_symcode='[ABCDGISTW]'
384   ;;
385 hpux*)
386   ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
387   ;;
388 irix*)
389   ac_symcode='[BCDEGRST]'
390   ;;
391 solaris*)
392   ac_symcode='[BDT]'
393   ;;
394 esac
395
396 # If we're using GNU nm, then use its standard symbol codes.
397 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
398   ac_symcode='[ABCDGISTW]'
399 fi
400 changequote([,])dnl
401
402 # Try without a prefix undercore, then with it.
403 for ac_symprfx in "" "_"; do
404
405   ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[       ]\($ac_symcode\)[       ][      ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
406
407   # Check to see that the pipe works correctly.
408   ac_pipe_works=no
409   rm -f conftest.$ac_ext
410   cat > conftest.$ac_ext <<EOF
411 #ifdef __cplusplus
412 extern "C" {
413 #endif
414 char nm_test_var;
415 void nm_test_func(){}
416 #ifdef __cplusplus
417 }
418 #endif
419 int main(){nm_test_var='a';nm_test_func;return 0;}
420 EOF
421
422   if AC_TRY_EVAL(ac_compile); then
423     # Now try to grab the symbols.
424     ac_nlist=conftest.nm
425   
426     if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
427
428       # Try sorting and uniquifying the output.
429       if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
430         mv -f "$ac_nlist"T "$ac_nlist"
431       else
432         rm -f "$ac_nlist"T
433       fi
434
435       # Make sure that we snagged all the symbols we need.
436       if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
437         if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
438           cat <<EOF > conftest.c
439 #ifdef __cplusplus
440 extern "C" {
441 #endif
442
443 EOF
444           # Now generate the symbol file.
445           eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
446
447           cat <<EOF >> conftest.c
448 #if defined (__STDC__) && __STDC__
449 # define lt_ptr_t void *
450 #else
451 # define lt_ptr_t char *
452 # define const
453 #endif
454
455 /* The mapping between symbol names and symbols. */
456 const struct {
457   const char *name;
458   lt_ptr_t address;
459 }
460 changequote(,)dnl
461 lt_preloaded_symbols[] =
462 changequote([,])dnl
463 {
464 EOF
465         sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
466         cat <<\EOF >> conftest.c
467   {0, (lt_ptr_t) 0}
468 };
469
470 #ifdef __cplusplus
471 }
472 #endif
473 EOF
474           # Now try linking the two files.
475           mv conftest.$ac_objext conftestm.$ac_objext
476           ac_save_LIBS="$LIBS"
477           ac_save_CFLAGS="$CFLAGS"
478           LIBS="conftestm.$ac_objext"
479           CFLAGS="$CFLAGS$no_builtin_flag"
480           if AC_TRY_EVAL(ac_link) && test -s conftest; then
481             ac_pipe_works=yes
482           else
483             echo "configure: failed program was:" >&AC_FD_CC
484             cat conftest.c >&AC_FD_CC
485           fi
486           LIBS="$ac_save_LIBS"
487           CFLAGS="$ac_save_CFLAGS"
488         else
489           echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
490         fi
491       else
492         echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
493       fi
494     else
495       echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
496     fi
497   else
498     echo "$progname: failed program was:" >&AC_FD_CC
499     cat conftest.c >&AC_FD_CC
500   fi
501   rm -rf conftest*
502
503   # Do not use the global_symbol_pipe unless it works.
504   if test "$ac_pipe_works" = yes; then
505     if test x"$ac_symprfx" = x"_"; then
506       ac_cv_sys_symbol_underscore=yes
507     else
508       ac_cv_sys_symbol_underscore=no
509     fi
510     break
511   else
512     ac_cv_sys_global_symbol_pipe=
513   fi
514 done
515 ])
516
517 ac_result=yes
518 if test -z "$ac_cv_sys_global_symbol_pipe"; then
519    ac_result=no
520 fi
521 AC_MSG_RESULT($ac_result)
522 ])
523
524 # AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
525 AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN,
526 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
527 AC_CHECK_TOOL(AS, as, false)
528 ])
529
530 # AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
531 #                            with an underscore?
532 AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE,
533 [AC_REQUIRE([AC_PROG_NM])dnl
534 AC_REQUIRE([AC_SYS_NM_PARSE])dnl
535 AC_MSG_CHECKING([for _ prefix in compiled symbols])
536 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
537 [ac_cv_sys_symbol_underscore=no
538 cat > conftest.$ac_ext <<EOF
539 void nm_test_func(){}
540 int main(){nm_test_func;return 0;}
541 EOF
542 if AC_TRY_EVAL(ac_compile); then
543   # Now try to grab the symbols.
544   ac_nlist=conftest.nm
545   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
546     # See whether the symbols have a leading underscore.
547     if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
548       ac_cv_sys_symbol_underscore=yes
549     else
550       if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
551         :
552       else
553         echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
554       fi
555     fi
556   else
557     echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
558   fi
559 else
560   echo "configure: failed program was:" >&AC_FD_CC
561   cat conftest.c >&AC_FD_CC
562 fi
563 rm -rf conftest*
564 ])
565 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
566 USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no}
567 AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl
568 ])
569
570 # AC_CHECK_LIBM - check for math library
571 AC_DEFUN(AC_CHECK_LIBM, [
572 AC_CHECK_LIB(mw, _mwvalidcheckl)
573 AC_CHECK_LIB(m, cos)
574 ])
575
576 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
577 # the libltdl convenience library, adds --enable-ltdl-convenience to
578 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
579 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
580 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
581 # '${top_builddir}/' (note the single quotes!) if your package is not
582 # flat, and, if you're not using automake, define top_builddir as
583 # appropriate in the Makefiles.
584 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [
585   case "$enable_ltdl_convenience" in
586   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
587   "") enable_ltdl_convenience=yes
588       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
589   esac
590   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
591 ])
592
593 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
594 # the libltdl installable library, and adds --enable-ltdl-install to
595 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
596 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
597 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
598 # '${top_builddir}/' (note the single quotes!) if your package is not
599 # flat, and, if you're not using automake, define top_builddir as
600 # appropriate in the Makefiles.
601 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
602 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [
603   AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [
604     case "$enable_ltdl_install" in
605     no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;;
606     "") enable_ltdl_install=yes
607         ac_configure_args="$ac_configure_args --enable-ltdl-install" ;;
608     esac
609   ])
610   if test x"$enable_ltdl_install" != x"no"; then
611     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
612   fi
613 ])
614
615 dnl old names
616 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
617 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
618 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
619 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
620 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
621 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
622 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
623 AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl
624 AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl
625 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl
626
627 # Macro to add for using GNU gettext.
628 # Ulrich Drepper <drepper@cygnus.com>, 1995.
629 #
630 # Modified to never use included libintl. 
631 # Owen Taylor <otaylor@redhat.com>, 12/15/1998
632 #
633 #
634 # This file can be copied and used freely without restrictions.  It can
635 # be used in projects which are not available under the GNU Public License
636 # but which still want to provide support for the GNU gettext functionality.
637 # Please note that the actual code is *not* freely available.
638
639 # serial 5
640
641 AC_DEFUN(AM_GTK_WITH_NLS,
642   [AC_MSG_CHECKING([whether NLS is requested])
643     dnl Default is enabled NLS
644     AC_ARG_ENABLE(nls,
645       [  --disable-nls           do not use Native Language Support],
646       USE_NLS=$enableval, USE_NLS=yes)
647     AC_MSG_RESULT($USE_NLS)
648     AC_SUBST(USE_NLS)
649
650     USE_INCLUDED_LIBINTL=no
651
652     dnl If we use NLS figure out what method
653     if test "$USE_NLS" = "yes"; then
654 #      AC_DEFINE(ENABLE_NLS)
655 #      AC_MSG_CHECKING([whether included gettext is requested])
656 #      AC_ARG_WITH(included-gettext,
657 #        [  --with-included-gettext use the GNU gettext library included here],
658 #        nls_cv_force_use_gnu_gettext=$withval,
659 #        nls_cv_force_use_gnu_gettext=no)
660 #      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
661       nls_cv_force_use_gnu_gettext="no"
662
663       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
664       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
665         dnl User does not insist on using GNU NLS library.  Figure out what
666         dnl to use.  If gettext or catgets are available (in this order) we
667         dnl use this.  Else we have to fall back to GNU NLS library.
668         dnl catgets is only used if permitted by option --with-catgets.
669         nls_cv_header_intl=
670         nls_cv_header_libgt=
671         CATOBJEXT=NONE
672
673         AC_CHECK_HEADER(libintl.h,
674           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
675             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
676                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
677
678            if test "$gt_cv_func_gettext_libc" != "yes"; then
679              AC_CHECK_LIB(intl, bindtextdomain,
680                [AC_CACHE_CHECK([for gettext in libintl],
681                  gt_cv_func_gettext_libintl,
682                  [AC_CHECK_LIB(intl, gettext,
683                   gt_cv_func_gettext_libintl=yes,
684                   gt_cv_func_gettext_libintl=no)],
685                  gt_cv_func_gettext_libintl=no)])
686            fi
687
688            if test "$gt_cv_func_gettext_libc" = "yes" \
689               || test "$gt_cv_func_gettext_libintl" = "yes"; then
690               AC_DEFINE(HAVE_GETTEXT)
691               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
692                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
693               if test "$MSGFMT" != "no"; then
694                 AC_CHECK_FUNCS(dcgettext)
695                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
696                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
697                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
698                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
699                                return _nl_msg_cat_cntr],
700                   [CATOBJEXT=.gmo
701                    DATADIRNAME=share],
702                   [CATOBJEXT=.mo
703                    DATADIRNAME=lib])
704                 INSTOBJEXT=.mo
705               fi
706             fi
707
708             # Added by Martin Baulig 12/15/98 for libc5 systems
709             if test "$gt_cv_func_gettext_libc" != "yes" \
710                && test "$gt_cv_func_gettext_libintl" = "yes"; then
711                INTLLIBS=-lintl
712                LIBS=`echo $LIBS | sed -e 's/-lintl//'`
713             fi
714         ])
715
716         if test "$CATOBJEXT" = "NONE"; then
717           AC_MSG_CHECKING([whether catgets can be used])
718           AC_ARG_WITH(catgets,
719             [  --with-catgets          use catgets functions if available],
720             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
721           AC_MSG_RESULT($nls_cv_use_catgets)
722
723           if test "$nls_cv_use_catgets" = "yes"; then
724             dnl No gettext in C library.  Try catgets next.
725             AC_CHECK_LIB(i, main)
726             AC_CHECK_FUNC(catgets,
727               [AC_DEFINE(HAVE_CATGETS)
728                INTLOBJS="\$(CATOBJS)"
729                AC_PATH_PROG(GENCAT, gencat, no)dnl
730 #              if test "$GENCAT" != "no"; then
731 #                AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
732 #                if test "$GMSGFMT" = "no"; then
733 #                  AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
734 #                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
735 #                fi
736 #                AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
737 #                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
738 #                USE_INCLUDED_LIBINTL=yes
739 #                CATOBJEXT=.cat
740 #                INSTOBJEXT=.cat
741 #                DATADIRNAME=lib
742 #                INTLDEPS='$(top_builddir)/intl/libintl.a'
743 #                INTLLIBS=$INTLDEPS
744 #                LIBS=`echo $LIBS | sed -e 's/-lintl//'`
745 #                nls_cv_header_intl=intl/libintl.h
746 #                nls_cv_header_libgt=intl/libgettext.h
747 #              fi
748             ])
749           fi
750         fi
751
752         if test "$CATOBJEXT" = "NONE"; then
753           dnl Neither gettext nor catgets in included in the C library.
754           dnl Fall back on GNU gettext library.
755           nls_cv_use_gnu_gettext=yes
756         fi
757       fi
758
759       if test "$nls_cv_use_gnu_gettext" != "yes"; then
760         AC_DEFINE(ENABLE_NLS)
761       else
762          # Unset this variable since we use the non-zero value as a flag.
763          CATOBJEXT=
764 #        dnl Mark actions used to generate GNU NLS library.
765 #        INTLOBJS="\$(GETTOBJS)"
766 #        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
767 #         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
768 #        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
769 #        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
770 #         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
771 #        AC_SUBST(MSGFMT)
772 #       USE_INCLUDED_LIBINTL=yes
773 #        CATOBJEXT=.gmo
774 #        INSTOBJEXT=.mo
775 #        DATADIRNAME=share
776 #       INTLDEPS='$(top_builddir)/intl/libintl.a'
777 #       INTLLIBS=$INTLDEPS
778 #       LIBS=`echo $LIBS | sed -e 's/-lintl//'`
779 #        nls_cv_header_intl=intl/libintl.h
780 #        nls_cv_header_libgt=intl/libgettext.h
781       fi
782
783       dnl Test whether we really found GNU xgettext.
784       if test "$XGETTEXT" != ":"; then
785         dnl If it is no GNU xgettext we define it as : so that the
786         dnl Makefiles still can work.
787         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
788           : ;
789         else
790           AC_MSG_RESULT(
791             [found xgettext program is not GNU xgettext; ignore it])
792           XGETTEXT=":"
793         fi
794       fi
795
796       # We need to process the po/ directory.
797       POSUB=po
798     else
799       DATADIRNAME=share
800       nls_cv_header_intl=intl/libintl.h
801       nls_cv_header_libgt=intl/libgettext.h
802     fi
803     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
804     AC_OUTPUT_COMMANDS(
805      [case "$CONFIG_FILES" in *po/Makefile.in*)
806         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
807       esac])
808
809
810 #    # If this is used in GNU gettext we have to set USE_NLS to `yes'
811 #    # because some of the sources are only built for this goal.
812 #    if test "$PACKAGE" = gettext; then
813 #      USE_NLS=yes
814 #      USE_INCLUDED_LIBINTL=yes
815 #    fi
816
817     dnl These rules are solely for the distribution goal.  While doing this
818     dnl we only have to keep exactly one list of the available catalogs
819     dnl in configure.in.
820     for lang in $ALL_LINGUAS; do
821       GMOFILES="$GMOFILES $lang.gmo"
822       POFILES="$POFILES $lang.po"
823     done
824
825     dnl Make all variables we use known to autoconf.
826     AC_SUBST(USE_INCLUDED_LIBINTL)
827     AC_SUBST(CATALOGS)
828     AC_SUBST(CATOBJEXT)
829     AC_SUBST(DATADIRNAME)
830     AC_SUBST(GMOFILES)
831     AC_SUBST(INSTOBJEXT)
832     AC_SUBST(INTLDEPS)
833     AC_SUBST(INTLLIBS)
834     AC_SUBST(INTLOBJS)
835     AC_SUBST(POFILES)
836     AC_SUBST(POSUB)
837   ])
838
839 AC_DEFUN(AM_GTK_GNU_GETTEXT,
840   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
841    AC_REQUIRE([AC_PROG_CC])dnl
842    AC_REQUIRE([AC_PROG_RANLIB])dnl
843    AC_REQUIRE([AC_ISC_POSIX])dnl
844    AC_REQUIRE([AC_HEADER_STDC])dnl
845    AC_REQUIRE([AC_C_CONST])dnl
846    AC_REQUIRE([AC_C_INLINE])dnl
847    AC_REQUIRE([AC_TYPE_OFF_T])dnl
848    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
849    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
850    AC_REQUIRE([AC_FUNC_MMAP])dnl
851
852    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
853 unistd.h sys/param.h])
854    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
855 strdup __argz_count __argz_stringify __argz_next])
856
857    if test "${ac_cv_func_stpcpy+set}" != "set"; then
858      AC_CHECK_FUNCS(stpcpy)
859    fi
860    if test "${ac_cv_func_stpcpy}" = "yes"; then
861      AC_DEFINE(HAVE_STPCPY)
862    fi
863
864    AM_LC_MESSAGES
865    AM_GTK_WITH_NLS
866
867    if test "x$CATOBJEXT" != "x"; then
868      if test "x$ALL_LINGUAS" = "x"; then
869        LINGUAS=
870      else
871        AC_MSG_CHECKING(for catalogs to be installed)
872        NEW_LINGUAS=
873        for lang in ${LINGUAS=$ALL_LINGUAS}; do
874          case "$ALL_LINGUAS" in
875           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
876          esac
877        done
878        LINGUAS=$NEW_LINGUAS
879        AC_MSG_RESULT($LINGUAS)
880      fi
881
882      dnl Construct list of names of catalog files to be constructed.
883      if test -n "$LINGUAS"; then
884        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
885      fi
886    fi
887
888    dnl The reference to <locale.h> in the installed <libintl.h> file
889    dnl must be resolved because we cannot expect the users of this
890    dnl to define HAVE_LOCALE_H.
891    if test $ac_cv_header_locale_h = yes; then
892      INCLUDE_LOCALE_H="#include <locale.h>"
893    else
894      INCLUDE_LOCALE_H="\
895 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
896    fi
897    AC_SUBST(INCLUDE_LOCALE_H)
898
899    dnl Determine which catalog format we have (if any is needed)
900    dnl For now we know about two different formats:
901    dnl   Linux libc-5 and the normal X/Open format
902    test -d intl || mkdir intl
903    if test "$CATOBJEXT" = ".cat"; then
904      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
905
906      dnl Transform the SED scripts while copying because some dumb SEDs
907      dnl cannot handle comments.
908      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
909    fi
910    dnl po2tbl.sed is always needed.
911    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
912      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
913
914    dnl In the intl/Makefile.in we have a special dependency which makes
915    dnl only sense for gettext.  We comment this out for non-gettext
916    dnl packages.
917    if test "$PACKAGE" = "gettext"; then
918      GT_NO="#NO#"
919      GT_YES=
920    else
921      GT_NO=
922      GT_YES="#YES#"
923    fi
924    AC_SUBST(GT_NO)
925    AC_SUBST(GT_YES)
926
927    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
928    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
929    dnl Try to locate is.
930    MKINSTALLDIRS=
931    if test -n "$ac_aux_dir"; then
932      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
933    fi
934    if test -z "$MKINSTALLDIRS"; then
935      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
936    fi
937    AC_SUBST(MKINSTALLDIRS)
938
939    dnl *** For now the libtool support in intl/Makefile is not for real.
940    l=
941    AC_SUBST(l)
942
943    dnl Generate list of files to be processed by xgettext which will
944    dnl be included in po/Makefile.
945    test -d po || mkdir po
946    if test "x$srcdir" != "x."; then
947      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
948        posrcprefix="$srcdir/"
949      else
950        posrcprefix="../$srcdir/"
951      fi
952    else
953      posrcprefix="../"
954    fi
955    rm -f po/POTFILES
956    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
957         < $srcdir/po/POTFILES.in > po/POTFILES
958   ])
959