X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/143121c5e122f8d90a38225311234ceade5e67c8..6c67131a074be47b5a0f749643c40f5fdabc980b:/aclocal.m4 diff --git a/aclocal.m4 b/aclocal.m4 index f38c00b746..b92b74aa73 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,754 +1,25 @@ -dnl --------------------------------------------------------------------------- -dnl -dnl Purpose: Cursom macros for autoconf configure script. -dnl Authoer: Vadim Zeitlin -dnl Created: 26.05.99 -dnl Version: $Id$ -dnl --------------------------------------------------------------------------- - -dnl =========================================================================== -dnl include automake macros -dnl =========================================================================== - -dnl Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN(AM_CONFIG_HEADER, -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx - ;; - esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - - -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_REQUIRE([AC_PROG_INSTALL]) -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' -AC_SUBST(INSTALL_SCRIPT)dnl -]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - - -dnl AM_PROG_LEX -dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT -AC_DEFUN(AM_PROG_LEX, -[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) -AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") -AC_PROG_LEX -AC_DECL_YYTEXT]) - - -# serial 29 AM_PROG_LIBTOOL -AC_DEFUN(AM_PROG_LIBTOOL, -[AC_REQUIRE([AM_ENABLE_SHARED])dnl -AC_REQUIRE([AM_ENABLE_STATIC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_RANLIB])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AM_PROG_LD])dnl -AC_REQUIRE([AM_PROG_NM])dnl -AC_REQUIRE([AM_SYS_NM_PARSE])dnl -AC_REQUIRE([AM_SYS_SYMBOL_UNDERSCORE])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -dnl -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Check for any special flags to pass to ltconfig. -libtool_flags= -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$silent" = yes && libtool_flags="$libtool_flags --silent" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$host" in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -*-*-cygwin32*) - AM_SYS_LIBTOOL_CYGWIN32 - ;; - -esac - -# enable the --disable-libtool-lock switch - -AC_ARG_ENABLE(libtool-lock, -[ --disable-libtool-lock force libtool not to do file locking], -need_locks=$enableval, -need_locks=yes) - -if test x"$need_locks" = xno; then - libtool_flags="$libtool_flags --disable-lock" -fi - - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ -DLLTOOL="$DLLTOOL" AS="$AS" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -# AM_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AM_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AM_ENABLE_SHARED, -[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl -]) - -# AM_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AM_DISABLE_SHARED, -[AM_ENABLE_SHARED(no)]) - -# AM_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AM_DISABLE_STATIC, -[AM_ENABLE_STATIC(no)]) - -# AM_ENABLE_STATIC - implement the --enable-static flag -# Usage: AM_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AM_ENABLE_STATIC, -[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AM_ENABLE_STATIC_DEFAULT)dnl -]) - - -# AM_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AM_PROG_LD, -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. -changequote(,)dnl - /* | [A-Za-z]:/*) - # Canonicalize the path of ld - re_direlt='/[^/][^/]*/\.\./' - sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%' -changequote([,])dnl - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - case "$host_os" in - cygwin*) - # Convert to a UNC path for cygwin - test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"` - ;; - *) - test -z "$LD" && LD="$ac_prog" - ;; - esac - ;; - ## - ## FIXME: The code fails later on if we try to use an $LD with - ## '\\' path separators. - ## -changequote(,)dnl - [A-Za-z]:[\\]*) - # Canonicalize the path of ld - re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)' - sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%' -changequote([,])dnl - sub_uncdir='s%\\%/%g' - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"` - done - case "$host_os" in - cygwin*) - # Convert to a UNC path for cygwin - test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"` - ;; - *) - test -z "$LD" && LD="$ac_prog" - ;; - esac - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(ac_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$ac_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_SUBST(LD) -AM_PROG_LD_GNU -]) - -AC_DEFUN(AM_PROG_LD_GNU, -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi]) -]) - -# AM_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AM_PROG_NM, -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(ac_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - ac_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - else - ac_cv_path_NM="$ac_dir/nm" - fi - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm -fi]) -NM="$ac_cv_path_NM" -AC_MSG_RESULT([$NM]) -AC_SUBST(NM) -]) - -# AM_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed -# by C symbol name from nm. -AC_DEFUN(AM_SYS_NM_PARSE, -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AM_PROG_NM])dnl -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output]) -AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe, -[# These are sane defaults that work on at least a few old systems. -# {They come from Ultrix. What could be older than Ultrix?!! ;)} - -changequote(,)dnl -# Character class describing NM global symbol codes. -ac_symcode='[BCDEGRSTU]' - -# Regexp to match symbols that can be accessed directly from C. -ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -ac_symxfrm='\1 \1' - -# Define system-specific variables. -case "$host_os" in -aix*) - ac_symcode='[BCDTU]' - ;; -sunos* | cygwin32* | mingw32*) - ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)' - ac_symxfrm='_\1 \1' - ;; -irix*) - # Cannot use undefined symbols on IRIX because inlined functions mess us up. - ac_symcode='[BCDEGRST]' - ;; -solaris*) - ac_symcode='[BDTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - ac_symcode='[ABCDGISTUW]' -fi - -case "$host_os" in -cygwin32* | mingw32*) - # We do not want undefined symbols on cygwin32. The user must - # arrange to define them via -l arguments. - ac_symcode='[ABCDGISTW]' - ;; -esac -changequote([,])dnl - -# Write the raw and C identifiers. -ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'" - -# Check to see that the pipe works correctly. -ac_pipe_works=no -cat > conftest.$ac_ext < $ac_nlist) && test -s "$ac_nlist"; then - - # Try sorting and uniquifying the output. - if sort "$ac_nlist" | uniq > "$ac_nlist"T; then - mv -f "$ac_nlist"T "$ac_nlist" - ac_wcout=`wc "$ac_nlist" 2>/dev/null` -changequote(,)dnl - ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` -changequote([,])dnl - (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1 - else - rm -f "$ac_nlist"T - ac_count=-1 - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then - if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then - cat < conftest.c -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c - - cat <> conftest.c -#if defined (__STDC__) && __STDC__ -# define __ptr_t void * -#else -# define __ptr_t char * -#endif - -/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ -int dld_preloaded_symbol_count = $ac_count; - -/* The mapping between symbol names and symbols. */ -struct { - char *name; - __ptr_t address; -} -changequote(,)dnl -dld_preloaded_symbols[] = -changequote([,])dnl -{ -EOF - sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c - cat <<\EOF >> conftest.c - {0, (__ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftestm.$ac_objext - ac_save_LIBS="$LIBS" - ac_save_CFLAGS="$CFLAGS" - LIBS="conftestm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest; then - ac_pipe_works=yes - else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.c >&AC_FD_CC - fi - LIBS="$ac_save_LIBS" - CFLAGS="$ac_save_CFLAGS" - else - echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC - fi - else - echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC - fi - else - echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi -else - echo "$progname: failed program was:" >&AC_FD_CC - cat conftest.c >&AC_FD_CC -fi -rm -rf conftest* - -# Do not use the global_symbol_pipe unless it works. -test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe= -]) - -ac_result=yes -if test -z "$ac_cv_sys_global_symbol_pipe"; then - ac_result=no -fi -AC_MSG_RESULT($ac_result) -]) - -# AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32 -AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32, -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -AC_CHECK_TOOL(AS, as, false) -]) - -# AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols -# with an underscore? -AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, -[AC_REQUIRE([AM_PROG_NM])dnl -AC_REQUIRE([AM_SYS_NM_PARSE])dnl -AC_MSG_CHECKING([for _ prefix in compiled symbols]) -AC_CACHE_VAL(ac_cv_sys_symbol_underscore, -[ac_cv_sys_symbol_underscore=no -cat > conftest.$ac_ext < $ac_nlist) && test -s "$ac_nlist"; then - # See whether the symbols have a leading underscore. - if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then - ac_cv_sys_symbol_underscore=yes - else - if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then - : - else - echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC - fi - fi - else - echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi -else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.c >&AC_FD_CC -fi -rm -rf conftest* -]) -AC_MSG_RESULT($ac_cv_sys_symbol_underscore) -if test x$ac_cv_sys_symbol_underscore = xyes; then - AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1, - [define if compiled symbols have a leading underscore]) -fi -]) +# generated automatically by aclocal 1.7.2 -*- Autoconf -*- +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -dnl =========================================================================== -dnl GKT+ version test -dnl =========================================================================== +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. dnl --------------------------------------------------------------------------- -dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS -dnl --------------------------------------------------------------------------- -dnl -AC_DEFUN(AM_PATH_GTK, -[dnl -dnl Get the cflags and libraries from the gtk-config script dnl -AC_ARG_WITH(gtk-prefix,[**--with-gtk-prefix=PFX Prefix where GTK is installed], - gtk_config_prefix="$withval", gtk_config_prefix="") -AC_ARG_WITH(gtk-exec-prefix,[**--with-gtk-exec-prefix=PFX Exec prefix where GTK is installed], - gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") - - if test x$gtk_config_exec_prefix != x ; then - gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" - if test x${GTK_CONFIG+set} != xset ; then - GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config - fi - fi - if test x$gtk_config_prefix != x ; then - gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" - if test x${GTK_CONFIG+set} != xset ; then - GTK_CONFIG=$gtk_config_prefix/bin/gtk-config - fi - fi - - AC_PATH_PROG(GTK_CONFIG, gtk-config, no) - min_gtk_version=ifelse([$1], ,0.99.7,$1) - AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) - no_gtk="" - if test "$GTK_CONFIG" != "no" ; then - GTK_CFLAGS=`$GTK_CONFIG --cflags` - GTK_LIBS=`$GTK_CONFIG --libs` - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS" +dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker, +dnl Vadim Zeitlin and Ron Lee dnl -dnl Now check if the installed GTK is sufficiently new. (Also sanity -dnl checks the results of gtk-config to some extent) +dnl This script is under the wxWindows licence. dnl - AC_TRY_RUN([ -#include -#include - -int -main () -{ - int major, minor, micro; - - if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_gtk_version"); - exit(1); - } - - if (gtk_minor_version == 1) return FALSE; - - return !((gtk_major_version > major) || - ((gtk_major_version == major) && (gtk_minor_version > minor)) || - ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))); -} -],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - else - no_gtk=yes - fi - if test "x$no_gtk" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - GTK_CFLAGS="" - GTK_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GTK_CFLAGS) - AC_SUBST(GTK_LIBS) -]) +dnl Version: $Id$ +dnl --------------------------------------------------------------------------- dnl =========================================================================== dnl macros to find the a file in the list of include/lib paths @@ -758,10 +29,10 @@ dnl --------------------------------------------------------------------------- dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes dnl to the full name of the file that was found or leaves it empty if not found dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_PATH_FIND_INCLUDES, +AC_DEFUN([WX_PATH_FIND_INCLUDES], [ ac_find_includes= -for ac_dir in $1; +for ac_dir in $1 /usr/include; do if test -f "$ac_dir/$2"; then ac_find_includes=$ac_dir @@ -771,15 +42,15 @@ for ac_dir in $1; ]) dnl --------------------------------------------------------------------------- -dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_includes +dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries dnl to the full name of the file that was found or leaves it empty if not found dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_PATH_FIND_LIBRARIES, +AC_DEFUN([WX_PATH_FIND_LIBRARIES], [ ac_find_libraries= -for ac_dir in $1; +for ac_dir in $1 /usr/lib; do - for ac_extension in a so sl; do + for ac_extension in a so sl dylib; do if test -f "$ac_dir/lib$2.$ac_extension"; then ac_find_libraries=$ac_dir break 2 @@ -791,29 +62,33 @@ for ac_dir in $1; dnl --------------------------------------------------------------------------- dnl Path to include, already defined dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_INCLUDE_PATH_EXIST, +AC_DEFUN([WX_INCLUDE_PATH_EXIST], [ - ac_path_to_include=$1 - echo "$2" | grep "\-I$1" > /dev/null - result=$? - if test $result = 0; then + dnl never add -I/usr/include to the CPPFLAGS + if test "x$1" = "x/usr/include"; then ac_path_to_include="" else - ac_path_to_include="-I$1" + echo "$2" | grep "\-I$1" > /dev/null + result=$? + if test $result = 0; then + ac_path_to_include="" + else + ac_path_to_include=" -I$1" + fi fi ]) dnl --------------------------------------------------------------------------- dnl Path to link, already defined dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_LINK_PATH_EXIST, +AC_DEFUN([WX_LINK_PATH_EXIST], [ echo "$2" | grep "\-L$1" > /dev/null result=$? if test $result = 0; then ac_path_to_link="" else - ac_path_to_link="-L$1" + ac_path_to_link=" -L$1" fi ]) @@ -829,7 +104,7 @@ dnl dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false-or-cross-compiling) dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_CPP_NEW_HEADERS, +AC_DEFUN([WX_CPP_NEW_HEADERS], [ if test "$cross_compiling" = "yes"; then ifelse([$2], , :, [$2]) @@ -839,10 +114,10 @@ AC_DEFUN(WX_CPP_NEW_HEADERS, AC_CHECK_HEADERS(iostream) - if test "x$HAVE_IOSTREAM" = x ; then - ifelse([$2], , :, [$2]) - else + if test "$ac_cv_header_iostream" = "yes" ; then ifelse([$1], , :, [$1]) + else + ifelse([$2], , :, [$2]) fi AC_LANG_RESTORE @@ -855,27 +130,27 @@ dnl dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_CPP_BOOL, +AC_DEFUN([WX_CPP_BOOL], [ AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - int main() - { - bool b = true; + AC_TRY_COMPILE( + [ + ], + [ + bool b = true; - return 0; - } + return 0; ], [ - AC_DEFINE(HAVE_BOOL) wx_cv_cpp_bool=yes ], - wx_cv_cpp_bool=no, - wx_cv_cpp_bool=no + [ + wx_cv_cpp_bool=no + ] ) AC_LANG_RESTORE @@ -887,56 +162,58 @@ AC_DEFUN(WX_CPP_BOOL, ]) dnl --------------------------------------------------------------------------- -dnl WX_CPP_SIZE_T_IS_NOT_INT checks whether size_t and int are different types, -dnl i.e. whether we may overload operator[] on its argument type +dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit +dnl keyword and defines HAVE_EXPLICIT if this is the case dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_CPP_SIZE_T_IS_NOT_INT, +AC_DEFUN([WX_CPP_EXPLICIT], [ - AC_CACHE_CHECK([if size_t and int are different types], wx_cv_cpp_sizet_not_int, + AC_CACHE_CHECK([if C++ compiler supports the explicit keyword], + wx_cv_explicit, [ AC_LANG_SAVE AC_LANG_CPLUSPLUS - AC_TRY_RUN([ - #include - - class S - { - public: - S(char *s) { m_s = s; } - - char operator[](size_t n) const { return m_s[n]; } - char operator[](int n) const { return m_s[n]; } - - private: - char *m_s; - }; - - int main() - { - S s("dummy"); - size_t n1 = 2; - int n2 = 3; - - return s[n1] == s[n2]; - } + dnl do the test in 2 steps: first check that the compiler knows about the + dnl explicit keyword at all and then verify that it really honours it + AC_TRY_COMPILE( + [ + class Foo { public: explicit Foo(int) {} }; + ], + [ + return 0; ], - AC_DEFINE(wxUSE_SIZE_T_STRING_OPERATOR) wx_cv_cpp_sizet_not_int=yes, - wx_cv_cpp_sizet_not_int=no, - wx_cv_cpp_sizet_not_int=no + [ + AC_TRY_COMPILE( + [ + class Foo { public: explicit Foo(int) {} }; + static void TakeFoo(const Foo& foo) { } + ], + [ + TakeFoo(17); + return 0; + ], + wx_cv_explicit=no, + wx_cv_explicit=yes + ) + ], + wx_cv_explicit=no ) AC_LANG_RESTORE ]) + + if test "$wx_cv_explicit" = "yes"; then + AC_DEFINE(HAVE_EXPLICIT) + fi ]) dnl --------------------------------------------------------------------------- dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_C_BIGENDIAN, -[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +AC_DEFUN([WX_C_BIGENDIAN], +[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian, [ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. AC_TRY_COMPILE([#include @@ -959,7 +236,7 @@ AC_TRY_RUN([main () { } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); -}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, ac_cv_c_bigendian=unknown) +}], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown]) fi]) if test $ac_cv_c_bigendian = unknown; then 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]) @@ -973,28 +250,78 @@ dnl --------------------------------------------------------------------------- dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file dnl --------------------------------------------------------------------------- -AC_DEFUN(WX_ARG_CACHE_INIT, +AC_DEFUN([WX_ARG_CACHE_INIT], [ - wx_arg_cache_file="./configarg.cache" + wx_arg_cache_file="configarg.cache" echo "loading argument cache $wx_arg_cache_file" rm -f ${wx_arg_cache_file}.tmp touch ${wx_arg_cache_file}.tmp touch ${wx_arg_cache_file} ]) -AC_DEFUN(WX_ARG_CACHE_FLUSH, +AC_DEFUN([WX_ARG_CACHE_FLUSH], [ echo "saving argument cache $wx_arg_cache_file" mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file} ]) +dnl this macro checks for a three-valued command line --with argument: +dnl possible arguments are 'yes', 'no', 'sys', or 'builtin' +dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name) +AC_DEFUN([WX_ARG_SYS_WITH], + [ + AC_MSG_CHECKING([for --with-$1]) + no_cache=0 + AC_ARG_WITH($1, [$2], + [ + if test "$withval" = yes; then + ac_cv_use_$1='$3=yes' + elif test "$withval" = no; then + ac_cv_use_$1='$3=no' + elif test "$withval" = sys; then + ac_cv_use_$1='$3=sys' + elif test "$withval" = builtin; then + ac_cv_use_$1='$3=builtin' + else + AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) + fi + ], + [ + LINE=`grep "$3" ${wx_arg_cache_file}` + if test "x$LINE" != x ; then + eval "DEFAULT_$LINE" + else + no_cache=1 + fi + + ac_cv_use_$1='$3='$DEFAULT_$3 + ]) + + eval "$ac_cv_use_$1" + if test "$no_cache" != 1; then + echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp + fi + + if test "$$3" = yes; then + AC_MSG_RESULT(yes) + elif test "$$3" = no; then + AC_MSG_RESULT(no) + elif test "$$3" = sys; then + AC_MSG_RESULT([system version]) + elif test "$$3" = builtin; then + AC_MSG_RESULT([builtin version]) + else + AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) + fi + ]) + dnl this macro checks for a command line argument and caches the result dnl usage: WX_ARG_WITH(option, helpmessage, variable-name) -AC_DEFUN(WX_ARG_WITH, +AC_DEFUN([WX_ARG_WITH], [ - AC_MSG_CHECKING("for --with-$1") + AC_MSG_CHECKING([for --with-$1]) no_cache=0 - AC_ARG_WITH($1, $2, + AC_ARG_WITH($1, [$2], [ if test "$withval" = yes; then ac_cv_use_$1='$3=yes' @@ -1026,12 +353,17 @@ AC_DEFUN(WX_ARG_WITH, ]) dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH -dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name) -AC_DEFUN(WX_ARG_ENABLE, +dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring) +dnl +dnl enablestring is a hack and allows to show "checking for --disable-foo" +dnl message when running configure instead of the default "checking for +dnl --enable-foo" one whih is useful for the options enabled by default +AC_DEFUN([WX_ARG_ENABLE], [ - AC_MSG_CHECKING("for --enable-$1") + enablestring=$4 + AC_MSG_CHECKING([for --${enablestring:-enable}-$1]) no_cache=0 - AC_ARG_ENABLE($1, $2, + AC_ARG_ENABLE($1, [$2], [ if test "$enableval" = yes; then ac_cv_use_$1='$3=yes' @@ -1062,3 +394,1243 @@ AC_DEFUN(WX_ARG_ENABLE, fi ]) + +dnl =========================================================================== +dnl Linker features test +dnl =========================================================================== + +dnl --------------------------------------------------------------------------- +dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned +dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use +dnl version script file named versionfile +dnl +dnl call WX_VERSIONED_SYMBOLS(versionfile) +dnl --------------------------------------------------------------------------- +AC_DEFUN([WX_VERSIONED_SYMBOLS], +[ + found_versioning=no + + dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards + dnl in the script. + dnl dnl Check for known non-gcc cases: + dnl case "${host}" in + dnl *-*-solaris2* ) + dnl if test "x$GCC" != "xyes" ; then + dnl LDFLAGS_VERSIONING="-M $1" + dnl found_versioning=yes + dnl fi + dnl ;; + dnl esac + + dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC): + if test $found_versioning = no ; then + AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script, + [ + echo "VER_1 { *; };" >conftest.sym + echo "int main() { return 0; }" >conftest.cpp + + if AC_TRY_COMMAND([ + $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp + -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then + if test -s conftest.stderr ; then + wx_cv_version_script=no + else + wx_cv_version_script=yes + fi + else + wx_cv_version_script=no + fi + rm -f conftest.output conftest.stderr conftest.sym conftest.cpp + ]) + if test $wx_cv_version_script = yes ; then + LDFLAGS_VERSIONING="-Wl,--version-script,$1" + fi + fi +]) + + +dnl =========================================================================== +dnl "3rd party" macros included here because they are not widely available +dnl =========================================================================== + +dnl --------------------------------------------------------------------------- +dnl test for availability of iconv() +dnl --------------------------------------------------------------------------- + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const, + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + ], + [], + wx_cv_func_iconv_const="no", + wx_cv_func_iconv_const="yes" + ) + ) + + iconv_const= + if test "x$wx_cv_func_iconv_const" = "xyes"; then + iconv_const="const" + fi + + AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) + +dnl --------------------------------------------------------------------------- +dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x) +dnl --------------------------------------------------------------------------- + +dnl WX_SYS_LARGEFILE_TEST +dnl +dnl NB: original autoconf test was checking if compiler supported 6 bit off_t +dnl arithmetic properly but this failed miserably with gcc under Linux +dnl whereas the system still supports 64 bit files, so now simply check +dnl that off_t is big enough +define(WX_SYS_LARGEFILE_TEST, +[typedef struct { + unsigned int field: sizeof(off_t) == 8; +} wxlf; +]) + + +dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR) +define(WX_SYS_LARGEFILE_MACRO_VALUE, +[ + AC_CACHE_CHECK([for $1 value needed for large files], [$3], + [ + AC_TRY_COMPILE([#define $1 $2 + #include ], + WX_SYS_LARGEFILE_TEST, + [$3=$2], + [$3=no]) + ] + ) + + if test "$$3" != no; then + wx_largefile=yes + AC_DEFINE_UNQUOTED([$1], [$$3]) + fi +]) + + +dnl AC_SYS_LARGEFILE +dnl ---------------- +dnl By default, many hosts won't let programs access large files; +dnl one must use special compiler options to get large-file access to work. +dnl For more details about this brain damage please see: +dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html +AC_DEFUN([AC_SYS_LARGEFILE], +[AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) +if test "$enable_largefile" != no; then + dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ... + dnl _LARGE_FILES -- for AIX + wx_largefile=no + WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits) + if test "x$wx_largefile" != "xyes"; then + WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files) + fi + + AC_MSG_CHECKING(if large file support is available) + if test "x$wx_largefile" = "xyes"; then + AC_DEFINE(HAVE_LARGEFILE_SUPPORT) + fi + AC_MSG_RESULT($wx_largefile) +fi +]) + + +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html +dnl +AC_DEFUN([AC_CXX_CONST_CAST], +[AC_CACHE_CHECK(whether the compiler supports const_cast<>, +ac_cv_cxx_const_cast, +[AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast(y);return z;], + ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no) + AC_LANG_RESTORE +]) +if test "$ac_cv_cxx_const_cast" = yes; then + AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>]) +fi +]) + +# Configure paths for GTK+ +# Owen Taylor 1997-2001 + +dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, +dnl pass to pkg-config +dnl +AC_DEFUN(AM_PATH_GTK_2_0, +[dnl +dnl Get the cflags and libraries from pkg-config +dnl +AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], + , enable_gtktest=yes) + + pkg_config_args=gtk+-2.0 + for module in . $4 + do + case "$module" in + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + no_gtk="" + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + if test x$PKG_CONFIG != xno ; then + if pkg-config --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_gtk=yes + PKG_CONFIG=no + fi + else + no_gtk=yes + fi + + min_gtk_version=ifelse([$1], ,2.0.0,$1) + AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" + enable_gtktest=no + fi + + if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then + : + else + no_gtk=yes + fi + fi + + if test x"$no_gtk" = x ; then + GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` + GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` + gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$GTK_LIBS $LIBS" +dnl +dnl Now check if the installed GTK+ is sufficiently new. (Also sanity +dnl checks the results of pkg-config to some extent) +dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtktest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((gtk_major_version != GTK_MAJOR_VERSION) || + (gtk_minor_version != GTK_MINOR_VERSION) || + (gtk_micro_version != GTK_MICRO_VERSION)) + { + printf("*** GTK+ header files (version %d.%d.%d) do not match\n", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + } + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://pkgconfig.sourceforge.net" + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK+ test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK+ or finding the wrong" + echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + +# Configure paths for GTK+ +# Owen Taylor 97-11-3 + +dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS +dnl +AC_DEFUN(AM_PATH_GTK, +[dnl +dnl Get the cflags and libraries from the gtk-config script +dnl +AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], + gtk_config_prefix="$withval", gtk_config_prefix="") +AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], + gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") +AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], + , enable_gtktest=yes) + + for module in . $4 + do + case "$module" in + gthread) + gtk_config_args="$gtk_config_args gthread" + ;; + esac + done + + if test x$gtk_config_exec_prefix != x ; then + gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config + fi + fi + if test x$gtk_config_prefix != x ; then + gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" + if test x${GTK_CONFIG+set} != xset ; then + GTK_CONFIG=$gtk_config_prefix/bin/gtk-config + fi + fi + + AC_PATH_PROG(GTK_CONFIG, gtk-config, no) + min_gtk_version=ifelse([$1], ,0.99.7,$1) + AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) + no_gtk="" + if test "$GTK_CONFIG" = "no" ; then + no_gtk=yes + else + GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` + GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` + gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_gtktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$GTK_LIBS $LIBS" +dnl +dnl Now check if the installed GTK is sufficiently new. (Also sanity +dnl checks the results of gtk-config to some extent +dnl + rm -f conf.gtktest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.gtktest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_gtk_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gtk_version"); + exit(1); + } + + if ((gtk_major_version != $gtk_config_major_version) || + (gtk_minor_version != $gtk_config_minor_version) || + (gtk_micro_version != $gtk_config_micro_version)) + { + printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", + $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf ("*** was found! If gtk-config was correct, then it is best\n"); + printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); + printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } +#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) + else if ((gtk_major_version != GTK_MAJOR_VERSION) || + (gtk_minor_version != GTK_MINOR_VERSION) || + (gtk_micro_version != GTK_MICRO_VERSION)) + { + printf("*** GTK+ header files (version %d.%d.%d) do not match\n", + GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + } +#endif /* defined (GTK_MAJOR_VERSION) ... */ + else + { + if ((gtk_major_version > major) || + ((gtk_major_version == major) && (gtk_minor_version > minor)) || + ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", + gtk_major_version, gtk_minor_version, gtk_micro_version); + printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); + printf("*** correct copy of gtk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gtk" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GTK_CONFIG" = "no" ; then + echo "*** The gtk-config script installed by GTK could not be found" + echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GTK_CONFIG environment variable to the" + echo "*** full path to gtk-config." + else + if test -f conf.gtktest ; then + : + else + echo "*** Could not run GTK test program, checking why..." + CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GTK or finding the wrong" + echo "*** version of GTK. If it is not finding GTK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" + echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" + echo "*** came with the system with the command" + echo "***" + echo "*** rpm --erase --nodeps gtk gtk-devel" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** or that you have moved GTK since it was installed. In the latter case, you" + echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GTK_CFLAGS="" + GTK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + rm -f conf.gtktest +]) + + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + + +dnl --------------------------------------------------------------------------- +dnl Support macros for makefiles generated by BAKEFILE. +dnl --------------------------------------------------------------------------- + +dnl Lots of compiler & linker detection code contained here was taken from +dnl wxWindows configure.in script (see http://www.wxwindows.org) + + + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_GNUMAKE +dnl +dnl Detects GNU make +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_GNUMAKE, +[ + dnl does make support "-include" (only GNU make does AFAIK)? + AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu, + [ + if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null | + egrep -s GNU > /dev/null); then + bakefile_cv_prog_makeisgnu="yes" + else + bakefile_cv_prog_makeisgnu="no" + fi + ]) + + if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then + IF_GNU_MAKE="" + else + IF_GNU_MAKE="#" + fi + AC_SUBST(IF_GNU_MAKE) +]) + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_PLATFORM +dnl +dnl Detects platform and sets PLATFORM_XXX variables accordingly +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_PLATFORM, +[ + PLATFORM_UNIX=0 + PLATFORM_WIN32=0 + PLATFORM_MSDOS=0 + PLATFORM_MAC=0 + PLATFORM_MACOSX=0 + + case "${host}" in + *-*-cygwin* | *-*-mingw32* ) + PLATFORM_WIN32=1 + ;; + *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx ) + PLATFORM_MSDOS=1 + ;; + powerpc-*-darwin* ) + PLATFORM_MAC=1 + PLATFORM_MACOSX=1 + ;; + * ) + PLATFORM_UNIX=1 + ;; + esac + + AC_SUBST(PLATFORM_UNIX) + AC_SUBST(PLATFORM_WIN32) + AC_SUBST(PLATFORM_MSDOS) + AC_SUBST(PLATFORM_MAC) + AC_SUBST(PLATFORM_MACOSX) +]) + + + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_SUFFIXES +dnl +dnl Detects shared various suffixes for shared libraries, libraries, programs, +dnl plugins etc. +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_SUFFIXES, +[ + SO_SUFFIX="so" + EXEEXT="" + DLLPREFIX=lib + + case "${host}" in + *-hp-hpux* ) + SO_SUFFIX="sl" + ;; + *-*-aix* ) + dnl quoting from + dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html: + dnl Both archive libraries and shared libraries on AIX have an + dnl .a extension. This will explain why you can't link with an + dnl .so and why it works with the name changed to .a. + SO_SUFFIX="a" + ;; + *-*-cygwin* | *-*-mingw32* ) + SO_SUFFIX="dll" + EXEEXT=".exe" + DLLPREFIX="" + ;; + *-pc-msdosdjgpp | *-pc-os2_emx | *-pc-os2-emx ) + EXEEXT=".exe" + DLLPREFIX="" + ;; + powerpc-*-darwin* ) + SO_SUFFIX="dylib" + ;; + esac + + AC_SUBST(SO_SUFFIX) + AC_SUBST(EXEEXT) + AC_SUBST(DLLPREFIX) +]) + + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_SHARED_LD +dnl +dnl Detects command for making shared libraries, substitutes SHARED_LD_CC +dnl and SHARED_LD_CXX. +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_SHARED_LD, +[ + dnl Defaults for GCC and ELF .so shared libs: + SHARED_LD_CC="\$(CC) -shared -o" + SHARED_LD_CXX="\$(CXX) -shared -o" + + dnl the extra compiler flags needed for compilation of shared library + if test "x$GCC" = "xyes"; then + dnl the switch for gcc is the same under all platforms + PIC_FLAG="-fPIC" + fi + + case "${host}" in + *-hp-hpux* ) + dnl default settings are good for gcc but not for the native HP-UX + if test "x$GCC" = "xyes"; then + dnl -o flag must be after PIC flag + SHARED_LD_CC="${CC} -shared ${PIC_FLAG} -o" + SHARED_LD_CXX="${CXX} -shared ${PIC_FLAG} -o" + else + dnl no idea why it wants it, but it does + LDFLAGS="$LDFLAGS -L/usr/lib" + + SHARED_LD_CC="${CC} -b -o" + SHARED_LD_CXX="${CXX} -b -o" + PIC_FLAG="+Z" + fi + ;; + + *-*-linux* ) + if test "x$GCC" != "xyes"; then + AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc, + [ + AC_TRY_COMPILE([], + [ + #ifndef __INTEL_COMPILER + #error Not icc + #endif + ], + bakefile_cv_prog_icc=yes, + bakefile_cv_prog_icc=no + ) + ]) + if test "$bakefile_cv_prog_icc" = "yes"; then + PIC_FLAG="-KPIC" + fi + fi + ;; + + *-*-solaris2* ) + if test "x$GCC" != xyes ; then + SHARED_LD_CC="${CC} -G -o" + SHARED_LD_CXX="${CXX} -G -o" + PIC_FLAG="-KPIC" + fi + ;; + + *-*-darwin* ) + dnl For Unix to MacOS X porting instructions, see: + dnl http://fink.sourceforge.net/doc/porting/porting.html + CFLAGS="$CFLAGS -fno-common" + CXXFLAGS="$CXXFLAGS -fno-common" + + dnl Most apps benefit from being fully binded (its faster and static + dnl variables initialized at startup work). + dnl This can be done either with the exe linker flag -Wl,-bind_at_load + dnl or with a double stage link in order to create a single module + dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved + + cat <shared-ld-sh +#!/bin/sh +#----------------------------------------------------------------------------- +#-- Name: distrib/mac/shared-ld-sh +#-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X +#-- Author: Gilles Depeyrot +#-- Copyright: (c) 2002 Gilles Depeyrot +#-- Licence: any use permitted +#----------------------------------------------------------------------------- + +verbose=0 +args="" +objects="" + +while test \${#} -gt 0; do + case \${1} in + + -v) + verbose=1 + ;; + + -o|-compatibility_version|-current_version|-framework|-undefined|-install_name) + # collect these options and values + args="\${args} \${1} \${2}" + shift + ;; + + -l*|-L*|-flat_namespace) + # collect these options + args="\${args} \${1}" + ;; + + -dynamiclib) + # skip these options + ;; + + -*) + echo "shared-ld: unhandled option '\${1}'" + exit 1 + ;; + + *.o | *.a | *.dylib) + # collect object files + objects="\${objects} \${1}" + ;; + + *) + echo "shared-ld: unhandled argument '\${1}'" + exit 1 + ;; + + esac + shift +done + +# +# Link one module containing all the others +# +if test \${verbose} = 1; then + echo "c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o" +fi +c++ -r -keep_private_externs -nostdlib \${objects} -o master.\$\$.o +status=\$? +if test \${status} != 0; then + exit \${status} +fi + +# +# Link the shared library from the single module created +# +if test \${verbose} = 1; then + echo "cc -dynamiclib master.\$\$.o \${args}" +fi +c++ -dynamiclib master.\$\$.o \${args} +status=\$? +if test \${status} != 0; then + exit \${status} +fi + +# +# Remove intermediate module +# +rm -f master.\$\$.o + +exit 0 +EOF + chmod +x shared-ld-sh + + SHARED_LD_CC="`pwd`/shared-ld-sh -undefined suppress -flat_namespace -o" + SHARED_LD_CXX="$SHARED_LD_CC" + PIC_FLAG="-dynamic -fPIC" + dnl FIXME - what about C libs? Gilles says to use c++ because it doesn't + dnl matter for C projects and matters for C++ ones + dnl FIXME - newer devel tools have linker flag to do this, the script + dnl is not necessary - detect! + ;; + + *-*-aix* ) + dnl default settings are ok for gcc + if test "x$GCC" != "xyes"; then + dnl the abs path below used to be hardcoded here so I guess it must + dnl be some sort of standard location under AIX? + AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, + makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) + dnl FIXME - what about makeCSharedLib? + SHARED_LD_CC="$AIX_CC_LD -p 0 -o" + SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o" + fi + ;; + + *-*-beos* ) + dnl can't use gcc under BeOS for shared library creation because it + dnl complains about missing 'main' + SHARED_LD_CC="${LD} -shared -o" + SHARED_LD_CXX="${LD} -shared -o" + ;; + + *-*-irix* ) + dnl default settings are ok for gcc + if test "x$GCC" != "xyes"; then + PIC_FLAG="-KPIC" + fi + ;; + + *-*-cygwin* | *-*-mingw32* ) + PIC_FLAG="" + ;; + + *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \ + *-*-sunos4* | \ + *-*-osf* | \ + *-*-dgux5* | \ + *-*-sysv5* ) + dnl defaults are ok + ;; + + *) + AC_MSG_ERROR(unknown system type $host.) + esac + + AC_SUBST(SHARED_LD_CC) + AC_SUBST(SHARED_LD_CXX) + AC_SUBST(PIC_FLAG) +]) + + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_SHARED_VERSIONS +dnl +dnl Detects linker options for attaching versions (sonames) to shared libs. +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_SHARED_VERSIONS, +[ + USE_SOVERSION=0 + USE_SOVERLINUX=0 + USE_SOVERSOLARIS=0 + USE_SOSYMLINKS=0 + USE_MACVERSION=0 + SONAME_FLAG= + + case "${host}" in + *-*-linux* ) + SONAME_FLAG="-Wl,-soname," + USE_SOVERSION=1 + USE_SOVERLINUX=1 + USE_SOSYMLINKS=1 + ;; + + *-*-solaris2* ) + SONAME_FLAG="-h " + USE_SOVERSION=1 + USE_SOVERSOLARIS=1 + USE_SOSYMLINKS=1 + ;; + + *-*-darwin* ) + USE_MACVERSION=1 + USE_SOVERSION=1 + USE_SOSYMLINKS=1 + ;; + esac + + AC_SUBST(USE_SOVERSION) + AC_SUBST(USE_SOVERLINUX) + AC_SUBST(USE_SOVERSOLARIS) + AC_SUBST(USE_MACVERSION) + AC_SUBST(USE_SOSYMLINKS) + AC_SUBST(SONAME_FLAG) +]) + + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_DEPS +dnl +dnl Detects available C/C++ dependency tracking options +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_DEPS, +[ + AC_MSG_CHECKING([for dependency tracking method]) + DEPS_TRACKING=0 + + if test "x$GCC" = "xyes"; then + DEPSMODE=gcc + DEPS_TRACKING=1 + case "${host}" in + powerpc-*-darwin* ) + dnl -cpp-precomp (the default) conflicts with -MMD option + dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html) + DEPSFLAG_GCC="-no-cpp-precomp -MMD" + ;; + * ) + DEPSFLAG_GCC="-MMD" + ;; + esac + AC_MSG_RESULT([gcc]) + else + AC_MSG_RESULT([none]) + fi + + if test $DEPS_TRACKING = 1 ; then + cat <bk-deps +#!/bin/sh + +# This script is part of Bakefile (http://bakefile.sf.net) autoconf script. +# It is used to track C/C++ files dependencies in portable way. +# +# Permission is given to use this file in any way. + +DEPSMODE=$DEPSMODE +DEPSDIR=.deps +DEPSFLAG_GCC="$DEPSFLAG_GCC" + +mkdir -p \$DEPSDIR + +if test \$DEPSMODE = gcc ; then + \${*} \${DEPSFLAG_GCC} + status=\${?} + if test \${status} != 0 ; then + exit \${status} + fi + # move created file to the location we want it in: + while test \${#} -gt 0; do + case "\${1}" in + -o ) + shift + objfile=\${1} + ;; + -* ) + ;; + * ) + srcfile=\${1} + ;; + esac + shift + done + depfile=\`basename \$srcfile | sed -e 's/\..*$/.d/g'\` + depobjname=\`echo \$depfile |sed -e 's/\.d/.o/g'\` + if test -f \$depfile ; then + sed -e "s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d + rm -f \$depfile + else + depfile=\`basename \$objfile | sed -e 's/\..*$/.d/g'\` + if test -f \$depfile ; then + sed -e "/^\$objfile/! s,\$depobjname:,\$objfile:,g" \$depfile >\${DEPSDIR}/\${objfile}.d + rm -f \$depfile + fi + fi + exit 0 +else + \${*} + exit \${?} +fi +EOF + chmod +x bk-deps + fi + + AC_SUBST(DEPS_TRACKING) +]) + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_CHECK_BASIC_STUFF +dnl +dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib" +dnl or "install" +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_CHECK_BASIC_STUFF, +[ + AC_PROG_RANLIB + AC_PROG_INSTALL + AC_PROG_LN_S + + AC_PROG_MAKE_SET + AC_SUBST(MAKE_SET) + + if test "$build" != "$host" ; then + AR=$host_alias-ar + STRIP=$host_alias-strip + else + AC_CHECK_PROG(AR, ar, ar, ar) + AC_CHECK_PROG(STRIP, strip, strip, true) + fi + + case ${host} in + *-hp-hpux* ) + INSTALL_DIR="mkdir" + ;; + *) INSTALL_DIR="$INSTALL -d" + ;; + esac + AC_SUBST(INSTALL_DIR) + + LDFLAGS_GUI= + case ${host} in + *-*-cygwin* | *-*-mingw32* ) + LDFLAGS_GUI="-Wl,--subsystem,windows -mwindows" + esac + AC_SUBST(LDFLAGS_GUI) +]) + + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE_RES_COMPILERS +dnl +dnl Checks for presence of resource compilers for win32 or mac +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE_RES_COMPILERS, +[ + RESCOMP= + SETFILE= + + case ${host} in + *-*-cygwin* | *-*-mingw32* ) + dnl Check for win32 resources compiler: + if test "$build" != "$host" ; then + RESCOMP=$host_alias-windres + else + AC_CHECK_PROG(RESCOMP, windres, windres, windres) + fi + ;; + + *-*-darwin* ) + AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez) + AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) + ;; + esac + + AC_SUBST(RESCOMP) + AC_SUBST(SETFILE) +]) + +dnl --------------------------------------------------------------------------- +dnl AC_BAKEFILE +dnl +dnl To be used in configure.in of any project using Bakefile-generated mks +dnl --------------------------------------------------------------------------- + +AC_DEFUN(AC_BAKEFILE, +[ + if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then + AC_BAKEFILE_CHECK_BASIC_STUFF + fi + AC_BAKEFILE_GNUMAKE + AC_BAKEFILE_PLATFORM + AC_BAKEFILE_SUFFIXES + AC_BAKEFILE_SHARED_LD + AC_BAKEFILE_SHARED_VERSIONS + AC_BAKEFILE_DEPS + AC_BAKEFILE_RES_COMPILERS + + builtin(include, autoconf_inc.m4) +]) +