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