autotools: Update for recent autoconf and autoconf macro archive versions

Günther Brammer 2011-08-10 01:13:23 +02:00
parent c43611bf37
commit 43cde4b1ea
6 changed files with 134 additions and 88 deletions

View File

@ -1,3 +1,6 @@
# Copyright (c) 2005-2011 Günther Brammer
# Copyright (c) 2009 Armin Burgmeier
# Copyright (c) 2010-2011 Nicolas Hake
# Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de
# Permission to use, copy, modify, and/or distribute this software for any

View File

@ -33,7 +33,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 17
#serial 20
AC_DEFUN([AX_BOOST_BASE],
[
@ -59,7 +59,7 @@ AC_ARG_WITH([boost],
AC_ARG_WITH([boost-libdir],
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
[
if test -d "$withval"
then
@ -84,13 +84,14 @@ if test "x$want_boost" = "xyes"; then
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
succeeded=no
dnl On x86_64 systems check for system libraries in both lib64 and lib.
dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed!
libsubdirs="lib"
if test `uname -m` = x86_64; then
ax_arch=`uname -m`
if test $ax_arch = x86_64 -o $ax_arch = ppc64 -o $ax_arch = s390x -o $ax_arch = sparc64; then
libsubdirs="lib64 lib lib64"
fi
@ -98,8 +99,13 @@ if test "x$want_boost" = "xyes"; then
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_path/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path/include"
for ac_boost_path_tmp in $libsubdirs; do
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
break
fi
done
elif test "$cross_compiling" != yes; then
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then

View File

@ -1,24 +1,31 @@
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_check_compiler_flags.html
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# Check whether the given compiler FLAGS work with the current language's
# compiler, or whether they give an error. (Warnings, however, are
# ignored.)
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2009 Matteo Frigo
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@ -46,29 +53,20 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
AS_LITERAL_IF([$1],
[AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [
ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
_AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
[ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
_AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])
AC_MSG_RESULT($ax_check_compiler_flags)
if test "x$ax_check_compiler_flags" = xyes; then
m4_default([$2], :)
else
m4_default([$3], :)
fi
])dnl AX_CHECK_COMPILER_FLAGS
#serial 2
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS

View File

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.nongnu.org/autoconf-archive/ax_pthread.html
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
@ -33,6 +33,10 @@
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
@ -45,9 +49,12 @@
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@ -75,11 +82,12 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 14
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
@ -150,6 +158,10 @@ case "${host_cpu}-${host_os}" in
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
*-darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
if test x"$ax_pthread_ok" = xno; then
@ -165,12 +177,12 @@ for flag in $ax_pthread_flags; do
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
@ -192,11 +204,17 @@ for flag in $ax_pthread_flags; do
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[ax_pthread_ok=yes])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
@ -219,12 +237,14 @@ if test "x$ax_pthread_ok" = xyes; then
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
[attr_name=$attr; break])
done
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
@ -243,15 +263,25 @@ if test "x$ax_pthread_ok" = xyes; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE(
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]]),
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
if test x"$GCC" != xyes; then
if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
fi
fi
else
PTHREAD_CC="$CC"
fi
@ -268,5 +298,5 @@ else
ax_pthread_ok=no
$2
fi
AC_LANG_RESTORE
AC_LANG_POP
])dnl AX_PTHREAD

View File

@ -51,6 +51,9 @@
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1 if you have the <readline.h> header file. */
#undef HAVE_READLINE_H

View File

