]> git.saurik.com Git - wxWidgets.git/blame - aclocal.m4
Small makefile corrections.
[wxWidgets.git] / aclocal.m4
CommitLineData
88ac883a
VZ
1dnl ---------------------------------------------------------------------------
2dnl
3dnl Purpose: Cursom macros for autoconf configure script.
4dnl Authoer: Vadim Zeitlin
5dnl Created: 26.05.99
6dnl Version: $Id$
7dnl ---------------------------------------------------------------------------
8
9dnl ===========================================================================
10dnl include automake macros
11dnl ===========================================================================
12
13dnl Like AC_CONFIG_HEADER, but automatically create stamp file.
14AC_DEFUN(AM_CONFIG_HEADER,
15[AC_PREREQ([2.12])
16AC_CONFIG_HEADER([$1])
17dnl When config.status generates a header, we must update the stamp-h file.
18dnl This file resides in the same directory as the config header
19dnl that is generated. We must strip everything past the first ":",
20dnl and everything past the last "/".
21AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
22ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
23<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
24<<am_indx=1
25for am_file in <<$1>>; do
26 case " <<$>>CONFIG_HEADERS " in
27 *" <<$>>am_file "*<<)>>
28 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
29 ;;
30 esac
31 am_indx=`expr "<<$>>am_indx" + 1`
32done<<>>dnl>>)
33changequote([,]))])
34
35# Do all the work for Automake. This macro actually does too much --
36# some checks are only needed if your package does certain things.
37# But this isn't really a big deal.
38
39# serial 1
40
41dnl Usage:
42dnl AM_INIT_AUTOMAKE(package,version, [no-define])
43
44AC_DEFUN(AM_INIT_AUTOMAKE,
45[AC_REQUIRE([AC_PROG_INSTALL])
46PACKAGE=[$1]
47AC_SUBST(PACKAGE)
48VERSION=[$2]
49AC_SUBST(VERSION)
50dnl test to see if srcdir already configured
51if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
52 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
53fi
54ifelse([$3],,
55AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
56AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
57AC_REQUIRE([AM_SANITY_CHECK])
58AC_REQUIRE([AC_ARG_PROGRAM])
59dnl FIXME This is truly gross.
60missing_dir=`cd $ac_aux_dir && pwd`
61AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
62AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
63AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
64AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
65AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
66AC_REQUIRE([AC_PROG_MAKE_SET])])
67
68
69# serial 1
70
71AC_DEFUN(AM_PROG_INSTALL,
72[AC_REQUIRE([AC_PROG_INSTALL])
73test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
74AC_SUBST(INSTALL_SCRIPT)dnl
75])
76
77#
78# Check to make sure that the build environment is sane.
79#
80
81AC_DEFUN(AM_SANITY_CHECK,
82[AC_MSG_CHECKING([whether build environment is sane])
83# Just in case
84sleep 1
85echo timestamp > conftestfile
86# Do `set' in a subshell so we don't clobber the current shell's
87# arguments. Must try -L first in case configure is actually a
88# symlink; some systems play weird games with the mod time of symlinks
89# (eg FreeBSD returns the mod time of the symlink's containing
90# directory).
91if (
92 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
93 if test "[$]*" = "X"; then
94 # -L didn't work.
95 set X `ls -t $srcdir/configure conftestfile`
96 fi
97 if test "[$]*" != "X $srcdir/configure conftestfile" \
98 && test "[$]*" != "X conftestfile $srcdir/configure"; then
99
100 # If neither matched, then we have a broken ls. This can happen
101 # if, for instance, CONFIG_SHELL is bash and it inherits a
102 # broken ls alias from the environment. This has actually
103 # happened. Such a system could not be considered "sane".
104 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
105alias in your environment])
106 fi
107
108 test "[$]2" = conftestfile
109 )
110then
111 # Ok.
112 :
113else
114 AC_MSG_ERROR([newly created file is older than distributed files!
115Check your system clock])
116fi
117rm -f conftest*
118AC_MSG_RESULT(yes)])
119
120dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
121dnl The program must properly implement --version.
122AC_DEFUN(AM_MISSING_PROG,
123[AC_MSG_CHECKING(for working $2)
124# Run test in a subshell; some versions of sh will print an error if
125# an executable is not found, even if stderr is redirected.
126# Redirect stdin to placate older versions of autoconf. Sigh.
127if ($2 --version) < /dev/null > /dev/null 2>&1; then
128 $1=$2
129 AC_MSG_RESULT(found)
130else
131 $1="$3/missing $2"
132 AC_MSG_RESULT(missing)
133fi
134AC_SUBST($1)])
135
136
137dnl AM_PROG_LEX
138dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
139AC_DEFUN(AM_PROG_LEX,
140[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
141AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
142AC_PROG_LEX
143AC_DECL_YYTEXT])
144
145
146# serial 29 AM_PROG_LIBTOOL
147AC_DEFUN(AM_PROG_LIBTOOL,
148[AC_REQUIRE([AM_ENABLE_SHARED])dnl
149AC_REQUIRE([AM_ENABLE_STATIC])dnl
150AC_REQUIRE([AC_CANONICAL_HOST])dnl
151AC_REQUIRE([AC_CANONICAL_BUILD])dnl
152AC_REQUIRE([AC_PROG_RANLIB])dnl
153AC_REQUIRE([AC_PROG_CC])dnl
154AC_REQUIRE([AM_PROG_LD])dnl
155AC_REQUIRE([AM_PROG_NM])dnl
156AC_REQUIRE([AM_SYS_NM_PARSE])dnl
157AC_REQUIRE([AM_SYS_SYMBOL_UNDERSCORE])dnl
158AC_REQUIRE([AC_PROG_LN_S])dnl
159dnl
160# Always use our own libtool.
161LIBTOOL='$(SHELL) $(top_builddir)/libtool'
162AC_SUBST(LIBTOOL)dnl
163
164# Check for any special flags to pass to ltconfig.
165libtool_flags=
166test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
167test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
168test "$silent" = yes && libtool_flags="$libtool_flags --silent"
169test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
170test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
171
172# Some flags need to be propagated to the compiler or linker for good
173# libtool support.
174case "$host" in
175*-*-irix6*)
176 # Find out which ABI we are using.
177 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
178 if AC_TRY_EVAL(ac_compile); then
179 case "`/usr/bin/file conftest.o`" in
180 *32-bit*)
181 LD="${LD-ld} -32"
182 ;;
183 *N32*)
184 LD="${LD-ld} -n32"
185 ;;
186 *64-bit*)
187 LD="${LD-ld} -64"
188 ;;
189 esac
190 fi
191 rm -rf conftest*
192 ;;
193
194*-*-sco3.2v5*)
195 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
196 SAVE_CFLAGS="$CFLAGS"
197 CFLAGS="$CFLAGS -belf"
198 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
199 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
200 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
201 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
202 CFLAGS="$SAVE_CFLAGS"
203 fi
204 ;;
205
206*-*-cygwin32*)
207 AM_SYS_LIBTOOL_CYGWIN32
208 ;;
209
210esac
211
212# enable the --disable-libtool-lock switch
213
214AC_ARG_ENABLE(libtool-lock,
215[ --disable-libtool-lock force libtool not to do file locking],
216need_locks=$enableval,
217need_locks=yes)
218
219if test x"$need_locks" = xno; then
220 libtool_flags="$libtool_flags --disable-lock"
221fi
222
223
224# Actually configure libtool. ac_aux_dir is where install-sh is found.
225CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
226LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
227DLLTOOL="$DLLTOOL" AS="$AS" \
228${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
229$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
230|| AC_MSG_ERROR([libtool configure failed])
231
232# Redirect the config.log output again, so that the ltconfig log is not
233# clobbered by the next message.
234exec 5>>./config.log
235])
236
237# AM_ENABLE_SHARED - implement the --enable-shared flag
238# Usage: AM_ENABLE_SHARED[(DEFAULT)]
239# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
240# `yes'.
241AC_DEFUN(AM_ENABLE_SHARED,
242[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
243AC_ARG_ENABLE(shared,
244changequote(<<, >>)dnl
245<< --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
246changequote([, ])dnl
247[p=${PACKAGE-default}
248case "$enableval" in
249yes) enable_shared=yes ;;
250no) enable_shared=no ;;
251*)
252 enable_shared=no
253 # Look at the argument we got. We use all the common list separators.
254 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
255 for pkg in $enableval; do
256 if test "X$pkg" = "X$p"; then
257 enable_shared=yes
258 fi
259 done
260 IFS="$ac_save_ifs"
261 ;;
262esac],
263enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
264])
265
266# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
267AC_DEFUN(AM_DISABLE_SHARED,
268[AM_ENABLE_SHARED(no)])
269
270# AM_DISABLE_STATIC - set the default static flag to --disable-static
271AC_DEFUN(AM_DISABLE_STATIC,
272[AM_ENABLE_STATIC(no)])
273
274# AM_ENABLE_STATIC - implement the --enable-static flag
275# Usage: AM_ENABLE_STATIC[(DEFAULT)]
276# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
277# `yes'.
278AC_DEFUN(AM_ENABLE_STATIC,
279[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
280AC_ARG_ENABLE(static,
281changequote(<<, >>)dnl
282<< --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
283changequote([, ])dnl
284[p=${PACKAGE-default}
285case "$enableval" in
286yes) enable_static=yes ;;
287no) enable_static=no ;;
288*)
289 enable_static=no
290 # Look at the argument we got. We use all the common list separators.
291 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
292 for pkg in $enableval; do
293 if test "X$pkg" = "X$p"; then
294 enable_static=yes
295 fi
296 done
297 IFS="$ac_save_ifs"
298 ;;
299esac],
300enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
301])
302
303
304# AM_PROG_LD - find the path to the GNU or non-GNU linker
305AC_DEFUN(AM_PROG_LD,
306[AC_ARG_WITH(gnu-ld,
307[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
308test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
309AC_REQUIRE([AC_PROG_CC])dnl
310AC_REQUIRE([AC_CANONICAL_HOST])dnl
311AC_REQUIRE([AC_CANONICAL_BUILD])dnl
312ac_prog=ld
313if test "$ac_cv_prog_gcc" = yes; then
314 # Check if gcc -print-prog-name=ld gives a path.
315 AC_MSG_CHECKING([for ld used by GCC])
316 ac_prog=`($CC -print-prog-name=ld) 2>&5`
317 case "$ac_prog" in
318 # Accept absolute paths.
319changequote(,)dnl
320 /* | [A-Za-z]:/*)
321 # Canonicalize the path of ld
322 re_direlt='/[^/][^/]*/\.\./'
323 sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%'
324changequote([,])dnl
325 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
326 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
327 done
328 case "$host_os" in
329 cygwin*)
330 # Convert to a UNC path for cygwin
331 test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"`
332 ;;
333 *)
334 test -z "$LD" && LD="$ac_prog"
335 ;;
336 esac
337 ;;
338 ##
339 ## FIXME: The code fails later on if we try to use an $LD with
340 ## '\\' path separators.
341 ##
342changequote(,)dnl
343 [A-Za-z]:[\\]*)
344 # Canonicalize the path of ld
345 re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)'
346 sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%'
347changequote([,])dnl
348 sub_uncdir='s%\\%/%g'
349 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
350 ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"`
351 done
352 case "$host_os" in
353 cygwin*)
354 # Convert to a UNC path for cygwin
355 test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"`
356 ;;
357 *)
358 test -z "$LD" && LD="$ac_prog"
359 ;;
360 esac
361 ;;
362 "")
363 # If it fails, then pretend we aren't using GCC.
364 ac_prog=ld
365 ;;
366 *)
367 # If it is relative, then search for the first ld in PATH.
368 with_gnu_ld=unknown
369 ;;
370 esac
371elif test "$with_gnu_ld" = yes; then
372 AC_MSG_CHECKING([for GNU ld])
373else
374 AC_MSG_CHECKING([for non-GNU ld])
375fi
376AC_CACHE_VAL(ac_cv_path_LD,
377[if test -z "$LD"; then
378 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
379 for ac_dir in $PATH; do
380 test -z "$ac_dir" && ac_dir=.
381 if test -f "$ac_dir/$ac_prog"; then
382 ac_cv_path_LD="$ac_dir/$ac_prog"
383 # Check to see if the program is GNU ld. I'd rather use --version,
384 # but apparently some GNU ld's only accept -v.
385 # Break only if it was the GNU/non-GNU ld that we prefer.
386 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
387 test "$with_gnu_ld" != no && break
388 else
389 test "$with_gnu_ld" != yes && break
390 fi
391 fi
392 done
393 IFS="$ac_save_ifs"
394else
395 ac_cv_path_LD="$LD" # Let the user override the test with a path.
396fi])
397LD="$ac_cv_path_LD"
398if test -n "$LD"; then
399 AC_MSG_RESULT($LD)
400else
401 AC_MSG_RESULT(no)
402fi
403test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
404AC_SUBST(LD)
405AM_PROG_LD_GNU
406])
407
408AC_DEFUN(AM_PROG_LD_GNU,
409[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
410[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
411if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
412 ac_cv_prog_gnu_ld=yes
413else
414 ac_cv_prog_gnu_ld=no
415fi])
416])
417
418# AM_PROG_NM - find the path to a BSD-compatible name lister
419AC_DEFUN(AM_PROG_NM,
420[AC_MSG_CHECKING([for BSD-compatible nm])
421AC_CACHE_VAL(ac_cv_path_NM,
422[if test -n "$NM"; then
423 # Let the user override the test.
424 ac_cv_path_NM="$NM"
425else
426 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
427 for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
428 test -z "$ac_dir" && ac_dir=.
429 if test -f $ac_dir/nm; then
430 # Check to see if the nm accepts a BSD-compat flag.
431 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
432 # nm: unknown option "B" ignored
433 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
434 ac_cv_path_NM="$ac_dir/nm -B"
435 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
436 ac_cv_path_NM="$ac_dir/nm -p"
437 else
438 ac_cv_path_NM="$ac_dir/nm"
439 fi
440 break
441 fi
442 done
443 IFS="$ac_save_ifs"
444 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
445fi])
446NM="$ac_cv_path_NM"
447AC_MSG_RESULT([$NM])
448AC_SUBST(NM)
449])
450
451# AM_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed
452# by C symbol name from nm.
453AC_DEFUN(AM_SYS_NM_PARSE,
454[AC_REQUIRE([AC_CANONICAL_HOST])dnl
455AC_REQUIRE([AM_PROG_NM])dnl
456# Check for command to grab the raw symbol name followed by C symbol from nm.
457AC_MSG_CHECKING([command to parse $NM output])
458AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
459[# These are sane defaults that work on at least a few old systems.
460# {They come from Ultrix. What could be older than Ultrix?!! ;)}
461
462changequote(,)dnl
463# Character class describing NM global symbol codes.
464ac_symcode='[BCDEGRSTU]'
465
466# Regexp to match symbols that can be accessed directly from C.
467ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
468
469# Transform the above into a raw symbol and a C symbol.
470ac_symxfrm='\1 \1'
471
472# Define system-specific variables.
473case "$host_os" in
474aix*)
475 ac_symcode='[BCDTU]'
476 ;;
477sunos* | cygwin32* | mingw32*)
478 ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
479 ac_symxfrm='_\1 \1'
480 ;;
481irix*)
482 # Cannot use undefined symbols on IRIX because inlined functions mess us up.
483 ac_symcode='[BCDEGRST]'
484 ;;
485solaris*)
486 ac_symcode='[BDTU]'
487 ;;
488esac
489
490# If we're using GNU nm, then use its standard symbol codes.
491if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
492 ac_symcode='[ABCDGISTUW]'
493fi
494
495case "$host_os" in
496cygwin32* | mingw32*)
497 # We do not want undefined symbols on cygwin32. The user must
498 # arrange to define them via -l arguments.
499 ac_symcode='[ABCDGISTW]'
500 ;;
501esac
502changequote([,])dnl
503
504# Write the raw and C identifiers.
505ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'"
506
507# Check to see that the pipe works correctly.
508ac_pipe_works=no
509cat > conftest.$ac_ext <<EOF
510#ifdef __cplusplus
511extern "C" {
512#endif
513char nm_test_var;
514void nm_test_func(){}
515#ifdef __cplusplus
516}
517#endif
518int main(){nm_test_var='a';nm_test_func;return 0;}
519EOF
520if AC_TRY_EVAL(ac_compile); then
521 # Now try to grab the symbols.
522 ac_nlist=conftest.nm
523 if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
524
525 # Try sorting and uniquifying the output.
526 if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
527 mv -f "$ac_nlist"T "$ac_nlist"
528 ac_wcout=`wc "$ac_nlist" 2>/dev/null`
529changequote(,)dnl
530 ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
531changequote([,])dnl
532 (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
533 else
534 rm -f "$ac_nlist"T
535 ac_count=-1
536 fi
537
538 # Make sure that we snagged all the symbols we need.
539 if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
540 if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
541 cat <<EOF > conftest.c
542#ifdef __cplusplus
543extern "C" {
544#endif
545
546EOF
547 # Now generate the symbol file.
548 sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
549
550 cat <<EOF >> conftest.c
551#if defined (__STDC__) && __STDC__
552# define __ptr_t void *
553#else
554# define __ptr_t char *
555#endif
556
557/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
558int dld_preloaded_symbol_count = $ac_count;
559
560/* The mapping between symbol names and symbols. */
561struct {
562 char *name;
563 __ptr_t address;
564}
565changequote(,)dnl
566dld_preloaded_symbols[] =
567changequote([,])dnl
568{
569EOF
570 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
571 cat <<\EOF >> conftest.c
572 {0, (__ptr_t) 0}
573};
574
575#ifdef __cplusplus
576}
577#endif
578EOF
579 # Now try linking the two files.
580 mv conftest.$ac_objext conftestm.$ac_objext
581 ac_save_LIBS="$LIBS"
582 ac_save_CFLAGS="$CFLAGS"
583 LIBS="conftestm.$ac_objext"
584 CFLAGS="$CFLAGS$no_builtin_flag"
585 if AC_TRY_EVAL(ac_link) && test -s conftest; then
586 ac_pipe_works=yes
587 else
588 echo "configure: failed program was:" >&AC_FD_CC
589 cat conftest.c >&AC_FD_CC
590 fi
591 LIBS="$ac_save_LIBS"
592 CFLAGS="$ac_save_CFLAGS"
593 else
594 echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
595 fi
596 else
597 echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
598 fi
599 else
600 echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
601 fi
602else
603 echo "$progname: failed program was:" >&AC_FD_CC
604 cat conftest.c >&AC_FD_CC
605fi
606rm -rf conftest*
607
608# Do not use the global_symbol_pipe unless it works.
609test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe=
610])
611
612ac_result=yes
613if test -z "$ac_cv_sys_global_symbol_pipe"; then
614 ac_result=no
615fi
616AC_MSG_RESULT($ac_result)
617])
618
619# AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
620AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
621[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
622AC_CHECK_TOOL(AS, as, false)
623])
624
625# AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
626# with an underscore?
627AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE,
628[AC_REQUIRE([AM_PROG_NM])dnl
629AC_REQUIRE([AM_SYS_NM_PARSE])dnl
630AC_MSG_CHECKING([for _ prefix in compiled symbols])
631AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
632[ac_cv_sys_symbol_underscore=no
633cat > conftest.$ac_ext <<EOF
634void nm_test_func(){}
635int main(){nm_test_func;return 0;}
636EOF
637if AC_TRY_EVAL(ac_compile); then
638 # Now try to grab the symbols.
639 ac_nlist=conftest.nm
640 if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
641 # See whether the symbols have a leading underscore.
642 if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then
643 ac_cv_sys_symbol_underscore=yes
644 else
645 if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
646 :
647 else
648 echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
649 fi
650 fi
651 else
652 echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
653 fi
654else
655 echo "configure: failed program was:" >&AC_FD_CC
656 cat conftest.c >&AC_FD_CC
657fi
658rm -rf conftest*
659])
660AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
661if test x$ac_cv_sys_symbol_underscore = xyes; then
662 AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1,
663 [define if compiled symbols have a leading underscore])
664fi
665])
666
667
668dnl ===========================================================================
669dnl GKT+ version test
670dnl ===========================================================================
671
672dnl ---------------------------------------------------------------------------
673dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
674dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
675dnl ---------------------------------------------------------------------------
676dnl
677AC_DEFUN(AM_PATH_GTK,
678[dnl
679dnl Get the cflags and libraries from the gtk-config script
680dnl
681AC_ARG_WITH(gtk-prefix,[**--with-gtk-prefix=PFX Prefix where GTK is installed],
682 gtk_config_prefix="$withval", gtk_config_prefix="")
683AC_ARG_WITH(gtk-exec-prefix,[**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed],
684 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
685
686 if test x$gtk_config_exec_prefix != x ; then
687 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
688 if test x${GTK_CONFIG+set} != xset ; then
689 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
690 fi
691 fi
692 if test x$gtk_config_prefix != x ; then
693 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
694 if test x${GTK_CONFIG+set} != xset ; then
695 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
696 fi
697 fi
698
699 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
700 min_gtk_version=ifelse([$1], ,0.99.7,$1)
701 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
702 no_gtk=""
703 if test "$GTK_CONFIG" != "no" ; then
704 GTK_CFLAGS=`$GTK_CONFIG --cflags`
705 GTK_LIBS=`$GTK_CONFIG --libs`
706 ac_save_CFLAGS="$CFLAGS"
707 ac_save_LIBS="$LIBS"
708 CFLAGS="$CFLAGS $GTK_CFLAGS"
709 LIBS="$LIBS $GTK_LIBS"
710dnl
711dnl Now check if the installed GTK is sufficiently new. (Also sanity
712dnl checks the results of gtk-config to some extent)
713dnl
714 AC_TRY_RUN([
715#include <gtk/gtk.h>
716#include <stdio.h>
717
718int
719main ()
720{
721 int major, minor, micro;
722
723 if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
724 printf("%s, bad version string\n", "$min_gtk_version");
725 exit(1);
726 }
727
728 if (gtk_minor_version == 1) return FALSE;
729
730 return !((gtk_major_version > major) ||
731 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
732 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)));
733}
734],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
735 CFLAGS="$ac_save_CFLAGS"
736 LIBS="$ac_save_LIBS"
737 else
738 no_gtk=yes
739 fi
740 if test "x$no_gtk" = x ; then
741 AC_MSG_RESULT(yes)
742 ifelse([$2], , :, [$2])
743 else
744 AC_MSG_RESULT(no)
745 GTK_CFLAGS=""
746 GTK_LIBS=""
747 ifelse([$3], , :, [$3])
748 fi
749 AC_SUBST(GTK_CFLAGS)
750 AC_SUBST(GTK_LIBS)
751])
752
753dnl ===========================================================================
754dnl macros to find the a file in the list of include/lib paths
755dnl ===========================================================================
756
757dnl ---------------------------------------------------------------------------
758dnl call AC_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
759dnl to the full name of the file that was found or leaves it empty if not found
760dnl ---------------------------------------------------------------------------
761AC_DEFUN(AC_PATH_FIND_INCLUDES,
762[
763ac_find_includes=
764for ac_dir in $1;
765 do
766 if test -f "$ac_dir/$2"; then
767 ac_find_includes=$ac_dir
768 break
769 fi
770 done
771])
772
773dnl ---------------------------------------------------------------------------
774dnl call AC_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_includes
775dnl to the full name of the file that was found or leaves it empty if not found
776dnl ---------------------------------------------------------------------------
777AC_DEFUN(AC_PATH_FIND_LIBRARIES,
778[
779ac_find_libraries=
780for ac_dir in $1;
781 do
782 for ac_extension in a so sl; do
783 if test -f "$ac_dir/lib$2.$ac_extension"; then
784 ac_find_libraries=$ac_dir
785 break 2
786 fi
787 done
788 done
789])
790
791dnl ---------------------------------------------------------------------------
792dnl Path to include, already defined
793dnl ---------------------------------------------------------------------------
794AC_DEFUN(AC_INCLUDE_PATH_EXIST,
795[
796 ac_path_to_include=$1
797 echo "$2" | grep "\-I$1" > /dev/null
798 result=$?
799 if test $result = 0; then
800 ac_path_to_include=""
801 else
802 ac_path_to_include="-I$1"
803 fi
804])
805
806dnl ---------------------------------------------------------------------------
807dnl Path to link, already defined
808dnl ---------------------------------------------------------------------------
809AC_DEFUN(AC_LINK_PATH_EXIST,
810[
811 echo "$2" | grep "\-L$1" > /dev/null
812 result=$?
813 if test $result = 0; then
814 ac_path_to_link=""
815 else
816 ac_path_to_link="-L$1"
817 fi
818])
819
820dnl ===========================================================================
821dnl C++ features test
822dnl ===========================================================================
823
824dnl ---------------------------------------------------------------------------
825dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
826dnl or only the old <iostream.h> one - it may be generally assumed that if
827dnl <iostream> exists, the other "new" headers (without .h) exist too.
828dnl
829dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling)
830dnl ---------------------------------------------------------------------------
831
832AC_DEFUN(WX_CPP_NEW_HEADERS,
833[
834 if test "$cross_compiling" = "yes"; then
835 ifelse([$2], , :, [$2])
836 else
837 AC_LANG_SAVE
838 AC_LANG_CPLUSPLUS
839
840 AC_CHECK_HEADERS(iostream)
841
842 if test "x$HAVE_IOSTREAM" = x ; then
843 ifelse([$2], , :, [$2])
844 else
845 ifelse([$1], , :, [$1])
846 fi
847
848 AC_LANG_RESTORE
849 fi
850])
851
852dnl ---------------------------------------------------------------------------
853dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
854dnl
855dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
856dnl ---------------------------------------------------------------------------
857
858AC_DEFUN(WX_CPP_BOOL,
859[
860 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
861 [
862 AC_LANG_SAVE
863 AC_LANG_CPLUSPLUS
864
865 AC_TRY_RUN([
866 int main()
867 {
868 bool b = true;
869
870 return 0;
871 }
872 ],
873 [
874 AC_DEFINE(HAVE_BOOL)
875 wx_cv_cpp_bool=yes
876 ],
877 wx_cv_cpp_bool=no,
878 wx_cv_cpp_bool=no
879 )
880
881 AC_LANG_RESTORE
882 ])
883
884 if test "$wx_cv_cpp_bool" = "yes"; then
885 AC_DEFINE(HAVE_BOOL)
886 fi
887])
888
889dnl ---------------------------------------------------------------------------
890dnl WX_CPP_SIZE_T_IS_NOT_INT checks whether size_t and int are different types,
891dnl i.e. whether we may overload operator[] on its argument type
892dnl ---------------------------------------------------------------------------
893
894AC_DEFUN(WX_CPP_SIZE_T_IS_NOT_INT,
895[
896 AC_CACHE_CHECK([if size_t and int are different types], wx_cv_cpp_sizet_not_int,
897 [
898 AC_LANG_SAVE
899 AC_LANG_CPLUSPLUS
900
901 AC_TRY_RUN([
902 #include <stdlib.h>
903
904 class S
905 {
906 public:
907 S(char *s) { m_s = s; }
908
909 char operator[](size_t n) const { return m_s[n]; }
910 char operator[](int n) const { return m_s[n]; }
911
912 private:
913 char *m_s;
914 };
915
916 int main()
917 {
918 S s("dummy");
919 size_t n1 = 2;
920 int n2 = 3;
921
922 return s[n1] == s[n2];
923 }
924 ],
925 AC_DEFINE(wxUSE_SIZE_T_STRING_OPERATOR) wx_cv_cpp_sizet_not_int=yes,
926 wx_cv_cpp_sizet_not_int=no,
927 wx_cv_cpp_sizet_not_int=no
928 )
929
930 AC_LANG_RESTORE
931 ])
932])