Fixes for datatype size on amd64.
[crack-attack.git] / configure.ac
blobc427fba2c51518c69aad5e148820a01d4e7d7bd4
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.59)
3 AC_INIT(crack-attack,1.1.15-cvs,lorien420@myrealbox.com)
4 AC_CONFIG_SRCDIR(src/Attack.cxx)
5 AC_CANONICAL_HOST
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE
9 AM_CONFIG_HEADER(src/config.h)
11 dnl Checks for programs.
12 AC_PROG_CC
13 AC_PROG_CXX
14 AC_PROG_INSTALL
15 AC_PROG_RANLIB
17 dnl Checks for libraries.
18 AC_CHECK_LIB([GL], [glBegin])
19 AC_CHECK_LIB([GLU], [gluLookAt])
20 # I don't know how to check these.
21 # FIXME: Replace `main' with a function in `-lX11':
22 #AC_CHECK_LIB([X11], [main])
23 # FIXME: Replace `main' with a function in `-lXi':
24 #AC_CHECK_LIB([Xi], [main])
25 AC_CHECK_LIB([glut], [glutInit])
27 AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, ,
28 AC_MSG_ERROR([ *** Unable to find SDL_image library with PNG support
29 (http://www.libsdl.org/projects/SDL_image/)]))
31 dnl Checks for header files.
32 AC_HEADER_STDC
33 AC_HEADER_SYS_WAIT
34 AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h string.h sys/socket.h unistd.h sys/types.h stdlib.h])
35 AC_CHECK_HEADER(inttypes.h, break, echo "Must have inttypes.h for enet. Exiting..."; exit)
37 dnl enet checks
38 AC_CHECK_MEMBER(
39   struct msghdr.msg_flags,
40   AC_DEFINE([HAS_MSGHDR_FLAGS], [], [has msghdr flags]),
41   [],
42   [sys/socket.h])
44 AC_CHECK_TYPE(socklen_t, [AC_DEFINE([HAS_SOCKLEN_T], [], [has socklen t])], ,
45               #include <sys/types.h>
46               #include <sys/socket.h>
50 dnl BinReloc source additions
51 AM_BINRELOC
52 AM_CONDITIONAL([WANT_BINRELOC], [test "$br_cv_binreloc" = "yes"])
54 dnl Check for gtk
55 AC_ARG_ENABLE(gtk,
56   AC_HELP_STRING([--enable-gtk=[yes/no]],[Use gtk front-end [default=yes]]),
57   enable_gtk="$enableval",
58   enable_gtk=yes)
59 if test "$enable_gtk" = "yes"; then
60   pkg_modules="gtk+-2.0 >= 2.6.0"
61   PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
62   AC_DEFINE([WANT_GTK], [], [Wants to compile gtk front-end])
63 else
64   PACKAGE_CFLAGS=""
65   PACKAGE_LIBS=""
67 AC_SUBST(PACKAGE_CFLAGS)
68 AC_SUBST(PACKAGE_LIBS)
69 AM_CONDITIONAL([WANT_GTK], [test "$enable_gtk" = yes])
71 dnl Check for sound support
72 AC_ARG_ENABLE(sound,
73   AC_HELP_STRING([--enable-sound=[yes/no]],
74     [Play sounds and music during game [default=no]]),
75   enable_sound="$enableval",
76   enable_sound="no")
77 AUDIO_CFLAGS=""
78 AUDIO_LIBS=""
79 if test "$enable_sound" != "no"; then
80   found_sound="no"
81   AM_PATH_SDL(1.2.0,
82     [
83       AC_CHECK_LIB([SDL_mixer],
84         [Mix_OpenAudio],
85         [found_sound=yes],
86         [found_sound=no]
87       )
88     ],[found_sound=no]
89   )
91   if test "$enable_sound" == "yes" -a "$found_sound" == "no"; then
92     AC_MSG_ERROR(libSDL and SDL_mixer are required for sound)
93   fi
94   if test "$found_sound" == "yes"; then
95     AUDIO_CFLAGS="$SDL_CFLAGS"
96     AUDIO_LIBS="$SDL_LIBS -lSDL_mixer"
97     AC_DEFINE(AUDIO_ENABLED, 1, [Has audio support])
98   fi
100 AC_SUBST(AUDIO_CFLAGS)
101 AC_SUBST(AUDIO_LIBS)
102 AM_CONDITIONAL([AUDIO_ENABLED], [test "$found_sound" = "yes"])
105 dnl Check for debugging
106 AC_ARG_ENABLE(debug,
107   AC_HELP_STRING([--enable-debug=[no/yes]],[Compile extra debugging info [default=no]]),
108   enable_debug="$enableval",
109   enable_debug=no)
110 if test "$enable_debug" = "yes"; then
111   DEBUG_INCLUDES=-DDEVELOPMENT
112   DEBUG_CFLAGS="-g3 -ggdb3 -Wall -pedantic"
113 else
114   DEBUG_INCLUDES=-DNDEBUG
115   DEBUG_CFLAGS=
117 AC_SUBST(DEBUG_INCLUDES)
118 AC_SUBST(DEBUG_CFLAGS)
120 # Suggested by davyd, borrowed from Nautilus
121 AC_ARG_ENABLE(more-warnings,
122 [  --enable-more-warnings  Maximum compiler warnings],
123 set_more_warnings="$enableval",[
124     set_more_warnings=no
126 AC_MSG_CHECKING(for more warnings, including -Werror)
127 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
128     AC_MSG_RESULT(yes)
129     CXXFLAGS="\
130     -Wall -Werror \
131     -Wchar-subscripts \
132     -Wpointer-arith \
133     -Wcast-align -Wsign-compare \
134     $CXXFLAGS"
136     for option in -Wno-strict-aliasing -Wno-sign-compare; do
137         SAVE_CXXFLAGS="$CXXFLAGS"
138         CXXFLAGS="$CXXFLAGS $option"
139         AC_MSG_CHECKING([whether gcc understands $option])
140         AC_TRY_COMPILE([], [],
141             has_option=yes,
142             has_option=no,)
143         if test $has_option = no; then
144             CXXFLAGS="$SAVE_CXXFLAGS"
145         fi
146         AC_MSG_RESULT($has_option)
147         unset has_option
148         unset SAVE_CXXFLAGS
149     done
150     unset option
151 else
152     AC_MSG_RESULT(no)
155 dnl Checks for typedefs, structures, and compiler characteristics.
156 AC_HEADER_STDBOOL
157 AC_C_CONST
158 AC_C_INLINE
159 AC_TYPE_PID_T
161 AC_PATH_XTRA
163 dnl Checks for library functions.
164 AC_FUNC_FORK
165 AC_FUNC_MEMCMP
166 AC_FUNC_STAT
167 AC_CHECK_FUNCS([atexit gethostbyname gethostbyname_r gethostbyaddr_r fcntl inet_ntoa mkdir pow socket sqrt strchr strcspn strstr poll])
169 AC_CONFIG_FILES(
170   Makefile
171   src/Makefile
172   src/gtk-gui/Makefile
173   data/Makefile
174   data/models/Makefile
175   doc/Makefile
176   autopackage/default.apspec
177   enet/Makefile
178   enet/include/Makefile
179   enet/include/enet/Makefile)
181 AC_OUTPUT