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.1)
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
49 if test "$CXX" = "CC"; then
52 CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility"
59 if echo $includedir | egrep "simgear$" > /dev/null; then
60 echo "includedir is" $includedir "libdir is" $libdir
62 includedir="${includedir}/simgear"
63 echo "includedir changed to" $includedir "libdir is" $libdir
66 dnl set logging; default value of with_logging=yes
67 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
68 if test "x$with_logging" = "xno" ; then
69 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
72 # Specify if we want to build with Norman's jpeg image server support.
73 # This requires libjpeg to be installed and available.
74 # Default to with_jpeg_server=no
76 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
77 if test "x$with_jpeg_factory" = "xyes" ; then
78 echo "Building with Norman's jpeg image factory support"
79 AC_CHECK_LIB(jpeg, jpeg_start_compress)
80 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
82 echo "In order to build the jpeg factory code you need libjpeg installed."
83 echo "otherwise please configure with the --with-jpeg-sever=no option"
85 echo "libjpeg is available at :"
86 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
90 echo "Building without Norman's jpeg image server support"
92 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
95 dnl Determine an extra directories to add to include/lib search paths
97 *-apple-darwin* | *-*-mingw32*)
98 echo no EXTRA_DIRS for $host
102 if test -d /usr/X11R6 ; then
103 EXTRA_DIR1="/usr/X11R6"
105 if test -d /opt/X11R6 ; then
106 EXTRA_DIR2="/opt/X11R6"
108 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
112 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
115 dnl Using AM_CONDITIONAL is a step out of the protected little
116 dnl automake fold so it is potentially dangerous. But, we are
117 dnl beginning to run into cases where the standard checks are not
118 dnl enough. AM_CONDITIONALS are then referenced to conditionally
119 dnl build a Makefile.in from a Makefile.am which lets us define custom
120 dnl includes, compile alternative source files, etc.
122 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
123 dnl to use it if it is.
125 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
126 echo no fancy X11 check
135 dnl Checks for libraries.
143 dnl Thread related checks
144 AC_CHECK_LIB(pthread, pthread_exit)
145 AC_CHECK_HEADER(pthread.h)
146 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
147 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
148 CFLAGS="$CFLAGS -D_REENTRANT"
150 if test "x$ac_cv_lib_pthread_pthread_exit" != "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
151 dnl FreeBSD: System has pthread.h, but -lpthread library check
152 dnl fails. See if we need -pthread instead of -lpthread and look
153 dnl for the functions in libc_r.
154 save_CXXFLAGS="$CXXFLAGS"
155 save_CFLAGS="$CFLAGS"
156 CXXFLAGS="-pthread $CXXFLAGS"
157 CFLAGS="-pthread $FLAGS"
159 AC_CHECK_LIB(c_r, pthread_exit)
160 if test "x$ac_cv_lib_c_r_pthread_exit" != "xyes"; then
161 CXXFLAGS=$save_CXXFLAGS
164 dnl This is cheating a bit. pthread_exit comes with using -pthread, not -lpthread
165 ac_cv_lib_pthread_pthread_exit="yes"
169 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
171 AC_CHECK_LIB(socket, socket)
173 dnl check for glut location
174 AC_CHECK_HEADER(GL/glut.h)
175 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
176 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
178 AC_CHECK_HEADER(GLUT/glut.h)
179 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
180 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
182 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
187 dnl check for OpenGL related libraries
189 *-*-cygwin* | *-*-mingw32*)
190 dnl CygWin under Windoze.
192 echo Win32 specific hacks...
193 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
194 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
196 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
197 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
199 dnl add -lwsock32 for mingwin
202 base_LIBS="$base_LIBS -lws2_32"
206 echo "Will link apps with $LIBS"
212 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
216 dnl X-Windows based machines
218 AC_CHECK_LIB(X11, XCreateWindow)
219 AC_CHECK_LIB(Xext, XShmCreateImage)
220 AC_CHECK_LIB(Xi, XGetExtensionVersion)
221 AC_CHECK_LIB(ICE, IceOpenConnection)
222 AC_CHECK_LIB(SM, SmcOpenConnection)
223 AC_CHECK_LIB(Xt, XtMalloc)
224 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
226 AC_CHECK_LIB(GLcore, glNewList)
227 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
228 dnl if no GLcore, check for GL
229 AC_CHECK_LIB(GL, glNewList)
230 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
231 dnl if no GL, check for MesaGL
232 AC_CHECK_LIB(MesaGL, glNewList)
235 dnl if GLcore found, then also check for GL
236 AC_CHECK_LIB(GL, glXCreateContext)
239 dnl if using mesa, check for xmesa.h
240 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
241 AC_CHECK_HEADER(GL/fxmesa.h)
242 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
243 AC_DEFINE([XMESA], 1, [Define for fxmesa])
244 AC_DEFINE([FX], 1, [Define for fxmesa])
248 AC_CHECK_LIB(GLU, gluLookAt)
249 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
250 dnl if no GLU, check for MesaGLU
251 AC_CHECK_LIB(MesaGLU, gluLookAt)
263 AC_SUBST(opengl_LIBS)
265 dnl Check for MS Windows environment
266 AC_CHECK_HEADER(windows.h)
267 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
269 # The following are C++ items that need to be tested for with the c++
274 dnl Check for "plib" without which we cannot go on
275 AC_CHECK_HEADER(plib/ul.h)
276 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
278 echo "You *must* have the plib library installed on your system to build"
281 echo "Please see README.plib for more details."
283 echo "configure aborted."
287 AC_MSG_CHECKING([for plib 1.6.0 or newer])
291 #define MIN_PLIB_VERSION 160
294 int major, minor, micro;
296 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
305 [AC_MSG_RESULT(wrong version);
306 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
310 dnl Check for MetaKit
311 AC_CHECK_HEADER(mk4.h)
312 if test "x$ac_cv_header_mk4_h" != "xyes"; then
314 echo "MetaKit library not found."
316 echo "If your OS does not provide an installable package for MetaKit"
317 echo "you will have to compile and install it first yourself. A copy"
318 echo "of metakit-$(VERSION).tar.gz is included with SimGear. You will"
319 echo "have to untar this source code, and follow its included instructions"
320 echo "to compile and install on your system."
322 echo "configure aborted."
326 AC_MSG_CHECKING([for metakit 2.4.3 or newer])
328 LIBS="$saved_LIBS -lmk4"
332 #define MIN_MK4_VERSION 243
335 int major, minor, micro;
337 if ( d4_MetaKitLibraryVersion < MIN_MK4_VERSION ) {
346 [AC_MSG_RESULT(wrong version);
349 Install metakit 2.4.3 or later first.
351 Or, the compiler may not be finding your libmk4.so library.
352 Please check the config.log file for specific details of the
353 failure if you believe you have the correct metakit version.
354 Also, look up this issue in the FlightGear FAQ.])],
362 dnl Check for system installed zlib
363 AC_CHECK_HEADER(zlib.h)
364 if test "x$ac_cv_header_zlib_h" != "xyes"; then
366 echo "zlib library not found."
368 echo "If your OS does not provide an installable package for zlib"
369 echo "you will have to compile and install it first yourself. A copy"
370 echo "of zlib-1.1.4.tar.gz is included with SimGear. You will"
371 echo "have to untar this source code, and follow its included instructions"
372 echo "to compile and install on your system."
374 echo "configure aborted."
378 dnl Checks for header files.
381 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
382 sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
384 if test "x$ac_cv_header_stdint_h" = "xyes"; then
385 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
388 dnl Checks for typedefs, structures, and compiler characteristics.
394 dnl Checks for library functions.
398 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
399 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
401 AM_CONFIG_HEADER(simgear/simgear_config.h)
409 simgear/compatibility/Makefile \
410 simgear/bucket/Makefile \
411 simgear/debug/Makefile \
412 simgear/ephemeris/Makefile \
413 simgear/io/Makefile \
414 simgear/magvar/Makefile \
415 simgear/math/Makefile \
416 simgear/metar/Makefile \
417 simgear/misc/Makefile \
418 simgear/route/Makefile \
419 simgear/screen/Makefile \
420 simgear/serial/Makefile \
421 simgear/sky/Makefile \
422 simgear/sky/clouds3d/Makefile \
423 simgear/threads/Makefile \
424 simgear/timing/Makefile \
425 simgear/xgl/Makefile \
426 simgear/xml/Makefile \
432 echo "Configure Summary"
433 echo "================="
435 echo "Prefix: $prefix"
437 if test "x$with_logging" != "x"; then
438 echo "Debug messages: $with_logging"
440 echo "Debug messages: yes"
443 echo -n "Automake version: "
444 automake --version | head -1
446 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
447 echo "With GL/glut.h"
449 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
450 echo "With GLUT/glut.h"
453 if test "x$with_jpeg_factory" = "xyes"; then
454 echo "With JPEG Factory support"
456 echo "Without JPEG Factory support"
459 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
460 echo "Threads: pthread lib found."
462 echo "Threads: no threads (pthread lib not found.)"