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