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