1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(README)
4AC_CANONICAL_TARGET([])
5
6dnl Setup for automake
7AM_INIT_AUTOMAKE(scorched3d, 43)
8
9dnl Check for tools
10AC_PROG_MAKE_SET
11AC_PROG_CC
12AC_PROG_CXX
13AC_PROG_INSTALL
14AC_PROG_RANLIB
15
16#LDFLAGS="-L/usr/X11R6/lib -L/usr/X11R6"
17#CPPFLAGS="-I/usr/X11R6/include -I/usr/X11R6"
18
19if test `uname` = Darwin; then
20#LDFLAGS="$LDFLAGS -lmx"
21#CPPFLAGS="$CPPFLAGS -DFFTW_USE_DOUBLE -D__DARWIN__ -D__MACOSX__"
22else
23#LDFLAGS="$LDFLAGS -L/usr/local/lib"
24#CPPFLAGS="$CPPFLAGS -I/usr/local/include"
25fi
26
27AC_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."
30])
31
32AC_ARG_ENABLE(serveronly,
33	[  --enable-serveronly Enable server only compilation],
34		    , enable_serveronly=no,
35		    enable_serveronly=yes)
36
37# Include the other configuration files
38if test "x$enable_serveronly" = "xno" ; then
39m4_include([configure-gl.m4])
40m4_include([configure-al.m4])
41m4_include([configure-wx.m4])
42m4_include([configure-ogg.m4])
43m4_include([configure-ft.m4])
44m4_include([configure-fftw.m4])
45S3D_SUBDIRS="launcher client server"
46else
47S3D_SUBDIRS="server"
48fi
49m4_include([configure-sdl.m4])
50m4_include([configure-flt.m4])
51m4_include([configure-sql.m4])
52
53AC_SUBST(S3D_SUBDIRS)
54
55dnl Checks for Profiling
56AC_MSG_CHECKING(for profiling enabled)
57AC_ARG_ENABLE(profiling,
58	[  --enable-profiling    Enable gprof code profiling],
59		    , enable_profiling=no,
60		    enable_profiling=yes)
61if test "x$enable_profiling" = "xyes" ; then
62	LIBS="$LIBS -pg"
63	CFLAGS="$CFLAGS -pg"
64	CPPFLAGS="$CPPFLAGS -pg"
65	CXXFLAGS="$CXXFLAGS -pg"
66fi
67AC_MSG_RESULT($enable_profiling)
68
69# Check for extra functions
70AC_CHECK_FUNCS(vsnprintf snprintf vasprintf asprintf iconv)
71
72# Check for extra headers
73AC_CHECK_HEADERS(unistd.h iconv.h)
74
75# FIXEME
76dnl Checking for Zlib Png Jpeg
77if test `uname` = Darwin; then
78LIBS="$LIBS /usr/local/lib/libexpat.a -lz -framework UnixImageIO"
79else
80LIBS="$LIBS -lexpat -lz -lpng -ljpeg"
81fi
82
83# Directory setup stuff
84dnl --with-docdir
85AC_ARG_WITH(docdir,
86	AC_HELP_STRING([--with-docdir=DIR],
87	[Use DIR to store documentation files (default DATADIR)]),
88	[with_docdir=$withval])
89if test "x$with_docdir" = "x" ; then
90	docdir='${datadir}/documentation'
91else
92	docdir=$with_docdir
93fi
94AC_SUBST(docdir)
95
96AC_PREFIX_DEFAULT(/usr/local/games/scorched3d)
97if test `uname` = Darwin; then
98prefix=./
99fi
100
101CFLAGS="$CFLAGS -DS3D_DOCDIR=\\\"${docdir}\\\" -DS3D_DATADIR=\\\"${datadir}\\\" -DS3D_BINDIR=\\\"${bindir}\\\""
102CXXFLAGS="$CXXFLAGS -DS3D_DOCDIR=\\\"${docdir}\\\" -DS3D_DATADIR=\\\"${datadir}\\\" -DS3D_BINDIR=\\\"${bindir}\\\""
103
104# put here at end because of sdl.m4 not defining
105AC_LANG_CPLUSPLUS
106
107# Finally create all the generated files
108AC_OUTPUT([
109Makefile
110src/Makefile
111src/launcher/Makefile
112src/launcher/scorched/Makefile
113src/client/Makefile
114src/client/scorchedc/Makefile
115src/server/Makefile
116src/server/scorcheds/Makefile
117])
118