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 # Require at least automake 2.52
12 dnl Initialize the automake stuff
13 AM_INIT_AUTOMAKE(SimGear, 0.0.19pre2)
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.
43 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
44 if test "$CXX" = "CC"; then
50 if echo $includedir | egrep "simgear$" > /dev/null; then
51 echo "includedir is" $includedir "libdir is" $libdir
53 includedir="${includedir}/simgear"
54 echo "includedir changed to" $includedir "libdir is" $libdir
57 # set logging default value
59 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
60 if test "x$with_logging" = "xno" ; then
61 AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
64 # Specify if we want to build with Norman's jpeg image server support.
65 # This requires libjpeg to be installed and available.
66 # Default to with_jpeg_server=no
68 AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
69 if test "x$with_jpeg_factory" = "xyes" ; then
70 echo "Building with Norman's jpeg image factory support"
71 AC_CHECK_LIB(jpeg, jpeg_start_compress)
72 if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
74 echo "In order to build the jpeg factory code you need libjpeg installed."
75 echo "otherwise please configure with the --with-jpeg-sever=no option"
77 echo "libjpeg is available at :"
78 echo " ftp://ftp.uu.net in the directory graphics/jpeg"
82 echo "Building without Norman's jpeg image server support"
84 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
87 dnl Check for MS Windows environment
88 AC_CHECK_HEADER(windows.h)
94 ],is_mingw=yes, is_mingw=no)
96 echo "IS_MINGW = $is_mingw"
97 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
103 ],is_cygwin=yes, is_cygwin=no)
105 echo "IS_CYGWIN = $is_cygwin"
106 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
108 if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
109 dnl extra library and include directories
110 EXTRA_DIRS="/usr/local /usr/X11R6"
112 if test -d /opt/X11R6 ; then
113 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
117 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
119 dnl Using AM_CONDITIONAL is a step out of the protected little
120 dnl automake fold so it is potentially dangerous. But, we are
121 dnl beginning to run into cases where the standard checks are not
122 dnl enough. AM_CONDITIONALS are then referenced to conditionally
123 dnl build a Makefile.in from a Makefile.am which lets us define custom
124 dnl includes, compile alternative source files, etc.
126 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
127 if test "x$HOSTTYPE" != "xmacintosh" ; then
128 dnl Check for X11 (fancy)
132 dnl Checks for libraries.
140 dnl Thread related checks
141 AC_CHECK_LIB(pthread, pthread_exit)
142 AC_CHECK_HEADER(pthread.h)
143 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
144 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
145 CFLAGS="$CFLAGS -D_REENTRANT"
147 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
149 AC_CHECK_LIB(socket, socket)
151 dnl X11 might be installed, but we don't want to use it for OSX -dw-
152 if test "x$HOSTTYPE" != "xmacintosh" ; then
153 AC_CHECK_LIB(X11, XCreateWindow)
154 AC_CHECK_LIB(Xext, XShmCreateImage)
155 AC_CHECK_LIB(Xi, XGetExtensionVersion)
156 AC_CHECK_LIB(ICE, IceOpenConnection)
157 AC_CHECK_LIB(SM, SmcOpenConnection)
158 AC_CHECK_LIB(Xt, XtMalloc)
159 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
162 dnl check for OpenGL related libraries
164 if test "x$HOSTTYPE" = "xmacintosh" ; then
166 LIBS="$LIBS -framework OpenGL -framework GLUT"
167 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
168 dnl Reasonable stuff for X-Windows based machines
170 AC_CHECK_LIB(GLcore, glNewList)
171 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
172 dnl if no GLcore, check for GL
173 AC_CHECK_LIB(GL, glNewList)
174 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
175 dnl if no GL, check for MesaGL
176 AC_CHECK_LIB(MesaGL, glNewList)
179 dnl if GLcore found, then also check for GL
180 AC_CHECK_LIB(GL, glXCreateContext)
183 dnl if using mesa, check for xmesa.h
184 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
185 AC_CHECK_HEADER(GL/fxmesa.h)
186 if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
187 AC_DEFINE([XMESA], 1, [Define for fxmesa])
188 AC_DEFINE([FX], 1, [Define for fxmesa])
192 AC_CHECK_LIB(GLU, gluLookAt)
193 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
194 dnl if no GLU, check for MesaGLU
195 AC_CHECK_LIB(MesaGLU, gluLookAt)
199 AC_CHECK_LIB(glut, glutGetModifiers)
201 dnl test for glutGameModeString, but avoid adding glut a second time into
202 dnl the list of libraries
204 AC_CHECK_LIB(glut, glutGameModeString)
209 echo Win32 specific hacks...
210 AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
212 dnl just define these to true and hope for the best
213 ac_cv_lib_glut_glutGetModifiers="yes"
214 ac_cv_lib_glut_glutGameModeString="yes"
216 if test "x$with_sgi_opengl" = "xyes" ; then
217 echo "Building with glut.dll, glu.dll, and opengl.dll"
222 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
225 WIN32_OPENGL=opengl32
228 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
229 LIBS="$LIBS -luser32 -lgdi32"
230 if test "x$is_mingw" = "xyes" ; then
231 EXTRA_DIRS="${EXTRA_DIRS}"
233 echo "Will link apps with $LIBS"
236 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
238 echo "Unable to find the necessary OpenGL or GLUT libraries."
239 echo "See config.log for automated test details and results ..."
243 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
245 echo "Your version of glut doesn't support game mode."
246 echo "You need to install the latest version of glut. If your"
247 echo "distribution doesn't provide a newer version, you can get the source"
250 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
258 AC_SUBST(opengl_LIBS)
260 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
262 # The following are C++ items that need to be tested for with the c++
267 dnl Check for "plib" without which we cannot go on
268 AC_CHECK_HEADER(plib/ul.h)
269 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
271 echo "You *must* have the plib library installed on your system to build"
274 echo "Please see README.plib for more details."
276 echo "configure aborted."
280 AC_MSG_CHECKING([for plib 1.6.0 or newer])
284 #define MIN_PLIB_VERSION 160
287 int major, minor, micro;
289 if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
298 [AC_MSG_RESULT(wrong version);
299 AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
303 dnl Check for system installed metakit
304 AC_CHECK_HEADER(mk4.h)
305 if test "x$ac_cv_header_mk4_h" != "xyes"; then
307 echo "Metakit not found, you will need to install this first."
308 echo "Please read the README.metakit for more information."
314 dnl Specify if we want logging (testing build) or not (release build)
316 dnl Check for system installed zlib
317 AC_CHECK_HEADER(zlib.h)
318 if test "x$ac_cv_header_zlib_h" != "xyes"; then
320 echo "zlib not found, you will need to install this first."
321 echo "Please read the README.zlib for more information."
325 dnl Checks for header files.
328 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
329 sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
331 if test "x$ac_cv_header_stdint_h" = "xyes"; then
332 AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
335 dnl Checks for typedefs, structures, and compiler characteristics.
341 dnl Checks for library functions.
344 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
345 random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
347 AM_CONFIG_HEADER(simgear/simgear_config.h)
355 simgear/bucket/Makefile \
356 simgear/debug/Makefile \
357 simgear/ephemeris/Makefile \
358 simgear/interpreter/Makefile \
359 simgear/io/Makefile \
360 simgear/magvar/Makefile \
361 simgear/math/Makefile \
362 simgear/metar/Makefile \
363 simgear/misc/Makefile \
364 simgear/route/Makefile \
365 simgear/screen/Makefile \
366 simgear/serial/Makefile \
367 simgear/sky/Makefile \
368 simgear/threads/Makefile \
369 simgear/timing/Makefile \
370 simgear/xgl/Makefile \
371 simgear/xml/Makefile \
377 echo "Configure Summary"
378 echo "================="
380 echo "Prefix: $prefix"
382 if test "x$with_logging" != "x"; then
383 echo "Debug messages: $with_logging"
385 echo "Debug messages: yes"
388 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
389 automake --version | head -1
391 if test "x$with_jpeg_factory" = "xyes"; then
392 echo "With JPEG Factory support"
394 echo "Without JPEG Factory support"
397 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
398 echo "Threads: pthread lib found."
400 echo "Threads: no threads (pthread lib not found.)"