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