Development back on the trunk!
[crack-attack.git] / configure.ac
blobb1a70d13c924fdcc13bf0edcae7645a3a84a6326
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 # FIXME: Replace `main' with a function in `-lGL':
19 AC_CHECK_LIB([GL], [glBegin])
20 # FIXME: Replace `main' with a function in `-lGLU':
21 AC_CHECK_LIB([GLU], [gluLookAt])
22 # I don't know how to check these.
23 # FIXME: Replace `main' with a function in `-lX11':
24 #AC_CHECK_LIB([X11], [main])
25 # FIXME: Replace `main' with a function in `-lXi':
26 #AC_CHECK_LIB([Xi], [main])
27 # FIXME: Replace `main' with a function in `-lXmu':
28 #AC_CHECK_LIB([Xmu], [main])
29 # FIXME: Replace `main' with a function in `-lglut':
30 AC_CHECK_LIB([glut], [glutInit])
33 dnl Checks for header files.
34 AC_HEADER_STDC
35 AC_HEADER_SYS_WAIT
36 AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h string.h sys/socket.h unistd.h sys/types.h stdlib.h])
37 AC_CHECK_HEADER(inttypes.h, break, echo "Must have inttypes.h for enet. Exiting..."; exit)
39 dnl enet checks
40 AC_CHECK_MEMBER(
41   struct msghdr.msg_flags, 
42   AC_DEFINE([HAS_MSGHDR_FLAGS], [], [has msghdr flags]),
43   [],
44   [sys/socket.h])
46 dnl BinReloc source additions
47 AM_BINRELOC
48 AM_CONDITIONAL([WANT_BINRELOC], [test "$br_cv_binreloc" = "yes"])
50 dnl Check for gtk
51 AC_ARG_ENABLE(gtk,
52   AC_HELP_STRING([--enable-gtk=[yes/no]],[Use gtk front-end [default=yes]]),
53   enable_gtk="$enableval",
54   enable_gtk=yes)
55 if test "$enable_gtk" = "yes"; then
56   pkg_modules="gtk+-2.0 >= 2.6.0"
57   PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
58   AC_DEFINE([WANT_GTK], [], [Wants to compile gtk front-end])
59 else
60   PACKAGE_CFLAGS=""
61   PACKAGE_LIBS=""
63 AC_SUBST(PACKAGE_CFLAGS)
64 AC_SUBST(PACKAGE_LIBS)
65 AM_CONDITIONAL([WANT_GTK], [test "$enable_gtk" = yes])
67 dnl Check for sound support
68 AC_ARG_ENABLE(sound,
69   AC_HELP_STRING([--enable-sound=[yes/no]],
70     [Play sounds and music during game [default=no]]),
71   enable_sound="$enableval",
72   enable_sound="no")
73 AUDIO_CFLAGS=""
74 AUDIO_LIBS=""
75 if test "$enable_sound" != "no"; then
76   found_sound="no"
77   AM_PATH_SDL(1.2.0,
78     [
79       AC_CHECK_LIB([SDL_mixer],
80         [Mix_OpenAudio],
81         [found_sound=yes],
82         [found_sound=no]
83       )
84     ],[found_sound=no]
85   )
87   if test "$enable_sound" == "yes" -a "$found_sound" == "no"; then
88     AC_MSG_ERROR(libSDL and SDL_mixer are required for sound)
89   fi
90   if test "$found_sound" == "yes"; then
91     AUDIO_CFLAGS="$SDL_CFLAGS"
92     AUDIO_LIBS="$SDL_LIBS -lSDL_mixer"
93     AC_DEFINE(AUDIO_ENABLED, 1, [Has audio support])
94   fi
96 AC_SUBST(AUDIO_CFLAGS)
97 AC_SUBST(AUDIO_LIBS)
98 AM_CONDITIONAL([AUDIO_ENABLED], [test "$found_sound" = "yes"])
101 dnl Check for debugging
102 AC_ARG_ENABLE(debug,
103   AC_HELP_STRING([--enable-debug=[no/yes]],[Compile extra debugging info [default=no]]),
104   enable_debug="$enableval",
105   enable_debug=no)
106 if test "$enable_debug" = "yes"; then
107   DEBUG_INCLUDES=-DDEVELOPMENT
108   DEBUG_CFLAGS="-g3 -ggdb3 -Wall -pedantic"
109 else
110   DEBUG_INCLUDES=-DNDEBUG
111   DEBUG_CFLAGS=
113 AC_SUBST(DEBUG_INCLUDES)
114 AC_SUBST(DEBUG_CFLAGS)
116 # Suggested by davyd, borrowed from Nautilus
117 AC_ARG_ENABLE(more-warnings,
118 [  --enable-more-warnings  Maximum compiler warnings],
119 set_more_warnings="$enableval",[
120     set_more_warnings=no
122 AC_MSG_CHECKING(for more warnings, including -Werror)
123 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
124     AC_MSG_RESULT(yes)
125     CXXFLAGS="\
126     -Wall -Werror \
127     -Wchar-subscripts \
128     -Wpointer-arith \
129     -Wcast-align -Wsign-compare \
130     $CXXFLAGS"
132     for option in -Wno-strict-aliasing -Wno-sign-compare; do
133         SAVE_CXXFLAGS="$CXXFLAGS"
134         CXXFLAGS="$CXXFLAGS $option"
135         AC_MSG_CHECKING([whether gcc understands $option])
136         AC_TRY_COMPILE([], [],
137             has_option=yes,
138             has_option=no,)
139         if test $has_option = no; then
140             CXXFLAGS="$SAVE_CXXFLAGS"
141         fi
142         AC_MSG_RESULT($has_option)
143         unset has_option
144         unset SAVE_CXXFLAGS
145     done
146     unset option
147 else
148     AC_MSG_RESULT(no)
151 dnl Checks for typedefs, structures, and compiler characteristics.
152 AC_HEADER_STDBOOL
153 AC_C_CONST
154 AC_C_INLINE
155 AC_TYPE_PID_T
157 AC_PATH_XTRA
159 dnl Checks for library functions.
160 AC_FUNC_FORK
161 AC_FUNC_MEMCMP
162 AC_FUNC_STAT
163 AC_CHECK_FUNCS([atexit gethostbyname gethostbyname_r gethostbyaddr_r fcntl inet_ntoa mkdir pow socket sqrt strchr strcspn strstr poll])
165 AC_CONFIG_FILES(
166   Makefile 
167   src/Makefile 
168   src/gtk-gui/Makefile
169   data/Makefile 
170   doc/Makefile
171   autopackage/default.apspec
172   enet/Makefile
173   enet/include/Makefile
174   enet/include/enet/Makefile)
176 AC_OUTPUT