/CS/migrated/tags/PRE_CSARRAY_SIZE_T_INDICES/configure.ac
m4 | 1622 lines | 925 code | 272 blank | 425 comment | 0 complexity | 6ac3c0ce8db342ef34d21c7b36940c09 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, LGPL-2.0
Large files files are truncated, but you can click here to view the full file
- # -*- Autoconf -*-
- #==============================================================================
- # Copyright (C)2003,2004 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.98])
- #------------------------------------------------------------------------------
- # cs_lib_paths_default
- # Whitespace delimited list of directory tuples in which to search, by
- # default, for external libraries. Each list item can specify an
- # include|library directory tuple (for example, "/usr/include|/usr/lib"),
- # or a single directory (for example, "/usr"). If the second form is
- # used, then the directory itself is searched first. If the external
- # resource is not found, then "include" and "lib" subdirectories of the
- # directory are searched. Thus, specifying "/proj" is shorthand for
- # "/proj|/proj /proj/include|/proj/lib".
- #
- # Present Cases:
- # /usr/local -- Not all compilers search here by default, so we specify
- # it manually.
- # /sw -- Fink, the MacOS/X manager of Unix packages, installs here by
- # default.
- #------------------------------------------------------------------------------
- m4_define([cs_lib_paths_default],
- [/usr/local/include|/usr/local/lib /sw/include|/sw/lib])
- #==============================================================================
- # INITIALIZATION
- #==============================================================================
- AC_INIT([crystal], [cs_version_number], [crystal-main@lists.sourceforge.net])
- CS_PACKAGEINFO([Crystal Space],
- [Copyright (C)1998-2004 Jorrit Tyberghein and others],
- [http://crystal.sourceforge.net/])
- AC_CONFIG_SRCDIR([libs/csutil/Jamfile])
- AC_CONFIG_AUX_DIR([mk/autoconf])
- AC_CANONICAL_HOST
- #------------------------------------------------------------------------------
- # Check for compilers and common tools.
- #------------------------------------------------------------------------------
- AC_PROG_CC
- CS_EMIT_BUILD_PROPERTY([CMD.CC], [$CC])
- AC_PROG_CXX
- CS_EMIT_BUILD_PROPERTY([CMD.C++], [$CXX])
- # C++ compiler is used as linker.
- CS_EMIT_BUILD_PROPERTY([CMD.LINK], [AS_ESCAPE([$(CMD.C++)])])
- AS_IF([test $ac_compiler_gnu = yes],
- [cs_compiler_name=GCC CS_HEADER_PROPERTY([COMP_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(["])])
- AC_PROG_RANLIB
- CS_EMIT_BUILD_PROPERTY([RANLIB], [$RANLIB])
- AC_CHECK_TOOLS([DLLTOOL], [dlltool])
- CS_EMIT_BUILD_PROPERTY([CMD.DLLTOOL], [$DLLTOOL])
- AC_CHECK_TOOLS([DLLWRAP], [dllwrap])
- CS_EMIT_BUILD_PROPERTY([CMD.DLLWRAP], [$DLLWRAP])
- AC_CHECK_TOOLS([WINDRES], [windres])
- CS_EMIT_BUILD_PROPERTY([CMD.WINDRES], [$WINDRES])
- AC_CHECK_TOOLS([OBJCOPY], [objcopy])
- AS_IF([test -n "$OBJCOPY"],
- [CS_EMIT_BUILD_PROPERTY([OBJCOPY.AVAILABLE], [yes])
- CS_EMIT_BUILD_PROPERTY([CMD.OBJCOPY], [$OBJCOPY])])
- AC_CHECK_PROGS([FLEX], [flex])
- CS_EMIT_BUILD_PROPERTY([CMD.FLEX], [$FLEX])
- AC_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])])])
- AC_CHECK_PROGS([DOXYGEN], [doxygen])
- CS_EMIT_BUILD_PROPERTY([CMD.DOXYGEN], [$DOXYGEN])
- AC_CHECK_PROGS([TEXI2DVI], [texi2dvi])
- CS_EMIT_BUILD_PROPERTY([CMD.TEXI2DVI], [$TEXI2DVI])
- AC_CHECK_PROGS([DVIPS], [dvips])
- CS_EMIT_BUILD_PROPERTY([CMD.DVIPS], [$DVIPS])
- AC_CHECK_PROGS([DVIPDF], [dvipdf])
- CS_EMIT_BUILD_PROPERTY([CMD.DVIPDF], [$DVIPDF])
- AC_CHECK_PROGS([MAKEINFO], [makeinfo])
- CS_EMIT_BUILD_PROPERTY([CMD.MAKEINFO], [$MAKEINFO])
- AC_CHECK_PROGS([INSTALL], [install])
- CS_EMIT_BUILD_PROPERTY([INSTALL], [$INSTALL])
- AC_CHECK_PROGS([SWIG], [swig])
- AS_IF([test -n "$SWIG"],
- [CS_CHECK_PROG_VERSION([swig], [$SWIG -version 2>&1], [1.3.14],
- [9.9|.9], [CS_EMIT_BUILD_PROPERTY([CMD.SWIG], [$SWIG])])])
- CS_CHECK_LIBTOOL
- CS_EMIT_BUILD_PROPERTY([LIBTOOL], [$LIBTOOL])
- CS_EMIT_BUILD_PROPERTY([APPLE_LIBTOOL], [$APPLE_LIBTOOL])
- CS_CHECK_MKDIR
- CS_EMIT_BUILD_PROPERTY([CMD.MKDIR], [$MKDIR])
- CS_EMIT_BUILD_PROPERTY([CMD.MKDIRS], [$MKDIRS])
- #------------------------------------------------------------------------------
- # 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])
- AC_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])
- AC_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.
- #------------------------------------------------------------------------------
- AC_CHECK_TOOLS([CSLIBS_CONFIG], [cslibs-config])
- AS_IF([test $ac_compiler_gnu = yes],
- [cs_cv_cslibs_compiler="--compiler gcc-`$CXX -dumpversion`"])
- AC_CACHE_CHECK([for cslibs package], [cs_cv_cslibs],
- [AS_IF([test -n "$CSLIBS_CONFIG"],
- [cs_cv_cslibs=yes
- cs_cv_cslibs_cflags=`
- AC_RUN_LOG([$CSLIBS_CONFIG --cflags $cs_cv_cslibs_compiler])`
- cs_cv_cslibs_lflags=`
- AC_RUN_LOG([$CSLIBS_CONFIG --lflags $cs_cv_cslibs_compiler])`
- cs_cv_cslibs_binpath=`
- AC_RUN_LOG([$CSLIBS_CONFIG --binpath $cs_cv_cslibs_compiler])`],
- [cs_cv_cslibs=no])])
- AS_IF([test $cs_cv_cslibs = yes],
- [CFLAGS="$CFLAGS $cs_cv_cslibs_cflags"
- CPPFLAGS="$CPPFLAGS $cs_cv_cslibs_cflags"
- LDFLAGS="$LDFLAGS $cs_cv_cslibs_lflags"
- PATH="$cs_cv_cslibs_binpath$PATH_SEPARATOR$PATH"])
- #------------------------------------------------------------------------------
- # Check for NASM and extensions (such as %xdefine) which we require.
- #------------------------------------------------------------------------------
- AC_CHECK_TOOLS([NASM], [nasmw nasm])
- AS_IF([test -n "$NASM"],
- [AC_CACHE_CHECK([if nasm is sufficiently recent], [cs_cv_prog_nasm_ok],
- [echo "%xdefine TEST" > conftest.asm
- AS_IF([AC_RUN_LOG(
- [$NASM conftest.asm -o conftest.$OBJEXT 1>&2])],
- [cs_cv_prog_nasm_ok=yes], [cs_cv_prog_nasm_ok=no])
- rm -f conftest.*])
- AS_IF([test $cs_cv_prog_nasm_ok = yes],
- [CS_EMIT_BUILD_PROPERTY([NASM.AVAILABLE], [yes])
- CS_EMIT_BUILD_PROPERTY([CMD.NASM], [$NASM])
- CS_HEADER_PROPERTY([DO_NASM])])])
- #------------------------------------------------------------------------------
- # Check for typical required libraries (libm, libmx, libdl, libnsl).
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_COMMON_LIBS],
- [AC_LANG_PUSH([C])
- AC_CHECK_LIB([m], [pow], [cs_cv_libm_libs=-lm], [cs_cv_libm_libs=])
- AC_CHECK_LIB([m], [cosf], [cs_cv_libm_libs=-lm])
- AC_CHECK_LIB([mx], [cosf])
- AC_CHECK_LIB([dl], [dlopen], [cs_cv_libdl_libs=-ldl], [cs_cv_libdl_libs=])
- AC_CHECK_LIB([nsl], [gethostbyname])
- 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_USE_FAKE_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_recursive != no],
- [CS_HEADER_PROPERTY([CS_PTHREAD_MUTEX_RECURSIVE],
- [$cs_cv_sys_pthread_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_RTLD_NOW_AVAILABLE])], [], [],
- [], [], [$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
- # OS_FOO header define.
- #------------------------------------------------------------------------------
- AC_DEFUN([CS_CHECK_HOST],
- [AC_REQUIRE([AC_CANONICAL_HOST])
- cs_host_os_normalized=''
- case $host_os in
- mingw*|cygwin*)
- cs_host_target=win32gcc
- cs_host_family=windows
- ;;
- darwin*)
- _CS_CHECK_HOST_DARWIN
- ;;
- *)
- # Everything else is assumed to be Unix or Unix-like.
- cs_host_target=unix
- cs_host_family=unix
- ;;
- esac])
- AC_DEFUN([_CS_CHECK_HOST_DARWIN],
- [AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_PROG_CXX])
- # Both MacOS/X and Darwin are identified via $host_os as "darwin". We need
- # a way to distinguish between the two. If Carbon.h is present, then
- # assume MacOX/S; if not, assume Darwin. If --with-x=yes was invoked, and
- # Carbon.h is present, then assume that user wants to cross-build for
- # Darwin even though build host is MacOS/X. Implementation note: At least
- # one MacOS/X user switches between gcc 2.95 and gcc 3.3 with a script
- # which toggles the values of CC, CXX, and CPP. Unfortunately, CPP was
- # being set to run the preprocessor directly ("cpp", for instance) rather
- # than running it via the compiler ("gcc -E", for instance). The problem
- # with running the preprocessor directly is that __APPLE__ and __GNUC__ are
- # not defined, which causes the Carbon.h check to fail. We avoid this
- # problem by supplying a non-empty fourth argument to AC_CHECK_HEADER(),
- # which causes it to test compile the header only (which is a more robust
- # test), rather than also testing it via the preprocessor.
- AC_CHECK_HEADER([Carbon/Carbon.h],
- [cs_host_macosx=yes], [cs_host_macosx=no], [/* force compile */])
- AS_IF([test $cs_host_macosx = yes],
- [AC_MSG_CHECKING([for --with-x])
- AS_IF([test "${with_x+set}" = set && test "$with_x" = "yes"],
- [AC_MSG_RESULT([yes (assume Darwin)])
- cs_host_macosx=no],
- [AC_MSG_RESULT([no])])])
- AS_IF([test $cs_host_macosx = yes],
- [cs_host_target=macosx
- cs_host_family=unix
- cs_host_os_normalized='MacOS/X'
- CS_HEADER_PROPERTY([OS_MACOSX])
- CS_HEADER_PROPERTY([CS_24BIT_PIXEL_LAYOUT], [CS_24BIT_PIXEL_ARGB])
- # 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])
- AC_CACHE_CHECK([for Objective-C compiler], [cs_cv_prog_objc],
- [cs_cv_prog_objc="$CC"])
- CS_EMIT_BUILD_PROPERTY([CMD.OBJC], [$cs_cv_prog_objc])
- AC_CACHE_CHECK([for Objective-C++ compiler], [cs_cv_prog_objcxx],
- [cs_cv_prog_objcxx="$CXX"])
- CS_EMIT_BUILD_PROPERTY([CMD.OBJC++], [$cs_cv_prog_objcxx])],
- [cs_host_target=unix
- cs_host_family=unix])])
- CS_CHECK_HOST
- case $cs_host_family in
- windows)
- CS_HEADER_PROPERTY([OS_WIN32])
- AS_IF([test -z "$cs_host_os_normalized"],
- [cs_host_os_normalized='Win32'])
- ;;
- unix)
- CS_HEADER_PROPERTY([OS_UNIX])
- AS_IF([test -z "$cs_host_os_normalized"],
- [cs_host_os_normalized='Unix'])
- ;;
- esac
- cs_host_os_normalized_uc="AS_TR_CPP([$cs_host_os_normalized])"
- CS_EMIT_BUILD_PROPERTY([TARGET.OS], [$cs_host_os_normalized_uc])
- CS_EMIT_BUILD_PROPERTY([TARGET.OS.NORMALIZED], [$cs_host_os_normalized])
- 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.
- #------------------------------------------------------------------------------
- AC_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_cflags=CS_TRIM([$cs_cv_perl_cflags])
- cs_cv_perl_lflags=CS_PATH_NORMALIZE([$cs_cv_perl_lflags])
- cs_cv_perl_lflags=CS_TRIM([$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_EMIT_CHECK_PYTHON([], [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_HEADER_PATH],
- [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],
- [cs_java_inc="-I/System/Library/Frameworks/JavaVM.framework/Headers"],
- [AS_IF([test -n "$JAVA_HOME"],
- [cs_java_dir="$JAVA_HOME"],
- [AS_IF([test -n "$1"],
- [cs_java_dir=`AS_DIRNAME([$1])`
- cs_java_dir=`AS_DIRNAME([$cs_java_dir])`],
- [cs_java_dir=''])])
- AS_IF([test -n "$cs_java_dir"],
- [cs_java_inc="-I$cs_java_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"],
- [cs_java_inc="$cs_java_inc
- $cs_java_inc/$cs_java_platform"])])])])
- AC_PATH_PROGS([JAVA], [java], [],
- [$PATH$PATH_SEPARATOR$JAVA_HOME/bin$PATH_SEPARATOR$JAVA_HOME/jre/bin])
- CS_EMIT_BUILD_PROPERTY([JAVA], [$JAVA])
- AC_PATH_PROGS([JAVAC], [javac], [],
- [$PATH$PATH_SEPARATOR$JAVA_HOME/bin$PATH_SEPARATOR$JAVA_HOME/jre/bin])
- 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_HEADER_PATH([$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_inc])], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_java], [JAVA])])])
- AC_PATH_PROGS([ANT], [ant], [], [$PATH$PATH_SEPARATOR$ANT_HOME/bin])
- CS_EMIT_BUILD_PROPERTY([ANT], [$ANT])
- #------------------------------------------------------------------------------
- # Use the CPPFLAGS, CXXFLAGS, CFLAGS, and LDFLAGS passed to configure.
- # Further, Autoconf insists upon issuing optimization flags (-O) and debug
- # flags (-g) at one and the same time, but this is not suitable for Crystal
- # Space's build system, which makes a distinction between `optimize' and
- # `debug' builds, so we must filter out these flags.
- #------------------------------------------------------------------------------
- CFLAGS=`echo "$CFLAGS" | sed 's/-O.//g;s/-g.//g'`
- CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-O.//g;s/-g.//g'`
- 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 how to enable compilation warnings. Note that on some platforms, it is
- # more appropriate to use -Wmost rather than -Wall even if the compiler
- # understands both, thus we attempt -Wmost before -Wall.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to enable compilation warnings],
- [cs_cv_prog_cxx_enable_warnings],
- [CS_CREATE_TUPLE([-Wmost]) CS_CREATE_TUPLE([-Wall])], [C++],
- [COMPILER.CFLAGS], [+],
- [cs_prog_cxx_enable_warnings="$cs_cv_prog_cxx_enable_warnings"],
- [cs_prog_cxx_enable_warnings=''])
- #------------------------------------------------------------------------------
- # Check how to make compiler treat warnings as errors.
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD_FLAGS([how to treat warnings as errors],
- [cs_cv_prog_cxx_enable_errors], [CS_CREATE_TUPLE([-Werror])], [C++],
- [cs_prog_cxx_enable_errors="$cs_cv_prog_cxx_enable_errors"],
- [cs_prog_cxx_enable_errors=''])
- #------------------------------------------------------------------------------
- # Check how to make compiler ignore unused variables and arguments. This is
- # needed for code generated by tools, such as Swig, Bison, and Flex, over which
- # we have no control.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to ignore unused variables],
- [cs_cv_prog_cxx_ignore_unused_variables],
- [CS_CREATE_TUPLE([-Wno-unused])], [C++],
- [COMPILER.C++FLAGS.WARNING.NO_UNUSED])
- #------------------------------------------------------------------------------
- # Check how to make compiler ignore uninitialized variables and arguments.
- # This is needed for code generated by tools, such as Swig, Bison, and Flex,
- # over which we have no control.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([how to ignore uninitialized variables],
- [cs_cv_prog_cxx_ignore_uninitialized_variables],
- [CS_CREATE_TUPLE([-Wno-uninitialized])], [C++],
- [COMPILER.C++FLAGS.WARNING.NO_UNINITIALIZED])
- #------------------------------------------------------------------------------
- # Check if warnings about unknown #pragmas can be disabled. (MSVC and Borland
- # use a number of pragmas not understood by GCC, for instance.)
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([[how to ignore unknown #pragma directives]],
- [cs_cv_prog_cxx_ignore_unknown_pragmas],
- [CS_CREATE_TUPLE([-Wno-unknown-pragmas])], [C++], [COMPILER.CFLAGS], [+])
- #------------------------------------------------------------------------------
- # 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])],
- [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 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.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([if -multiply_defined suppress is needed],
- [cs_cv_prog_link_suppress_multiple],
- [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 qsqrt() 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 qsqrt().
- #------------------------------------------------------------------------------
- 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
- AS_IF([test $cs_cv_prog_cxx_force_cpusubtype_all != no],
- [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_prog_cxx_enable_errors])
- ;;
- esac])
- CS_CHECK_VTABLE_THUNKS
- #------------------------------------------------------------------------------
- # Check if compiler recognizes -pipe directive.
- #------------------------------------------------------------------------------
- CS_EMIT_BUILD_FLAGS([if -pipe is accepted], [cs_cv_prog_cxx_pipe],
- [CS_CREATE_TUPLE([-pipe])], [C++], [COMPILER.CFLAGS], [+])
- #------------------------------------------------------------------------------
- # Check if compiler/linker recognizes -shared directive which is needed for
- # linking plugin modules. Unfortunately, the Apple compiler (and possibly
- # others) require extra effort. Even though the compiler does not recognize
- # the -shared option, it nevertheless returns a "success" result after
- # complaining that the option is unrecognized. Worse, even -Werror fails to
- # coerce the compiler into returning a "failure" result, so we must perform the
- # additional task of checking the compiler's output for an appropriate error
- # emission, such as "unrecognized option `-shared'".
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD_FLAGS([if -shared is accepted], [cs_cv_prog_link_shared],
- [CS_CREATE_TUPLE([-shared])], [C++],
- [CS_EMIT_BUILD_PROPERTY([PLUGIN.LFLAGS], [-shared], [+])], [],
- [$cs_prog_cxx_enable_errors], [], [], [nrecognize])
- #------------------------------------------------------------------------------
- # Check if linker recognizes -soname which is used to assign a name internally
- # to plugin modules.
- #------------------------------------------------------------------------------
- CS_CHECK_BUILD([if -soname is accepted], [cs_cv_prog_link_soname], [],
- [CS_CREATE_TUPLE([-Wl,-soname,foobar])], [C++],
- [CS_EMIT_BUILD_PROPERTY([PLUGIN.LFLAGS.USE_SONAME], [yes])])
- #------------------------------------------------------------------------------
- # 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])])
- 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]], [-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 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 $CXX recognizes -fomit-frame-pointer],
- [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 $CXX recognizes -ffast-math],
- [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], [+])
- AS_IF([test $cs_cv_prog_cxx_debug != no],
- [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.
- #------------------------------------------------------------------------------
- AS_IF([test -d /usr/local/include],
- [CS_CHECK_BUILD_FLAGS([if -I/usr/local/include is usable],
- [cs_cv_prog_cxx_local_include],
- [CS_CREATE_TUPLE([-I/usr/local/include])], [C++],
- [cs_cv_prog_cxx_local_include=yes],
- [cs_cv_prog_cxx_local_include=no],
- [$cs_prog_cxx_enable_warnings $cs_prog_cxx_enable_errors])],
- [cs_cv_prog_cxx_local_include=no])
- AS_IF([test $cs_cv_prog_cxx_local_include = yes],
- [CS_EMIT_BUILD_PROPERTY([COMPILER.CFLAGS], [-I/usr/local/include], [+])
- CPPFLAGS="$CPPFLAGS -I/usr/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"])
- #------------------------------------------------------------------------------
- # 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])])
- #------------------------------------------------------------------------------
- # 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.
- #
- # IMPLEMENTATION NOTES
- #
- # Some Mesa installations require pthread, so pthread flags are employed if
- # available.
- #
- # The check for opengl32 needs to precede other checks because Cygwin users
- # often have Mesa installed, and Mesa's OpenGL library is compiled without the
- # __stdcall flags which results in link errors, whereas Microsoft's native
- # opengl32 works fine. Conversely, some Unix implementations have Wine
- # installed (Windows emulation layer) which includes an opengl32.so library.
- # We need to avoid detection of this library on Unix since it would cause an
- # undesirable dependence upon Wine.
- #
- # Many OpenGL libraries on Unix already contain GLX, so there is no separate
- # GLX library, thus we first check for GLX using the discovered OpenGL library
- # before attempting to locate a separate GLX-specific library. The same logic
- # is also applied to GLU and GLUT checks.
- #
- # On MacOS/X, some users have XFree86 installed which creates a link from
- # /usr/include/GL to /usr/X11R6/include/GL. We want to ignore this directory
- # and instead check for Apple's OpenGL.framework, if we are not cross-building
- # for Darwin. We accomplish this by placing the OpenGL.framework test ahead of
- # the other tests.
- #
- # 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.
- #------------------------------------------------------------------------------
- m4_define([cs_define_int32],
- [[#if !HAVE_TYPE_INT32
- typedef long int32;
- #endif
- ]])
- AC_DEFUN([CS_CHECK_GL_PREPARE],
- [AC_REQUIRE([CS_CHECK_HOST])
- AC_REQUIRE([CS_CHECK_COMMON_LIBS])
- AC_REQUIRE([CS_CHECK_PTHREAD])
- AC_REQUIRE([AC_PATH_X])
- AC_REQUIRE([AC_PATH_XTRA])
- AC_CHECK_TYPE([int32], [AC_DEFINE([HAVE_TYPE_INT32])], [])
- AC_CHECK_HEADERS([windows.h], [], [], [cs_define_int32])])
- # CS_GL_INCLUDE(CPP-MACRO,FALLBACK,HEADER)
- AC_DEFUN([CS_GL_INCLUDE],
- [AC_REQUIRE([CS_CHECK_GL_PREPARE])
- [#if HAVE_WINDOWS_H
- #if !HAVE_TYPE_INT32
- typedef long int32;
- #endif
- #include <windows.h>
- #endif
- #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]])
- CS_CHECK_GL_PREPARE
- # Apply plaform-specific flags if necessary.
- cs_gl_plat_cflags=''
- cs_gl_plat_lflags=''
- cs_gl_plat_libs=''
- AS_IF([test -n "$cs_cv_libm_cflags$cs_cv_libm_lflags$cs_cv_libm_libs"],
- [cs_gl_plat_cflags="$cs_cv_libm_cflags $cs_gl_plat_cflags"
- cs_gl_plat_lflags="$cs_cv_libm_lflags $cs_gl_plat_lflags"
- cs_gl_plat_libs="$cs_cv_libm_libs $cs_gl_plat_libs"])
- AS_IF([test $cs_cv_sys_pthread = yes],
- [cs_gl_plat_cflags="$cs_cv_sys_pthread_cflags $cs_gl_plat_cflags"
- cs_gl_plat_lflags="$cs_cv_sys_pthread_lflags $cs_gl_plat_lflags"
- cs_gl_plat_libs="$cs_cv_sys_pthread_libs $cs_gl_plat_libs"])
- AS_IF([test "$no_x" != yes],
- [cs_gl_plat_cflags="$X_CFLAGS $cs_gl_plat_cflags"
- cs_gl_plat_lflags="$cs_gl_plat_lflags"
- cs_gl_plat_libs="
- $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS $cs_gl_plat_libs"])
- # Mesa requested?
- AC_ARG_WITH([mesa], [AC_HELP_STRING([--with-mesa],
- [use Mesa OpenGL library if available (default YES)])],
- [], [with_mesa=yes])
- AS_IF([test $with_mesa != no],
- [cs_mesa_gl=CS_CREATE_TUPLE([],[],[-lMesaGL])
- cs_mesa_glu=CS_CREATE_TUPLE([],[],[-lMesaGLU])
- cs_mesa_glx=CS_CREATE_TUPLE([],[],[-lMesaGLX])])
- # MacOS/X or Darwin?
- AS_IF([test "x$cs_host_macosx" = "xyes"],
- [cs_osx_gl=CS_CREATE_TUPLE([-DCS_OPENGL_PATH=OpenGL],[],
- [-framework OpenGL])
- cs_osx_glu=CS_CREATE_TUPLE([-DCS_GLU_PATH=OpenGL],[],[-framework OpenGL])
- cs_osx_glut=CS_CREATE_TUPLE([-DCS_GLUT_PATH=GLUT],[],[-framework GLUT])])
- # Windows?
- case $host_os in
- mingw*|cygwin*)
- cs_win32_gl=CS_CREATE_TUPLE([],[],[-lopengl32])
- cs_win32_glu=CS_CREATE_TUPLE([],[],[-lglu32])
- cs_win32_glut=CS_CREATE_TUPLE([],[],[-lglut32])
- ;;
- esac
- # Check for OpenGL.
- CS_CHECK_BUILD([for OpenGL], [cs_cv_libgl],
- [AC_LANG_PROGRAM([CS_GL_INCLUDE([CS_OPENGL_PATH],[GL],[gl.h])],[glEnd()])],
- [$cs_win32_gl \
- $cs_osx_gl \
- CS_CREATE_TUPLE([],[],[-lGL]) \
- CS_CREATE_TUPLE([],[],[-lgl]) \
- $cs_mesa_gl], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libgl], [GL])], [], [],
- [$cs_gl_plat_cflags], [$cs_gl_plat_lflags], [$cs_gl_plat_libs])
- AS_IF([test $cs_cv_libgl = yes],
- [# Check for GLU.
- CS_CHECK_BUILD([for GLU], [cs_cv_libglu],
- [AC_LANG_PROGRAM(
- [CS_GL_INCLUDE([CS_GLU_PATH],[GL],[glu.h])], [gluNewQuadric()])],
- [$cs_osx_glu \
- CS_CREATE_TUPLE() \
- $cs_win32_glu \
- CS_CREATE_TUPLE([],[],[-lGLU]) \
- CS_CREATE_TUPLE([],[],[-lglu]) \
- $cs_mesa_glu], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libglu], [GLU])], [], [],
- [$cs_cv_libgl_cflags], [$cs_cv_libgl_lflags], [$cs_cv_libgl_libs])
- # Check for GLUT.
- CS_CHECK_BUILD([for GLUT], [cs_cv_libglut],
- [AC_LANG_PROGRAM(
- [CS_GL_INCLUDE([CS_GLUT_PATH],[GL],[glut.h])], [glutSwapBuffers])],
- [$cs_osx_glut \
- CS_CREATE_TUPLE() \
- $cs_win32_glut \
- CS_CREATE_TUPLE([],[],[-lGLUT]) \
- CS_CREATE_TUPLE([],[],[-lglut])], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libglut], [GLUT])], [], [],
- [$cs_cv_libgl_cflags], [$cs_cv_libgl_lflags], [$cs_cv_libgl_libs])
- # Check for GLX.
- CS_CHECK_BUILD([for GLX], [cs_cv_libglx],
- [AC_LANG_PROGRAM([[#include <GL/glx.h>]], [glXWaitGL()])],
- [CS_CREATE_TUPLE() \
- CS_CREATE_TUPLE([],[],[-lGLX]) \
- CS_CREATE_TUPLE([],[],[-lglx]) \
- $cs_mesa_glx], [],
- [CS_EMIT_BUILD_RESULT([cs_cv_libglx], [GLX])], [], [],
- [$cs_cv_libgl_cflags], [$cs_cv_libgl_lflags], [$cs_cv_libgl_libs])
- # Check for GLX extensions. Define CSGL_EXT_STATIC_ASSERTION if _not_
- # present.
- AS_IF([test $cs_cv_libglx = yes],
- [CS_CHECK_BUILD([for GLX extensions], [cs_cv_libglx_extensions],
- [AC_LANG_PROGRAM(
- [[#define GLX_GLXEXT_PROTOTYPES
- #include <GL/glx.h>]],
- [glXGetProcAddressARB(0)])],
- [CS_CREATE_TUPLE(
- [$cs_cv_libglx_cflags],
- [$cs_cv_libglx_lflags],
- [$cs_cv_libglx_libs])],
- [], [], [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.
- #------------------------------------------------------------------------------
- AC_CHECK_TYPE([int32], [AC_DEFINE([HAVE_TYPE_INT32])], [])
- CS_CHECK_BUILD([for DirectX], [cs_cv_libdirectx],
- [AC_LANG_PROGRAM(
- [[#if !HAVE_TYPE_INT32
- typedef long int32;
- #endif
- #include <windows.h>
- #include <ddraw.h>
- #include <dsound.h>
- #include <dinput.h>]],
- [DirectDrawCreate(0,0,0);
- DirectSoundCreate(0,0,0);
- DirectInputCreate(0,0,0,0)])],
- [CS_CREATE_TUPLE([],[],[-lddraw -ldsound -ldinput]) \
- CS_CREATE_TUPLE([-I/usr/include/directx],[],[-lddraw -ldsound -ldinput])],
- [], [CS_EMIT_BUILD_RESULT([cs_cv_libdirectx], [DIRECTX])])
- #------------------------------------------------------------------------------
- # Check for the Windows Multimedia library, used by the 'sndwaveout' plugin.
- #------------------------------------------------------------------------------
- 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])],
- [CS_MSG_ERROR([zlib is essential for building CS.])], [], [], [], [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*.
- #------------------------------------------------------------------------------
- AS_IF([test "$cs_cv_libz" = yes && test "$cs_cv_libjpeg" = yes],
- [CS_CHECK_LIB_WITH([mng],
- [AC_LANG_PROGRAM([[#include <libmng.h>]], [mng_version_release()])],
- [$srcdir/libs/libmng*…
Large files files are truncated, but you can click here to view the full file