/CS/migrated/tags/PRE_MAP2CS_REMOVAL/configure.ac
m4 | 1592 lines | 865 code | 267 blank | 460 comment | 0 complexity | 89444d5a9608ac647cf5e4be43766e1d MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, LGPL-2.0
- # configure.ac -*- Autoconf -*-
- #==============================================================================
- # Copyright (C)2003-2006 by Eric Sunshine <sunshine@sunshineco.com>
- #
- # Autoconf input script for Crystal Space. Process this file with
- # CS/bin/autogen.sh to produce a configure script.
- #==============================================================================
- AC_PREREQ([2.56])
- #------------------------------------------------------------------------------
- # cs_version_number
- # Keep this value synchronized with CS/include/csver.h.
- #------------------------------------------------------------------------------
- m4_define([cs_version_number], [0.99])
- #==============================================================================
- # INITIALIZATION
- #==============================================================================
- AC_INIT([crystalspace], [cs_version_number],
- [crystal-main@lists.sourceforge.net])
- CS_PACKAGEINFO([Crystal Space],
- [Copyright (C)1998-2005 Jorrit Tyberghein and others],
- [http://www.crystalspace3d.org/])
- AC_CONFIG_SRCDIR([libs/Jamfile])
- AC_CONFIG_AUX_DIR([mk/autoconf])
- AC_CANONICAL_HOST
- #------------------------------------------------------------------------------
- # Check for compilers and linker.
- #------------------------------------------------------------------------------
- CS_PROG_CC
- CS_PROG_CXX
- CS_PROG_LINK
- AC_PROG_CXXCPP
- CS_EMIT_BUILD_PROPERTY([CMD.C++CPP], [$CXXCPP])
- AS_IF([test $ac_compiler_gnu = yes],
- [cs_compiler_name=GCC CS_HEADER_PROPERTY([CS_COMPILER_GCC])],
- [cs_compiler_name="AS_TR_CPP([$CXX])"])
- CS_EMIT_BUILD_PROPERTY([COMPILER.TYPE], [$cs_compiler_name])
- CS_HEADER_PROPERTY([CS_COMPILER_NAME],
- [AS_ESCAPE(["])$cs_compiler_name[]AS_ESCAPE(["])])
- #------------------------------------------------------------------------------
- # Check for common tools.
- #------------------------------------------------------------------------------
- CS_CHECK_COMMON_TOOLS_LINK
- CS_CHECK_COMMON_TOOLS_BASIC
- CS_CHECK_COMMON_TOOLS_DOC_TEXINFO
- CS_CHECK_COMMON_TOOLS_DOC_DOXYGEN
- CS_CHECK_PROGS([FLEX], [flex])
- CS_EMIT_BUILD_PROPERTY([CMD.FLEX], [$FLEX])
- CS_CHECK_PROGS([BISON], [bison])
- AS_IF([test -n "$BISON"],
- [CS_CHECK_PROG_VERSION([bison], [$BISON --version], [1.35], [9.9],
- [CS_EMIT_BUILD_PROPERTY([CMD.BISON], [$BISON])])])
- CS_CHECK_TOOLS([HHC], [hhc])
- CS_EMIT_BUILD_PROPERTY([CMD.HHC], [$HHC])
- CS_CHECK_PROGS([SWIG], [swig])
- AS_IF([test -n "$SWIG"],
- [CS_CHECK_PROG_VERSION([swig], [$SWIG -version 2>&1], [1.3.21],
- [9.9|.9], [CS_EMIT_BUILD_PROPERTY([CMD.SWIG], [$SWIG])])])
- #------------------------------------------------------------------------------
- # In order to avoid alienating users by forcing them to install and use Jam,
- # config.status is instructed (see far below) to build Jam on the user's behalf
- # from local sources, and to place the executable in the root of the build
- # directory. When checking for Jam, in addition to PATH, we also look in root
- # of the build directory since we might already have built Jam on a previous
- # configure run.
- #
- # IMPLEMENTATION NOTES
- #
- # The Crystal Space build system supports Jam versions starting with 2.4.
- # Earlier versions are rejected. Examples of rejected versions include Apple's
- # highly modified Jam (based upon 2.2.1), and ftjam (based upon
- # 2.3.2). BoostJam reports its version number as 3.1.9 (or greater), though it
- # is actually based upon Jam 2.4. Since we accept 2.4, and since 3.1.9 passes
- # the "jam -v >= 2.4" assertion, this version anomaly is not a problem.
- #
- # We also check for 'make', since it is used to build Jam locally, when needed.
- #------------------------------------------------------------------------------
- m4_define([cs_jam_local_exe], [jam$EXEEXT])
- CS_PATH_PROGS([JAM], [jam], [], [$PATH$PATH_SEPARATOR.])
- AS_IF([test -n "$JAM"],
- [CS_CHECK_PROG_VERSION([jam], ["$JAM" -v 2>&1], [2.4], [9.9|.9],
- [cs_prog_jam_okay=yes], [cs_prog_jam_okay=no])],
- [cs_prog_jam_okay=no])
- AS_IF([test $cs_prog_jam_okay != yes],
- [JAM=./cs_jam_local_exe CS_NEED_LOCAL_JAM=yes])
- CS_EMIT_BUILD_PROPERTY([JAM], [$JAM])
- CS_CHECK_PROGS([MAKE], [gnumake gmake make])
- #------------------------------------------------------------------------------
- # The cs-win32libs package is a convenience archive made available to Windows
- # users of Crystal Space. It contains common libraries, headers, and tools
- # (such as zlib, libjpeg, cal3d, etc.) usable by MSVC, Mingw/MSYS, and Cygwin
- # users. It saves users the bother of having to install these packages
- # manually one at a time.
- #------------------------------------------------------------------------------
- CS_CHECK_CSWIN32LIBS
- #------------------------------------------------------------------------------
- # Use the CPPFLAGS, CXXFLAGS, CFLAGS, and LDFLAGS passed to configure, as well
- # as any additional flags provided by cs-win32libs.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS], [$CPPFLAGS $CFLAGS], [+])
- CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS], [$CPPFLAGS $CXXFLAGS], [+])
- CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [$LDFLAGS], [+])
- #------------------------------------------------------------------------------
- # Check for typical required libraries (libm, libmx, libdl, libnsl).
- #------------------------------------------------------------------------------
- AC_LANG_PUSH([C++])
- AC_CHECK_HEADERS([cmath], [CS_HEADER_PROPERTY([CS_HAVE_CMATH_H])])
- AC_CHECK_HEADERS([math.h], [CS_HEADER_PROPERTY([CS_HAVE_MATH_H])])
- AC_LANG_POP([C++])
- CS_CHECK_COMMON_LIBS
- AS_IF([test $ac_cv_lib_m_pow = yes || test $ac_cv_lib_m_cosf = yes],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [-lm], [+])])
- AS_IF([test $ac_cv_lib_mx_cosf = yes],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [-lmx], [+])])
- AS_IF([test $ac_cv_lib_dl_dlopen = yes],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [-ldl], [+])])
- AS_IF([test $ac_cv_lib_nsl_gethostbyname = yes],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [-lnsl], [+])])
- AS_IF([test $ac_cv_lib_m_cosf != no || test $ac_cv_lib_mx_cosf != no],
- [CS_HEADER_PROPERTY([CS_HAVE_MATH_H_FLOAT_FUNCS])])
- #------------------------------------------------------------------------------
- # Check for pthread. Also check if pthread implementation supports the
- # recursive mutex extension.
- #------------------------------------------------------------------------------
- CS_CHECK_PTHREAD([cygwin*])
- CS_EMIT_BUILD_RESULT([cs_cv_sys_pthread], [PTHREAD])
- AS_IF([test $cs_cv_sys_pthread_mutex_recursive != no],
- [CS_HEADER_PROPERTY([CS_PTHREAD_MUTEX_RECURSIVE],
- [$cs_cv_sys_pthread_mutex_recursive])])
- #------------------------------------------------------------------------------
- # Check if RTLD_NOW dlopen() flag is available; some installations (OpenBSD,
- # for example) provide only RTLD_LAZY.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_RTLD],
- [AC_REQUIRE([CS_CHECK_COMMON_LIBS])
- CS_CHECK_BUILD([for RTLD_NOW], [cs_cv_sys_rtld_now],
- [AC_LANG_PROGRAM([[#include <dlfcn.h>]], [dlopen(0, RTLD_NOW)])],
- [], [], [CS_HEADER_PROPERTY([CS_HAVE_RTLD_NOW])], [], [],
- [], [], [$cs_cv_libdl_libs])])
- CS_CHECK_RTLD
- #------------------------------------------------------------------------------
- # Determine host platform. Recognized families: Unix, Windows, MacOS/X.
- #
- # CS_CHECK_HOST
- # Sets the shell variables cs_host_target and cs_host_family. Client
- # code can use these variables to emit appropriate Jam variables and
- # CS_PLATFORM_FOO header define.
- #------------------------------------------------------------------------------
- CS_CHECK_HOST
- AS_IF([test "x$cs_host_macosx" = "xyes"],
- [# We assume that we always have CoreAudio available on MacOS/X.
- CS_EMIT_BUILD_PROPERTY([COREAUDIO.AVAILABLE], [yes])
- CS_EMIT_BUILD_PROPERTY([COREAUDIO.LFLAGS], [-framework CoreAudio -framework AudioToolbox])
- CS_HEADER_PROPERTY([CS_PLATFORM_MACOSX])],
- [case $cs_host_family in
- windows)
- CS_HEADER_PROPERTY([CS_PLATFORM_WIN32])
- ;;
- unix)
- CS_HEADER_PROPERTY([CS_PLATFORM_UNIX])
- esac])
- CS_HEADER_PROPERTY([CS_PLATFORM_NAME],
- [AS_ESCAPE(["])$cs_host_os_normalized[]AS_ESCAPE(["])])
- #------------------------------------------------------------------------------
- # Check if Perl SDK is installed and which compiler and linker flags are
- # required to embed Perl. Also determine if the glue file can be created with
- # ExtUtils::Embed or if it must be created manually.
- #------------------------------------------------------------------------------
- CS_CHECK_PROGS([PERL], [perl5 perl])
- CS_EMIT_BUILD_PROPERTY([PERL5], [$PERL])
- CS_EMIT_BUILD_PROPERTY([PERL], [$PERL])
- CS_EMIT_BUILD_PROPERTY([CMD.PERL5], [$PERL])
- # csperl5 fails to build on many platforms, so default is NO for now.
- AC_ARG_WITH([perl], [AC_HELP_STRING([--with-perl],
- [use Perl5 scripting interface (default NO)])])
- AS_IF([test -z "$with_perl"], [with_perl=no])
- AS_IF([test -n "$PERL" && test "$with_perl" != no],
- [AC_CACHE_CHECK([for perl ExtUtils::Embed module], [cs_cv_perl_mod_embed],
- [AS_IF([AC_RUN_LOG([$PERL -MExtUtils::Embed -e 0 1>&2])],
- [cs_cv_perl_mod_embed=yes], [cs_cv_perl_mod_embed=no])])
- AS_IF([test $cs_cv_perl_mod_embed = yes],
- [CS_EMIT_BUILD_PROPERTY([PERL5.EXTUTILS.EMBED.AVAILABLE], [yes])
- AC_CACHE_CHECK([for perl DynaLoader module],
- [cs_cv_perl_mod_dynaloader],
- [AS_IF([AC_RUN_LOG([$PERL -MDynaLoader -e 0 1>&2])],
- [cs_cv_perl_mod_dynaloader=yes],
- [cs_cv_perl_mod_dynaloader=no])])
- AS_IF([test $cs_cv_perl_mod_dynaloader = yes],
- [CS_EMIT_BUILD_PROPERTY([PERL5.DYNALOADER.AVAILABLE], [yes])])],
- [# ExtUtils::Embed absent.
- AC_MSG_NOTICE([Recommend you install a recent release of Perl 5.])
- AC_MSG_NOTICE([http://www.perl.org/])
- AC_CACHE_CHECK([for perl Config module], [cs_cv_perl_mod_config],
- [AS_IF([AC_RUN_LOG([$PERL -MConfig -e 0 1>&2])],
- [cs_cv_perl_mod_config=yes], [cs_cv_perl_mod_config=no])])])
- AS_VAR_SET_IF([cs_cv_perl_cflags], [],
- [AS_IF([test $cs_cv_perl_mod_embed = yes],
- [cs_cv_perl_cflags=`AC_RUN_LOG(
- [$PERL -MExtUtils::Embed -e ccopts])`
- cs_cv_perl_lflags=`AC_RUN_LOG(
- [$PERL -MExtUtils::Embed -e ldopts])`
- cs_cv_perl_ext=`AC_RUN_LOG([$PERL -MConfig -e \
- '$e = $Config{"dlext"} || $Config{"so"} || ""; print "$e"'])`],
- [AS_IF([test $cs_cv_perl_mod_config = yes],
- [cs_perl_core=`AC_RUN_LOG(
- [$PERL -MConfig -e 'print $Config{archlib}'])`
- cs_perl_core="${cs_perl_core}/CORE"
- cs_cv_perl_cflags=`AC_RUN_LOG(
- [$PERL -MConfig -e 'print $Config{ccflags}'])`
- cs_cv_perl_cflags="${cs_cv_perl_cflags} -I${cs_perl_core}"
- cs_cv_perl_lflags=`AC_RUN_LOG([$PERL -MConfig -e \
- 'print $Config{ldflags}, " ", $Config{libs}'])`
- cs_cv_perl_lflags="${cs_cv_perl_lflags} -L${cs_perl_core}"
- cs_cv_perl_ext=`AC_RUN_LOG([$PERL -MConfig -e \
- '$e = $Config{"dlext"}||$Config{"so"}||""; print "$e"'])`],
- [cs_perl_core=`AC_RUN_LOG([$PERL -V:archlib | \
- $PERL -e '<STDIN> =~ m/\x27(.*)\x27/; print $1'])`
- cs_perl_core="${cs_perl_core}/CORE"
- cs_cv_perl_cflags=`AC_RUN_LOG([$PERL -V:ccflags | \
- $PERL -e '<STDIN> =~ m/\x27(.*)\x27/; print $1'])`
- cs_cv_perl_cflags="${cs_cv_perl_cflags} -I${cs_perl_core}"
- cs_cv_perl_lflags=`AC_RUN_LOG([$PERL -V:ldflags | \
- $PERL -e '<STDIN> =~ m/\x27(.*)\x27/; print $1'])`
- cs_perl_lflags_tmp=`AC_RUN_LOG([$PERL -V:libs | \
- $PERL -e '<STDIN> =~ m/\x27(.*)\x27/; print $1'])`
- cs_cv_perl_lflags="${cs_cv_perl_lflags} ${cs_perl_lflags_tmp}
- -L${cs_perl_core}"
- cs_cv_perl_ext=`AC_RUN_LOG([$PERL -V:dlext | \
- $PERL -e '<STDIN> =~ m/\x27(.*)\x27/; print $1'])`])])
- cs_cv_perl_cflags=CS_PATH_NORMALIZE([$cs_cv_perl_cflags])
- cs_cv_perl_lflags=CS_PATH_NORMALIZE([$cs_cv_perl_lflags])])
- AS_IF([test -n "$cs_cv_perl_cflags$cs_cv_perl_lflags"],
- [CS_CHECK_BUILD([if Perl SDK is usable], [cs_cv_perl],
- [AC_LANG_PROGRAM(
- [[#include <EXTERN.h>
- #include <perl.h>]],
- [perl_run(0);])],
- [CS_CREATE_TUPLE([$cs_cv_perl_cflags],[],[$cs_cv_perl_lflags])])
- AS_IF([test $cs_cv_perl = yes],
- [CS_EMIT_BUILD_RESULT([cs_cv_perl], [PERL5])
- CS_EMIT_BUILD_PROPERTY([PERL5.MODULE_EXT],[.$cs_cv_perl_ext])])])])
-
- #------------------------------------------------------------------------------
- # Check if Python SDK is installed and which compiler and linker flags are
- # required to embed Python.
- #------------------------------------------------------------------------------
- CS_CHECK_PYTHON([emit], [], [Python scripting interface])
- #------------------------------------------------------------------------------
- # Check if Java2 SDK is installed and which compiler and linker flags are
- # needed. Also check if Ant build tool, which is commonly used to build Java
- # projects, is available.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_JAVA_FLAGS],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([CS_CHECK_HOST])
- AS_IF([test x$cs_host_macosx = xyes && # Not cross-building for Darwin.
- test -r /System/Library/Frameworks/JavaVM.framework/Headers],
- [$1_cflags="-I/System/Library/Frameworks/JavaVM.framework/Headers"
- $1_libs="-framework JavaVM"],
- [AS_IF([test -n "$JAVA_HOME"],
- [$1_dir="$JAVA_HOME"],
- [AS_IF([test -n "$2"],
- [$1_dir=`AS_DIRNAME([$2])`
- $1_dir=`AS_DIRNAME([$$1_dir])`],
- [$1_dir=''])])
- AS_IF([test -n "$$1_dir"],
- [$1_cflags="-I$$1_dir/include"
- case $host_os in
- mingw*|cygwin*) cs_java_platform=win32 ;;
- *) cs_java_platform=`echo $host_os |
- sed 's/^\([[^-]]*\).*$/\1/'` ;;
- esac
- AS_IF([test -n "$cs_java_platform"],
- [$1_cflags="$$1_cflags
- $$1_cflags/$cs_java_platform"])
- $1_cflags=CS_PATH_NORMALIZE([$$1_cflags])])])])
- JAVA_HOME=CS_PATH_NORMALIZE([$JAVA_HOME])
- AS_IF([test -z "$JAVA" && test -n "$JAVACMD"],
- [JAVA=CS_PATH_NORMALIZE([$JAVACMD])])
- CS_PATH_PROGS([JAVA], [java], [],
- [$JAVA_HOME/bin$PATH_SEPARATOR$JAVA_HOME/jre/bin$PATH_SEPARATOR$PATH])
- CS_EMIT_BUILD_PROPERTY([JAVA], [$JAVA])
- CS_PATH_PROGS([JAVAC], [javac], [],
- [$JAVA_HOME/bin$PATH_SEPARATOR$JAVA_HOME/jre/bin$PATH_SEPARATOR$PATH])
- CS_EMIT_BUILD_PROPERTY([JAVAC], [$JAVAC])
- AC_ARG_WITH([java], [AC_HELP_STRING([--with-java],
- [use Java scripting interface (default YES)])])
- AS_IF([test -z "$with_java"], [with_java=yes])
- AS_IF([test "$with_java" != no && test -n "$JAVAC" && test -n "$JAVA"],
- [CS_JAVA_FLAGS([cs_java], [$JAVAC])
- CS_CHECK_BUILD([if Java2 SDK is usable], [cs_cv_java],
- [AC_LANG_PROGRAM(
- [[#include <jni.h>
- JNIEXPORT void JNICALL f(JNIEnv *env, jobject obj);]])],
- [CS_CREATE_TUPLE() \
- CS_CREATE_TUPLE([$cs_java_cflags],[$cs_java_lflags],[$cs_java_libs])],
- [], [CS_EMIT_BUILD_RESULT([cs_cv_java], [JAVA])])])
- CS_PATH_PROGS([ANT], [ant], [], [$PATH$PATH_SEPARATOR$ANT_HOME/bin])
- CS_EMIT_BUILD_PROPERTY([ANT], [$ANT])
- #------------------------------------------------------------------------------
- # Check if STL is available. Although STL is not used heavily in Crystal Space,
- # a few plugin modules take advantage of it, so they need to know if it is
- # available.
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD([for STL], [cs_cv_libstl],
- [AC_LANG_PROGRAM(
- [[#include <map>
- #include <string>]],
- [[std::map<std::string,int> m; m.begin();]])],
- [], [C++], [CS_EMIT_BUILD_RESULT([cs_cv_libstl], [STL])])
- #------------------------------------------------------------------------------
- # Check how to enable and disable compilation warnings, and how to promote
- # diagnostics from warning to error status.
- #------------------------------------------------------------------------------
- CS_COMPILER_WARNINGS([C++], [cs_cv_prog_cxx_enable_warnings],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS],
- [$cs_cv_prog_cxx_enable_warnings], [+])])
- CS_COMPILER_ERRORS([C++], [cs_cv_prog_cxx_enable_errors])
- CS_COMPILER_IGNORE_UNUSED([C++], [cs_cv_prog_cxx_ignore_unused],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS.WARNING.NO_UNUSED],
- [$cs_cv_prog_cxx_ignore_unused])])
- CS_COMPILER_IGNORE_UNINITIALIZED([C++], [cs_cv_prog_cxx_ignore_uninitialized],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS.WARNING.NO_UNINITIALIZED],
- [$cs_cv_prog_cxx_ignore_uninitialized])])
- CS_COMPILER_IGNORE_PRAGMAS([C++], [cs_cv_prog_cxx_ignore_unknown_pragmas],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS],
- [$cs_cv_prog_cxx_ignore_unknown_pragmas], [+])])
- # On MacOS/X, use of `long double' in csutil/formatter.h causes complaints.
- CS_COMPILER_IGNORE_LONG_DOUBLE([C++], [cs_cv_prog_cxx_ignore_long_double],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS.MANDATORY],
- [$cs_cv_prog_cxx_ignore_long_double], [+])])
- #------------------------------------------------------------------------------
- # Check for option to disable strict-aliasing (enabled by gcc on higher
- # optimization levels). This is needed for some code we don't have
- # control over (e.g. SWIG-generated code) that breaks strict-aliasing rules.
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD_FLAGS([for flag to disable string-aliasing],
- [cs_cv_prog_cxx_no_strict_aliasing],
- [CS_CREATE_TUPLE([-fno-strict-aliasing])], [C++])
- AS_IF([test $cs_cv_prog_cxx_no_strict_aliasing != no],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS.STRICTALIASING.DISABLE],
- [$cs_cv_prog_cxx_no_strict_aliasing], [+])])
- #------------------------------------------------------------------------------
- # Check if C++ exceptions can be enabled and disabled.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to enable C++ exceptions],
- [cs_cv_prog_cxx_enable_exceptions],
- [CS_CREATE_TUPLE([-fexceptions -fno-omit-frame-pointer]) \
- CS_CREATE_TUPLE([-fexceptions])],
- [C++], [COMPILER.C++FLAGS.EXCEPTIONS.ENABLE])
- CS_EMIT_BUILD_FLAGS([how to disable C++ exceptions],
- [cs_cv_prog_cxx_disable_exceptions], [CS_CREATE_TUPLE([-fno-exceptions])],
- [C++], [COMPILER.C++FLAGS.EXCEPTIONS.DISABLE], [],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS],
- [$cs_cv_prog_cxx_disable_exceptions], [+])])
- #------------------------------------------------------------------------------
- # Check how to make compiler comply strongly with the official C++ language
- # specification. Crystal Space itself can not abide 100% by the standard (for
- # instance, we employ `long long', which is not part of the present
- # specification), however, some external projects do so (by using gcc's -ansi
- # and -pedantic options, for instance). Because such projects may utilize
- # Crystal Space, we must ensure that our public headers likewise comply with
- # the official specification.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to enforce C++ standards conformance],
- [cs_cv_prog_cxx_enable_pedantic], [CS_CREATE_TUPLE([-ansi -pedantic])],
- [C++], [COMPILER.C++FLAGS.PEDANTIC.ENABLE])
- #------------------------------------------------------------------------------
- # Check if the linker recognizes "-multiply_defined suppress". This is
- # required for MacOS/X 10.1 to avoid warning messages when linking a program
- # with "-framework Foundation" if that program does not actually employ any
- # Objective-C. Note that we first attempt the uglier equivalent
- # "-Wl,-multiply_defined,suppress" in order to make life simpler for external
- # projects using cs-config (which reports this linker option in response to
- # --libs) in conjunction with GNU libtool. The problem with "-multiply_defined
- # suppress" for GNU libtool users is that libtool re-orders linker arguments,
- # not realizing that "suppress" must follow immediately after
- # "-multiply_defined". The uglier equivalent does not suffer from this problem
- # in the hands of libtool since it contains no whitespace.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([if -multiply_defined suppress is needed],
- [cs_cv_prog_link_suppress_multiple],
- [CS_CREATE_TUPLE([], [-Wl,-multiply_defined,suppress]) \
- CS_CREATE_TUPLE([], [-multiply_defined suppress])],
- [], [COMPILER.LFLAGS], [+])
- #------------------------------------------------------------------------------
- # Check if the linker recognizes "-force_cpusubtype_ALL". This is required on
- # MacOS/X since the Crystal Space's PowerPC implementation of csQsqrt() uses
- # the `frsqrte' instruction which is only valid when the -force_cpusubtype_ALL
- # flag is present. This flag is marked "mandatory" because it is required even
- # for external projects if they use csQsqrt().
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_FORCE_CPUSUBTYPE_ALL],
- [CS_CHECK_BUILD_FLAGS([if -force_cpusubtype_ALL is needed],
- [cs_cv_prog_cxx_force_cpusubtype_all],
- [CS_CREATE_TUPLE([], [-force_cpusubtype_ALL])])])
-
- CS_CHECK_FORCE_CPUSUBTYPE_ALL
- CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS.MANDATORY],
- [$cs_cv_prog_cxx_force_cpusubtype_all], [+])
- #------------------------------------------------------------------------------
- # Check if the MacOS/X compiler recognizes "-fno-common". This flag is needed
- # when building plugin modules (and the libraries which are linked into
- # plugins) prior to Apple's introduction of the two-level namespace symbol
- # scheme in order to ensure that each plugin module gets its own copy of
- # uninitialized global variables.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_NO_COMMON],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- case $host_os in
- darwin*)
- CS_EMIT_BUILD_FLAGS([if -fno-common is needed],
- [cs_cv_prog_cxx_no_common],
- [CS_CREATE_TUPLE([], [-fno-common])], [C++],
- [COMPILER.CFLAGS.MANDATORY], [+])
- ;;
- esac])
- CS_CHECK_NO_COMMON
- #------------------------------------------------------------------------------
- # Check if Mingw and Cygwin compilers recognize -fvtable-thunks. As of gcc
- # 3.x, this option is no longer supported. Unfortunately, rather than
- # returning an error code (as it does with other unrecognized options), the
- # compiler merely prints a warning message when -fvtable-thunks is used, thus
- # we use -Werror to turn the warning into an error.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_VTABLE_THUNKS],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- case $host_os in
- mingw*|cygwin*)
- CS_CHECK_BUILD_FLAGS([if -fvtable-thunks is needed],
- [cs_cv_prog_cxx_vtable_thunks],
- [CS_CREATE_TUPLE([-fvtable-thunks])], [C++],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS.MANDATORY],
- [$cs_cv_prog_cxx_vtable_thunks], [+])],
- [], [$cs_cv_prog_cxx_enable_errors])
- ;;
- esac])
- CS_CHECK_VTABLE_THUNKS
- #------------------------------------------------------------------------------
- # Check how to ask the linker to export all dynamic symbols in debug mode to
- # allow the backtrace() callstack creation code to obtain symbols in all cases.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to export all dynamic symbols],
- [cs_cv_prog_link_export_dynamic], [CS_CREATE_TUPLE([-Wl,-E])],
- [C++], [COMPILER.LFLAGS.debug], [+])
- #------------------------------------------------------------------------------
- # Check if linker recognizes --kill-at which is needed to make csjava.dll
- # usable by JNI on Windows. Without this, JNI is unable to find the exported
- # JNI glue functions in csjava.dll.
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD([if --kill-at is accepted], [cs_cv_prog_link_kill_at], [],
- [CS_CREATE_TUPLE([],[-Wl,--kill-at])], [C++],
- [CS_EMIT_BUILD_PROPERTY([CSJAVA.LFLAGS], [-Wl,--kill-at])])
- #------------------------------------------------------------------------------
- # Check if C++ function inlining can be enabled and disabled. Apparently, with
- # some versions of GNU build tools on Windows, the Crystal Space Python plugin
- # fails to link and emits the error message "Error: 0-bit reloc in dll". In
- # particular, this occurs with optimizations (such as -O3) enabled. We can
- # avoid the error by disabling function inlining.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to disable function inlining],
- [cs_cv_prog_cxx_disable_inlining],
- [CS_CREATE_TUPLE([-fno-inline-functions])],
- [C++], [COMPILER.C++FLAGS.INLINING.DISABLE])
- #------------------------------------------------------------------------------
- # Check if "hidden" visibilty for inline functions is supported.
- #
- # IMPLEMENTATION NOTES
- #
- # There is an obscure bug in gcc 3.4.x and 4.0.x where
- # -fvisibility-inlines-hidden on AMD64 in combination with -fPIC and -shared
- # flags causes the linker to fail with a bogus error stating that the target
- # library needs to be built with -fPIC even when it has been built using that
- # option. On such installations, if Crystal Space is built with
- # -fvisibility-inlines-hidden, then clients liking against Crystal Space
- # experience this bogus error. Normally, we would test for this anomaly by
- # manipulating a std::basic_string<> in a test program, and avoid
- # -fvisibility-inlines-hidden if the test program fails to link, however,
- # practical experience has shown that this test is not 100% reliable for all
- # such installations. Instead, for simplicity, we disable this flag presently
- # for all versions of gcc on AMD64. References:
- #
- # http://dev.gentoo.org/~kugelfang/pappy-visibility.txt
- # http://www.gnu.org/software/gcc/gcc-4.0/changes.html#visibility
- # http://www.nedprod.com/programs/gccvisibility.html
- # http://bugs.gentoo.org/show_bug.cgi?id=78720
- #
- # Furthermore, there seems to be a bug on MacOS/X with gcc 4.0.x where use of
- # -fvisibility-inlines-hidden causes link problems with external clients which
- # do not specify this flag. For this reason, we also disable this flag on
- # MacOS/X. In particular, clients receive errors of this sort:
- #
- # /usr/bin/ld: libcrystalspace.a(scf.o) malformed object, illegal
- # reference for -dynamic code (reference to a coalesced section
- # (__TEXT,__textcoal_nt) from section (__TEXT,__text) relocation
- # entry (1))
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD_FLAGS([for inline visibility flag],
- [cs_cv_prog_cxx_visibility_inlines_hidden],
- [CS_CREATE_TUPLE([-fvisibility-inlines-hidden])],[C++])
- AS_IF([test -n "$cs_cv_prog_cxx_visibility_inlines_hidden"],
- [AC_CACHE_CHECK([if $cs_cv_prog_cxx_visibility_inlines_hidden is buggy],
- [cs_cv_prog_cxx_visibility_inlines_hidden_buggy],
- [AS_IF([test $ac_compiler_gnu = yes],
- [AS_IF([test $host_cpu = x86_64 || test x$cs_host_macosx = xyes],
- [cs_cv_prog_cxx_visibility_inlines_hidden_buggy=yes],
- [cs_cv_prog_cxx_visibility_inlines_hidden_buggy=no])],
- [cs_cv_prog_cxx_visibility_inlines_hidden_buggy=no])])],
- [cs_cv_prog_cxx_visibility_inlines_hidden_buggy=no])
- AS_IF([test $cs_cv_prog_cxx_visibility_inlines_hidden_buggy != yes],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS],
- [$cs_cv_prog_cxx_visibility_inlines_hidden], [+])])
- #------------------------------------------------------------------------------
- # Check how to set default symbol visibility, and how to override the setting
- # in code.
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD_FLAGS([for symbol visibility flag],
- [cs_cv_prog_cxx_visibility_hidden],
- [CS_CREATE_TUPLE([-fvisibility=hidden])], [C++])
- CS_SYMBOL_QUALIFIER([how to declare default visibility],
- [cs_cv_prog_cxx_declare_visible_def],
- [__attribute__((visibility("default")))], [], [C++])
- AS_IF([test $cs_cv_prog_cxx_declare_visible_def != no && \
- test -n "$cs_cv_prog_cxx_visibility_hidden"],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.C++FLAGS],
- [$cs_cv_prog_cxx_visibility_hidden], [+])
- CS_HEADER_PROPERTY([CS_VISIBILITY_DEFAULT],
- [$cs_cv_prog_cxx_declare_visible_def])])
- #------------------------------------------------------------------------------
- # Check for compiler- and CPU-specific code generation flags. These flags are
- # mutually exclusive. Exclusivity is enforced by the CS_CHECK_CODE_GEN_FLAG()
- # macro. Note that use of these flags typically means that the resulting
- # binary will not be backward compatible. For instance, if Pentium-specific
- # instructions are used, the program will not work with earlier processors,
- # such as the Intel 486. Because these options are potentially dangerous,
- # their use it controlled by the user via --enable-cpu-specific-optimizations
- # which accepts "no" (same as "disable"), "minimum" (the default), and
- # "maximum". The "minimum" option selects optimizations which are likely to be
- # supported by reasonably modern hardware, thus making the resulting
- # executables fairly portable.
- #
- # CS_CHECK_CODE_GEN_FLAG(CPU-PATTERN, FLAGS, [LANGUAGE])
- # If compiler- and CPU-specific optimization flags have not already been
- # determined, and if the canonical host CPU matches CPU-PATTERN, try
- # using the provided compiler FLAGS with the compiler represented by
- # LANGUAGE (typically either "C" or "C++"). If language is omitted, C++
- # is used. If the compiler accepts the flags, assign them to the shell
- # variable cs_cv_prog_cxx_code_gen.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_CODE_GEN_FLAG],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- AS_IF([test "$cs_cv_prog_cxx_code_gen" = no],
- [case $host_cpu in
- $1) CS_BUILD_IFELSE([],
- [CS_CREATE_TUPLE([$2])], m4_default([$3],[C++]),
- [cs_cv_prog_cxx_code_gen=$cs_build_cflags], [])
- ;;
- esac])])
- AC_MSG_CHECKING([whether to use CPU-specific optimizations])
- AC_ARG_ENABLE([cpu-specific-optimizations],
- [AC_HELP_STRING([--enable-cpu-specific-optimizations=level],
- [enable CPU-specific optimizations; recognized levels are `no',
- `minimum' or `min', `maximum' or `max' (default MINIMUM); the `minimum'
- option selects optimizations which are likely to be supported by
- reasonably modern hardware, thus making the resulting executables
- fairly portable; use the `maximum' option with caution since code for
- one processor will not work with earlier processors (for example, Intel
- 686-specific code will not work with a 586)])],
- [case $enable_cpu_specific_optimizations in
- yes|min) enable_cpu_specific_optimizations=minimum ;;
- max) enable_cpu_specific_optimizations=maximum ;;
- esac],
- [enable_cpu_specific_optimizations=minimum])
- AC_MSG_RESULT([$enable_cpu_specific_optimizations])
- case $enable_cpu_specific_optimizations in
- no|minimum|maximum) ;;
- *) CS_MSG_ERROR([unrecognized option; use `no', `minimum', or `maximum'])
- ;;
- esac
- AS_IF([test $enable_cpu_specific_optimizations != no],
- [AC_CACHE_CHECK([for code generation flags], [cs_cv_prog_cxx_code_gen],
- [cs_cv_prog_cxx_code_gen=no
- AS_IF([test $enable_cpu_specific_optimizations = maximum],
- [CS_CHECK_CODE_GEN_FLAG([athlon], [-march=athlon])
- CS_CHECK_CODE_GEN_FLAG([athlon], [-mcpu=athlon -march=athlon])
- CS_CHECK_CODE_GEN_FLAG([athlon], [-mcpu=athlon])
- CS_CHECK_CODE_GEN_FLAG([*686], [-march=i686])
- CS_CHECK_CODE_GEN_FLAG([*686], [-mcpu=pentiumpro -march=i686])
- CS_CHECK_CODE_GEN_FLAG([*686], [-mcpu=pentiumpro])
- CS_CHECK_CODE_GEN_FLAG([*686], [-mpentiumpro -march=i686])
- CS_CHECK_CODE_GEN_FLAG([*686], [-mpentiumpro])])
- AS_IF([test $host_vendor = apple],
- [# Work around issue on intel macs, where "-fpmath=sse" is on by
- # default, but this breaks compilation when combined with
- # the "-march=i586" selected below. So the "minimum" optimization
- # on x86 Apples is -march=i686.
- CS_CHECK_CODE_GEN_FLAG([[*[3-9]86]], [-march=i686])])
- CS_CHECK_CODE_GEN_FLAG([x86_64], [-march=k8])
- CS_CHECK_CODE_GEN_FLAG([x86_64], [-mtune=k8])
- CS_CHECK_CODE_GEN_FLAG([[*[5-6]86]], [-march=i586])
- CS_CHECK_CODE_GEN_FLAG([[*[5-6]86]], [-mcpu=pentium -march=i586])
- CS_CHECK_CODE_GEN_FLAG([[*[5-6]86]], [-mcpu=pentium])
- CS_CHECK_CODE_GEN_FLAG([[*[5-6]86]], [-mpentium -march=i586])
- CS_CHECK_CODE_GEN_FLAG([[*[5-6]86]], [-mpentium])
- CS_CHECK_CODE_GEN_FLAG([[*[3-9]86]], [-march=i486])
- CS_CHECK_CODE_GEN_FLAG([[*[3-9]86]], [-mcpu=i486 -march=i486])
- CS_CHECK_CODE_GEN_FLAG([[*[3-9]86]], [-mcpu=i486])
- CS_CHECK_CODE_GEN_FLAG([[*[3-9]86]], [-m486])
- CS_CHECK_CODE_GEN_FLAG([alpha], [-mieee])])
- AS_IF([test "$cs_cv_prog_cxx_code_gen" != no],
- [CS_EMIT_BUILD_PROPERTY(
- [COMPILER.CFLAGS], [$cs_cv_prog_cxx_code_gen], [+])])])
- #------------------------------------------------------------------------------
- # Check if byteswap.h is available, which contains optimized byte swapping
- # functiosn (used for endian conversion).
- #------------------------------------------------------------------------------
- AC_CHECK_HEADERS([byteswap.h],
- [CS_HEADER_PROPERTY([CS_HAVE_BYTESWAP_H])])
- #------------------------------------------------------------------------------
- # Check for compiler optimization flags.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_OPTIMIZE_FLAGS],
- [AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_PROG_CXX])
- cs_optimize_flags=''
- CS_EMIT_BUILD_FLAGS([how to enable optimizations],
- [cs_cv_prog_cxx_optimize],
- [CS_CREATE_TUPLE([-O3]) CS_CREATE_TUPLE([-O2]) CS_CREATE_TUPLE([-O])],
- [C++], [COMPILER.CFLAGS.optimize], [+],
- [cs_optimize_flags="$cs_optimize_flags $cs_cv_prog_cxx_optimize"])
- CS_EMIT_BUILD_FLAGS([if -fomit-frame-pointer is accepted],
- [cs_cv_prog_cxx_omit_frame_pointer],
- [CS_CREATE_TUPLE([-fomit-frame-pointer])],
- [C++], [COMPILER.CFLAGS.optimize], [+],
- [cs_optimize_flags="$cs_optimize_flags \
- $cs_cv_prog_cxx_omit_frame_pointer"])
- CS_EMIT_BUILD_FLAGS([if -ffast-math is accepted],
- [cs_cv_prog_cxx_fast_math],
- [CS_CREATE_TUPLE([-ffast-math])], [C++],
- [COMPILER.CFLAGS.optimize], [+],
- [cs_optimize_flags="$cs_optimize_flags $cs_cv_prog_cxx_fast_math"])])
- CS_CHECK_OPTIMIZE_FLAGS
- #------------------------------------------------------------------------------
- # Check for compiler debug flags.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to enable compiler debug output],
- [cs_cv_prog_cxx_debug],
- [CS_CREATE_TUPLE([-g3]) CS_CREATE_TUPLE([-g2]) CS_CREATE_TUPLE([-g])],
- [C++], [COMPILER.CFLAGS.debug], [+],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS.debug],
- [$cs_cv_prog_cxx_debug], [+])])
- #------------------------------------------------------------------------------
- # Check if compiler complains about adding /usr/local/include to the header
- # search path. If not, add it to the header search path since not all
- # compilers search there by default. Some compiler, on the other hand,
- # complain if it is already in the built-in search path, and we would like to
- # avoid the complaint, if possible.
- #
- # Furthermore, add a -L entry to LDFLAGS for /usr/local/lib if present.
- # Finally, add /usr/local/lib to LD_LIBRARY_PATH if present since not all
- # platforms do so by default. This will allow some tests to succeed which would
- # otherwise fail. An example is the sizeof(wchar_t) check on Solaris, which
- # attempts to run a test program. Without augmenting LD_LIBRARY_PATH, the test
- # program would fail to run, citing inability to locate libstdc++.so.
- #------------------------------------------------------------------------------
- AS_IF([test -d /usr/local/include],
- [CS_CHECK_BUILD_FLAGS([if -I/usr/local/include is usable],
- [cs_cv_prog_cpp_local_include],
- [CS_CREATE_TUPLE([-I/usr/local/include])], [C++], [], [],
- [$cs_cv_prog_cxx_enable_warnings $cs_cv_prog_cxx_enable_errors])],
- [cs_cv_prog_cpp_local_include=''])
- AS_IF([test -n "$cs_cv_prog_cpp_local_include"],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS],
- [$cs_cv_prog_cpp_local_include], [+])
- CPPFLAGS="$CPPFLAGS $cs_cv_prog_cpp_local_include"])
- AS_IF([test -d /usr/local/lib],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [-L/usr/local/lib], [+])
- LDFLAGS="$LDFLAGS -L/usr/local/lib"
- LD_LIBRARY_PATH="$LD_LIBRARY_PATH$PATH_SEPARATOR/usr/local/lib"
- export LD_LIBRARY_PATH])
- #------------------------------------------------------------------------------
- # Check if va_copy() or __va_copy() is available.
- #------------------------------------------------------------------------------
- # CS_CHECK_VA_COPY(FUNCTION)
- AC_DEFUN([CS_CHECK_VA_COPY],
- [CS_CHECK_BUILD([for $1], [cs_cv_func_$1],
- [AC_LANG_PROGRAM(
- [[#include <stdio.h>
- #include <stdarg.h>]],
- [va_list ap1; va_list ap2; $1(ap1,ap2)])],
- [], [], [CS_HEADER_PROPERTY(AS_TR_CPP([CS_HAVE_$1]))], [], [],
- [$cs_cv_prog_cxx_enable_pedantic])])
- CS_CHECK_VA_COPY([va_copy])
- CS_CHECK_VA_COPY([__va_copy])
- #------------------------------------------------------------------------------
- # Check for X-Windows. If the X-Windows implementation is XFree86, then also
- # enable the `VideoMode' extension.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_X_CHECK_PREPARE],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([CS_CHECK_HOST])
- # Explicitly disable X checking on Windows to avoid discovering XFree86 in
- # case Cygwin is installed. Doing so allows us to avoid Mesa's OpenGL
- # headers during the OpenGL check, and prefer Microsoft's OpenGL headers.
- # The Mesa OpenGL headers cause link errors because they do not employ
- # __stdcall.
- case $host_os in
- mingw*|cygwin*) with_x=no ;;
- esac
- # Explicitly disable X checking on MacOS/X in case the optional XFree86 is
- # installed since we want to avoid an undesirable dependency upon XFree86
- # in the CS executables and plugins. If the user is actually
- # cross-building for Darwin on MacOS/X, then the --with-x option will
- # override this test (by setting cs_host_macosx to "no").
- AS_IF([test x$cs_host_macosx = xyes], [with_x=no])])
- CS_X_CHECK_PREPARE
- AC_PATH_X
- AC_PATH_XTRA
- AS_IF([test "$no_x" != yes],
- [# We must be especially careful to instruct CS_EMIT_BUILD_PROPERTY() to
- # emit the following properties even if their values are empty. This is
- # necessary because of the way that Jam performs "product-wise" variable
- # expansion. For example, if X is "x" and Y is undefined, Jam will expand
- # "$(X) $(Y)" to "", whereas every other tool in the world will expand it
- # to "x ". Since the emitted X11.CFLAGS, X11.LFLAGS, XFREE86VM.CFLAGS, and
- # XFREE86VM.LFLAGS properties reference the other variables by name, we
- # must ensure that those other variables are defined (even if only with an
- # empty string).
- CS_EMIT_BUILD_PROPERTY([X11.AVAILABLE], [yes])
- CS_EMIT_BUILD_PROPERTY([X_CFLAGS], [$X_CFLAGS], [], [Y])
- CS_EMIT_BUILD_PROPERTY([X_LIBS], [$X_LIBS], [], [Y])
- CS_EMIT_BUILD_PROPERTY([X_PRE_LIBS], [$X_PRE_LIBS], [], [Y])
- CS_EMIT_BUILD_PROPERTY([X_EXTRA_LIBS], [$X_EXTRA_LIBS], [], [Y])
- CS_EMIT_BUILD_PROPERTY([X11.CFLAGS], [AS_ESCAPE([$(X_CFLAGS)])])
- CS_EMIT_BUILD_PROPERTY([X11.LFLAGS],
- [AS_ESCAPE([$(X_PRE_LIBS) $(X_LIBS) -lXext -lX11 $(X_EXTRA_LIBS)])])
- CS_CHECK_LIB_WITH([Xxf86vm],
- [AC_LANG_PROGRAM(
- [[#define XK_MISCELLANY 1
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- #include <X11/Xatom.h>
- #include <X11/extensions/xf86vmode.h>]],
- [XF86VidModeLockModeSwitch(0, 0, 0)])], [], [],
- [CS_EMIT_BUILD_PROPERTY([XFREE86VM.AVAILABLE], [yes])
- CS_EMIT_BUILD_PROPERTY([XFREE86VM.CFLAGS], [AS_ESCAPE([$(X_CFLAGS)])])
- CS_EMIT_BUILD_PROPERTY([XFREE86VM.LFLAGS],
- [AS_ESCAPE([$(X_PRE_LIBS) $(X_LIBS) -lXxf86vm -lXext -lX11
- $(X_EXTRA_LIBS)])])], [],
- [$X_CFLAGS], [], [$X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS])
- CS_CHECK_LIB_WITH([Xaw],
- [AC_LANG_PROGRAM(
- [[#include <X11/Shell.h>
- #include <X11/Xaw/Form.h>]],
- [XtVaGetValues(0,0,0,0)])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_libXaw], [XAW])], [],
- [$X_CFLAGS], [], [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS])])
- #------------------------------------------------------------------------------
- # Check for OpenGL and companions. Also check if GLX extensions are supported
- # and define the (backward) header property CSGL_EXT_STATIC_ASSERTION if they
- # are _not_ supported. Finally, check if the type GLhandleARB is exported by
- # the GL headers. It is starting to show up in very modern headers, but is
- # absent from most.
- #
- # IMPLEMENTATION NOTES
- #
- # GLU is not required or used by CrystalSpace itself, but certain 3rd party
- # libraries may depend on it (notably Cg).
- #------------------------------------------------------------------------------
- CS_CHECK_OPENGL
- AS_IF([test $cs_cv_libgl = yes],
- [# Check for GLhandleARB.
- CS_CHECK_BUILD([for GLhandleARB], [cs_cv_libgl_glhandlearb],
- [AC_LANG_PROGRAM(
- [CS_GL_INCLUDE([CS_OPENGL_PATH],[GL],[gl.h])],
- [GLhandleARB x; (void)x;])],
- [], [], [CS_HEADER_PROPERTY([CS_HAVE_GLHANDLEARB_T])], [], [],
- [$cs_cv_libgl_cflags], [$cs_cv_libgl_lflags], [$cs_cv_libgl_libs])])
- CS_CHECK_GLX
- # Check for GLX extensions. Define CSGL_EXT_STATIC_ASSERTION if _not_
- # present.
- CS_CHECK_GLXEXT([], [CS_HEADER_PROPERTY([CSGL_EXT_STATIC_ASSERTION])])
- #------------------------------------------------------------------------------
- # Check for DirectDraw. At least one user (Jorrit) has a strange installation
- # in which inclusion of <windows.h> fails if an int32 is not present, thus we
- # must take this into account. With Cygwin, we must check for the DirectX
- # headers in /usr/include/directx.
- #------------------------------------------------------------------------------
- # CS_CHECK_DIRECTX([DSOUND-VERSION])
- AC_DEFUN([CS_CHECK_DIRECTX],
- [CS_CHECK_BUILD([for DirectX$1], [cs_cv_libdirectx$1],
- [AC_LANG_PROGRAM(
- [[#if !HAVE_TYPE_INT32
- typedef long int32;
- #endif
- #define DIRECTINPUT_VERSION 0x0500
- #include <windows.h>
- #include <ddraw.h>
- #include <dsound.h>
- #include <dinput.h>]],
- [DirectDrawCreate(0,0,0);
- DirectSoundCreate$1(0,0,0);
- DirectInputCreate(0,0,0,0)])],
- [CS_CREATE_TUPLE([],[],[-lddraw -ldsound -ldinput]) \
- CS_CREATE_TUPLE([-I/usr/include/directx],[],
- [-lddraw -ldsound -ldinput])],
- [C++], [CS_EMIT_BUILD_RESULT([cs_cv_libdirectx$1], [DIRECTX$1])])])
- AS_IF([test $cs_host_family = windows],
- [AC_CHECK_TYPE([int32], [AC_DEFINE([HAVE_TYPE_INT32])], [])
- CS_CHECK_DIRECTX([])
- CS_CHECK_DIRECTX([8])])
- #------------------------------------------------------------------------------
- # Check for the Windows Multimedia library, used by the 'sndwaveout' plugin.
- #------------------------------------------------------------------------------
- AS_IF([test $cs_host_family = windows],
- [CS_CHECK_BUILD([for waveout], [cs_cv_libwaveout],
- [AC_LANG_PROGRAM(
- [[#include <windows.h>
- #include <mmsystem.h>]],
- [waveOutOpen(0, 0, 0, 0, 0, 0)])],
- [CS_CREATE_TUPLE([],[],[-lwinmm])],
- [], [CS_EMIT_BUILD_RESULT([cs_cv_libwaveout], [WAVEOUT])])])
- #------------------------------------------------------------------------------
- # Check for zlib. In addition to the standard installed locations, we also
- # search CS/libs/zlib*.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([z],
- [AC_LANG_PROGRAM([[#include <zlib.h>]], [zlibVersion()])],
- [$srcdir/libs/zlib*], [], [CS_EMIT_BUILD_RESULT([cs_cv_libz], [ZLIB])],
- [AC_MSG_NOTICE([*** zlib not found; VFS will be unusable])],
- [], [], [], [zlib])
- #------------------------------------------------------------------------------
- # Check for libpng. In addition to the standard installed locations, we also
- # search CS/libs/libpng*. Some platforms, such as RedHat 8.x require libm.a to
- # be linked with libpng, so use libm.a if available.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_LIBPNG_PREPARE],
- [AC_REQUIRE([CS_CHECK_COMMON_LIBS])])
- AS_IF([test "$cs_cv_libz" = yes],
- [CS_CHECK_LIBPNG_PREPARE
- CS_CHECK_LIB_WITH([png],
- [AC_LANG_PROGRAM([[#include <png.h>]],
- [png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0)])],
- [$srcdir/libs/libpng*], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libpng], [PNG])], [],
- [$cs_cv_libz_cflags $cs_cv_libm_cflags],
- [$cs_cv_libz_lflags $cs_cv_libm_lflags],
- [$cs_cv_libz_libs $cs_cv_libm_libs], [libpng])])
- #------------------------------------------------------------------------------
- # Check for libjpeg. In addition to the standard installed locations, we also
- # search CS/libs/*jpeg*.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([jpeg],
- [AC_LANG_PROGRAM(
- [[#include <stddef.h>
- #include <stdio.h>
- #include <jpeglib.h>]],
- [jpeg_create_compress(0)])],
- [$srcdir/libs/*jpeg*], [], [CS_EMIT_BUILD_RESULT([cs_cv_libjpeg], [JPEG])],
- [], [], [], [], [libjpeg])
- #------------------------------------------------------------------------------
- # Check for libmng. In addition to the standard installed locations, we also
- # search CS/libs/libmng*. Note that libmng on some OpenBSD installations has a
- # dependency on lcms (http://www.littlecms.com/), so we must check for this
- # library, and utilize it explicitly if present.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([lcms],
- [AC_LANG_PROGRAM([[#include <lcms.h>]],
- [LPLUT p = cmsAllocLUT(); cmsFreeLUT(p);])],
- [/usr/include/lcms| /usr/local/include/lcms|])
- CS_CHECK_LIB_WITH([mng],
- [AC_LANG_PROGRAM([[#include <libmng.h>]], [mng_version_release()])],
- [$srcdir/libs/libmng*], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libmng], [MNG])], [],
- [$cs_cv_liblcms_cflags $cs_cv_libjpeg_cflags $cs_cv_libz_cflags],
- [$cs_cv_liblcms_lflags $cs_cv_libjpeg_lflags $cs_cv_libz_lflags],
- [$cs_cv_liblcms_libs $cs_cv_libjpeg_libs $cs_cv_libz_libs],
- [libmng])
- #------------------------------------------------------------------------------
- # Check for MikMod. In addition to the standard installed locations, we also
- # search CS/libs/libmikmod*.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([mikmod],
- [AC_LANG_PROGRAM(
- [[#include <mikmod.h>]],
- [MikMod_Init("mikmodtest"); MikMod_Exit();])],
- [$srcdir/libs/libmikmod*], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libmikmod], [MIKMOD])], [],
- [$cs_cv_sys_pthread_cflags],
- [$cs_cv_sys_pthread_lflags],
- [$cs_cv_sys_pthread_libs])
- #------------------------------------------------------------------------------
- # Check for Ogg/Vorbis. In addition to the standard installed locations, we
- # also search CS/libs/libogg*, CS/libs/libvorbis.*, CS/libs/libvorbisfile*.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([ogg],
- [AC_LANG_PROGRAM(
- [[#include <ogg/ogg.h>]],
- [ogg_sync_state state; ogg_sync_init(&state);])],
- [$srcdir/libs/libogg*], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libogg], [OGG])])
- AS_IF([test "$cs_cv_libogg" = yes],
- [CS_CHECK_LIB_WITH([vorbis],
- [AC_LANG_PROGRAM([[#include <vorbis/codec.h>]],
- [vorbis_info info; vorbis_info_init(&info);])],
- [$srcdir/libs/libvorbis.*], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libvorbis], [VORBIS])], [],
- [$cs_cv_libogg_cflags],
- [$cs_cv_libogg_lflags],
- [$cs_cv_libogg_libs])])
- AS_IF([test "$cs_cv_libvorbis" = yes],
- [CS_CHECK_LIB_WITH([vorbisfile],
- [AC_LANG_PROGRAM(
- [[#include <vorbis/vorbisfile.h>
- #include <stdio.h>]],
- [OggVorbis_File file; ov_test(stdin, &file, "", 0);])],
- [$srcdir/libs/libvorbisfile*], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libvorbisfile], [VORBISFILE])], [],
- [$cs_cv_libogg_cflags $cs_cv_libvorbis_cflags],
- [$cs_cv_libogg_lflags $cs_cv_libvorbis_lflags],
- [$cs_cv_libogg_libs $cs_cv_libvorbis_libs])])
- #------------------------------------------------------------------------------
- # Check for lib3ds. In addition to the standard installed locations, we also
- # search CS/libs/lib3ds*.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_LIB3DS_PREPARE],
- [AC_REQUIRE([CS_CHECK_COMMON_LIBS])])
- CS_CHECK_LIB3DS_PREPARE
- CS_CHECK_LIB_WITH([3ds],
- [AC_LANG_PROGRAM([[#include <lib3ds/file.h>]],[lib3ds_file_new();])],
- [$srcdir/libs/lib3ds*], [], [], [], [], [], [$cs_cv_libm_libs],
- [lib3ds, lib3ds-120])
- AS_IF([test $cs_cv_lib3ds = yes],
- [CS_CHECK_BUILD([if lib3ds is sufficiently recent], [cs_cv_lib3ds_recent],
- [AC_LANG_PROGRAM([[#include <lib3ds/io.h>]], [lib3ds_io_free(0);])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_lib3ds], [3DS])], [], [],
- [$cs_cv_lib3ds_cflags], [$cs_cv_lib3ds_lflags], [$cs_cv_lib3ds_libs])])
- #------------------------------------------------------------------------------
- # Check for ODE. In addition to the standard installed locations, we also
- # search CS/libs/libode*. Also check if it is a sufficiently recent version.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([ode],
- [AC_LANG_PROGRAM([[#include <ode/ode.h>]], [dWorldCreate()])],
- [$srcdir/libs/libode*], [C++])
- AS_IF([test $cs_cv_libode = yes],
- [CS_CHECK_BUILD([if libode is built with OPCODE support],
- [cs_cv_libode_opcode],
- [AC_LANG_PROGRAM(
- [[#include <ode/ode.h>]],
- [dGeomTriMeshDataCreate();])],
- [], [C++], [], [], [],
- [$cs_cv_libode_cflags], [$cs_cv_libode_lflags], [$cs_cv_libode_libs])],
- [cs_cv_libode_opcode=no])
- AS_IF([test $cs_cv_libode_opcode = yes],
- [CS_CHECK_BUILD([if libode is sufficiently recent], [cs_cv_libode_recent],
- [AC_LANG_PROGRAM(
- [[#include <ode/ode.h>]],
- [dGeomTriMeshGetTriangleCount(0);])],
- [], [C++],
- [CS_EMIT_BUILD_RESULT([cs_cv_libode], [ODE])], [], [],
- [$cs_cv_libode_cflags], [$cs_cv_libode_lflags], [$cs_cv_libode_libs])],
- [cs_cv_libode_recent=no])
- #------------------------------------------------------------------------------
- # Check for bullet physics library.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([bullet],
- [AC_LANG_PROGRAM([[
- #include <BroadphaseCollision/SimpleBroadphase.h>
- #include <CcdPhysics/CcdPhysicsController.h>
- #include <CcdPhysics/CcdPhysicsEnvironment.h>
- #include <CollisionDispatch/CollisionDispatcher.h>
- ]],
- [CollisionDispatcher dispatcher; SimpleBroadphase broadphase;
- new CcdPhysicsEnvironment (&dispatcher, &broadphase)])],
- [], [C++], [CS_EMIT_BUILD_RESULT([cs_cv_libbullet], [BULLET])], [],
- [], [],
- [-lbulletccdphysics -lbulletphysicsinterfacecommon -lbulletdynamics -lbullet])
- #------------------------------------------------------------------------------
- # Check for OpenAL.
- #------------------------------------------------------------------------------
- # CS_AL_INCLUDE(CPP-MACRO,FALLBACK,HEADER)
- AC_DEFUN([CS_AL_INCLUDE],
- [[#ifndef CS_HEADER_GLOBAL
- #define CS_HEADER_GLOBAL(X,Y) CS_HEADER_GLOBAL_COMPOSE(X,Y)
- #define CS_HEADER_GLOBAL_COMPOSE(X,Y) <X/Y>
- #endif
- #ifdef $1
- #include CS_HEADER_GLOBAL($1,$3)
- #else
- #include <$2/$3>
- #endif]])
- AC_DEFUN([CS_CHECK_LIBOPENAL],
- [AC_REQUIRE([CS_CHECK_COMMON_LIBS])
- CS_CHECK_BUILD([for OpenAL], [cs_cv_libopenal],
- [AC_LANG_PROGRAM(
- [CS_AL_INCLUDE([CS_OPENAL_PATH],[AL],[alut.h])],
- [alutInit(0,0);])],
- [CS_CREATE_TUPLE([-DCS_OPENAL_PATH=OpenAL],[],[-framework OpenAL]) \
- CS_CREATE_TUPLE([],[],[-lopenal]) \
- CS_CREATE_TUPLE([],[],[-lopenal32]) \
- CS_CREATE_TUPLE([],[],[-lalut -lopenal]) \
- CS_CREATE_TUPLE([],[],[-lalut -lopenal32]) \
- CS_CREATE_TUPLE([],[],[-lALut -lOpenAL32]) \
- CS_CREATE_TUPLE([],[],[-lopenal -ldsound]) \
- CS_CREATE_TUPLE([],[],[-lopenal32 -ldsound]) \
- CS_CREATE_TUPLE([],[],[-lalut -lopenal -ldsound]) \
- CS_CREATE_TUPLE([],[],[-lalut -lopenal32 -ldsound])], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libopenal], [OPENAL])], [], [],
- [$cs_cv_sys_pthread_cflags],
- [$cs_cv_sys_pthread_lflags],
- [$cs_cv_sys_pthread_libs $cs_cv_libdl_libs $cs_cv_libm_libs])])
- CS_CHECK_LIBOPENAL
- #------------------------------------------------------------------------------
- # Check for FreeType2. Note that on MacOS/X, Fink strangely installs
- # `freetype-config' in /sw/lib/freetype2/bin, thus we augment PATH so that
- # CS_CHECK_LIB_WITH() will take this unusual location into account.
- #------------------------------------------------------------------------------
- PATH=$PATH$PATH_SEPARATOR/sw/lib/freetype2/bin
- export PATH
- CS_CHECK_LIB_WITH([freetype2],
- [AC_LANG_PROGRAM(
- [[#include <ft2build.h>
- #include FT_FREETYPE_H]],
- [FT_Library p; FT_Init_FreeType(&p); FT_Done_FreeType(p);])],
- [], [], [], [], [], [], [], [freetype])
- AS_IF([test $cs_cv_libfreetype2 = yes],
- [CS_CHECK_BUILD([if freetype2 is sufficiently recent],
- [cs_cv_freetype2_recent],
- [AC_LANG_PROGRAM(
- [[#include <ft2build.h>
- #include FT_INTERNAL_OBJECTS_H
- #include FT_FREETYPE_H
- #include FT_GLYPH_H
- #include FT_MODULE_H]], [return
- FT_LOAD_TARGET_MONO|FT_RENDER_MODE_NORMAL|FT_ENCODING_UNICODE])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_libfreetype2], [FT2])], [], [],
- [$cs_cv_libfreetype2_cflags],
- [$cs_cv_libfreetype2_lflags],
- [$cs_cv_libfreetype2_libs])])
- #------------------------------------------------------------------------------
- # For Mingw, test if we need to link explicitly with libmingwex.a. Older
- # versions of Mingw did not have this library, whereas newer interim versions
- # supply it but do not link automatically with it. The very newest versions
- # link with libmingwex.a automatically. To see if libmingwex.a is required, we
- # try calling opendir(), which exists in libming32.a for older releases, and in
- # libmingwex.a for newer releases.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_LIBMINGWX],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- case $host_os in
- mingw*)
- AC_CACHE_CHECK([for libmingwex], [cs_cv_libmingwex],
- [CS_BUILD_IFELSE(
- [AC_LANG_PROGRAM([[#include <dirent.h>]], [opendir("");])],
- [CS_CREATE_TUPLE() CS_CREATE_TUPLE([],[],[-lmingwex])], [],
- [AS_IF([test -n "$cs_build_libs"],
- [cs_cv_libmingwex=yes], [cs_cv_libmingwex=no])],
- [cs_cv_libmingwex=no])])
- ;;
- *) cs_cv_libmingwex=no ;;
- esac])
- CS_CHECK_LIBMINGWX
- AS_IF([test $cs_cv_libmingwex = yes],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.LFLAGS], [-lmingwex], [+])])
- #------------------------------------------------------------------------------
- # Check for Cal3D.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([cal3d],
- [AC_LANG_PROGRAM([[#include <cal3d/cal3d.h>]],
- [CalModel* m = 0; m->getMixer();])], [], [C++])
- AS_IF([test $cs_cv_libcal3d = yes],
- [CS_CHECK_BUILD([if cal3d is sufficiently recent], [cs_cv_cal3d_recent],
- [AC_LANG_PROGRAM(
- [[#include <cal3d/cal3d.h>]],
- [int x = LOADER_FLIP_WINDING;])],
- [], [C++],
- [CS_EMIT_BUILD_RESULT([cs_cv_libcal3d], [CAL3D])], [], [],
- [$cs_cv_libcal3d_cflags],
- [$cs_cv_libcal3d_lflags],
- [$cs_cv_libcal3d_libs])])
- #------------------------------------------------------------------------------
- # Check for SDL.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([sdl],
- [AC_LANG_PROGRAM(
- [[#include <SDL.h>
- #undef main]],
- [SDL_Init(0); SDL_Quit();])])
- AS_IF([test $cs_cv_libsdl = yes],
- [CS_CHECK_BUILD([if SDL is sufficiently recent], [cs_cv_sdl_recent],
- [AC_LANG_PROGRAM(
- [[#include <SDL.h>
- #undef main]],
- [SDL_EnableKeyRepeat(0,0)])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_libsdl], [SDL])], [], [],
- [$cs_cv_libsdl_cflags], [$cs_cv_libsdl_lflags], [$cs_cv_libsdl_libs])])
- #------------------------------------------------------------------------------
- # Check for VOS.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([metaobject_a3dl],
- [AC_LANG_PROGRAM(
- [[#include <vos/metaobjects/a3dl/object3d.hh>]],
- [A3DL::Object3D o(0); o.setPosition(0,0,0);])],
- [], [C++], [], [], [], [],
- [-lboost_thread -lvutil -lvip -lvos],
- [libmetaobject_a3dl])
- AS_IF([test $cs_cv_libmetaobject_a3dl = yes],
- [CS_CHECK_LIB_WITH([metaobject_misc],
- [AC_LANG_PROGRAM(
- [[#include <vos/metaobjects/misc/metadata.hh>]],
- [VOS::Metadata m(0); m.setCreationTime(0);])],
- [], [C++], [], [],
- [$cs_cv_libmetaobject_a3dl_cflags],
- [$cs_cv_libmetaobject_a3dl_lflags],
- [$cs_cv_libmetaobject_a3dl_libs -lircclient],
- [libmetaobject_misc])],
- [cs_cv_libmetaobject_misc=no])
- AS_IF([test $cs_cv_libmetaobject_misc = yes],
- [CS_EMIT_BUILD_RESULT([cs_cv_libmetaobject_misc], [VOS])])
- #------------------------------------------------------------------------------
- # Check for wxWidgets. Also check if it was built with OpenGL support since it
- # is required by the Crystal Space wxWidgets canvas.
- #
- # IMPLEMENTATION NOTE
- #
- # On Windows, wx-config's --gl-libs options incorrectly emits a reference to a
- # non-existent library (wxmsw_glxxx.lib). To handle this broken case, we first
- # try the result of --libs and --gl-libs together; if that fails, then we try
- # only --libs augmented with the results of our own OpenGL checks. On more
- # recent WX versions it seems that on Win32 both the libraries from --gl-libs
- # and the OpenGL checks are needed - the last case.
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([wx],
- [AC_LANG_PROGRAM(
- [[#include "wx/wxprec.h"
- #ifdef __BORLANDC__
- #pragma hdrstop
- #endif
- #ifndef WX_PRECOMP
- #include "wx/wx.h"
- #endif
- ]],
- [[wxWindow* p = 0; int w,h; p->GetClientSize(&w,&h);]])],
- [], [C++])
-
- AS_IF([test $cs_cv_libwx = yes],
- [AS_IF([test -z "$cs_cv_libwx_opengl"],
- [AS_IF([test -n "$CONFIG_WX"],
- [cs_cv_libwx_gllibs=CS_RUN_PATH_NORMALIZE([$CONFIG_WX --gl-libs])],
- [cs_cv_libwx_gllibs=''])])
- CS_CHECK_BUILD([if wxWidgets is built with OpenGL support],
- [cs_cv_libwx_opengl],
- [AC_LANG_PROGRAM(
- [[#include "wx/wxprec.h"
- #ifdef __BORLANDC__
- #pragma hdrstop
- #endif
- #ifndef WX_PRECOMP
- #include "wx/wx.h"
- #endif
- #include "wx/glcanvas.h"
- ]],
- [wxGLCanvas* f = new wxGLCanvas(0, wxID_ANY); glVertex3f(0,0,0)])],
- [CS_CREATE_TUPLE(
- [$cs_cv_libwx_cflags],
- [$cs_cv_libwx_lflags],
- [$cs_cv_libwx_libs $cs_cv_libwx_gllibs]) \
- CS_CREATE_TUPLE(
- [$cs_cv_libwx_cflags $cs_cv_libglu_cflags],
- [$cs_cv_libwx_lflags $cs_cv_libglu_lflags],
- [$cs_cv_libwx_libs $cs_cv_libglu_libs]) \
- CS_CREATE_TUPLE(
- [$cs_cv_libwx_cflags $cs_cv_libglu_cflags],
- [$cs_cv_libwx_lflags $cs_cv_libglu_lflags],
- [$cs_cv_libwx_libs $cs_cv_libwx_gllibs $cs_cv_libglu_libs])],
- [C++])],
- [cs_cv_libwx_opengl=no])
-
- AS_IF([test $cs_cv_libwx_opengl = yes],
- [CS_EMIT_BUILD_RESULT([cs_cv_libwx_opengl], [WX])])
- #----------------------------------------------------------------------------
- # Check for CEGUI.
- #----------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([CEGUI],
- [AC_LANG_PROGRAM([[#include <CEGUI.h>]],
- [CEGUI::WindowManager::getSingleton();])], [], [C++],
- [], [], [], [], [], [CEGUIBase])
- AS_IF([test $cs_cv_libCEGUI = yes],
- [CS_CHECK_BUILD([if CEGUI is sufficiently recent], [cs_cv_CEGUI_recent],
- [AC_LANG_PROGRAM(
- [[#include <falagard/CEGUIFalWidgetLookManager.h>]],
- [CEGUI::WidgetLookManager::getSingleton();])],
- [], [C++],
- [CS_EMIT_BUILD_RESULT([cs_cv_libCEGUI], [CEGUI])], [], [],
- [$cs_cv_libCEGUI_cflags],
- [$cs_cv_libCEGUI_lflags],
- [$cs_cv_libCEGUI_libs])])
- #------------------------------------------------------------------------------
- # Check if GNU/Linux joystick API is present.
- #------------------------------------------------------------------------------
- AS_IF([test $cs_host_family != windows],
- [CS_CHECK_BUILD([for GNU/Linux joystick API], [cs_cv_sys_linux_joystick],
- [AC_LANG_PROGRAM(
- [[#include <fcntl.h>
- #include <sys/ioctl.h>
- #include <linux/joystick.h>]],
- [unsigned char axes;
- unsigned char buttons;
- int version;
- char name[[[128]]];
- int fd;
- struct js_event js;
- (void)js;
- ioctl(fd, JSIOCGVERSION, &version);
- ioctl(fd, JSIOCGAXES, &axes);
- ioctl(fd, JSIOCGBUTTONS, &buttons);
- ioctl(fd, JSIOCGNAME(128), name);])],
- [], [],
- [CS_EMIT_BUILD_PROPERTY([LINUXJOYSTICK.AVAILABLE], [yes])])])
- #------------------------------------------------------------------------------
- # Check for Cg shader package.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_LIBCG],
- [AC_REQUIRE([CS_CHECK_COMMON_LIBS])
- AC_REQUIRE([CS_CHECK_PTHREAD])
- CS_CHECK_LIB_WITH([Cg],
- [AC_LANG_PROGRAM(
- [[#include <Cg/cg.h>]],
- [CGcontext c = cgCreateContext()])],
- [], [], [], [],
- [$cs_cv_libm_cflags $cs_cv_sys_pthread_cflags],
- [$cs_cv_libm_lflags $cs_cv_sys_pthread_lflags],
- [$cs_cv_libm_libs $cs_cv_sys_pthread_libs],
- [cg, CG])
- AS_IF([test $cs_cv_libCg = yes],
- [CS_CHECK_BUILD([if Cg is sufficiently recent], [cs_cv_libCg_recent],
- [AC_LANG_PROGRAM(
- [[#include <Cg/cg.h>]], [cgSetErrorHandler(0,0);])],
- [], [], [], [], [],
- [$cs_cv_libCg_cflags],
- [$cs_cv_libCg_lflags],
- [$cs_cv_libCg_libs])],
- [cs_cv_libCg_recent=no])
- AS_IF([test $cs_cv_libCg_recent = yes],
- [CS_CHECK_LIB_WITH([CgGL],
- [AC_LANG_PROGRAM(
- [[#include <Cg/cg.h>
- #include <Cg/cgGL.h>]],
- [CGprogram p; cgGLBindProgram(p)])],
- [], [C++],
- [CS_EMIT_BUILD_RESULT([cs_cv_libCgGL], [CG])], [],
- [$cs_cv_libCg_cflags $cs_cv_libgl_cflags $cs_cv_libglu_cflags],
- [$cs_cv_libCg_lflags $cs_cv_libgl_lflags $cs_cv_libglu_lflags],
- [$cs_cv_libCg_libs $cs_cv_libgl_libs $cs_cv_libglu_libs],
- [cggl, cgGL, CGGL, Cg, cg, CG])])])
- CS_CHECK_LIBCG
- #------------------------------------------------------------------------------
- # Check for OpenSoundSystem (OSS).
- #------------------------------------------------------------------------------
- AS_IF([test $cs_host_family != windows],
- [AC_CHECK_HEADER([soundcard.h],
- [CS_HEADER_PROPERTY([CS_HAVE_SOUNDCARD_H])
- cs_cv_header_soundcard_h=yes],
- [AC_CHECK_HEADER([sys/soundcard.h],
- [CS_HEADER_PROPERTY([CS_HAVE_SYS_SOUNDCARD_H])
- cs_cv_header_soundcard_h=yes],
- [AC_CHECK_HEADER([machine/soundcard.h],
- [CS_HEADER_PROPERTY([CS_HAVE_MACHINE_SOUNDCARD_H])
- cs_cv_header_soundcard_h=yes],
- [cs_cv_header_soundcard_h=no])])])]
-
- [AS_IF([test $cs_cv_header_soundcard_h = yes],
- [CS_EMIT_BUILD_PROPERTY([OSS.AVAILABLE], [yes])])])
- #------------------------------------------------------------------------------
- # Check for JACK daemon jackasyn library (JACKASYN)
- #------------------------------------------------------------------------------
- AS_IF([test $cs_host_family != windows],
- [CS_CHECK_LIB_WITH([jackasyn],
- [AC_LANG_PROGRAM(
- [[#include <stdio.h>
- #include <libjackoss.h>]],
- [jackoss_open("/dev/dsp",1);])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_libjackasyn], [JACKASYN])])])
- #------------------------------------------------------------------------------
- # Check for Advanced GNU/Linux Sound Architecture (ALSA)
- #------------------------------------------------------------------------------
- AS_IF([test $cs_host_family != windows],
- [CS_CHECK_LIB_WITH([asound],
- [AC_LANG_PROGRAM(
- [[#include <alsa/asoundlib.h>]],
- [snd_pcm_hw_params_t* p; snd_pcm_hw_params_alloca(&p);])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_libasound], [ALSA])])])
- #------------------------------------------------------------------------------
- # Check for Colour Ascii Art library (libcaca).
- #------------------------------------------------------------------------------
- CS_CHECK_LIB_WITH([caca],
- [AC_LANG_PROGRAM([[#include <caca.h>]], [caca_init(); caca_end();])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_libcaca], [LIBCACA])], [], [], [], [],
- [libcaca])
- #------------------------------------------------------------------------------
- # Check for SpiderMonkey JavaScript library.
- #------------------------------------------------------------------------------
- case $cs_host_family in
- windows)
- cs_spidermonkey_platform='XP_WIN'
- ;;
- *)
- cs_spidermonkey_platform='XP_UNIX'
- ;;
- esac
- CS_CHECK_LIB_WITH([js],
- [AC_LANG_PROGRAM([[#include <js/jsapi.h>]],
- [JS_NewRuntime(0)])],
- [], [], [CS_EMIT_BUILD_RESULT([cs_cv_libjs], [JS])], [],
- [-D$cs_spidermonkey_platform])
- #------------------------------------------------------------------------------
- # Check if regular expressions are available.
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD([for regexp support], [cs_cv_regexp],
- [AC_LANG_PROGRAM(
- [[#ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
- #endif
- #include <regex.h>]],
- [regex_t re; regcomp (&re, 0, 0); regexec (&re, 0, 0, 0, 0);])],
- [], [],
- [CS_HEADER_PROPERTY([CS_HAVE_REGEX])
- CS_EMIT_BUILD_PROPERTY([REGEX.AVAILABLE], [yes])])
- #------------------------------------------------------------------------------
- # Check if backtrace() is available.
- #------------------------------------