1 dnl Process this file with autoget.sh to produce a working configure
5 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
7 dnl Require at least automake 2.52
10 dnl Initialize the automake stuff
11 AM_INIT_AUTOMAKE(SimGear, 0.3.10)
13 dnl Specify KAI C++ compiler and flags.
14 dnl Borrowed with slight modification from blitz distribution.
16 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
18 KCC*) # KAI C++ http://www.kai.com/
19 echo "Configuring for KAI C++"
20 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
21 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
22 CXX_DEBUG_FLAGS="-g +K0"
27 AC_MSG_CHECKING([CXX])
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/MIPSpro740"
51 compatibility_DIR="compatibility"
52 MIPSpro_DIRS="MIPSpro740"
53 AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
56 if ( _COMPILER_VERSION < 740 ) {
62 ], AC_MSG_RESULT(yes),
64 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
65 MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
66 AC_MSG_WARN([Using our own subset of the STL headers])
67 ], AC_MSG_RESULT(yes))
68 AC_SUBST(MIPSpro_DIRS)
79 AC_SUBST(compatibility_DIR)
81 if echo $includedir | egrep "simgear$" > /dev/null; then
82 echo "includedir is" $includedir "libdir is" $libdir
84 includedir="${includedir}/simgear"
85 echo "includedir changed to" $includedir "libdir is" $libdir
88 dnl set logging; default value of with_logging=yes
89 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
90 if test "x$with_logging" = "xno" ; then
91 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
94 # Specify if we want to build with Norman's jpeg image server support.
95 # This requires libjpeg to be installed and available.
96 # Default to with_jpeg_server=no
98 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
99 if test "x$with_jpeg_factory" = "xyes" ; then
100 echo "Building with Norman's jpeg image factory support"
101 AC_CHECK_LIB(jpeg, jpeg_start_compress)
102 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
104 echo "In order to build the jpeg factory code you need libjpeg installed."
105 echo "otherwise please configure with the --with-jpeg-sever=no option"
107 echo "libjpeg is available at :"
108 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
112 echo "Building without Norman's jpeg image server support"
114 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
116 # specify the plib location
117 AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
119 if test "x$with_plib" != "x" ; then
120 echo "plib prefix is $with_plib"
121 EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
124 # specify the osg location
125 AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
127 if test "x$with_osg" != "x" ; then
128 echo "osg prefix is $with_osg"
129 EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
132 dnl Determine an extra directories to add to include/lib search paths
134 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
135 echo no EXTRA_DIRS for $host
139 if test -d /usr/X11R6 ; then
140 EXTRA_DIR1="/usr/X11R6"
142 if test -d /opt/X11R6 ; then
143 EXTRA_DIR2="/opt/X11R6"
145 EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
149 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
152 dnl Using AM_CONDITIONAL is a step out of the protected little
153 dnl automake fold so it is potentially dangerous. But, we are
154 dnl beginning to run into cases where the standard checks are not
155 dnl enough. AM_CONDITIONALS are then referenced to conditionally
156 dnl build a Makefile.in from a Makefile.am which lets us define custom
157 dnl includes, compile alternative source files, etc.
159 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
160 dnl to use it if it is.
162 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
163 echo no fancy X11 check
172 dnl Checks for libraries.
174 dnl Thread related checks
175 AC_CHECK_HEADER(pthread.h)
176 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
177 if test "x$ac_cv_header_pthread_h" = "xyes"; then
178 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
179 CFLAGS="$CFLAGS -D_REENTRANT"
181 if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
182 CXXFLAGS="-pthread $CXXFLAGS"
183 CFLAGS="-pthread $CFLAGS"
187 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
192 dnl search for network related libraries
193 AC_SEARCH_LIBS(inet_addr, xnet)
194 AC_SEARCH_LIBS(socket, socket)
199 dnl check for some default libraries
200 AC_SEARCH_LIBS(cos, m)
204 dnl check for OpenGL related libraries
206 *-*-cygwin* | *-*-mingw32*)
207 dnl CygWin under Windoze.
209 echo Win32 specific hacks...
210 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
211 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
213 LIBS="$LIBS -lglu32 -lopengl32"
214 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
216 dnl add -lwsock32 for mingwin
219 base_LIBS="$base_LIBS -lws2_32"
223 echo "Will link apps with $LIBS"
229 LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
233 dnl X-Windows based machines
235 AC_SEARCH_LIBS(XCreateWindow, X11)
236 AC_SEARCH_LIBS(XShmCreateImage, Xext)
237 AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
238 AC_SEARCH_LIBS(IceOpenConnection, ICE)
239 AC_SEARCH_LIBS(SmcOpenConnection, SM)
240 AC_SEARCH_LIBS(XtMalloc, Xt)
241 AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
243 AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
244 if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
245 dnl if GLcore found, then also check for GL
246 AC_SEARCH_LIBS(glXCreateContext, GL)
249 dnl if using mesa, check for xmesa.h
250 if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; then
251 AC_CHECK_HEADER(GL/fxmesa.h)
252 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
253 AC_DEFINE([XMESA], 1, [Define for fxmesa])
254 AC_DEFINE([FX], 1, [Define for fxmesa])
258 AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
263 AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
264 AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
269 dnl check for OpenAL libraries
272 *-*-cygwin* | *-*-mingw32*)
273 dnl CygWin under Windoze.
274 INCLUDES="$INCLUDES -I/usr/local/include/"
275 LIBS="$LIBS -L/usr/local/lib"
276 AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal ] )
277 AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
278 LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
280 OPENAL_OK="$ac_cv_search_alGenBuffers"
286 LIBS="$LIBS -framework IOKit -framework OpenAL"
288 # not sure how to test if OpenAL exists on MacOS (does it come by default?)
293 dnl default unix style machines
296 LIBS="$LIBS $thread_LIBS"
297 AC_SEARCH_LIBS(alGenBuffers, openal)
298 AC_SEARCH_LIBS(alutInit, [ alut openal ] )
299 OPENAL_OK="$ac_cv_search_alGenBuffers"
306 if test "$OPENAL_OK" == "no"; then
308 echo "You *must* have the openal library installed on your system to build"
311 echo "Please see README.OpenAL for more details."
313 echo "configure aborted."
320 AC_SUBST(openal_LIBS)
321 AC_SUBST(opengl_LIBS)
322 AC_SUBST(thread_LIBS)
323 AC_SUBST(network_LIBS)
325 dnl Check for MS Windows environment
326 AC_CHECK_HEADER(windows.h)
327 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
329 # The following are C++ items that need to be tested for with the c++
334 dnl Check for "plib" without which we cannot go on
335 AC_CHECK_HEADER(plib/ul.h)
336 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
338 echo "You *must* have the plib library installed on your system to build"
341 echo "Please see README.plib for more details."
343 echo "configure aborted."
347 AC_MSG_CHECKING([for plib 1.8.4 or newer])
351 #define MIN_PLIB_VERSION 184
354 int major, minor, micro;
356 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
365 [AC_MSG_RESULT(wrong version);
366 AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
374 dnl Check for system installed zlib
375 AC_CHECK_HEADER(zlib.h)
376 if test "x$ac_cv_header_zlib_h" != "xyes"; then
378 echo "zlib library not found."
380 echo "If your OS does not provide an installable package for zlib"
381 echo "you will have to compile and install it first yourself. A copy"
382 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
383 echo "have to untar this source code, and follow its included instructions"
384 echo "to compile and install on your system."
386 echo "configure aborted."
390 dnl Checks for header files.
393 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
394 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
396 if test "x$ac_cv_header_stdint_h" = "xyes"; then
397 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
400 dnl Checks for typedefs, structures, and compiler characteristics.
407 dnl Checks for library functions.
409 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
413 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
414 random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
417 AM_CONFIG_HEADER(simgear/simgear_config.h)
424 simgear/compatibility/Makefile \
425 simgear/compatibility/MIPSpro721/Makefile \
426 simgear/compatibility/MIPSpro740/Makefile \
427 simgear/bucket/Makefile \
428 simgear/debug/Makefile \
429 simgear/ephemeris/Makefile \
430 simgear/io/Makefile \
431 simgear/magvar/Makefile \
432 simgear/math/Makefile \
433 simgear/environment/Makefile \
434 simgear/misc/Makefile \
435 simgear/nasal/Makefile \
436 simgear/props/Makefile \
437 simgear/route/Makefile \
438 simgear/scene/Makefile \
439 simgear/scene/material/Makefile \
440 simgear/scene/model/Makefile \
441 simgear/scene/sky/Makefile \
442 simgear/scene/tgdb/Makefile \
443 simgear/scene/util/Makefile \
444 simgear/screen/Makefile \
445 simgear/serial/Makefile \
446 simgear/sound/Makefile \
447 simgear/structure/Makefile \
448 simgear/threads/Makefile \
449 simgear/timing/Makefile \
450 simgear/xml/Makefile \
456 echo "Configure Summary"
457 echo "================="
459 echo "Prefix: $prefix"
461 if test "x$with_logging" != "x"; then
462 echo "Debug messages: $with_logging"
464 echo "Debug messages: yes"
467 echo -n "Automake version: "
468 automake --version | head -1
470 if test "x$with_jpeg_factory" = "xyes"; then
471 echo "With JPEG Factory support"
473 echo "Without JPEG Factory support"
476 if test "x$ac_cv_header_pthread_h" = "xyes"; then
477 echo "Threads: pthread lib found."
479 echo "Threads: no threads (pthread lib not found.)"