]> git.mxchange.org Git - flightgear.git/blob - configure.ac
Merge branch 'next' of gitorious.org:fg/flightgear into atcdcl
[flightgear.git] / configure.ac
1 dnl Process this file with autogen.sh to produce a working configure
2 dnl script.
3
4 AC_INIT(FlightGear, m4_esyscmd([cat ./version | tr -d '\n']), [http://www.flightgear.org])
5
6 dnl Ensure touching the version causes autoconf to re-run
7 AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/version'])
8
9 AC_CONFIG_SRCDIR([src/Airports/simple.cxx])
10
11 dnl Require at least automake 2.52
12 AC_PREREQ(2.52)
13
14 dnl Initialize the automake stuff
15 dnl set the $host variable based on local machine/os
16 AC_CANONICAL_TARGET
17 AM_INIT_AUTOMAKE([dist-bzip2])
18
19 # variables for version.h
20 AC_DEFINE([HAVE_VERSION_H], 1, [Set if version.h is generated])
21
22 # are we running under Hudson? (defines BUILD_ID, BUILD_NUMBER in the environment)
23 if test "x$BUILD_ID" != "x" ; then
24     AC_SUBST([HUDSON_BUILD_ID], $BUILD_ID)
25     AC_SUBST([HUDSON_BUILD_NUMBER], $BUILD_NUMBER)
26 else
27     AC_SUBST([HUDSON_BUILD_ID], [none])
28     AC_SUBST([HUDSON_BUILD_NUMBER], 0)
29 fi
30
31 AC_CHECK_PROG([HAVE_GIT], git, 1)
32 if test "x$HAVE_GIT" != "x" ; then 
33     # git might be installed, but we might be building from a tarball
34     if git rev-parse ; then
35         AC_SUBST([REVISION], `git rev-parse HEAD`)
36     else
37         AC_SUBST([REVISION], [none])    
38     fi
39 else
40     AC_SUBST([REVISION], [none])        
41 fi
42
43 dnl Checks for programs.
44 AC_PROG_MAKE_SET
45 AC_PROG_CC
46 AC_PROG_CPP
47 AC_PROG_CXX
48 AC_PROG_CXXCPP
49 AC_PROG_RANLIB
50 AC_PROG_INSTALL
51 AC_PROG_LN_S
52 AX_BOOST_BASE([1.37.0])
53
54 # Show all compiler warnings by default
55 CXXFLAGS="$CXXFLAGS -Wall"
56 CFLAGS="$CFLAGS -Wall"
57
58 if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
59    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
60 fi
61
62 # specify the simgear location
63 AC_ARG_WITH(simgear, [  --with-simgear=PREFIX   Specify the prefix path to SimGear])
64
65 if test "x$with_simgear" != "x" ; then
66     echo "SimGear prefix path is $with_simgear"
67     EXTRA_DIRS="${EXTRA_DIRS} $with_simgear"
68     CXXFLAGS="$CXXFLAGS -I$with_simgear"
69 fi
70
71 # specify the plib location
72 AC_ARG_WITH(plib, [  --with-plib=PREFIX      Specify the prefix path to plib])
73
74 if test "x$with_plib" != "x" ; then
75     echo "plib prefix is $with_plib"
76     EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
77 fi
78
79 # specify the osg location
80 AC_ARG_WITH(osg, [  --with-osg=PREFIX       Specify the prefix path to osg])
81
82 if test "x$with_osg" != "x" ; then
83     echo "osg prefix is $with_osg"
84     EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
85 fi
86
87 # specify framework related locations for Mac OS X
88 case "${host}" in
89 *-apple-darwin*)
90
91     dnl Thank you Christian Bauer from SheepSaver
92     dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
93     dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_FOUND) ; 
94     AC_DEFUN([AC_CHECK_FRAMEWORK], [
95     AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
96     AC_CACHE_CHECK([whether compiler supports framework $1],
97         ac_Framework, [
98         saved_LIBS="$LIBS"
99         FRAMEWORKS="$FRAMEWORKS -framework $1"
100         if test "$3" = ""; then
101             FRAMEWORKS="$FRAMEWORKS $ADD2LD"
102         elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
103             FRAMEWORKS="$FRAMEWORKS -F$3"
104             CXXFLAGS="$CXXFLAGS -F$3"
105             CCFLAGS="$CCFLAGS -F$3"
106             CPPFLAGS="$CPPFLAGS -F$3"
107             dnl This is needed for AC_TRY_LINK when a framework path is specified
108             export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
109         fi
110         AC_TRY_LINK(
111         [$2], [],
112         [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
113         )
114     ])
115     AS_IF([test AS_VAR_GET(ac_Framework) = yes],
116         [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
117     )
118     AS_IF([test AS_VAR_GET(ac_Framework) = yes], $4)
119     AS_VAR_POPDEF([ac_Framework])dnl
120     ])
121
122     # Mac OS X specific configure options
123     AC_ARG_WITH(cocoa_framework, [  --with-cocoa-framework         Use the Cocoa rather than Carbon])
124     if test "x$with_cocoa_framework" != "x" ; then
125         macAPI=Cocoa
126         AC_MSG_NOTICE([Using Cocoa framework])
127     else
128         macAPI=Carbon
129         AC_MSG_NOTICE([Using Carbon framework])
130     fi
131
132     AC_ARG_WITH(osg_framework, [  --with-osg-framework=PREFIX    Specify the prefix path to osg frameworks [default=standard framework paths]])
133     if test "x$with_osg_framework" != "x" ; then
134         echo "osg prefix is $with_osg_framework"
135         export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
136     fi
137
138     AC_ARG_WITH(plib_framework, [  --with-plib-framework=PREFIX   Specify the prefix path to PLIB framework [default=standard framework paths]])
139     if test "x$with_plib_framework" != "x" ; then
140         echo "plib prefix is $with_plib_framework"
141         export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_plib_framework"
142     fi
143
144     AC_ARG_WITH(alut_framework, [  --with-alut-framework=PREFIX   Specify the prefix path to ALUT.framework ])
145     if test "x$with_alut_framework" != "x"; then
146         echo "ALUT framework prefix is $with_alut_framework"
147     fi
148
149     ;;
150 esac
151
152 dnl Determine an extra directories to add to include/lib search paths
153 case "${host}" in
154 *-apple-darwin* | *-*-mingw32*)
155     echo no EXTRA_DIRS for $host
156     ;;
157
158 *-*-cygwin*)
159     if test -d /usr/local ; then
160         EXTRA_DIRS="${EXTRA_DIRS} /usr/local"
161     fi
162     ;;
163
164 *)
165     if test -d /usr/X11R6 ; then
166         EXTRA_DIR1="/usr/X11R6"
167     fi
168     if test -d /opt/X11R6 ; then
169         EXTRA_DIR2="/opt/X11R6"
170     fi
171     EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2 /usr/local"
172     ;;
173
174 esac
175 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
176
177
178 case "${host}" in
179 *-*-irix*)
180     if test "$CXX" = "CC"; then
181         AR="CC -ar"
182         ARFLAGS="-o"
183         CXXFLAGS="$CXXFLAGS -c99 -I$with_simgear/include/simgear/compatibility"
184         CFLAGS="$CFLAGS -c99"
185     else
186         AR="ar"
187         ARFLAGS="cru"
188     fi
189     ;;
190 *)
191     AR="ar"
192     ARFLAGS="cru"
193     ;;
194 esac
195 AC_SUBST(AR)
196 AC_SUBST(ARFLAGS)
197
198 dnl set logging; default value of with_logging=yes
199 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
200 if test "x$with_logging" = "xno" ; then
201     AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
202 fi
203
204 AC_ARG_ENABLE(sp_fdms, [  --enable-sp-fdms               Include special purpose Flight Models], [enable_sp_fdms="$enableval"] )
205 if test "x$enable_sp_fdms" != "xno"; then
206     AC_DEFINE([ENABLE_SP_FDM], 1, [Define to include special purpose FDMs])
207 else
208     AC_DEFINE([ENABLE_SP_FDM], 0, [Define to include special purpose FDMs])
209 fi
210 AM_CONDITIONAL(ENABLE_SP_FDM, test "x$enable_sp_fdms" != "xno")
211
212 dnl EXPERIMENTAL generic event driven input device
213 # defaults to no
214 AC_ARG_WITH(eventinput, [  --with-eventinput       Include event driven input (EXPERIMENTAL) [default=no]], [], [with_eventinput=no])
215 if test "x$with_eventinput" = "xyes"; then
216     AC_DEFINE([WITH_EVENTINPUT], 1, [Define to enable generic event driven input device])
217     case "${host}" in
218     dnl OS specific sources for event driven input
219     dnl Linux and Mac OS X are supported at this moment
220     *-apple-darwin*)
221         eventinput_EXTRA_OBJS="FGMacOSXEventInput.o"
222         eventinput_INCUDES=""
223         eventinput_LIBS=""
224         ;;
225     *linux*)
226         dnl
227         dnl FIXME: include paths for dbus are hard-coded at this moment.
228         dnl FIXME: these must be found in configure
229         dnl
230         eventinput_EXTRA_OBJS="FGLinuxEventInput.o"
231         eventinput_INCLUDES="-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/lib/dbus-1.0/include"
232         eventinput_LIBS="-ldbus-1 -lhal"
233         ;;
234     *)
235         echo "Event driven input is not supported on ${host}."
236         ;;
237     esac
238     AC_SUBST(eventinput_EXTRA_OBJS)
239     AC_SUBST(eventinput_INCLUDES)
240     AC_SUBST(eventinput_LIBS)
241 fi
242 AM_CONDITIONAL(WITH_EVENTINPUT, test "x$with_eventinput" = "xyes")
243
244 dnl Thread related checks
245 # defaults to yes
246 AC_ARG_WITH(threads, [  --with-threads          Include tile loading threads [default=yes]], [], [with_threads=yes])
247 if test "x$with_threads" = "xyes"; then
248     AC_DEFINE([ENABLE_THREADS], 1, [Define to enable threaded tile paging])
249     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
250     CFLAGS="$CFLAGS -D_REENTRANT"
251 fi
252 AC_CHECK_HEADER(pthread.h)
253
254 dnl Used by JSBSim to conditionally compile in fgfs interface code
255 AC_DEFINE([FGFS], 1, [Define so that JSBSim compiles in 'library' mode])
256
257 # Check for MS Windows environment
258 AC_CHECK_HEADER(windows.h)
259
260 dnl Using AM_CONDITIONAL is a step out of the protected little 
261 dnl automake fold so it is potentially dangerous.  But, we are
262 dnl beginning to run into cases where the standard checks are not
263 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
264 dnl build a Makefile.in from a Makefile.am which lets us define custom
265 dnl includes, compile alternative source files, etc.
266
267 dnl Check for external variables daylight and timezone.
268 AC_EXT_DAYLIGHT
269 if test "$have_daylight" = yes; then
270     AC_DEFINE([HAVE_DAYLIGHT], 1, [Define if system has daylight variable])
271 fi
272
273 AC_EXT_TIMEZONE
274 if test "$have_timezone" = yes; then
275     AC_DEFINE([HAVE_TIMEZONE], 1, [Define if system has timezone variable])
276 fi
277
278
279 dnl add joystick support libraries
280 dnl search for FreeBSD library
281 AC_SEARCH_LIBS(hid_init, usbhid)
282 joystick_LIBS="$LIBS"
283 LIBS=""
284
285
286 dnl ENABLE_AUDIO_SUPPORT could be depricated at any time in favor of
287 dnl just assuming we have audio support on all platform.  We can
288 dnl depend on plib to hide the details.
289 AC_DEFINE([ENABLE_AUDIO_SUPPORT], 1, [Define for audio support])
290
291 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
292 dnl to use it if it is.
293 case "${host}" in
294 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
295     echo no fancy X11 check
296     ;;
297
298 *)
299     AC_PATH_XTRA
300     ;;
301
302 esac
303
304 dnl Checks for libraries.
305
306 dnl Thread related checks
307 AC_SEARCH_LIBS(pthread_create, [pthread c_r])
308 if test "x$ac_cv_header_pthread_h" = "xyes"; then
309   if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
310     CXXFLAGS="-pthread $CXXFLAGS"
311     CFLAGS="-pthread $CFLAGS"
312     LIBS="-lsgthreads $LIBS"
313   fi
314 fi
315
316 thread_LIBS="$LIBS"
317 LIBS=""
318
319 dnl search for network related libraries
320 AC_SEARCH_LIBS(inet_addr, xnet)
321 AC_SEARCH_LIBS(socket, socket)
322 AC_SEARCH_LIBS(main, nsl)
323
324 network_LIBS="$LIBS"
325 LIBS=""
326
327 dnl check for some default libraries
328 AC_SEARCH_LIBS(sqrt, [am ffm fm fastm m])
329 AC_SEARCH_LIBS(ceil, m)
330 AC_SEARCH_LIBS(dlclose, dl)
331 AC_SEARCH_LIBS(clock_gettime, rt)
332
333 base_LIBS="$LIBS"
334
335 dnl Check for SDL or glut if enabled.
336 AC_ARG_ENABLE(osgviewer, [  --enable-osgviewer             Configure to use osgViewer (default)], [enable_osgviewer="$enableval"])
337 AC_ARG_ENABLE(sdl,  [  --enable-sdl                   Configure to use SDL], [enable_sdl="$enableval"])
338 AC_ARG_ENABLE(glut, [  --enable-glut                  Configure to use GLUT], [enable_glut="$enableval"])
339 AM_CONDITIONAL(USE_SDL, test "x$enable_sdl" = "xyes")
340 AM_CONDITIONAL(USE_GLUT, test "x$enable_glut" = "xyes")
341 if test "x$enable_sdl" != "xyes" -a "x$enable_glut" != "xyes" -a "x$enable_osgviewer" != "xno"; then
342    enable_osgviewer="yes"
343 fi
344 if test \( "x$enable_osgviewer" = "xyes" \
345    -a \( "x$enable_sdl" = "xyes" -o "x$enable_glut" = "xyes" \) \) \
346    -o \( "x$enable_sdl" = "xyes" -a "x$enable_glut" = "xyes" \); then
347    echo " Only one of --enable-osgviewer, --enable-sdl, or --enable -glut may"
348    echo " be supplied."
349    exit
350 fi
351 AC_DEFINE([PU_USE_NONE], 1, [Define to use application's pu callbacks])
352
353 AC_ARG_ENABLE(osgdebug, [  --enable-osgdebug              Use OSG debug libraries], [enable_osgdebug="$enableval"])
354
355 dnl check for OpenGL related libraries
356 case "${host}" in
357 *-*-cygwin* | *-*-mingw32*)
358     dnl CygWin under Windoze.
359
360     echo Win32 specific hacks...
361     AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
362     AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
363
364     if test "x$enable_sdl" = "xyes"; then
365         AC_SEARCH_LIBS(SDL_Init, SDL)
366     else
367         LIBS="$LIBS -lglut32"
368     fi
369
370     LIBS="$LIBS -lglu32 -lopengl32 -luser32 -lgdi32"
371     joystick_LIBS="$joystick_LIBS -lwinmm"
372
373     dnl add -lwsock32 for mingwin
374     case "${host}" in
375     *-*-mingw32*)
376         echo "********** BUILDING FOR MINGW32 *************"
377         network_LIBS="$network_LIBS -lws2_32"
378         ;;
379     esac
380
381     echo "Will link apps with $LIBS"
382     ;;
383
384
385 *-apple-darwin*)
386     dnl Mac OS X
387
388     LIBS="$LIBS -framework GLUT -framework OpenGL -framework AGL -framework $macAPI -lobjc"
389     LDFLAGS="$LDFLAGS -headerpad_max_install_names"
390     joystick_LIBS="$joystick_LIBS -framework IOKit -framework CoreFoundation"
391     ;;
392
393 *)
394     dnl X-Windows based machines
395
396     dnl Skip X11 library tests if requested.
397     if test "x$no_x" != "xyes"; then
398         AC_SEARCH_LIBS(XCreateWindow, X11)
399         AC_SEARCH_LIBS(XShmCreateImage, Xext)
400         AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
401         AC_SEARCH_LIBS(IceOpenConnection, ICE)
402         AC_SEARCH_LIBS(SmcOpenConnection, SM)
403         AC_SEARCH_LIBS(XtMalloc, Xt)
404         AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
405     fi
406
407     AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
408     if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
409         dnl if GLcore found, then also check for GL
410         AC_SEARCH_LIBS(glXCreateContext, GL)
411     fi
412
413     dnl if using mesa, check for xmesa.h
414     if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
415         AC_CHECK_HEADER(GL/fxmesa.h)
416         if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
417             AC_DEFINE([XMESA], 1, [Define for fxmesa])
418             AC_DEFINE([FX], 1, [Define for fxmesa])
419         fi
420     fi
421
422     AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
423     AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
424     if test "x$enable_sdl" = "xyes"; then
425         AC_SEARCH_LIBS(SDL_Init, SDL)
426     fi
427     ;;
428
429 esac
430
431 opengl_LIBS="$LIBS"
432 LIBS="$base_LIBS $joystick_LIBS"
433
434 dnl check for OpenAL libraries
435 OPENAL_OK="no"
436 ALUT_OK="no"
437 case "${host}" in
438 *-*-cygwin* | *-*-mingw32*)
439     dnl CygWin under Windoze.
440     INCLUDES="$INCLUDES -I/usr/local/include/"
441     LIBS="$LIBS -L/usr/local/lib"
442     AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
443     AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
444     LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
445     openal_LIBS="$LIBS"
446     OPENAL_OK="$ac_cv_search_alGenBuffers"
447     ALUT_OK="$ac_cv_search_alutInit"
448     ;;
449
450 *-apple-darwin*)
451     dnl Mac OS X
452
453     # Mac OS X has OpenAL.framework, but no ALUT, by default, so we
454     # require use of a non-Apple ALUT.framework which we provide
455     openal_LIBS="-framework IOKit -framework OpenAL"
456     
457     AC_CHECK_FRAMEWORK(OpenAL, [#include <OpenAL/al.h>], "", [OPENAL_OK="yes"])
458     AC_CHECK_FRAMEWORK(ALUT, [#include <ALUT/alut.h>], $with_alut_framework, [
459         ALUT_OK="yes"
460         openal_LIBS="$openal_LIBS -framework ALUT"
461     ])
462     ;;
463
464 *)
465     dnl default unix style machines
466
467     save_LIBS=$LIBS
468     LIBS="$LIBS $thread_LIBS"
469     AC_SEARCH_LIBS(alGenBuffers, openal)
470     AC_SEARCH_LIBS(alutInit, [ alut openal ] )
471     OPENAL_OK="$ac_cv_search_alGenBuffers"
472     ALUT_OK="$ac_cv_search_alutInit"
473     openal_LIBS="$LIBS"
474     LIBS=$save_LIBS
475     ;;
476
477 esac
478
479 if test "$OPENAL_OK" == "no"; then
480     echo
481     echo "You *must* have the openal library installed on your system to build"
482     echo "SimGear!"
483     echo
484     echo "Please see README.OpenAL for more details."
485     echo
486     echo "configure aborted."
487     exit
488 fi
489
490 if test "$ALUT_OK" == "no"; then
491     echo
492     echo "You *must* have the alut library installed on your system to build"
493     echo "SimGear!"
494     echo
495     echo "Please see README.OpenAL for more details."
496     echo
497     echo "configure aborted."
498     exit
499 fi
500
501
502 LIBS="$base_LIBS"
503
504 AC_SUBST(base_LIBS)
505 AC_SUBST(openal_LIBS)
506 AC_SUBST(opengl_LIBS)
507 AC_SUBST(thread_LIBS)
508 AC_SUBST(network_LIBS)
509 AC_SUBST(joystick_LIBS)
510
511 # The following are C++ items that need to be tested for with the c++
512 # compiler
513
514 AC_LANG_PUSH(C++)
515
516 dnl Check for the presence of SimGear
517 if test "x$with_simgear" != "x"; then
518 AC_CHECK_HEADER($with_simgear/include/simgear/version.h, [ac_cv_header_simgear_version_h=yes], [ac_cv_header_simgear_version_h=no])
519 else
520 AC_CHECK_HEADER(simgear/version.h)
521 fi
522 if test "x$ac_cv_header_simgear_version_h" != "xyes"; then
523     echo
524     echo "You *must* have the SimGear support library installed on your system"
525     echo "to build the FGFS simulator!"
526     echo
527     echo "Please see README.SimGear for more details."
528     echo
529     echo "configure aborted."
530     exit
531 fi
532
533 AC_MSG_CHECKING([for SimGear 2.0.0 or newer])
534 AC_TRY_RUN([
535 #include <stdio.h>
536
537 #include <simgear/version.h>
538
539 #define STRINGIFY(X) XSTRINGIFY(X)
540 #define XSTRINGIFY(X) #X
541
542 #define MIN_MAJOR 2
543 #define MIN_MINOR 0
544 #define MIN_MICRO 0
545
546 int main() {
547     int major, minor, micro;
548
549     /* printf("%d.%d.%d or greater, ", MIN_MAJOR, MIN_MINOR, MIN_MICRO); */
550     printf("[found %s] ... ", STRINGIFY(SIMGEAR_VERSION));
551
552     sscanf( STRINGIFY(SIMGEAR_VERSION), "%d.%d.%d", &major, &minor, &micro );
553
554     if ( (major < MIN_MAJOR) ||
555          (major == MIN_MAJOR && minor < MIN_MINOR) ||
556          (major == MIN_MAJOR && minor == MIN_MINOR && micro < MIN_MICRO) ) {
557          return -1;
558     }
559
560     return 0;
561 }
562
563 ],
564   AC_MSG_RESULT(yes),
565   [AC_MSG_RESULT(wrong version);
566    AC_MSG_ERROR([Install latest SimGear first...])],
567   AC_MSG_RESULT(yes)
568 )
569
570 LIBS="$saved_LIBS"
571
572 dnl Check if SimGear was built with Norman's JPEG factory support
573 if test "x$with_simgear" != "x"; then
574 AC_CHECK_HEADER($with_simgear/include/simgear/screen/jpgfactory.hxx,[ac_cv_header_simgear_screen_jpgfactory_hxx=yes],[ac_cv_header_simgear_screen_jpgfactory_hxx=no])
575 else
576 AC_CHECK_HEADER(simgear/screen/jpgfactory.hxx)
577 fi
578 if test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes"; then
579     AC_CHECK_LIB(jpeg, jpeg_start_compress)
580     if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
581         echo
582         echo "The JPEG factory code was built and installed with SimGear."
583         echo "However it appears the libjpeg is no longer installed."
584         echo "You need to install libjpeg or remove jpgfactory support from"
585         echo "SimGear"
586         echo
587         echo "libjpeg is available at :"
588         echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
589         exit 1
590     fi
591     AC_DEFINE([FG_JPEG_SERVER], 1,
592               [Define to build with jpeg screen shot server])
593 fi
594 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$ac_cv_header_simgear_screen_jpgfactory_hxx" = "xyes")
595
596 # Check for "plib" without which we cannot go on
597 case "${host}" in
598 *-apple-darwin*)
599     if test "x$with_plib_framework" != "x"; then
600         AC_CHECK_FRAMEWORK(PLIB, [#include <plib/ul.h>], $with_plib_framework, no)
601         plib_FRAMEWORK="$FRAMEWORKS"
602         AC_SUBST(plib_FRAMEWORK)
603         FRAMEWORKS=""
604     fi
605     ;;
606 esac
607 AM_CONDITIONAL(HAVE_FRAMEWORK_PLIB, test "x$ac_cv_framework_PLIB" != "x")
608
609 AC_CHECK_HEADER(plib/ul.h)
610 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
611     echo
612     echo "You *must* have the plib library installed on your system to build"
613     echo "the FGFS simulator!"
614     echo
615     echo "Please see README.plib for more details."
616     echo
617     echo "configure aborted."
618     exit
619 fi
620
621 echo "$DYLD_FRAMEWORK_PATH"
622 AC_MSG_CHECKING([for plib 1.8.5 or newer])
623 AC_TRY_RUN([
624 #include <plib/ul.h>
625
626 #define MIN_PLIB_VERSION 185
627
628 int main() {
629     if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
630          return -1;
631     }
632
633     return 0;
634 }
635
636 ],
637   AC_MSG_RESULT(yes),
638   [AC_MSG_RESULT(wrong version);
639    AC_MSG_ERROR([Install plib 1.8.5 or later first...])],
640   AC_MSG_RESULT(yes)
641 )
642
643 dnl If we get here then plib is available, so force use of plib
644 dnl joystick lib
645 AC_DEFINE([ENABLE_PLIB_JOYSTICK], 1, [Define to enable plib joystick support])
646
647 # Find the OSG libraries.  Note special handling for OS X frameworks
648 if test "x$with_osg_framework" = "x"; then
649     if test "x$enable_osgdebug" = "xyes"; then
650         AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion, , [AC_MSG_ERROR(OpenThreads library not found.)],)
651         AC_CHECK_LIB(osgd,osgGetVersion, , [AC_MSG_ERROR(OpenSceneGraph library not found.)],)
652         AC_CHECK_LIB(osgUtild,osgUtilGetVersion, , [AC_MSG_ERROR(OpenSceneGraph utility library not found.)],)
653         AC_CHECK_LIB(osgDBd,osgDBGetVersion, , [AC_MSG_ERROR(OpenSceneGraph database library not found.)],)
654         AC_CHECK_LIB(osgTextd,osgTextGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Text library not found.)],)
655         AC_CHECK_LIB(osgGAd,osgGAGetVersion, , [AC_MSG_ERROR(OpenSceneGraph GUI Abstraction library not found.)],)
656         AC_CHECK_LIB(osgViewerd,osgViewerGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Viewer library not found.)],)
657         AC_CHECK_LIB(osgSimd,osgSimGetVersion, , [AC_MSG_ERROR(OpenSceneGraph simulation library not found.)],)
658         AC_CHECK_LIB(osgParticled,osgParticleGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Particle library not found.)],)
659         AC_CHECK_LIB(osgFXd, osgFXGetVersion, , [AC_MSG_ERROR(OpenSceneGraph FX library not found.)],)
660     else
661         AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion, , [AC_MSG_ERROR(OpenThreads library not found.)],)
662         AC_CHECK_LIB(osg,osgGetVersion, , [AC_MSG_ERROR(OpenSceneGraph library not found.)],)
663         AC_CHECK_LIB(osgUtil,osgUtilGetVersion, , [AC_MSG_ERROR(OpenSceneGraph utility library not found.)],)
664         AC_CHECK_LIB(osgDB,osgDBGetVersion, , [AC_MSG_ERROR(OpenSceneGraph database library not found.)],)
665         AC_CHECK_LIB(osgText,osgTextGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Text library not found.)],)
666         AC_CHECK_LIB(osgGA,osgGAGetVersion, , [AC_MSG_ERROR(OpenSceneGraph GUI Abstraction library not found.)],)
667         AC_CHECK_LIB(osgViewer,osgViewerGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Viewer library not found.)],)
668         AC_CHECK_LIB(osgSim,osgSimGetVersion, , [AC_MSG_ERROR(OpenSceneGraph simulation library not found.)],)
669         AC_CHECK_LIB(osgParticle,osgParticleGetVersion, , [AC_MSG_ERROR(OpenSceneGraph Particle library not found.)],)
670         AC_CHECK_LIB(osgFX, osgFXGetVersion, , [AC_MSG_ERROR(OpenSceneGraph FX library not found.)],)
671     fi
672 else
673     # Checking osg frameworks.
674     AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
675     AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
676     AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
677     AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
678     AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
679     AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
680     AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
681     AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
682     AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
683     osg_FRAMEWORKS="$FRAMEWORKS"
684     FRAMEWORKS=""
685     AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
686     openthreads_FRAMEWORK="$FRAMEWORKS"
687     AC_SUBST(osg_FRAMEWORKS)
688     AC_SUBST(openthreads_FRAMEWORK)
689 fi
690 AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
691
692 AC_CHECK_HEADER(osg/Version)
693 if test "x$ac_cv_header_osg_Version" != "xyes"; then
694     echo
695     echo "You *must* have the OpenSceneGraph support library installed on your system"
696     echo "to build the FGFS simulator!"
697     echo
698     echo "Please see README.OSG for more details."
699     echo
700     echo "configure aborted."
701     exit
702 fi
703
704
705 AC_MSG_CHECKING([checking for osg::CullSettings::CLEAR_MASK])
706 AC_COMPILE_IFELSE(
707   [AC_LANG_PROGRAM([[#include <osg/CullSettings>]],
708     [[osg::CullSettings::VariablesMask mask = osg::CullSettings::CLEAR_MASK;]])],
709   [AC_DEFINE([HAVE_CULLSETTINGS_CLEAR_MASK],1,[define if OSG has CullSettings::CLEAR_MASK])
710    AC_MSG_RESULT([yes])],
711   [AC_MSG_RESULT([no])])
712
713 # Special handling for static version of OSG
714 if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_LIBRARY_STATIC" 2>/dev/null`" ; then
715     saved_LIBS="$LIBS"
716     LIBS=""
717     #***** Check image support (needed for static build) *****
718     AC_SEARCH_LIBS([jpeg_read_header], [jpeg], [CPPFLAGS="$CPPFLAGS -DOSG_JPEG_ENABLED"])
719     AC_SEARCH_LIBS([png_read_image], [png 'png -lz'], [CPPFLAGS="$CPPFLAGS -DOSG_PNG_ENABLED"])
720     AC_SEARCH_LIBS([TIFFOpen], [tiff], [CPPFLAGS="$CPPFLAGS -DOSG_TIFF_ENABLED"])
721     img_LIBS="$LIBS"
722     LIBS="$saved_LIBS"
723
724     if test "x$with_osg" != "x" ; then
725         osg_prefix="$with_osg"
726     else
727         osg_prefix="/usr"
728     fi
729     PKG_CHECK_EXISTS([openscenegraph], [osg_version="`$PKG_CONFIG --modversion openscenegraph 2>/dev/null`"])
730     LIBS="-L$osg_prefix/lib/osgPlugins-$osg_version -losgdb_bmp -losgdb_dds -losgdb_hdr -losgdb_pic -losgdb_pnm -losgdb_rgb -losgdb_tga \
731                                                           -losgdb_3ds -losgdb_ac -losgdb_ive -losgdb_osg -losgdb_txf \
732                                                           -losgVolume -losgTerrain $LIBS -losgUtil"
733
734     if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_JPEG_ENABLED" 2>/dev/null`" ; then
735       LIBS="$LIBS -losgdb_jpeg"
736     fi
737     if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_PNG_ENABLED" 2>/dev/null`" ; then
738       LIBS="$LIBS -losgdb_png"
739     fi
740     if test -n "`echo "$CPPFLAGS" "$CXXFLAGS" "$CFLAGS" | grep "\-DOSG_TIFF_ENABLED" 2>/dev/null`" ; then
741       LIBS="$LIBS -losgdb_tiff"
742     fi
743
744     LIBS="$LIBS $img_LIBS"
745 fi
746
747 AC_LANG_POP
748
749 dnl Check for system installed zlib
750 AC_CHECK_HEADER(zlib.h)
751 if test "x$ac_cv_header_zlib_h" != "xyes"; then
752     echo
753     echo "zlib library not found."
754     echo
755     echo "If your OS does not provide an installable package for zlib"
756     echo "you will have to compile and install it first yourself.  A copy"
757     echo "of zlib-1.1.4.tar.gz is included with SimGear.  You will"
758     echo "have to untar this source code, and follow it's included instructions"
759     echo "to compile and install on your system."
760     echo
761     echo "configure aborted."
762     echo
763 fi
764
765 dnl Check for Subversion library support
766 # libsvn support defaults to yes
767 save_LIBS=$LIBS
768 save_CPPFLAGS=$CPPFLAGS
769 AC_ARG_WITH(libsvn, [  --without-libsvn        Do not use libsvn for terrasync [default=no]], [], [with_libsvn=yes])
770 if test "x$with_libsvn" = "xyes"; then
771     LIBS="`apr-1-config --link-ld`"
772     CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes --cppflags`"
773     AC_CHECK_HEADERS([svn_client.h])
774        if test "x$ac_cv_header_svn_client_h" = "xyes"; then
775         echo "TerraSync will use libsvn"
776         AC_SEARCH_LIBS(svn_client_checkout, svn_client-1)
777         AC_SEARCH_LIBS(svn_cmdline_init, svn_subr-1)
778         svn_LIBS=$LIBS
779         svn_CPPFLAGS=$CPPFLAGS
780         AC_SUBST(svn_LIBS)
781         AC_SUBST(svn_CPPFLAGS)
782        else
783         echo "Libsvn not found. TerraSync will use command line subversion"
784         svn_LIBS=""
785         svn_CPPFLAGS=""
786        fi
787 else
788 echo "Libsvn explicitly disabled. TerraSync will use command line subversion"
789   svn_LIBS=""
790   svn_CPPFLAGS=""
791 fi
792 LIBS=$save_LIBS
793 CPPFLAGS=$save_CPPFLAGS
794
795 AC_MSG_CHECKING([for feenableexcept])
796 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE
797 #include <fenv.h>]], [[feenableexcept(FE_DIVBYZERO)]])],
798 [AC_DEFINE([HAVE_FEENABLEEXCEPT], 1, [define if system has fenableexcept])],
799 AC_MSG_RESULT([yes]),
800 AC_MSG_RESULT([no]))
801
802 dnl Checks for header files.
803 AC_HEADER_STDC
804 AC_CHECK_HEADERS( \
805         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \
806         sys/time.h sys/timeb.h unistd.h windows.h values.h )
807
808 dnl Checks for typedefs, structures, and compiler characteristics.
809 AC_C_CONST
810 AC_TYPE_SIZE_T
811 AC_HEADER_TIME
812 AC_STRUCT_TM
813
814 dnl Checks for library functions.
815 old_LIBS=$LIBS
816 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
817 AC_TYPE_SIGNAL
818 AC_FUNC_VPRINTF
819 AC_CHECK_FUNCS( [ \
820         ftime gettimeofday timegm memcpy bcopy mktime strstr rand mkfifo \
821         random drand48 setitimer getitimer signal GetLocalTime rint getrusage \
822         truncf ] )
823 LIBS=$old_LIBS
824
825 AM_CONFIG_HEADER(src/Include/config.h)
826
827 AC_CONFIG_FILES([ \
828         Makefile \
829         man/Makefile \
830         man/est-epsilon.1 \
831         man/fgfs.1 \
832         man/fgjs.1 \
833         man/gl-info.1 \
834         man/js_demo.1 \
835         man/pstest.1 \
836         scripts/Makefile \
837         scripts/debug/Makefile \
838         scripts/perl/Makefile \
839         scripts/perl/examples/Makefile \
840         scripts/python/Makefile \
841         src/Makefile \
842         src/Include/Makefile \
843         src/Include/version.h \
844         src/Aircraft/Makefile \
845         src/Airports/Makefile \
846         src/ATC/Makefile \
847         src/ATCDCL/Makefile \
848         src/Autopilot/Makefile \
849         src/Cockpit/Makefile \
850         src/Cockpit/built_in/Makefile \
851         src/Environment/Makefile \
852         src/FDM/ExternalNet/Makefile \
853         src/FDM/ExternalPipe/Makefile \
854         src/FDM/JSBSim/Makefile \
855         src/FDM/JSBSim/initialization/Makefile \
856         src/FDM/JSBSim/input_output/Makefile \
857         src/FDM/JSBSim/math/Makefile \
858         src/FDM/JSBSim/models/Makefile \
859         src/FDM/JSBSim/models/flight_control/Makefile \
860         src/FDM/JSBSim/models/atmosphere/Makefile \
861         src/FDM/JSBSim/models/propulsion/Makefile \
862         src/FDM/LaRCsim/Makefile \
863         src/FDM/SP/Makefile \
864         src/FDM/UIUCModel/Makefile \
865         src/FDM/YASim/Makefile \
866         src/FDM/Makefile \
867         src/GUI/Makefile \
868         src/Input/Makefile \
869         src/Instrumentation/Makefile \
870         src/Instrumentation/KLN89/Makefile \
871         src/Instrumentation/HUD/Makefile \
872         src/Main/Makefile \
873         src/Main/runfgfs \
874         src/Main/runfgfs.bat \
875         src/Model/Makefile \
876         src/AIModel/Makefile \
877         src/MultiPlayer/Makefile \
878         src/Navaids/Makefile \
879         src/Network/Makefile \
880         src/Scenery/Makefile \
881         src/Scripting/Makefile \
882         src/Sound/Makefile \
883         src/Systems/Makefile \
884         src/Time/Makefile \
885         src/Traffic/Makefile \
886         tests/Makefile \
887         utils/Makefile \
888         utils/GPSsmooth/Makefile \
889         utils/fgadmin/Makefile
890         utils/fgadmin/src/Makefile \
891         utils/js_server/Makefile \
892         utils/Modeller/Makefile \
893         utils/propmerge/Makefile \
894         utils/TerraSync/Makefile \
895         utils/xmlgrep/Makefile \
896         utils/fgviewer/Makefile
897 ])
898 AC_OUTPUT
899
900 AC_OUTPUT_COMMANDS([chmod 755 src/Main/runfgfs])
901
902 echo ""
903 echo "Configure Summary"
904 echo "================="
905
906 echo "Prefix: $prefix"
907
908 if test "x$with_logging" != "x"; then
909     echo "Log messages: $with_logging"
910 else
911     echo "Log messages: yes"
912 fi
913
914 echo -n "Automake version: "
915 automake --version | head -n 1
916
917 if test "x$with_multiplayer" != "xno"; then
918     echo "Building with multiplayer support"
919 fi
920
921 if test "x$with_threads" = "xyes"; then
922     echo "Threads: yes"
923 else
924     echo "Threads: no"
925 fi
926
927 if test "x$with_eventinput" = "xyes"; then
928     echo "Event input: yes"
929 else
930     echo "Event input: no"
931 fi
932
933 if test "x$enable_sp_fdms" != "xno"; then
934     echo "Include special purpose flight models: yes"
935 else
936     echo "Include special purpose flight models: no"
937 fi