1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
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.
44 dnl Used on the Irix platform
49 if test "$CXX" = "CC"; then
58 if echo $includedir | egrep "simgear$" > /dev/null; then
59 echo "includedir is" $includedir "libdir is" $libdir
61 includedir="${includedir}/simgear"
62 echo "includedir changed to" $includedir "libdir is" $libdir
65 dnl set logging; default value of with_logging=yes
66 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
67 if test "x$with_logging" = "xno" ; then
68 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
71 # Specify if we want to build with Norman's jpeg image server support.
72 # This requires libjpeg to be installed and available.
73 # Default to with_jpeg_server=no
75 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
76 if test "x$with_jpeg_factory" = "xyes" ; then
77 echo "Building with Norman's jpeg image factory support"
78 AC_CHECK_LIB(jpeg, jpeg_start_compress)
79 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
81 echo "In order to build the jpeg factory code you need libjpeg installed."
82 echo "otherwise please configure with the --with-jpeg-sever=no option"
84 echo "libjpeg is available at :"
85 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
89 echo "Building without Norman's jpeg image server support"
91 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
94 dnl Determine an extra directories to add to include/lib search paths
96 *-apple-darwin* | *-*-mingw32*)
97 echo no EXTRA_DIRS for $host
101 if test -d /usr/X11R6 ; then
102 EXTRA_DIR1="/usr/X11R6"
104 if test -d /opt/X11R6 ; then
105 EXTRA_DIR2="/opt/X11R6"
107 EXTRA_DIRS="$EXTRA_DIR1 $EXTRA_DIR2"
111 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
114 dnl Using AM_CONDITIONAL is a step out of the protected little
115 dnl automake fold so it is potentially dangerous. But, we are
116 dnl beginning to run into cases where the standard checks are not
117 dnl enough. AM_CONDITIONALS are then referenced to conditionally
118 dnl build a Makefile.in from a Makefile.am which lets us define custom
119 dnl includes, compile alternative source files, etc.
121 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
122 dnl to use it if it is.
124 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
125 echo no fancy X11 check
134 dnl Checks for libraries.
142 dnl Thread related checks
143 AC_CHECK_LIB(pthread, pthread_exit)
144 AC_CHECK_HEADER(pthread.h)
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 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
151 AC_CHECK_LIB(socket, socket)
154 *-*-cygwin* | *-*-mingw32*)
155 dnl CygWin under Windoze.
157 echo Win32 specific hacks...
158 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
159 AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
161 LIBS="$LIBS -lglut32 -lglu32 -lopengl32"
162 LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
164 dnl add -lwsock32 for mingwin
167 LIBS="$LIBS -lwsock32"
171 echo "Will link apps with $LIBS"
177 LIBS="$LIBS -framework GLUT -framework OpenGL -framework Carbon -lobjc"
181 dnl X-Windows based machines
183 AC_CHECK_LIB(X11, XCreateWindow)
184 AC_CHECK_LIB(Xext, XShmCreateImage)
185 AC_CHECK_LIB(Xi, XGetExtensionVersion)
186 AC_CHECK_LIB(ICE, IceOpenConnection)
187 AC_CHECK_LIB(SM, SmcOpenConnection)
188 AC_CHECK_LIB(Xt, XtMalloc)
189 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
191 AC_CHECK_LIB(GLcore, glNewList)
192 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
193 dnl if no GLcore, check for GL
194 AC_CHECK_LIB(GL, glNewList)
195 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
196 dnl if no GL, check for MesaGL
197 AC_CHECK_LIB(MesaGL, glNewList)
200 dnl if GLcore found, then also check for GL
201 AC_CHECK_LIB(GL, glXCreateContext)
204 dnl if using mesa, check for xmesa.h
205 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
206 AC_CHECK_HEADER(GL/fxmesa.h)
207 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
208 AC_DEFINE([XMESA], 1, [Define for fxmesa])
209 AC_DEFINE([FX], 1, [Define for fxmesa])
213 AC_CHECK_LIB(GLU, gluLookAt)
214 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
215 dnl if no GLU, check for MesaGLU
216 AC_CHECK_LIB(MesaGLU, gluLookAt)
224 dnl check for glut location
225 AC_CHECK_HEADER(GL/glut.h)
226 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
227 AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location])
229 AC_CHECK_HEADER(GLUT/glut.h)
230 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
231 AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location])
233 echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue"
242 AC_SUBST(opengl_LIBS)
244 dnl Check for MS Windows environment
245 AC_CHECK_HEADER(windows.h)
246 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
248 # The following are C++ items that need to be tested for with the c++
253 dnl Check for "plib" without which we cannot go on
254 AC_CHECK_HEADER(plib/ul.h)
255 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
257 echo "You *must* have the plib library installed on your system to build"
260 echo "Please see README.plib for more details."
262 echo "configure aborted."
266 AC_MSG_CHECKING([for plib 1.6.0 or newer])
270 #define MIN_PLIB_VERSION 160
273 int major, minor, micro;
275 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
284 [AC_MSG_RESULT(wrong version);
285 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
289 dnl Check for system installed metakit
290 AC_CHECK_HEADER(mk4.h)
291 if test "x$ac_cv_header_mk4_h" != "xyes"; then
293 echo "Metakit not found, you will need to install this first."
294 echo "Please read the README.metakit for more information."
300 dnl Check for system installed zlib
301 AC_CHECK_HEADER(zlib.h)
302 if test "x$ac_cv_header_zlib_h" != "xyes"; then
304 echo "zlib not found, you will need to install this first."
305 echo "Please read the README.zlib for more information."
309 dnl Checks for header files.
312 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
313 sys/stat.h sys/time.h sys/timeb.h unistd.h winbase.h values.h )
315 if test "x$ac_cv_header_stdint_h" = "xyes"; then
316 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
319 dnl Checks for typedefs, structures, and compiler characteristics.
325 dnl Checks for library functions.
329 ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
330 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
332 AM_CONFIG_HEADER(simgear/simgear_config.h)
340 simgear/bucket/Makefile \
341 simgear/debug/Makefile \
342 simgear/ephemeris/Makefile \
343 simgear/io/Makefile \
344 simgear/magvar/Makefile \
345 simgear/math/Makefile \
346 simgear/metar/Makefile \
347 simgear/misc/Makefile \
348 simgear/route/Makefile \
349 simgear/screen/Makefile \
350 simgear/serial/Makefile \
351 simgear/sky/Makefile \
352 simgear/sky/clouds3d/Makefile \
353 simgear/threads/Makefile \
354 simgear/timing/Makefile \
355 simgear/xgl/Makefile \
356 simgear/xml/Makefile \
362 echo "Configure Summary"
363 echo "================="
365 echo "Prefix: $prefix"
367 if test "x$with_logging" != "x"; then
368 echo "Debug messages: $with_logging"
370 echo "Debug messages: yes"
373 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
374 automake --version | head -1
376 if test "x$ac_cv_header_GL_glut_h" = "xyes"; then
377 echo "With GL/glut.h"
379 if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then
380 echo "With GLUT/glut.h"
383 if test "x$with_jpeg_factory" = "xyes"; then
384 echo "With JPEG Factory support"
386 echo "Without JPEG Factory support"
389 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
390 echo "Threads: pthread lib found."
392 echo "Threads: no threads (pthread lib not found.)"