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