]> git.mxchange.org Git - simgear.git/blob - configure.in
Added gdbm to SimGear. Many systems will already have gdbm installed so
[simgear.git] / configure.in
1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a 
2 dnl working configure script.
3 dnl
4 dnl $Id$
5
6 AC_INIT(simgear/bucket/newbucket.cxx)
7
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.7)
10
11 dnl Checks for programs.
12 AC_PROG_MAKE_SET
13 AC_PROG_CC
14 AC_PROG_CXX
15 AC_PROG_RANLIB
16 AC_PROG_INSTALL
17 AC_PROG_LN_S
18
19 if echo $includedir | egrep "simgear$" > /dev/null; then
20     echo "includedir is" $includedir "libdir is" $libdir
21 else
22     includedir="${includedir}/simgear"
23     echo "includedir changed to" $includedir "libdir is" $libdir
24 fi
25
26
27 dnl Run configure in the gdbm subdir
28 dnl AC_CONFIG_SUBDIRS( simgear/gdbm )
29
30
31 dnl Specify if we want logging (testing build) or not (release build)
32 # set logging default value
33 # with_logging=yes
34 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
35 if test "x$with_logging" = "xno" ; then
36     AC_DEFINE(FG_NDEBUG)
37 fi
38
39 dnl specify if we are building with "checker"
40 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
41
42 if test "x$with_efence" = "xyes" ; then
43     echo "Building with efence"
44     LIBS= "$LIBS -lefence"
45 fi
46
47 dnl Check for MS Windows environment
48 AC_CHECK_HEADER(windows.h)
49
50 dnl extra library and include directories
51 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
52
53 if test -d /opt/X11R6 ; then
54      EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
55 fi
56
57 if test "x$ac_cv_header_windows_h" = "xyes" ; then
58     EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
59 # elif test `uname -s` = "SunOS" ; then
60 #   EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
61 fi
62 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
63
64 dnl Using AM_CONDITIONAL is a step out of the protected little 
65 dnl automake fold so it is potentially dangerous.  But, we are
66 dnl beginning to run into cases where the standard checks are not
67 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
68 dnl build a Makefile.in from a Makefile.am which lets us define custom
69 dnl includes, compile alternative source files, etc.
70
71 dnl Enable serial support on Unix type systems
72 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
73
74 dnl Check for X11 (fancy)
75 AC_PATH_XTRA
76
77 dnl Checks for libraries.
78
79 null_LIBS="$LIBS"
80
81 AC_CHECK_LIB(m, cos)
82
83 base_LIBS="$LIBS"
84
85 AC_CHECK_LIB(socket, socket)
86 AC_CHECK_LIB(X11, XCreateWindow)
87 AC_CHECK_LIB(Xext, XShmCreateImage)
88 AC_CHECK_LIB(Xi, XGetExtensionVersion)
89 AC_CHECK_LIB(ICE, IceOpenConnection)
90 AC_CHECK_LIB(SM, SmcOpenConnection)
91 AC_CHECK_LIB(Xt, XtMalloc)
92 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
93
94 dnl check for OpenGL related libraries
95
96 if test "x$ac_cv_header_windows_h" != "xyes" ; then
97     dnl Reasonable stuff for non-windoze variants ... :-)
98
99     AC_CHECK_LIB(GLcore, glNewList)
100     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
101         dnl if no GLcore, check for GL
102         AC_CHECK_LIB(GL, glNewList)
103         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
104             dnl if no GL, check for MesaGL
105             AC_CHECK_LIB(MesaGL, glNewList)
106         fi
107     else
108         dnl if GLcore found, then also check for GL
109         AC_CHECK_LIB(GL, glXCreateContext)
110     fi
111
112     dnl if using mesa, check for xmesa.h
113     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
114         AC_CHECK_HEADER(GL/xmesa.h)
115         if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
116             AC_DEFINE( XMESA )
117             AC_DEFINE( FX )
118         fi
119     fi
120
121     AC_CHECK_LIB(GLU, gluLookAt)
122     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
123         dnl if no GLU, check for MesaGLU
124         AC_CHECK_LIB(MesaGLU, gluLookAt)
125     fi
126
127     dnl check for glut
128     AC_CHECK_LIB(glut, glutGetModifiers)
129
130     dnl test for glutGameModeString, but avoid adding glut a second time into
131     dnl the list of libraries
132     save_LIBS="$LIBS"
133     AC_CHECK_LIB(glut, glutGameModeString)
134     LIBS="$save_LIBS"
135 else
136     dnl Win32 is a little wierd because it has to try to handle the various
137     dnl winbloze-isms.  We'll just do this manually for now.
138
139     echo Win32 specific hacks...
140     AC_DEFINE(WIN32)
141
142     dnl force a failed check since we will be building under windoze
143     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
144
145     dnl just define these to true and hope for the best
146     ac_cv_lib_glut_glutGetModifiers="yes"
147     ac_cv_lib_glut_glutGameModeString="yes"
148
149     if test "x$with_sgi_opengl" = "xyes" ; then
150         echo "Building with glut.dll, glu.dll, and opengl.dll"
151         WIN32_GLUT=glut
152         WIN32_GLU=glu
153         WIN32_OPENGL=opengl
154     else 
155         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
156         WIN32_GLUT=glut32
157         WIN32_GLU=glu32
158         WIN32_OPENGL=opengl32
159     fi
160
161     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
162     LIBS="$LIBS -luser32 -lgdi32"
163     echo "Will link apps with $LIBS"
164 fi
165
166 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
167     echo 
168     echo "Unable to find the necessary OpenGL or GLUT libraries."
169     echo "See config.log for automated test details and results ..."
170     exit 1
171 fi
172
173 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
174     echo
175     echo "Your version of glut doesn't support game mode."
176     echo "You need to fetch and install the latest version of glut from:"
177     echo
178     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
179     exit 1
180 fi
181
182 opengl_LIBS="$LIBS"
183 LIBS="$base_LIBS"
184
185 AC_SUBST(base_LIBS)
186 AC_SUBST(opengl_LIBS)
187
188 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
189
190 dnl Check for "plib" without which we cannot go on
191 AC_CHECK_HEADER(plib/pu.h)
192 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
193     echo
194     echo "You *must* have the plib library installed on your system to build"
195     echo "the FGFS simulator!"
196     echo
197     echo "Please see README.plib for more details."
198     echo
199     echo "configure aborted."
200     exit
201 fi
202
203 dnl Check for system installed gdbm
204 AC_CHECK_HEADER(gdbm.h)
205 if test "x$ac_cv_header_gdbm_h" = "xyes"; then
206     AC_DEFINE( HAVE_GDBM )
207 else
208     echo "no gdbm found, configuring and building."
209 fi
210 AM_CONDITIONAL(HAVE_GDBM, test "x$ac_cv_header_gdbm_h" = "xyes" )
211
212 dnl Check for system installed zlib
213 AC_CHECK_HEADER(zlib.h)
214 if test "x$ac_cv_header_zlib_h" = "xyes"; then
215     AC_DEFINE( HAVE_ZLIB )
216 else
217     echo "no zlib found, building."
218 fi
219 AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
220
221 dnl Checks for header files.
222 AC_HEADER_STDC
223 AC_CHECK_HEADERS( \
224         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
225         sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
226
227 dnl Checks for typedefs, structures, and compiler characteristics.
228 AC_C_CONST
229 AC_TYPE_SIZE_T
230 AC_HEADER_TIME
231 AC_STRUCT_TM
232
233 dnl Checks for library functions.
234 AC_TYPE_SIGNAL
235 AC_FUNC_VPRINTF
236 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
237         random setitimer getitimer signal GetLocalTime rint getrusage )
238
239 AM_CONFIG_HEADER(simgear/config.h)
240
241 AC_OUTPUT( \
242         Makefile \
243         SimGear.spec \
244         simgear/Makefile \
245         simgear/version.h \
246         simgear/bucket/Makefile \
247         simgear/debug/Makefile \
248         simgear/gdbm/Makefile \
249         simgear/magvar/Makefile \
250         simgear/math/Makefile \
251         simgear/misc/Makefile \
252         simgear/screen/Makefile \
253         simgear/serial/Makefile \
254         simgear/xgl/Makefile \
255         simgear/zlib/Makefile \
256 )
257
258 # AC_OUTPUT_COMMANDS([./mksymlinks.sh])
259
260 echo ""
261 echo "Configure Summary"
262 echo "================="
263
264 echo "Prefix: $prefix"
265
266 if test "x$with_logging" != "x"; then
267     echo "Debug messages: $with_logging"
268 else
269     echo "Debug messages: yes"
270 fi
271
272 if test "x$with_efence" != "x"; then
273     echo "Electric fence: $with_efence"
274 else
275     echo "Electric fence: no"
276 fi
277
278 if test "x$ac_cv_header_gdbm_h" != "xyes"; then
279    echo "Building gdbm"
280 fi
281
282 if test "x$ac_cv_header_zlib_h" != "xyes"; then
283    echo "Building zlib"
284 fi