@ -1,21 +1,27 @@
dnl Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de
dnl Permission to use, copy, modify, and/or distribute this software for any
dnl purpose with or without fee is hereby granted, provided that the above
dnl copyright notice and this permission notice appear in all copies.
dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(clonk, 5)
AC_COPYRIGHT([©2005-2010 Günther Brammer])
# Copyright (c) 2005-2011 Günther Brammer
# Copyright (c) 2005, 2008 Peter Wortmann
# Copyright (c) 2006 Julian Raschke
# Copyright (c) 2010 Armin Burgmeier
# Copyright (c) 2010 Mortimer
# Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_PREREQ([2.67])
AC_INIT([clonk], [5])
AC_COPYRIGHT([©2005-2011 Günther Brammer])
AC_CONFIG_SRCDIR([/src/C4Game.cpp])
AC_CONFIG_AUX_DIR([autotools])
AC_CONFIG_HEADER([config.h])
@ -29,7 +35,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PROG_CXX
AC_LANG([C++])
AX_CHECK_COMPILER_FLAGS([-std=gnu++0x], [CXX="${CXX} -std=gnu++0x"])
AX_CHECK_COMPILE_FLAG([-std=gnu++0x], [CXX="${CXX} -std=gnu++0x"], [])
AC_COMPILE_IFELSE([
void f(struct D&&); int main() { return 0; }
], [AC_DEFINE([HAVE_RVALUE_REF], [], [C++ Compiler has rvalue references, a C++0x feature.])], [AX_PROG_CXX_REFTOTEMP])
@ -79,7 +85,7 @@ if test "x$ac_cv_header_execinfo_h" = xyes; then
fi
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--enable-debug], [debugging options [default=no]])],
[AS_HELP_STRING([--enable-debug],[debugging options [default=no]])],
, [enable_debug=no])
if test $enable_debug = yes; then
AC_DEFINE([_DEBUG], 1, [compile with debug options])
@ -88,18 +94,18 @@ else
fi
AC_ARG_ENABLE([debugrec],
[AC_HELP_STRING([--enable-debugrec], [write additional debug control to records [default=no]])],
[AS_HELP_STRING([--enable-debugrec],[write additional debug control to records [default=no]])],
, [enable_debugrec=no])
if test $enable_debugrec = yes; then
AC_DEFINE([DEBUGREC], 1, [Activate DebugRecs])
fi
AC_ARG_ENABLE([console],
[AC_HELP_STRING([--enable-console],[compile as pure console application [default=no]])],
[AS_HELP_STRING([--enable-console],[compile as pure console application [default=no]])],
, [enable_console=no])
AC_ARG_ENABLE([sound],
[AC_HELP_STRING([--enable-sound],[compile with sound support [default=yes]])],
[AS_HELP_STRING([--enable-sound],[compile with sound support [default=yes]])],
, [if test $enable_console = yes; then enable_sound=no; else if test $win32 = true; then enable_sound=no; else enable_sound=yes; fi; fi])
# GTK+
@ -137,7 +143,7 @@ AM_CONDITIONAL(DEVELOPER_MODE, [test $with_gtk != no])
# OpenAL
AC_ARG_WITH([openal],
[AC_HELP_STRING([--with-openal],[compile with openal support [default=no]])],
[AS_HELP_STRING([--with-openal],[compile with openal support [default=no]])],
, [with_openal=no])
if test $with_openal = yes; then
PKG_CHECK_MODULES(OPENAL, [vorbis vorbisfile openal])
@ -170,7 +176,7 @@ if test $with_sdl = yes; then
[$SDL_LIBS])
fi
AC_ARG_ENABLE(sdlmainloop,
[AC_HELP_STRING([--enable-sdlmainloop],[use SDL instead of X11 or Win32 [default=no]])],
[AS_HELP_STRING([--enable-sdlmainloop],[use SDL instead of X11 or Win32 [default=no]])],
, [if test $osx = true; then enable_sdlmainloop=yes; else enable_sdlmainloop=no; fi ])
else
enable_sdlmainloop=no
@ -183,7 +189,7 @@ AM_CONDITIONAL(SDL_MAIN_LOOP, [test $enable_sdlmainloop = yes])
if test $enable_sound = yes; then
AC_ARG_ENABLE([mp3],
[AC_HELP_STRING([--enable-mp3],[enable mp3 support [default=no]])],
[AS_HELP_STRING([--enable-mp3],[enable mp3 support [default=no]])],
, [enable_mp3=no])
if test $enable_mp3 = yes; then
AC_DEFINE([USE_MP3], 1, [MP3 music])
@ -265,7 +271,7 @@ fi
# OpenGL
AC_ARG_WITH([gl],
[AC_HELP_STRING([--with-gl],[compile with opengl support [default=yes]])],
[AS_HELP_STRING([--with-gl],[compile with opengl support [default=yes]])],
, [if test $enable_console = yes; then with_gl=no; else with_gl=yes; fi])
if test $with_gl = yes; then
if test $osx = true; then
@ -293,7 +299,7 @@ fi
# DirectX
AC_ARG_WITH([directx],
[AC_HELP_STRING([--with-directx],[compile with directx support [default=no]])],
[AS_HELP_STRING([--with-directx],[compile with directx support [default=no]])],
, [with_directx="no"])
if test "$with_directx" = yes; then
AC_CHECK_LIB(d3d9, main, [CLONK_LIBS="-ld3d9 $CLONK_LIBS"],
@ -302,7 +308,7 @@ if test "$with_directx" = yes; then
fi
AC_ARG_WITH([automatic-update],
[AC_HELP_STRING([--with-automatic-update],[enable support for automatic engine updates [default=yes]])],
[AS_HELP_STRING([--with-automatic-update],[enable support for automatic engine updates [default=yes]])],
, [with_automatic_update="yes"])
if test "$with_automatic_update" = "yes"; then
AC_DEFINE([WITH_AUTOMATIC_UPDATE], 1, [Enable automatic update system])