1 dnl ---------------------------------------------------------------------------
3 dnl Purpose: Cursom macros for autoconf configure script.
4 dnl Authoer: Vadim Zeitlin
7 dnl ---------------------------------------------------------------------------
9 dnl ===========================================================================
10 dnl include automake macros
11 dnl ===========================================================================
13 dnl Like AC_CONFIG_HEADER, but automatically create stamp file.
14 AC_DEFUN(AM_CONFIG_HEADER,
16 AC_CONFIG_HEADER([$1])
17 dnl When config.status generates a header, we must update the stamp-h file.
18 dnl This file resides in the same directory as the config header
19 dnl that is generated. We must strip everything past the first ":",
20 dnl and everything past the last "/".
21 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
22 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
23 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
25 for 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
31 am_indx=`expr "<<$>>am_indx" + 1`
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.
42 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
44 AC_DEFUN(AM_INIT_AUTOMAKE,
45 [AC_REQUIRE([AC_PROG_INSTALL])
50 dnl test to see if srcdir already configured
51 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
52 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
55 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
56 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
57 AC_REQUIRE([AM_SANITY_CHECK])
58 AC_REQUIRE([AC_ARG_PROGRAM])
59 dnl FIXME This is truly gross.
60 missing_dir=`cd $ac_aux_dir && pwd`
61 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
62 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
63 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
64 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
65 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
66 AC_REQUIRE([AC_PROG_MAKE_SET])])
71 AC_DEFUN(AM_PROG_INSTALL,
72 [AC_REQUIRE([AC_PROG_INSTALL])
73 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
74 AC_SUBST(INSTALL_SCRIPT)dnl
78 # Check to make sure that the build environment is sane.
81 AC_DEFUN(AM_SANITY_CHECK,
82 [AC_MSG_CHECKING([whether build environment is sane])
85 echo 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
92 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
93 if test "[$]*" = "X"; then
95 set X `ls -t $srcdir/configure conftestfile`
97 if test "[$]*" != "X $srcdir/configure conftestfile" \
98 && test "[$]*" != "X conftestfile $srcdir/configure"; then
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
105 alias in your environment])
108 test "[$]2" = conftestfile
114 AC_MSG_ERROR([newly created file is older than distributed files!
115 Check your system clock])
120 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
121 dnl The program must properly implement --version.
122 AC_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.
127 if ($2 --version) < /dev/null > /dev/null 2>&1; then
132 AC_MSG_RESULT(missing)
138 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
139 AC_DEFUN(AM_PROG_LEX,
140 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
141 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
146 # serial 29 AM_PROG_LIBTOOL
147 AC_DEFUN(AM_PROG_LIBTOOL,
148 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
149 AC_REQUIRE([AM_ENABLE_STATIC])dnl
150 AC_REQUIRE([AC_CANONICAL_HOST])dnl
151 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
152 AC_REQUIRE([AC_PROG_RANLIB])dnl
153 AC_REQUIRE([AC_PROG_CC])dnl
154 AC_REQUIRE([AM_PROG_LD])dnl
155 AC_REQUIRE([AM_PROG_NM])dnl
156 AC_REQUIRE([AM_SYS_NM_PARSE])dnl
157 AC_REQUIRE([AM_SYS_SYMBOL_UNDERSCORE])dnl
158 AC_REQUIRE([AC_PROG_LN_S])dnl
160 # Always use our own libtool.
161 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
164 # Check for any special flags to pass to ltconfig.
166 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
167 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
168 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
169 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
170 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
172 # Some flags need to be propagated to the compiler or linker for good
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
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"
207 AM_SYS_LIBTOOL_CYGWIN32
212 # enable the --disable-libtool-lock switch
214 AC_ARG_ENABLE(libtool-lock,
215 [ --disable-libtool-lock force libtool not to do file locking],
216 need_locks=$enableval,
219 if test x"$need_locks" = xno; then
220 libtool_flags="$libtool_flags --disable-lock"
224 # Actually configure libtool. ac_aux_dir is where install-sh is found.
225 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
226 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
227 DLLTOOL="$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])
232 # Redirect the config.log output again, so that the ltconfig log is not
233 # clobbered by the next message.
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
241 AC_DEFUN(AM_ENABLE_SHARED,
242 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
243 AC_ARG_ENABLE(shared,
244 changequote(<<, >>)dnl
245 << --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
247 [p=${PACKAGE-default}
249 yes) enable_shared=yes ;;
250 no) 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
263 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
266 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
267 AC_DEFUN(AM_DISABLE_SHARED,
268 [AM_ENABLE_SHARED(no)])
270 # AM_DISABLE_STATIC - set the default static flag to --disable-static
271 AC_DEFUN(AM_DISABLE_STATIC,
272 [AM_ENABLE_STATIC(no)])
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
278 AC_DEFUN(AM_ENABLE_STATIC,
279 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
280 AC_ARG_ENABLE(static,
281 changequote(<<, >>)dnl
282 << --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
284 [p=${PACKAGE-default}
286 yes) enable_static=yes ;;
287 no) 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
300 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
304 # AM_PROG_LD - find the path to the GNU or non-GNU linker
307 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
308 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
309 AC_REQUIRE([AC_PROG_CC])dnl
310 AC_REQUIRE([AC_CANONICAL_HOST])dnl
311 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
313 if 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`
318 # Accept absolute paths.
321 # Canonicalize the path of ld
322 re_direlt='/[^/][^/]*/\.\./'
323 sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%'
325 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
326 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
330 # Convert to a UNC path for cygwin
331 test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"`
334 test -z "$LD" && LD="$ac_prog"
339 ## FIXME: The code fails later on if we try to use an $LD with
340 ## '\\' path separators.
344 # Canonicalize the path of ld
345 re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)'
346 sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%'
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%"`
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"`
358 test -z "$LD" && LD="$ac_prog"
363 # If it fails, then pretend we aren't using GCC.
367 # If it is relative, then search for the first ld in PATH.
371 elif test "$with_gnu_ld" = yes; then
372 AC_MSG_CHECKING([for GNU ld])
374 AC_MSG_CHECKING([for non-GNU ld])
376 AC_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
389 test "$with_gnu_ld" != yes && break
395 ac_cv_path_LD="$LD" # Let the user override the test with a path.
398 if test -n "$LD"; then
403 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
408 AC_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.
411 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
412 ac_cv_prog_gnu_ld=yes
418 # AM_PROG_NM - find the path to a BSD-compatible name lister
420 [AC_MSG_CHECKING([for BSD-compatible nm])
421 AC_CACHE_VAL(ac_cv_path_NM,
422 [if test -n "$NM"; then
423 # Let the user override the test.
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"
438 ac_cv_path_NM="$ac_dir/nm"
444 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
451 # AM_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed
452 # by C symbol name from nm.
453 AC_DEFUN(AM_SYS_NM_PARSE,
454 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
455 AC_REQUIRE([AM_PROG_NM])dnl
456 # Check for command to grab the raw symbol name followed by C symbol from nm.
457 AC_MSG_CHECKING([command to parse $NM output])
458 AC_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?!! ;)}
463 # Character class describing NM global symbol codes.
464 ac_symcode='[BCDEGRSTU]'
466 # Regexp to match symbols that can be accessed directly from C.
467 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
469 # Transform the above into a raw symbol and a C symbol.
472 # Define system-specific variables.
477 sunos* | cygwin32* | mingw32*)
478 ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
482 # Cannot use undefined symbols on IRIX because inlined functions mess us up.
483 ac_symcode='[BCDEGRST]'
490 # If we're using GNU nm, then use its standard symbol codes.
491 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
492 ac_symcode='[ABCDGISTUW]'
496 cygwin32* | 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]'
504 # Write the raw and C identifiers.
505 ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'"
507 # Check to see that the pipe works correctly.
509 cat > conftest.$ac_ext <<EOF
514 void nm_test_func(){}
518 int main(){nm_test_var='a';nm_test_func;return 0;}
520 if AC_TRY_EVAL(ac_compile); then
521 # Now try to grab the symbols.
523 if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
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`
530 ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
532 (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
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
547 # Now generate the symbol file.
548 sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
550 cat <<EOF >> conftest.c
551 #if defined (__STDC__) && __STDC__
552 # define __ptr_t void *
554 # define __ptr_t char *
557 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
558 int dld_preloaded_symbol_count = $ac_count;
560 /* The mapping between symbol names and symbols. */
566 dld_preloaded_symbols[] =
570 sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
571 cat <<\EOF >> conftest.c
579 # Now try linking the two files.
580 mv conftest.$ac_objext conftestm.$ac_objext
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
588 echo "configure: failed program was:" >&AC_FD_CC
589 cat conftest.c >&AC_FD_CC
592 CFLAGS="$ac_save_CFLAGS"
594 echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
597 echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
600 echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
603 echo "$progname: failed program was:" >&AC_FD_CC
604 cat conftest.c >&AC_FD_CC
608 # Do not use the global_symbol_pipe unless it works.
609 test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe=
613 if test -z "$ac_cv_sys_global_symbol_pipe"; then
616 AC_MSG_RESULT($ac_result)
619 # AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
620 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
621 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
622 AC_CHECK_TOOL(AS, as, false)
625 # AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
626 # with an underscore?
627 AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE,
628 [AC_REQUIRE([AM_PROG_NM])dnl
629 AC_REQUIRE([AM_SYS_NM_PARSE])dnl
630 AC_MSG_CHECKING([for _ prefix in compiled symbols])
631 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
632 [ac_cv_sys_symbol_underscore=no
633 cat > conftest.$ac_ext <<EOF
634 void nm_test_func(){}
635 int main(){nm_test_func;return 0;}
637 if AC_TRY_EVAL(ac_compile); then
638 # Now try to grab the symbols.
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
645 if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
648 echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
652 echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
655 echo "configure: failed program was:" >&AC_FD_CC
656 cat conftest.c >&AC_FD_CC
660 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
661 if 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])
668 dnl ===========================================================================
669 dnl GKT+ version test
670 dnl ===========================================================================
672 dnl ---------------------------------------------------------------------------
673 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
674 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
675 dnl ---------------------------------------------------------------------------
677 AC_DEFUN(AM_PATH_GTK,
679 dnl Get the cflags and libraries from the gtk-config script
681 AC_ARG_WITH(gtk-prefix,[**--with-gtk-prefix=PFX Prefix where GTK is installed],
682 gtk_config_prefix="$withval", gtk_config_prefix="")
683 AC_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="")
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
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
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)
703 if test "$GTK_CONFIG" != "no" ; then
704 GTK_CFLAGS=`$GTK_CONFIG --cflags`
705 GTK_LIBS=`$GTK_CONFIG --libs`
706 ac_save_CFLAGS="$CFLAGS"
708 CFLAGS="$CFLAGS $GTK_CFLAGS"
709 LIBS="$LIBS $GTK_LIBS"
711 dnl Now check if the installed GTK is sufficiently new. (Also sanity
712 dnl checks the results of gtk-config to some extent)
721 int major, minor, micro;
723 if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) {
724 printf("%s, bad version string\n", "$min_gtk_version");
728 if (gtk_minor_version == 1) return FALSE;
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)));
734 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
735 CFLAGS="$ac_save_CFLAGS"
740 if test "x$no_gtk" = x ; then
742 ifelse([$2], , :, [$2])
747 ifelse([$3], , :, [$3])
753 dnl ===========================================================================
754 dnl macros to find the a file in the list of include/lib paths
755 dnl ===========================================================================
757 dnl ---------------------------------------------------------------------------
758 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
759 dnl to the full name of the file that was found or leaves it empty if not found
760 dnl ---------------------------------------------------------------------------
761 AC_DEFUN(WX_PATH_FIND_INCLUDES,
766 if test -f "$ac_dir/$2"; then
767 ac_find_includes=$ac_dir
773 dnl ---------------------------------------------------------------------------
774 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_includes
775 dnl to the full name of the file that was found or leaves it empty if not found
776 dnl ---------------------------------------------------------------------------
777 AC_DEFUN(WX_PATH_FIND_LIBRARIES,
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
791 dnl ---------------------------------------------------------------------------
792 dnl Path to include, already defined
793 dnl ---------------------------------------------------------------------------
794 AC_DEFUN(WX_INCLUDE_PATH_EXIST,
796 ac_path_to_include=$1
797 echo "$2" | grep "\-I$1" > /dev/null
799 if test $result = 0; then
800 ac_path_to_include=""
802 ac_path_to_include="-I$1"
806 dnl ---------------------------------------------------------------------------
807 dnl Path to link, already defined
808 dnl ---------------------------------------------------------------------------
809 AC_DEFUN(WX_LINK_PATH_EXIST,
811 echo "$2" | grep "\-L$1" > /dev/null
813 if test $result = 0; then
816 ac_path_to_link="-L$1"
820 dnl ===========================================================================
821 dnl C++ features test
822 dnl ===========================================================================
824 dnl ---------------------------------------------------------------------------
825 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
826 dnl or only the old <iostream.h> one - it may be generally assumed that if
827 dnl <iostream> exists, the other "new" headers (without .h) exist too.
829 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling)
830 dnl ---------------------------------------------------------------------------
832 AC_DEFUN(WX_CPP_NEW_HEADERS,
834 if test "$cross_compiling" = "yes"; then
835 ifelse([$2], , :, [$2])
840 AC_CHECK_HEADERS(iostream)
842 if test "x$HAVE_IOSTREAM" = x ; then
843 ifelse([$2], , :, [$2])
845 ifelse([$1], , :, [$1])
852 dnl ---------------------------------------------------------------------------
853 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
855 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
856 dnl ---------------------------------------------------------------------------
858 AC_DEFUN(WX_CPP_BOOL,
860 AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
884 if test "$wx_cv_cpp_bool" = "yes"; then
889 dnl ---------------------------------------------------------------------------
890 dnl WX_CPP_SIZE_T_IS_NOT_INT checks whether size_t and int are different types,
891 dnl i.e. whether we may overload operator[] on its argument type
892 dnl ---------------------------------------------------------------------------
894 AC_DEFUN(WX_CPP_SIZE_T_IS_NOT_INT,
896 AC_CACHE_CHECK([if size_t and int are different types], wx_cv_cpp_sizet_not_int,
907 S(char *s) { m_s = s; }
909 char operator[](size_t n) const { return m_s[n]; }
910 char operator[](int n) const { return m_s[n]; }
922 return s[n1] == s[n2];
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
934 dnl ---------------------------------------------------------------------------
935 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
936 dnl ---------------------------------------------------------------------------
938 AC_DEFUN(WX_C_BIGENDIAN,
939 [AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
940 [ac_cv_c_bigendian=unknown
941 # See if sys/param.h defines the BYTE_ORDER macro.
942 AC_TRY_COMPILE([#include <sys/types.h>
943 #include <sys/param.h>], [
944 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
946 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
947 AC_TRY_COMPILE([#include <sys/types.h>
948 #include <sys/param.h>], [
949 #if BYTE_ORDER != BIG_ENDIAN
951 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
952 if test $ac_cv_c_bigendian = unknown; then
953 AC_TRY_RUN([main () {
954 /* Are we little or big endian? From Harbison&Steele. */
958 char c[sizeof (long)];
961 exit (u.c[sizeof (long) - 1] == 1);
962 }], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, ac_cv_c_bigendian=unknown)
964 if test $ac_cv_c_bigendian = unknown; then
965 AC_MSG_WARN([Assuming little-endian target machine - this may be overriden by adding the line "ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}" to config.cache file])
967 if test $ac_cv_c_bigendian = yes; then
968 AC_DEFINE(WORDS_BIGENDIAN)
972 dnl ---------------------------------------------------------------------------
973 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
974 dnl ---------------------------------------------------------------------------
976 AC_DEFUN(WX_ARG_CACHE_INIT,
978 wx_arg_cache_file="configarg.cache"
979 echo "loading argument cache $wx_arg_cache_file"
980 rm -f ${wx_arg_cache_file}.tmp
981 touch ${wx_arg_cache_file}.tmp
982 touch ${wx_arg_cache_file}
985 AC_DEFUN(WX_ARG_CACHE_FLUSH,
987 echo "saving argument cache $wx_arg_cache_file"
988 mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
991 dnl this macro checks for a command line argument and caches the result
992 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
993 AC_DEFUN(WX_ARG_WITH,
995 AC_MSG_CHECKING("for --with-$1")
999 if test "$withval" = yes; then
1000 ac_cv_use_$1='$3=yes'
1002 ac_cv_use_$1='$3=no'
1006 LINE=`grep "$3" ${wx_arg_cache_file}`
1007 if test "x$LINE" != x ; then
1008 eval "DEFAULT_$LINE"
1013 ac_cv_use_$1='$3='$DEFAULT_$3
1016 eval "$ac_cv_use_$1"
1017 if test "$no_cache" != 1; then
1018 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
1021 if test "$$3" = yes; then
1028 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
1029 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name)
1030 AC_DEFUN(WX_ARG_ENABLE,
1032 AC_MSG_CHECKING("for --enable-$1")
1034 AC_ARG_ENABLE($1, $2,
1036 if test "$enableval" = yes; then
1037 ac_cv_use_$1='$3=yes'
1039 ac_cv_use_$1='$3=no'
1043 LINE=`grep "$3" ${wx_arg_cache_file}`
1044 if test "x$LINE" != x ; then
1045 eval "DEFAULT_$LINE"
1050 ac_cv_use_$1='$3='$DEFAULT_$3
1053 eval "$ac_cv_use_$1"
1054 if test "$no_cache" != 1; then
1055 echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
1058 if test "$$3" = yes; then