1 dnl Process this file with autoget.sh to produce a working configure
7 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
9 dnl Require at least automake 2.52
12 dnl Initialize the automake stuff
13 AM_INIT_AUTOMAKE(SimGear, 0.3.3)
15 dnl Specify KAI C++ compiler and flags.
16 dnl Borrowed with slight modification from blitz distribution.
18 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
20 KCC*) # KAI C++ http://www.kai.com/
21 echo "Configuring for KAI C++"
22 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
23 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
24 CXX_DEBUG_FLAGS="-g +K0"
32 dnl Checks for programs.
41 dnl set the $host variable based on local machine/os
44 dnl Used on the Irix platform
47 if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
50 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility"
51 compatibility_DIR="compatibility"
62 AC_SUBST(compatibility_DIR)
64 if echo $includedir | egrep "simgear$" > /dev/null; then
65 echo "includedir is" $includedir "libdir is" $libdir
67 includedir="${includedir}/simgear"
68 echo "includedir changed to" $includedir "libdir is" $libdir
71 dnl set logging; default value of with_logging=yes
72 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
73 if test "x$with_logging" = "xno" ; then
74 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
77 # Specify if we want to build with Norman's jpeg image server support.
78 # This requires libjpeg to be installed and available.
79 # Default to with_jpeg_server=no
81 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
82 if test "x$with_jpeg_factory" = "xyes" ; then
83 echo "Building with Norman's jpeg image factory support"
84 AC_CHECK_LIB(jpeg, jpeg_start_compress)
85 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
87 echo "In order to build the jpeg factory code you need libjpeg installed."
88 echo "otherwise please configure with the --with-jpeg-sever=no option"
90 echo "libjpeg is available at :"
91 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
95 echo "Building without Norman's jpeg image server support"
97 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
100 dnl Determine an extra directories to add to include/lib search paths
102 *-apple-darwin* | *-*-mingw32*)
103 echo no EXTRA_DIRS for $host
107 if test -d /usr/X11R6 ; then
108 EXTRA_DIR1="/usr/X11R6"
110 if test -d /opt/X11R6 ; then
111 EXTRA_DIR2="/opt/X11R6"
113 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
117 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
120 dnl Using AM_CONDITIONAL is a step out of the protected little
121 dnl automake fold so it is potentially dangerous. But, we are
122 dnl beginning to run into cases where the standard checks are not
123 dnl enough. AM_CONDITIONALS are then referenced to conditionally
124 dnl build a Makefile.in from a Makefile.am which lets us define custom
125 dnl includes, compile alternative source files, etc.
127 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
128 dnl to use it if it is.
130 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
131 echo no fancy X11 check
140 dnl Checks for libraries.
142 dnl Thread related checks
143 AC_CHECK_HEADER(pthread.h)
144 AC_CHECK_LIB(pthread, pthread_exit)
145 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
146 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
147 CFLAGS="$CFLAGS -D_REENTRANT"
149 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
150 dnl FreeBSD: System has pthread.h, but -lpthread library check
151 dnl fails. See if we need -pthread instead of -lpthread and look
152 dnl for the functions in libc_r.
153 save_CXXFLAGS="$CXXFLAGS"
154 save_CFLAGS="$CFLAGS"
155 CXXFLAGS="-pthread $CXXFLAGS"
156 CFLAGS="-pthread $FLAGS"
158 AC_CHECK_LIB(c_r, pthread_exit)
159 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
160 CXXFLAGS=$save_CXXFLAGS
163 dnl This is cheating a bit. pthread_exit comes with using -pthread, not
165 ac_cv_lib_pthread_pthread_exit="yes"
170 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
175 dnl search for network related libraries
176 AC_SEARCH_LIBS(inet_addr, xnet)
177 AC_SEARCH_LIBS(socket, socket)
182 dnl check for some default libraries
183 AC_SEARCH_LIBS(cos, m)
187 dnl check for glut location
188 AC_CHECK_HEADER(GL/glut.h)
189 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
190 AC_DEFINE([GLUT_H], <GL/glut.h>, [Define as glut.h include location])
192 AC_CHECK_HEADER(GLUT/glut.h)
193 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
194 AC_DEFINE([GLUT_H], <GLUT/glut.h>, [Define as glut.h include location])
196 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
201 dnl check for OpenGL related libraries
203 *-*-cygwin* | *-*-mingw32*)
204 dnl CygWin under Windoze.
206 echo Win32 specific hacks...
207 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
208 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
210 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
211 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
213 dnl add -lwsock32 for mingwin
216 base_LIBS="$base_LIBS -lws2_32"
220 echo "Will link apps with $LIBS"
226 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
230 dnl X-Windows based machines
232 AC_SEARCH_LIBS(XCreateWindow, X11)
233 AC_SEARCH_LIBS(XShmCreateImage, Xext)
234 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
235 AC_SEARCH_LIBS(IceOpenConnection, ICE)
236 AC_SEARCH_LIBS(SmcOpenConnection, SM)
237 AC_SEARCH_LIBS(XtMalloc, Xt)
238 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
240 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
241 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
242 dnl if GLcore found, then also check for GL
243 AC_SEARCH_LIBS(glXCreateContext, GL)
246 dnl if using mesa, check for xmesa.h
247 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
248 AC_CHECK_HEADER(GL/fxmesa.h)
249 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
250 AC_DEFINE([XMESA], 1, [Define for fxmesa])
251 AC_DEFINE([FX], 1, [Define for fxmesa])
255 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
256 AC_SEARCH_LIBS(glutGetModifiers, [ glut freeglut ])
265 AC_SUBST(opengl_LIBS)
266 AC_SUBST(thread_LIBS)
267 AC_SUBST(network_LIBS)
269 dnl Check for MS Windows environment
270 AC_CHECK_HEADER(windows.h)
271 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
273 # The following are C++ items that need to be tested for with the c++
278 dnl Check for "plib" without which we cannot go on
279 AC_CHECK_HEADER(plib/ul.h)
280 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
282 echo "You *must* have the plib library installed on your system to build"
285 echo "Please see README.plib for more details."
287 echo "configure aborted."
291 AC_MSG_CHECKING([for plib 1.6.0 or newer])
295 #define MIN_PLIB_VERSION 160
298 int major, minor, micro;
300 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
309 [AC_MSG_RESULT(wrong version);
310 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
314 dnl Check for MetaKit
315 AC_CHECK_HEADER(mk4.h)
316 if test "x$ac_cv_header_mk4_h" != "xyes"; then
318 echo "MetaKit library not found."
320 echo "If your OS does not provide an installable package for MetaKit"
321 echo "you will have to compile and install it first yourself. A copy"
322 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
323 echo "have to untar this source code, and follow its included instructions"
324 echo "to compile and install on your system."
326 echo "configure aborted."
330 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
332 LIBS="$saved_LIBS -lmk4"
336 #define MIN_MK4_VERSION 243
339 int major, minor, micro;
341 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
350 [AC_MSG_RESULT(wrong version);
353 Install metakit 2.4.3 or later first.
355 Or, the compiler may not be finding your libmk4.so library.
356 Please check the config.log file for specific details of the
357 failure if you believe you have the correct metakit version.
358 Also, look up this issue in the FlightGear FAQ.])],
366 dnl Check for system installed zlib
367 AC_CHECK_HEADER(zlib.h)
368 if test "x$ac_cv_header_zlib_h" != "xyes"; then
370 echo "zlib library not found."
372 echo "If your OS does not provide an installable package for zlib"
373 echo "you will have to compile and install it first yourself. A copy"
374 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
375 echo "have to untar this source code, and follow its included instructions"
376 echo "to compile and install on your system."
378 echo "configure aborted."
382 dnl Checks for header files.
385 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
386 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
388 if test "x$ac_cv_header_stdint_h" = "xyes"; then
389 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
392 dnl Checks for typedefs, structures, and compiler characteristics.
398 dnl Checks for library functions.
402 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
403 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
405 AM_CONFIG_HEADER(simgear/simgear_config.h)
413 simgear/compatibility/Makefile \
414 simgear/bucket/Makefile \
415 simgear/debug/Makefile \
416 simgear/ephemeris/Makefile \
417 simgear/io/Makefile \
418 simgear/magvar/Makefile \
419 simgear/math/Makefile \
420 simgear/metar/Makefile \
421 simgear/misc/Makefile \
422 simgear/props/Makefile \
423 simgear/route/Makefile \
424 simgear/scene/Makefile \
425 simgear/scene/material/Makefile \
426 simgear/scene/model/Makefile \
427 simgear/scene/sky/Makefile \
428 simgear/scene/sky/clouds3d/Makefile \
429 simgear/scene/tgdb/Makefile \
430 simgear/screen/Makefile \
431 simgear/serial/Makefile \
432 simgear/sound/Makefile \
433 simgear/threads/Makefile \
434 simgear/timing/Makefile \
435 simgear/xgl/Makefile \
436 simgear/xml/Makefile \
442 echo "Configure Summary"
443 echo "================="
445 echo "Prefix: $prefix"
447 if test "x$with_logging" != "x"; then
448 echo "Debug messages: $with_logging"
450 echo "Debug messages: yes"
453 echo -n "Automake version: "
454 automake --version | head -1
456 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
457 echo "With GL/glut.h"
459 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
460 echo "With GLUT/glut.h"
463 if test "x$with_jpeg_factory" = "xyes"; then
464 echo "With JPEG Factory support"
466 echo "Without JPEG Factory support"
469 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
470 echo "Threads: pthread lib found."
472 echo "Threads: no threads (pthread lib not found.)"