configure.ac 4.16 KB
Newer Older
1 2
dnl Autoconf setup

3
AC_INIT([eris], [1.3.23], [erik@ogenvik.org])
4 5 6 7
AC_PREREQ(2.5)
AC_CONFIG_SRCDIR([Eris/Entity.cpp])
AC_CONFIG_HEADERS([config.h])

8 9
AC_CONFIG_MACRO_DIR([m4])

10 11 12 13 14 15
dnl Detect the canonical host environment

AC_CANONICAL_HOST

dnl Automake setup

16 17
AM_INIT_AUTOMAKE([nostdinc dist-bzip2 color-tests parallel-tests no-define silent-rules])
AM_SILENT_RULES([yes])
18 19

dnl versioning info for libtool
20
ERIS_CURRENT=21
21 22 23 24
ERIS_REVISION=0
ERIS_AGE=0

ERIS_REQUIRES=""
25 26 27
ERIS_DEPS=""

LT_INIT([disable-static])
28 29 30 31 32 33 34

AC_PROG_CXX

AC_ARG_ENABLE(debug,
    [  --enable-debug          enable debug information [default=no]],
    [
        if test "$enableval" = "yes"; then
35
            CXXFLAGS="$CXXFLAGS -Wall -Wno-unknown-pragmas -DDEBUG"
36
        else
37
            CXXFLAGS="$CXXFLAGS -Wall -Wno-unknown-pragmas -DNDEBUG"
38 39
        fi
    ],[
40
        CXXFLAGS="$CXXFLAGS -Wall -Wno-unknown-pragmas -DNDEBUG"
41 42 43 44 45 46
    ]
)


dnl Make sure we've got sensible versions of the sources (eg to get snprintf)

47 48 49 50 51
dnl AC_DEFINE(_XOPEN_SOURCE, 500, [This is XOpen source])
dnl AC_DEFINE(_ISOC99_SOURCE,1, [This is C99 source])

AC_LANG_PUSH(C++)

52 53
AX_CXX_COMPILE_STDCXX_11

54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
dnl Check for float to int converters

AC_CHECK_FUNCS([llrint lrintf rintf rint])
AC_CHECK_FUNCS([fabsf])

AC_MSG_CHECKING(for mingw32)
AC_TRY_COMPILE(,[
#ifdef __MINGW32__
#error MingW32 detected, adding -lws2_32 and -lwsock32 to LIBS
#endif
],[
    AC_MSG_RESULT(no)
    have_winsock='no'
],[
    AC_MSG_RESULT(yes)
    have_winsock='yes'
])
AM_CONDITIONAL(HAVE_WINSOCK, test "x$have_winsock" = "xyes")

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93

PKG_PROG_PKG_CONFIG


PKG_CHECK_MODULES(SIGC, sigc++-2.0 != 2.0.8,
    [
        CPPFLAGS="$CPPFLAGS $SIGC_CFLAGS"
        LIBS="$LIBS $SIGC_LIBS"
        ERIS_REQUIRES="$ERIS_REQUIRES sigc++-2.0"
    ],[
        AC_MSG_RESULT([no])
        AC_MSG_ERROR([
Cannot find a valid version of the sigc++ library:
$SIGC_PKG_ERRORS
Perhaps you should add the directory containing the missing libraries to the
PKG_CONFIG_PATH environment variable.
Please see http://libsigc.sourceforge.net/ for details of how to download and
install the library.])
    ]
)
dnl check for all the WorldForge libs we use
94
PKG_CHECK_MODULES(WF, skstream-0.3 >= 0.3.9 atlascpp-0.6 >= 0.6.3 wfmath-1.0 >= 1.0.0 mercator-0.3 >= 0.3.3,
95 96
    [
        CPPFLAGS="$CPPFLAGS $WF_CFLAGS"
97
        ERIS_DEPS="$ERIS_DEPS $WF_LIBS"
98
        ERIS_REQUIRES="$ERIS_REQUIRES skstream-0.3 atlascpp-0.6 wfmath-1.0 mercator-0.3"
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
    ],[
        AC_MSG_RESULT([no])
        AC_MSG_ERROR([
Cannot find valid versions of required WorldForge libraries:
$WF_PKG_ERRORS
Perhaps you should add the directory containing the missing libraries to the
PKG_CONFIG_PATH environment variable.
Please see http://worldforge.org/dev/eng/libraries/eris for details of the
libraries required and where to obtain them.])
    ]
)

AC_LANG_POP(C++)

AC_ARG_ENABLE(perl,
[  --enable-perl         Enable building of Perl bindings
],
[
dnl testing for sigcperl should be sufficient, since that requires
dnl perl and sucks in its CFLAGS and LIBS
	PKG_CHECK_MODULES(SIGCPERL, sigcperl >= 0.2, [
		AC_MSG_CHECKING(for Perl module SigC)
		if (`perl -e "use SigC;"`)
		then
			AC_MSG_RESULT(yes)
			enable_perl='yes'
		else
			AC_MSG_RESULT(no)
			AC_MSG_WARN(SigC module not found, not building perl bindings)
			enable_perl='no'
		fi
	],[
		AC_MSG_RESULT(no)
		AC_MSG_WARN(libsigcperl not found, not building perl bindings)
		enable_perl='no'
	])
])
AM_CONDITIONAL(PERL_BINDINGS, test "x$enable_perl" = "xyes")

PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.0.0,
    [
	have_glib='yes'
    ],
    [
	AM_PATH_GLIB(1.2.0,[
		have_glib='yes'
		],[
		AC_MSG_RESULT([no])
147
		AC_MSG_WARN(Could not find glib, not building glib poll)
148 149 150 151 152 153 154 155 156 157 158
		have_glib='no'
		]
	)
    ])
AM_CONDITIONAL(HAVE_GLIB, test "x$have_glib" = "xyes")

ERIS_LIB_SUFFIX="-1.3"
ERIS_LIBS="-leris$ERIS_LIB_SUFFIX"
ERIS_VERSION_INFO=$ERIS_CURRENT:$ERIS_REVISION:$ERIS_AGE

AC_SUBST(ERIS_LIB_SUFFIX)
159
AC_SUBST(ERIS_DEPS)
160 161 162 163 164 165 166 167 168 169
AC_SUBST(ERIS_LIBS)
AC_SUBST(ERIS_REQUIRES)
AC_SUBST(ERIS_VERSION_INFO)

AC_CONFIG_FILES([
Makefile
Eris/Makefile
bindings/Makefile
bindings/polls/Makefile
bindings/polls/glib/Makefile
170
bindings/polls/winsock/Makefile
171 172 173 174
bindings/perl/compile_flags.pl
test/Makefile
eris.dox
eris.spec
175
mingw32-eris.spec
176 177 178
eris-1.3.pc
])
AC_OUTPUT