]> git.mxchange.org Git - flightgear.git/blob - configure.ac
Removed unused cur_view_fdm variable as suggested by Bernie Bright.
[flightgear.git] / configure.ac
1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a 
2 dnl working configure script.
3
4 #
5 # $Id$
6 #
7
8 AC_INIT
9 AC_CONFIG_SRCDIR([src/Aircraft/aircraft.cxx])
10
11 # Require at least automake 2.52
12 AC_PREREQ(2.52)
13
14 # Initialize the automake stuff
15 AM_INIT_AUTOMAKE(FlightGear, 0.7.11pre1)
16
17 # Checks for programs.
18 AC_PROG_MAKE_SET
19 AC_PROG_CC
20 AC_PROG_CPP
21 AC_PROG_CXX
22 AC_PROG_RANLIB
23 AC_PROG_INSTALL
24 AC_PROG_LN_S
25
26 # Initialize libtool
27 # AM_PROG_LIBTOOL
28
29 # Initialize maintainer mode
30 # AM_MAINTAINER_MODE
31
32 # This is needed for AC_TRY_COMPILE later
33 # AC_ISC_POSIX
34
35 # Check to see if this `configure' is being run in the `Cygwin32' environment
36 AC_EGREP_CPP(yes,
37 [#ifdef __MINGW32__
38  yes
39  #endif
40 ],is_mingw=yes, is_mingw=no)
41
42 echo "IS_MINGW = $is_mingw"
43 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
44
45 AC_EGREP_CPP(yes,
46 [#ifdef __CYGWIN__
47  yes
48  #endif
49 ],is_cygwin=yes, is_cygwin=no)
50
51 echo "IS_CYGWIN = $is_cygwin"
52 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
53
54 # Determine version of automake ... important becuase of
55 # incompatibilities between versions
56 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//g'`
57 if test $AUTO_MAKE_VERSION -lt 15; then
58     echo "You need to upgrade your automake to version 1.5 or newer"
59     exit 1
60 fi
61
62 # Used by JSBSim
63 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
64
65 # Used on the Irix platform
66 AR="ar"
67 OS=`uname -s`
68 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
69     if test "$CXX" = "CC"; then
70         AR="CC -ar"
71         AC_SUBST(AR)
72     fi
73 fi
74
75
76 # Specify if we want logging (testing build) or not (release build)
77 # set logging default value
78 # with_logging=yes
79 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
80 if test "x$with_logging" = "xno" ; then
81     AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
82 fi
83
84 # Specify if we want to build with Oliver's networking support
85 # default to with_network=yes
86 AC_ARG_WITH(network_olk, [  --with-network-olk      Include Oliver's multi-pilot networking support])
87 if test "x$with_network_olk" = "xno" ; then
88     echo "Building without Oliver's multi-pilot network support"
89 else
90     echo "Building with Oliver's multi-pilot network support"
91     AC_DEFINE([FG_NETWORK_OLK], 1, [Define to build with Oliver's networking])
92 fi
93 AM_CONDITIONAL(ENABLE_NETWORK_OLK, test "x$with_network_olk" != "xno")
94
95
96 # Specify if we want to use WeatherCM instead of FGEnvironment.
97 # default to with_weathercm=no
98 AC_ARG_WITH(new-environment, [  --with-weathercm        Use WeatherCM instead of FGEnvironment])
99 if test "x$with_weathercm" = "xyes" ; then
100     echo "Building with WeatherCM"
101     AC_DEFINE([FG_WEATHERCM], 1,
102               [Define to build with Christian Mayer's weather code])
103 else
104     echo "Building with FGEnvironment"
105 fi
106 AM_CONDITIONAL(ENABLE_WEATHERCM, test "x$with_weathercm" = "xyes")
107
108 # Let the Win32 user specify if they want to build with the SGI
109 # opengl.dll as opposed to the more standard openg32.dll
110 AC_ARG_WITH(sgi-opengl, [  --with-sgi-opengl       Build against SGI's opengl.dll glu.dll and glut.dll])
111
112 dnl Thread related checks
113 AC_ARG_WITH(threads, [  --with-threads          Include tile loading threads [default=no]])
114 if test "x$with_threads" = "xyes"; then
115     AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
116     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
117     CFLAGS="$CFLAGS -D_REENTRANT"
118     AC_CHECK_HEADER(pthread.h)
119 fi
120 AM_CONDITIONAL(WITH_THREADS, test "x$with_threads" = "xyes")
121
122 # specify the plib location
123 AC_ARG_WITH(plib, [  --with-plib=PREFIX      Specify the prefix path to plib])
124
125 if test "x$with_plib" != "x" ; then
126     echo "plib prefix is $with_plib"
127     EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
128 fi
129
130 # specify the metakit location
131 AC_ARG_WITH(metakit, [  --with-metakit=PREFIX   Specify the prefix path to metakit])
132
133 if test "x$with_metakit" != "x" ; then
134     echo "metakit prefix is $with_metakit"
135     EXTRA_DIRS="${EXTRA_DIRS} $with_metakit"
136 fi
137
138 # specify the simgear location
139 AC_ARG_WITH(simgear, [  --with-simgear=PREFIX   Specify the prefix path to simgear])
140
141 if test "x$with_simgear" != "x" ; then
142     echo "SimGear prefix path is $with_simgear"
143     EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
144 fi
145
146 # Check for MS Windows environment
147 AC_CHECK_HEADER(windows.h)
148
149 # extra library and include directories
150 if test "x$ac_cv_header_windows_h" != "xyes" ; then
151     EXTRA_DIRS="${EXTRA_DIRS} /usr/local /usr/X11R6"
152
153     if test -d /opt/X11R6 ; then
154         EXTRA_DIRS="${EXTRA_DIRS} /opt/X11R6"
155     fi
156 else
157     if test  "x$is_cygwin" = "xyes" ; then
158         EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
159     fi
160 fi
161
162 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
163
164 # Using AM_CONDITIONAL is a step out of the protected little 
165 # automake fold so it is potentially dangerous.  But, we are
166 # beginning to run into cases where the standard checks are not
167 # enough.  AM_CONDITIONALS are then referenced to conditionally
168 # build a Makefile.in from a Makefile.am which lets us define custom
169 # includes, compile alternative source files, etc.
170
171 # Check for external variables daylight and timezone.
172 AC_EXT_DAYLIGHT
173 if test "$have_daylight" = yes; then
174     AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
175 fi
176 # AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
177
178 AC_EXT_TIMEZONE
179 if test "$have_timezone" = yes; then
180     AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
181 fi
182 # AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
183
184 # Check for audio support
185 AC_MSG_CHECKING(for audio support)
186 audio_LIBS=""
187 if test -r /usr/include/soundcard.h \
188         -o -r /usr/include/linux/soundcard.h \
189         -o -r /usr/include/machine/soundcard.h \
190         -o -r /usr/include/audio.h \
191         -o "x$ac_cv_header_windows_h" = "xyes" \
192         -o "$HOSTTYPE" = "macintosh"; then
193
194     AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
195     audio_LIBS="-lplibsl -lplibsm"
196     AC_MSG_RESULT(yes)
197     if test -r /usr/include/audio.h; then
198         audio_LIBS="$audio_LIBS -laudio"
199     fi
200
201     if test "x$ac_cv_header_windows_h" = "xyes"; then
202         audio_LIBS="$audio_LIBS -lwinmm"
203     fi
204
205     if test "$HOSTTYPE" = "macintosh"; then
206         audio_LIBS="$audio_LIBS -framework Carbon"
207     fi
208 else
209     AC_MSG_RESULT(no)
210 fi
211 AC_SUBST(audio_LIBS)
212
213 # Check for X11 (fancy)
214 if test "x$no_x" != "xyes"; then
215     AC_PATH_XTRA
216 fi
217
218 # Checks for libraries.
219
220 null_LIBS="$LIBS"
221
222 AC_CHECK_LIB(m, cos)
223
224 dnl MINGW requires libwsock32
225 if test  "x$is_mingw" = "xyes" ; then
226     LIBS="$LIBS -lws2_32"
227 fi
228
229 base_LIBS="$LIBS"
230
231 dnl Mesa >= 3.2 requires pthreads
232 AC_CHECK_LIB(pthread, pthread_exit)
233 AC_CHECK_LIB(socket, socket)
234
235 dnl Skip X library tests.
236 if test "x$no_x" != "xyes"; then
237     AC_CHECK_LIB(X11, XCreateWindow)
238     AC_CHECK_LIB(Xext, XShmCreateImage)
239     AC_CHECK_LIB(Xi, XGetExtensionVersion)
240     AC_CHECK_LIB(ICE, IceOpenConnection)
241     AC_CHECK_LIB(SM, SmcOpenConnection)
242     AC_CHECK_LIB(Xt, XtMalloc)
243     AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
244 fi
245
246 # check for OpenGL related libraries
247
248 if test "$HOSTTYPE" = "macintosh"; then
249     LIBS="$LIBS -framework OpenGL -framework GLUT -lobjc"
250 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
251     # Reasonable stuff for non-windoze variants ... :-)
252
253     AC_CHECK_LIB(GLcore, glNewList)
254     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
255         # if no GLcore, check for GL
256         AC_CHECK_LIB(GL, glNewList)
257         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
258             # if no GL, check for MesaGL
259             AC_CHECK_LIB(MesaGL, glNewList)
260         fi
261     else
262         # if GLcore found, then also check for GL
263         AC_CHECK_LIB(GL, glXCreateContext)
264     fi
265
266     # check for xmesa.h and if found enable XMESA / FX
267     AC_CHECK_HEADER(GL/fxmesa.h)
268     if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
269         save_LIBS="$LIBS"
270         AC_CHECK_LIB(GL, XMesaSetFXmode)
271         if test "x$ac_cv_lib_GL_XMesaSetFXmode" = "xyes" ; then
272             AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
273             AC_DEFINE([FX], 1, [Define for Mesa FX mode])
274         else
275             AC_CHECK_LIB(MesaGL, XMesaSetFXmode)
276             if test "x$ac_cv_lib_MesaGL_XMesaSetFXmode" = "xyes" ; then
277                 AC_DEFINE([XMESA], 1, [Define for Mesa FX mode])
278                 AC_DEFINE([FX], 1, [Define for Mesa FX mode])
279             fi
280         fi
281         LIBS="$save_LIBS"
282     fi
283
284     AC_CHECK_LIB(GLU, gluLookAt)
285     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
286         # if no GLU, check for MesaGLU
287         AC_CHECK_LIB(MesaGLU, gluLookAt)
288     fi
289
290     # check for glut
291     AC_CHECK_LIB(glut, glutGetModifiers)
292
293     # test for glutGameModeString, but avoid adding glut a second time into
294     # the list of libraries
295     save_LIBS="$LIBS"
296     AC_CHECK_LIB(glut, glutGameModeString)
297     LIBS="$save_LIBS"
298 else
299     # Win32 is a little wierd because it has to try to handle the various
300     # winbloze-isms.  We'll just do this manually for now.
301
302     echo Win32 specific hacks...
303     AC_DEFINE([WIN32], 1, [Define if building on a Win32 platform])
304
305     # just define these to true and hope for the best
306     ac_cv_lib_glut_glutGetModifiers="yes"
307     ac_cv_lib_glut_glutGameModeString="yes"
308
309     if test "x$with_sgi_opengl" = "xyes" ; then
310         echo "Building with glut.dll, glu.dll, and opengl.dll"
311         WIN32_GLUT=glut
312         WIN32_GLU=glu
313         WIN32_OPENGL=opengl
314     else 
315         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
316         WIN32_GLUT=glut32
317         WIN32_GLU=glu32
318         WIN32_OPENGL=opengl32
319     fi
320
321     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
322     LIBS="$LIBS -luser32 -lgdi32"
323     echo "Will link apps with $LIBS"
324 fi
325
326 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
327     echo 
328     echo "Unable to find the necessary OpenGL or GLUT libraries."
329     echo "See config.log for automated test details and results ..."
330     exit 1
331 fi
332
333 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
334     echo
335     echo "Your version of glut doesn't support game mode."
336     echo "You need to install the latest version.  If your distribution doesn't"
337     echo "provide a newer version, you can get the latest source code from:"
338     echo
339     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
340     exit 1
341 fi
342
343 opengl_LIBS="$LIBS"
344 LIBS="$base_LIBS"
345
346 AC_SUBST(base_LIBS)
347 AC_SUBST(opengl_LIBS)
348
349 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
350
351 # The following are C++ items that need to be tested for with the c++
352 # compiler
353
354 AC_LANG_PUSH(C++)
355
356 # Check for "plib" without which we cannot go on
357 AC_CHECK_HEADER(plib/pu.h)
358 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
359     echo
360     echo "You *must* have the plib library installed on your system to build"
361     echo "the FGFS simulator!"
362     echo
363     echo "Please see README.plib for more details."
364     echo
365     echo "configure aborted."
366     exit
367 fi
368
369 # needed for plib 1.3.x and later
370 AC_CHECK_LIB(plibul, ulInit,,,)
371
372 if test "x$ac_cv_lib_plibul_ulInit" != "xyes"; then
373     echo
374     echo "You have an old version of plib, you need to upgrade to at least"
375     echo "plib-1.4.2"
376     exit
377 fi
378
379 # If we get here then plib is available, so force use of plib joystick lib
380 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
381
382 # Do we have a new CVS plib version with jsJoystick::getName?
383 echo -n "Testing for Plib joystick getName support: "
384 AC_EGREP_HEADER( getName, plib/js.h,
385                  plib_js_has_getname=yes, plib_js_has_getname=no )
386 echo $plib_js_has_getname
387 if test $plib_js_has_getname = 'yes'; then
388     AC_DEFINE([FG_PLIB_JOYSTICK_GETNAME], 1,
389               [Define to enable plib joystick name support])
390 fi
391
392 # Check for the presence of SimGear
393 AC_CHECK_HEADER(simgear/version.h)
394 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
395     echo
396     echo "You *must* have the SimGear support library installed on your system"
397     echo "to build the FGFS simulator!"
398     echo
399     echo "Please see README.SimGear for more details."
400     echo
401     echo "configure aborted."
402     exit
403 fi
404
405 AC_MSG_CHECKING([for proper simgear version])
406 AC_TRY_RUN([
407 #include <stdio.h>
408
409 #include <simgear/version.h>
410
411 #define STRINGIFY(X) XSTRINGIFY(X)
412 #define XSTRINGIFY(X) #X
413
414 #define MIN_MAJOR 0
415 #define MIN_MINOR 0
416 #define MIN_MICRO 19
417
418 int main() {
419     int major, minor, micro;
420
421     printf("%d.%d.%d or greater... ", MIN_MAJOR, MIN_MINOR, MIN_MICRO);
422
423     sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, &micro );
424
425     if ( major < MIN_MAJOR ) {
426          return -1;
427     } else if ( major == MIN_MAJOR && minor < MIN_MINOR ) {
428          return -1;
429     } else if ( major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO ){
430          return -1;
431     }
432
433     return 0;
434 }
435
436 ],
437   AC_MSG_RESULT(yes),
438   [AC_MSG_RESULT(wrong version);
439    AC_MSG_ERROR([Install latest simgear first...])],
440   AC_MSG_RESULT(yes)
441 )
442
443 # Check for MetaKit
444 AC_CHECK_HEADER(mk4.h)
445 if test "x$ac_cv_header_mk4_h" != "xyes"; then
446     echo
447     echo "MetaKit library not found."
448     echo
449     echo "If your OS does not provide an installable package for MetaKit"
450     echo "you will have to compile and install it first yourself.  A copy"
451     echo "of metakit-$(VERSION).tar.gz is included with SimGear.  You will"
452     echo "have to untar this source code, and follow it's included instructions"
453     echo "to compile and install on your system."
454     echo
455     echo "configure aborted."
456     exit
457 fi
458
459 AC_MSG_CHECKING([for proper metakit version])
460
461 saved_LIBS="$LIBS"
462 LIBS="$saved_LIBS -lmk4"
463 AC_TRY_RUN([
464 #include <mk4.h>
465
466 #define MIN_MK4_VERSION 243
467
468 int main() {
469     int major, minor, micro;
470
471     if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
472          return -1;
473     }
474
475     return 0;
476 }
477
478 ],
479   AC_MSG_RESULT(yes),
480   [AC_MSG_RESULT(wrong version);
481    AC_MSG_ERROR([Install metakit 2.4.3 or later first...])],
482   AC_MSG_RESULT(yes)
483 )
484 LIBS="$saved_LIBS"
485
486 # Check if SimGear was built with Norman JPEG factory support
487 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
488 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
489     AC_CHECK_LIB(jpeg, jpeg_start_compress)
490     if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
491         echo
492         echo "The JPEG factory code was built and installed with SimGear."
493         echo "However it appears the libjpeg is no longer installed."
494         echo "You need to install libjpeg or remove jpgfactory support from"
495         echo "SimGear"
496         echo
497         echo "libjpeg is available at :"
498         echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
499         exit 1
500     fi
501     AC_DEFINE([FG_JPEG_SERVER], 1,
502               [Define to build with jpeg screen shot server])
503 fi
504 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
505
506 AC_LANG_POP
507
508 # Check for system installed zlib
509 AC_CHECK_HEADER(zlib.h)
510 if test "x$ac_cv_header_zlib_h" != "xyes"; then
511     echo
512     echo "zlib library not found."
513     echo
514     echo "If your OS does not provide an installable package for zlib"
515     echo "you will have to compile and install it first yourself.  A copy"
516     echo "of zlib-1.1.4.tar.gz is included with SimGear.  You will"
517     echo "have to untar this source code, and follow it's included instructions"
518     echo "to compile and install on your system."
519     echo
520     echo "configure aborted."
521     echo
522 fi
523
524 # Checks for header files.
525 AC_HEADER_STDC
526 AC_CHECK_HEADERS( \
527         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
528         sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
529
530 # Checks for typedefs, structures, and compiler characteristics.
531 AC_C_CONST
532 AC_TYPE_SIZE_T
533 AC_HEADER_TIME
534 AC_STRUCT_TM
535
536 # Checks for library functions.
537 AC_TYPE_SIGNAL
538 AC_FUNC_VPRINTF
539 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
540         random setitimer getitimer signal GetLocalTime rint getrusage )
541
542 AM_CONFIG_HEADER(src/Include/config.h)
543
544 AC_CONFIG_FILES([ \
545         Makefile \
546         man/Makefile \
547         man/est-epsilon.1 \
548         man/fgfs.1 \
549         man/fgjs.1 \
550         man/gl-info.1 \
551         man/js_demo.1 \
552         man/pstest.1 \
553         scripts/Makefile \
554         scripts/debug/Makefile \
555         scripts/python/Makefile \
556         src/Makefile \
557         src/Include/Makefile \
558         src/Include/version.h \
559         src/Aircraft/Makefile \
560         src/Airports/Makefile \
561         src/ATC/Makefile \
562         src/Autopilot/Makefile \
563         src/Cockpit/Makefile \
564         src/Cockpit/built_in/Makefile \
565         src/Controls/Makefile \
566         src/Environment/Makefile \
567         src/FDM/Balloon/Makefile \
568         src/FDM/JSBSim/Makefile \
569         src/FDM/JSBSim/filtersjb/Makefile \
570         src/FDM/LaRCsim/Makefile \
571         src/FDM/UIUCModel/Makefile \
572         src/FDM/YASim/Makefile \
573         src/FDM/Makefile \
574         src/GUI/Makefile \
575         src/Input/Makefile \
576         src/Main/Makefile \
577         src/Main/runfgfs \
578         src/Main/runfgfs.bat \
579         src/Model/Makefile \
580         src/Navaids/Makefile \
581         src/Network/Makefile \
582         src/NetworkOLK/Makefile \
583         src/Objects/Makefile \
584         src/Scenery/Makefile \
585         src/Sound/Makefile \
586         src/Time/Makefile \
587         src/WeatherCM/Makefile \
588         tests/Makefile \
589 ])
590 AC_OUTPUT
591
592 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
593
594 echo ""
595 echo "Configure Summary"
596 echo "================="
597
598 echo "Prefix: $prefix"
599
600 if test "x$with_logging" != "x"; then
601     echo "Debug messages: $with_logging"
602 else
603     echo "Debug messages: yes"
604 fi
605
606 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
607 automake --version | head -1
608
609 echo "New plib joystick name support: $plib_js_has_getname"
610
611 if test "x$with_weathercm" != "x"; then
612     echo "WeatherCM instead of FGEnvironment: $with_weathercm"
613 else
614     echo "Using FGEnvironment"
615 fi
616
617 if test "x$with_threads" = "xyes"; then
618     echo "threads: yes"
619 else
620     echo "threads: no"
621 fi