git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d.git] / configure.ac
blob8de9885df1112aa6534e36ff445d4f39dcbe8060
1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(README)
4 AC_CANONICAL_TARGET([]) 
6 dnl Setup for automake
7 AM_INIT_AUTOMAKE(scorched3d, 41)
9 dnl Check for tools
10 AC_PROG_MAKE_SET
11 AC_PROG_CC
12 AC_PROG_CXX
13 AC_PROG_INSTALL
14 AC_PROG_RANLIB
16 LDFLAGS="-L/usr/X11R6/lib -L/usr/X11R6"
17 CPPFLAGS="-I/usr/X11R6/include -I/usr/X11R6"
19 if test `uname` == Darwin; then
20 LDFLAGS="$LDFLAGS -lmx"
21 CPPFLAGS="$CPPFLAGS -DFFTW_USE_DOUBLE -D__DARWIN__ -D__MACOSX__"
22 else
23 LDFLAGS="$LDFLAGS -L/usr/local/lib"
24 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
27 AC_CHECK_LIB(fridge, beer, echo "Hmm?!",[
28         echo "Warning: No beer found in fridge!";
29         echo "We highly suggest that you rectify this situation immediately."
32 AC_ARG_ENABLE(serveronly, 
33         [  --enable-serveronly Enable server only compilation],
34                     , enable_serveronly=no,
35                     enable_serveronly=yes)
37 # Include the other configuration files
38 if test "x$enable_serveronly" = "xno" ; then
39 m4_include([configure-gl.m4])
40 m4_include([configure-al.m4])
41 m4_include([configure-wx.m4])
42 m4_include([configure-ogg.m4])
43 m4_include([configure-ft.m4])
44 m4_include([configure-fftw.m4])
45 S3D_SUBDIRS="launcher client server"
46 else
47 S3D_SUBDIRS="server"
49 m4_include([configure-sdl.m4])
50 m4_include([configure-flt.m4])
51 m4_include([configure-sql.m4])
53 AC_SUBST(S3D_SUBDIRS)
55 dnl Checks for Profiling
56 AC_MSG_CHECKING(for profiling enabled)
57 AC_ARG_ENABLE(profiling, 
58         [  --enable-profiling    Enable gprof code profiling],
59                     , enable_profiling=no,
60                     enable_profiling=yes)
61 if test "x$enable_profiling" = "xyes" ; then
62         LIBS="$LIBS -pg"
63         CFLAGS="$CFLAGS -pg"
64         CPPFLAGS="$CPPFLAGS -pg"
65         CXXFLAGS="$CXXFLAGS -pg"
67 AC_MSG_RESULT($enable_profiling)
69 # Check for extra functions
70 AC_CHECK_FUNCS(vsnprintf snprintf vasprintf asprintf iconv)
72 # Check for extra headers
73 AC_CHECK_HEADERS(unistd.h iconv.h)
75 # FIXEME
76 dnl Checking for Zlib Png Jpeg
77 if test `uname` == Darwin; then
78 LIBS="$LIBS -lexpat -lz -framework UnixImageIO"
79 else
80 LIBS="$LIBS -lexpat -lz -lpng -ljpeg"
83 # Directory setup stuff
84 dnl --with-docdir
85 AC_ARG_WITH(docdir,
86         AC_HELP_STRING([--with-docdir=DIR],
87         [Use DIR to store documentation files (default DATADIR)]),
88         [with_docdir=$withval])
89 if test "x$with_docdir" = "x" ; then
90         docdir='${datadir}/documentation'
91 else
92         docdir=$with_docdir
94 AC_SUBST(docdir)
96 AC_PREFIX_DEFAULT(/usr/local/games/scorched3d)
97 if test `uname` == Darwin; then
98 prefix=./
101 CFLAGS="$CFLAGS -DS3D_DOCDIR=\\\"${docdir}\\\" -DS3D_DATADIR=\\\"${datadir}\\\" -DS3D_BINDIR=\\\"${bindir}\\\""
102 CXXFLAGS="$CXXFLAGS -DS3D_DOCDIR=\\\"${docdir}\\\" -DS3D_DATADIR=\\\"${datadir}\\\" -DS3D_BINDIR=\\\"${bindir}\\\""
104 # put here at end because of sdl.m4 not defining
105 AC_LANG_CPLUSPLUS
107 # Finally create all the generated files
108 AC_OUTPUT([
109 Makefile
110 src/Makefile
111 src/launcher/Makefile
112 src/launcher/scorched/Makefile
113 src/client/Makefile
114 src/client/scorchedc/Makefile
115 src/server/Makefile
116 src/server/scorcheds/Makefile