]> git.mxchange.org Git - flightgear.git/blob - configure.in
source tree reorganization prior to flightgear 0.7
[flightgear.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl The basis for this file was generated by autoscan(1) [pere 1998-03-19]
4 dnl
5 dnl $Id$
6
7 AC_INIT(Simulator/Aircraft/aircraft.cxx)
8
9 dnl Initialize the automake stuff
10 AM_INIT_AUTOMAKE(FlightGear, 0.6.2)
11
12 dnl configure other independant packages included with flight gear for
13 dnl convenience
14 dnl AC_CONFIG_SUBDIRS( Lib/plib )
15
16 dnl Checks for programs.
17 AC_PROG_MAKE_SET
18 AC_PROG_CC
19 AC_PROG_CXX
20 AC_PROG_RANLIB
21 AC_PROG_INSTALL
22 AC_PROG_LN_S
23
24 dnl Initialize libtool
25 dnl AM_PROG_LIBTOOL
26
27 dnl Initialize maintainer mode
28 dnl AM_MAINTAINER_MODE
29
30 dnl This is needed for AC_TRY_COMPILE later
31 dnl AC_ISC_POSIX
32
33 dnl Check to see if this `configure' is being run in the `Cygwin32' environment
34 dnl AM_CYGWIN32
35
36 dnl Specify if we want logging (testing build) or not (release build)
37 # set logging default value
38 # with_logging=yes
39 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
40 if test "x$with_logging" = "xno" ; then
41     AC_DEFINE(FG_NDEBUG)
42 fi
43
44
45 dnl specify if we are building with "checker"
46 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
47
48 if test "x$with_efence" = "xyes" ; then
49     echo "Building with efence"
50     LIBS= "$LIBS -lefence"
51 fi
52
53 dnl specify the compiled flight model
54 AC_ARG_WITH(flight-model, [  --with-flight-model=xxx Specify the flight model (navion, c172)])
55
56 if test "x$with_flight_model" = "xc172" ; then
57     echo "Building with c172 flight model"
58 else 
59     echo "Building with navion flight model"
60 fi
61 AM_CONDITIONAL(ENABLE_C172, test "x$with_flight_model" = "xc172")
62
63 dnl Let the Win32 user specify if they want to build with the SGI
64 dnl opengl.dll as opposed to the more standard openg32.dll
65 AC_ARG_WITH(sgi-opengl, [  --with-sgi-opengl       Build against SGI's opengl.dll glu.dll and glut.dll])
66
67 dnl Check for MS Windows environment
68 AC_CHECK_HEADER(windows.h)
69
70 dnl extra library and include directories
71 EXTRA_DIRS="/usr/local /usr/X11R6"
72
73 if test -d /opt/X11R6 ; then
74      EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
75 fi
76
77 if test "x$ac_cv_header_windows_h" = "xyes" ; then
78     EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
79 # elif test `uname -s` = "SunOS" ; then
80 #   EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
81 fi
82 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
83
84 dnl Check for "plib" without which we cannot go on
85 AC_CHECK_HEADER(plib/pu.h)
86 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
87     echo
88     echo "You *must* have the plib library installed on your system to build"
89     echo "the FGFS simulator!"
90     echo
91     echo "Please see README.plib for more details."
92     echo
93     echo "configure aborted."
94     exit
95     AM_CONDITIONAL(ENABLE_PLIB_JOYSTICK, false )
96 else
97     dnl Use plib joystick lib
98     AM_CONDITIONAL(ENABLE_PLIB_JOYSTICK, true )
99 fi
100
101 dnl Using AM_CONDITIONAL is a step out of the protected little 
102 dnl automake fold so it is potentially dangerous.  But, we are
103 dnl beginning to run into cases where the standard checks are not
104 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
105 dnl build a Makefile.in from a Makefile.am which lets us define custom
106 dnl includes, compile alternative source files, etc.
107
108 dnl Check for external variables daylight and timezone.
109 AC_EXT_DAYLIGHT
110 AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
111
112 AC_EXT_TIMEZONE
113 AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
114
115 dnl Check for Linux style audio support
116 AM_CONDITIONAL(ENABLE_AUDIO_SUPPORT, \
117         test -r /usr/include/soundcard.h \
118                 -o -r /usr/include/linux/soundcard.h \
119                 -o -r /usr/include/machine/soundcard.h \
120                 -o -r /usr/include/audio.h \
121                 -o "x$ac_cv_header_windows_h" = "xyes" )
122
123 AM_CONDITIONAL(ENABLE_IRIX_AUDIO, test -r /usr/include/audio.h)
124
125 AM_CONDITIONAL(ENABLE_WIN32_AUDIO, test "x$ac_cv_header_windows_h" = "xyes")
126
127 dnl Enable serial support on Unix type systems
128 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
129
130 dnl Check for X11 (fancy)
131 AC_PATH_XTRA
132
133 dnl Checks for libraries.
134
135 null_LIBS="$LIBS"
136
137 AC_CHECK_LIB(m, cos)
138
139 base_LIBS="$LIBS"
140
141 AC_CHECK_LIB(socket, socket)
142 AC_CHECK_LIB(X11, XCreateWindow)
143 AC_CHECK_LIB(Xext, XShmCreateImage)
144 AC_CHECK_LIB(Xi, XGetExtensionVersion)
145 AC_CHECK_LIB(ICE, IceOpenConnection)
146 AC_CHECK_LIB(SM, SmcOpenConnection)
147 AC_CHECK_LIB(Xt, XtMalloc)
148 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
149
150 dnl check for OpenGL related libraries
151
152 if test "x$ac_cv_header_windows_h" != "xyes" ; then
153     dnl Reasonable stuff for non-windoze variants ... :-)
154
155     AC_CHECK_LIB(GLcore, glNewList)
156     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
157         dnl if no GLcore, check for GL
158         AC_CHECK_LIB(GL, glNewList)
159         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
160             dnl if no GL, check for MesaGL
161             AC_CHECK_LIB(MesaGL, glNewList)
162         fi
163     else
164         dnl if GLcore found, then also check for GL
165         AC_CHECK_LIB(GL, glXCreateContext)
166     fi
167
168     dnl if using mesa, check for xmesa.h
169     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
170         AC_CHECK_HEADER(GL/xmesa.h)
171         AM_CONDITIONAL(ENABLE_XMESA_FX, \
172                        test "x$ac_cv_header_GL_xmesa_h" = "xyes")
173     else
174         dnl force a failed check
175         AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
176     fi
177
178     AC_CHECK_LIB(GLU, gluLookAt)
179     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
180         dnl if no GLU, check for MesaGLU
181         AC_CHECK_LIB(MesaGLU, gluLookAt)
182     fi
183
184     dnl check for glut
185     AC_CHECK_LIB(glut, glutGetModifiers)
186
187     dnl test for glutGameModeString, but avoid adding glut a second time into
188     dnl the list of libraries
189     save_LIBS="$LIBS"
190     AC_CHECK_LIB(glut, glutGameModeString)
191     LIBS="$save_LIBS"
192 else
193     dnl Win32 is a little wierd because it has to try to handle the various
194     dnl winbloze-isms.  We'll just do this manually for now.
195
196     echo Win32 specific hacks...
197     AC_DEFINE(WIN32)
198
199     dnl force a failed check since we will be building under windoze
200     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
201
202     dnl just define these to true and hope for the best
203     ac_cv_lib_glut_glutGetModifiers="yes"
204     ac_cv_lib_glut_glutGameModeString="yes"
205
206     if test "x$with_sgi_opengl" = "xyes" ; then
207         echo "Building with glut.dll, glu.dll, and opengl.dll"
208         WIN32_GLUT=glut
209         WIN32_GLU=glu
210         WIN32_OPENGL=opengl
211     else 
212         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
213         WIN32_GLUT=glut32
214         WIN32_GLU=glu32
215         WIN32_OPENGL=opengl32
216     fi
217
218     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
219     LIBS="$LIBS -luser32 -lgdi32"
220     echo "Will link apps with $LIBS"
221 fi
222
223 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
224     echo 
225     echo "Unable to find the necessary OpenGL or GLUT libraries."
226     echo "See config.log for automated test details and results ..."
227     exit 1
228 fi
229
230 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
231     echo
232     echo "Your version of glut doesn't support game mode."
233     echo "You need to fetch and install the latest version of glut from:"
234     echo
235     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
236     exit 1
237 fi
238
239 opengl_LIBS="$LIBS"
240 LIBS="$base_LIBS"
241
242 AC_SUBST(base_LIBS)
243 AC_SUBST(opengl_LIBS)
244
245 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
246
247 dnl Check if Generic Polygon Clipping library is installed
248 dnl (from http://www.cs.man.ac.uk/aig/staff/alan/software/)
249 AC_CHECK_HEADERS( gpc.h )
250 if test "x$ac_cv_header_gpc_h" != "xyes"; then
251     echo
252     echo "You need to have the GPC library installed on your system to build"
253     echo "some of the scenery generation tools, otherwise you won't be able."
254     echo "to create scenery."
255     echo
256     echo "Please see README.gpc for more details."
257     echo
258     echo "(pausing 5 seconds)"
259     sleep 5
260     echo
261 fi
262
263 dnl Check if  Geographic Foundation Classes library is installed
264 dnl (from ftp://ftp.flightgear.org/pub/fgfs/Source/)
265 AC_CHECK_HEADERS( gfc/gdbf.h )
266 if test "x$ac_cv_header_gfc_gdbf_h" != "xyes"; then
267     echo
268     echo "You need to have the GFC library installed on your system to build"
269     echo "some of the scenery generation tools, otherwise, they may fail."
270     echo
271     echo "Please see README.gfc for more details."
272     echo 
273     echo "(pausing 5 seconds)"
274     sleep 5
275     echo
276 fi
277
278 dnl Checks for header files.
279 AC_HEADER_STDC
280 AC_CHECK_HEADERS( \
281         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/stat.h sys/time.h \
282         sys/timeb.h unistd.h windows.h winbase.h values.h )
283
284 dnl Checks for typedefs, structures, and compiler characteristics.
285 AC_C_CONST
286 AC_TYPE_SIZE_T
287 AC_HEADER_TIME
288 AC_STRUCT_TM
289
290 dnl Checks for library functions.
291 AC_TYPE_SIGNAL
292 AC_FUNC_VPRINTF
293 AC_CHECK_FUNCS( ftime gettimeofday memcpy bcopy mktime strstr rand random \
294         setitimer getitimer signal GetLocalTime rint getrusage )
295
296 AM_CONFIG_HEADER(Include/config.h)
297
298 AC_OUTPUT( \
299         VERSION \
300         Makefile \
301         Include/Makefile \
302         Lib/Makefile \
303         Lib/Bucket/Makefile \
304         Lib/Debug/Makefile \
305         Lib/Math/Makefile \
306         Lib/Misc/Makefile \
307         Lib/Serial/Makefile \
308         Lib/XGL/Makefile \
309         Lib/zlib/Makefile \
310         Simulator/Makefile \
311         Simulator/Aircraft/Makefile \
312         Simulator/Airports/Makefile \
313         Simulator/Astro/Makefile \
314         Simulator/Autopilot/Makefile \
315         Simulator/Cockpit/Makefile \
316         Simulator/Controls/Makefile \
317         Simulator/FDM/External/Makefile \
318         Simulator/FDM/JSBsim/Makefile \
319         Simulator/FDM/LaRCsim/Makefile \
320         Simulator/FDM/Slew/Makefile \
321         Simulator/FDM/Makefile \
322         Simulator/GUI/Makefile \
323         Simulator/Joystick/Makefile \
324         Simulator/Main/Makefile \
325         Simulator/Main/runfgfs \
326         Simulator/Main/runfgfs.bat \
327         Simulator/Makefile \
328         Simulator/Objects/Makefile \
329         Simulator/Scenery/Makefile \
330         Simulator/Time/Makefile \
331         Simulator/Weather/Makefile \
332         Tools/Makefile \
333         Tools/Construct/Makefile \
334         Tools/Construct/Array/Makefile \
335         Tools/Construct/Clipper/Makefile \
336         Tools/Construct/Combine/Makefile \
337         Tools/Construct/GenOutput/Makefile \
338         Tools/Construct/Match/Makefile \
339         Tools/Construct/Triangulate/Makefile \
340         Tools/Construct/Main/Makefile \
341         Tools/Construct/Parallel/Makefile \
342         Tools/Lib/Makefile \
343         Tools/Lib/DEM/Makefile \
344         Tools/Lib/Polygon/Makefile \
345         Tools/Lib/Triangle/Makefile \
346         Tools/Prep/Makefile \
347         Tools/Prep/DemChop/Makefile \
348         Tools/Prep/DemInfo/Makefile \
349         Tools/Prep/DemRaw2ascii/Makefile \
350         Tools/Prep/GenAirports/Makefile \
351         Tools/Prep/ShapeFile/Makefile \
352         Tools/Utils/Makefile \
353         Tests/Makefile \
354 )
355
356 AC_OUTPUT_COMMANDS([chmod 755 Simulator/Main/runfgfs])
357