2011-05-23 17:18:52 +10:00
|
|
|
AC_INIT([libgim], [0.1.0], [danny@nerdcruft.net])
|
2012-04-27 17:54:26 +10:00
|
|
|
## Explicitly set an empty CXXFLAGS if not present to prevent AC_PROG_CXX from
|
|
|
|
## generating a default -O2. This allows us to manually select -O0 when
|
|
|
|
## debugging is enabled.
|
|
|
|
: ${CXXFLAGS=""}
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-06-25 11:55:24 +10:00
|
|
|
AC_CANONICAL_HOST
|
2011-05-23 17:18:52 +10:00
|
|
|
|
|
|
|
AC_PROG_CXX
|
|
|
|
AC_LANG([C++])
|
2012-04-24 12:59:13 +10:00
|
|
|
LT_INIT
|
2011-05-23 17:18:52 +10:00
|
|
|
AM_PROG_CC_C_O
|
|
|
|
|
2013-02-27 15:11:51 +11:00
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
2011-05-23 17:18:52 +10:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2012-04-24 13:00:31 +10:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-07-03 15:54:00 +10:00
|
|
|
AM_INIT_AUTOMAKE([1.11 silent-rules])
|
2012-04-24 13:00:31 +10:00
|
|
|
AM_SILENT_RULES([yes])
|
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-06-30 21:45:02 +10:00
|
|
|
AC_ARG_ENABLE([debugging],
|
|
|
|
[AS_HELP_STRING([--enable-debugging],
|
|
|
|
[enables developer debugging support])],
|
|
|
|
[ case "${enableval}" in
|
2011-07-04 16:19:07 +10:00
|
|
|
yes) ac_cv_debugging=yes ;;
|
|
|
|
no) ac_cv_debugging=no ;;
|
2011-06-30 21:45:02 +10:00
|
|
|
*) AC_MSG_ERROR([bad value for --enable-debugging=[yes|no]]) ;;
|
|
|
|
esac ],
|
2011-07-04 16:19:07 +10:00
|
|
|
[ac_cv_debugging=no])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-07-12 20:55:01 +10:00
|
|
|
AC_ARG_ENABLE([mudflap],
|
|
|
|
[AS_HELP_STRING([--enable-mudflap],
|
|
|
|
[enable mudflap runtime debugging])],
|
|
|
|
[ case "${enableval}" in
|
|
|
|
yes) ac_cv_mudflap=yes ;;
|
|
|
|
no) ac_cv_mudflap=no ;;
|
|
|
|
*) AC_MSG_ERROR([bad value for --enable-mudflap[yes|no]]) ;;
|
|
|
|
esac ],
|
|
|
|
[ac_cv_mudflap=no])
|
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
##
|
|
|
|
## Warnings
|
|
|
|
WARNING_FLAGS=""
|
|
|
|
|
2011-06-30 20:31:54 +10:00
|
|
|
AS_CXX_COMPILER_FLAG([-Wall], [WARNING_FLAGS="$WARNING_FLAGS -Wall"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wextra], [WARNING_FLAGS="$WARNING_FLAGS -Wextra"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wno-parentheses], [WARNING_FLAGS="$WARNING_FLAGS -Wno-parentheses"])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-06-30 20:31:54 +10:00
|
|
|
AS_CXX_COMPILER_FLAG([-Wpointer-arith], [WARNING_FLAGS="$WARNING_FLAGS -Wpointer-arith"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wcast-qual], [WARNING_FLAGS="$WARNING_FLAGS -Wcast-qual"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wcast-align], [WARNING_FLAGS="$WARNING_FLAGS -Wcast-align"])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-06-30 20:31:54 +10:00
|
|
|
AS_CXX_COMPILER_FLAG([-Wsign-compare], [WARNING_FLAGS="$WARNING_FLAGS -Wsign-compare"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wsign-conversion], [WARNING_FLAGS="$WARNING_FLAGS -Wsign-conversion"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wtype-limits], [WARNING_FLAGS="$WARNING_FLAGS -Wtype-limits"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wfloat-equal], [WARNING_FLAGS="$WARNING_FLAGS -Wfloat-equal"])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2013-02-27 15:11:05 +11:00
|
|
|
AS_CXX_COMPILER_FLAG([-Wswitch-default], [COMMON_CFLAGS="$COMMON_CFLAGS -Wswitch-default"])
|
|
|
|
#AS_CXX_COMPILER_FLAG([-Wswitch-enum], [COMMON_CFLAGS="$COMMON_CFLAGS -Wswitch-enum"])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2012-05-26 17:58:36 +10:00
|
|
|
#AS_CXX_COMPILER_FLAG([-Wzero-as-null-pointer-constant], [WARNING_FLAGS="$WARNING_FLAGS -Wzero-as-null-pointer-constant"])
|
|
|
|
|
2011-06-30 20:31:54 +10:00
|
|
|
AS_CXX_COMPILER_FLAG([-Wunused-parameter], [WARNING_FLAGS="$WARNING_FLAGS -Wunused-parameter"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wunused-but-set-variable], [WARNING_FLAGS="$WARNING_FLAGS -Wunused-parameter"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wshadow], [WARNING_FLAGS="$WARNING_FLAGS -Wshadow"])
|
|
|
|
AS_CXX_COMPILER_FLAG([-Wredundant-decls], [WARNING_FLAGS="$WARNING_FLAGS -Wredundant-decls"])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2011-06-30 20:31:54 +10:00
|
|
|
AS_CXX_COMPILER_FLAG([-pedantic], [COMMON_CFLAGS="$COMMON_CFLAGS -pedantic"])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
|
|
|
##
|
|
|
|
## Compilation
|
2011-06-30 20:31:54 +10:00
|
|
|
AS_CXX_COMPILER_FLAG([-fno-common ], [COMMON_CFLAGS="$COMMON_CFLAGS -fno-common "])
|
|
|
|
AS_CXX_COMPILER_FLAG([-fno-nonansi-builtins],
|
2011-05-23 17:18:52 +10:00
|
|
|
[COMMON_CFLAGS="$COMMON_CFLAGS -fno-nonansi-builtins"])
|
2012-05-23 17:01:30 +10:00
|
|
|
##AS_CXX_COMPILER_FLAG([-fno-rtti], [COMMON_CFLAGS="$COMMON_CFLAGS -fno-rtti"])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2012-06-13 14:42:57 +10:00
|
|
|
AS_CXX_COMPILER_FLAG([-fno-deduce-init-list], [COMMON_CFLAGS="$COMMON_CFLAGS -fno-deduce-init-list "])
|
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
|
|
|
|
##
|
|
|
|
## Compiler features
|
|
|
|
AC_C_CONST
|
|
|
|
AC_C_RESTRICT
|
|
|
|
AC_C_INLINE
|
|
|
|
|
2011-06-21 23:36:51 +10:00
|
|
|
##
|
|
|
|
## Architecture features
|
|
|
|
AC_C_BIGENDIAN
|
|
|
|
|
2011-07-04 16:17:50 +10:00
|
|
|
##
|
|
|
|
## Useful headers or platform features
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_SSIZE_T
|
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
##
|
2011-06-25 12:40:57 +10:00
|
|
|
## platform features
|
2012-05-14 16:10:11 +10:00
|
|
|
#AC_DEFINE([_GNU_SOURCE], [], [Description])
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2012-05-08 15:00:48 +10:00
|
|
|
case $host_os in
|
|
|
|
mingw32)
|
2012-05-10 16:53:29 +10:00
|
|
|
AM_CONDITIONAL([PLATFORM_WIN32], [true])
|
|
|
|
AM_CONDITIONAL([PLATFORM_LINUX], [false])
|
2012-08-07 18:33:44 +10:00
|
|
|
|
|
|
|
AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
|
|
|
|
AC_SUBST([NET_LIBS], [-lws2_32])
|
|
|
|
|
2012-05-15 16:06:18 +10:00
|
|
|
#COMMON_LDFLAGS="$COMMON_LDFLAGS -ldbghelp"
|
2012-05-08 15:00:48 +10:00
|
|
|
;;
|
|
|
|
|
|
|
|
linux-gnu)
|
2012-05-10 16:53:29 +10:00
|
|
|
AM_CONDITIONAL([PLATFORM_WIN32], [false])
|
|
|
|
AM_CONDITIONAL([PLATFORM_LINUX], [true])
|
2012-05-08 15:00:48 +10:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
AC_ERROR([Unknown host_os])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2011-07-04 16:17:12 +10:00
|
|
|
AC_FUNC_MMAP
|
2011-06-25 12:40:57 +10:00
|
|
|
|
2013-02-26 17:50:56 +11:00
|
|
|
AC_CHECK_FUNC([strndup], [
|
|
|
|
AC_DEFINE([HAVE_STRNDUP], [], [strndup appears to be present])
|
|
|
|
])
|
|
|
|
|
2011-07-04 16:17:12 +10:00
|
|
|
AC_CHECK_HEADER([execinfo.h], [break])
|
2011-06-25 12:40:57 +10:00
|
|
|
AM_CONDITIONAL([HAVE_EXECINFO], [test x$ac_cv_header_execinfo_h = "xyes"])
|
|
|
|
|
2011-11-04 17:28:04 +11:00
|
|
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
|
|
|
if [[ "x$ac_cv_search_clock_gettime" == "x-*" ]]; then
|
|
|
|
COMMON_LDFLAGS="$COMMON_LDFLAGS $ac_cv_search_clock_gettime"
|
|
|
|
fi
|
2012-05-08 15:00:48 +10:00
|
|
|
|
2011-07-04 16:17:12 +10:00
|
|
|
|
2011-06-30 21:45:02 +10:00
|
|
|
##
|
|
|
|
## Debug features
|
2011-07-04 16:19:07 +10:00
|
|
|
if test "x$ac_cv_debugging" = "xyes"; then
|
2012-05-14 16:10:11 +10:00
|
|
|
COMMON_CFLAGS="$COMMON_CFLAGS -O0"
|
2011-07-04 16:19:07 +10:00
|
|
|
|
2011-07-12 20:55:01 +10:00
|
|
|
if test "x$ac_cv_mudflap" = "xyes"; then
|
|
|
|
AS_CXX_COMPILER_FLAG([-fmudflapth], [
|
|
|
|
COMMON_CFLAGS="$COMMON_CFLAGS -fmudflapth";
|
|
|
|
COMMON_LDFLAGS="$COMMON_LDFLAGS -lmudflapth"
|
|
|
|
])
|
|
|
|
fi
|
2011-07-04 16:19:07 +10:00
|
|
|
|
2012-05-14 16:10:11 +10:00
|
|
|
AC_DEFINE([ENABLE_DEBUGGING], [], [Description])
|
|
|
|
AC_DEFINE([_FORTIFY_SOURCE], [2], [Description])
|
|
|
|
AC_DEFINE([_GLIBCXX_DEBUG], [], [Description])
|
|
|
|
|
2011-07-12 20:55:01 +10:00
|
|
|
else
|
2012-06-18 16:12:09 +10:00
|
|
|
## Use 'none' LTO partitioning to avoid discarded section linker errors
|
|
|
|
## against boost
|
|
|
|
COMMON_CFLAGS="$COMMON_CFLAGS -O2 -flto=8 -flto-partition=none"
|
|
|
|
COMMON_LDFLAGS="$COMMON_LDFLAGS -flto=8 -flto-partition=none"
|
2011-06-30 21:45:02 +10:00
|
|
|
fi
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2012-05-10 16:56:25 +10:00
|
|
|
case $host_os in
|
|
|
|
mingw32)
|
|
|
|
COMMON_CFLAGS="$COMMON_CFLAGS -gstabs"
|
|
|
|
;;
|
|
|
|
|
|
|
|
linux-gnu)
|
|
|
|
COMMON_CFLAGS="$COMMON_CFLAGS -g"
|
|
|
|
AS_CXX_COMPILER_FLAG([-ggdb], [COMMON_CFLAGS="$COMMON_CFLAGS -ggdb"])
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
AC_ERROR([Unknown host_os])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-05-10 16:55:38 +10:00
|
|
|
case $host_cpu in
|
|
|
|
x86_64)
|
2012-05-15 16:07:03 +10:00
|
|
|
OPTIMISATION_FLAGS="$OPTIMISATION_FLAGS -mtune=generic"
|
2012-05-10 16:55:38 +10:00
|
|
|
;;
|
|
|
|
|
|
|
|
i686)
|
2012-05-15 16:07:03 +10:00
|
|
|
OPTIMISATION_FLAGS="$OPTIMISATION_FLAGS -march=prescott -mtune=generic -mfpmath=sse"
|
2012-05-10 16:55:38 +10:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
AC_MSG_ERROR([Unknown target CPU])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
##
|
|
|
|
## Documentation
|
|
|
|
|
|
|
|
##
|
|
|
|
## Required packages
|
2012-07-30 16:33:55 +10:00
|
|
|
CHECK_RAGEL([ip.cpp])
|
2011-06-30 20:33:55 +10:00
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2012-05-17 14:15:47 +10:00
|
|
|
AX_BOOST_BASE([1.49], [], [AC_MSG_ERROR([Boost version >= 1.42 required])])
|
2011-07-05 21:34:44 +10:00
|
|
|
AC_SUBST(BOOST_CPPFLAGS)
|
|
|
|
AC_SUBST(BOOST_LDFLAGS)
|
|
|
|
|
2011-09-25 14:25:24 +10:00
|
|
|
# boost-system isn't a hard requirement, it's only really used to fulfill
|
|
|
|
# some other dependency I've since forgotten about...
|
|
|
|
AX_BOOST_SYSTEM
|
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
AX_BOOST_FILESYSTEM
|
2011-07-05 21:34:44 +10:00
|
|
|
AC_SUBST(BOOST_FILESYSTEM_LIB)
|
|
|
|
|
2011-06-30 20:34:24 +10:00
|
|
|
if test "x$ax_cv_boost_filesystem" != "xyes"; then
|
|
|
|
AC_MSG_ERROR("boost-filesystem is a hard requirement")
|
|
|
|
fi
|
|
|
|
|
2011-05-23 17:18:52 +10:00
|
|
|
## Optional packages
|
|
|
|
|
|
|
|
## Output
|
|
|
|
|
2012-06-13 14:42:57 +10:00
|
|
|
COMMON_CXXFLAGS="-std=c++0x -pipe -include config.h $WARNING_FLAGS $OPTIMISATION_FLAGS $COMMON_CFLAGS"
|
2011-06-30 21:45:02 +10:00
|
|
|
COMMON_LDFLAGS="$COMMON_LDFLAGS "
|
2011-05-23 17:18:52 +10:00
|
|
|
|
|
|
|
AC_SUBST(COMMON_CXXFLAGS)
|
2011-06-30 21:45:02 +10:00
|
|
|
AC_SUBST(COMMON_LDFLAGS)
|
2011-05-23 17:18:52 +10:00
|
|
|
|
2012-04-24 12:59:13 +10:00
|
|
|
AC_CONFIG_FILES([
|
2011-05-23 17:18:52 +10:00
|
|
|
Doxyfile
|
|
|
|
Makefile
|
|
|
|
test/Makefile
|
|
|
|
])
|
2012-04-24 12:59:13 +10:00
|
|
|
AC_OUTPUT
|