1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a
2 dnl working configure script.
6 AC_INIT(simgear/bucket/newbucket.cxx)
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.17)
11 dnl Specify KAI C++ compiler and flags.
12 dnl Borrowed with slight modification from blitz distribution.
14 [ --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
16 KCC*) # KAI C++ http://www.kai.com/
17 echo "Configuring for KAI C++"
18 AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
19 CXX_OPTIMIZE_FLAGS=="+K3 -O3"
20 CXX_DEBUG_FLAGS="-g +K0"
28 dnl Checks for programs.
37 # Check to see if this `configure' is being run in the `Cygwin32' environment
44 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
45 if test "$CXX" = "CC"; then
51 if echo $includedir | egrep "simgear$" > /dev/null; then
52 echo "includedir is" $includedir "libdir is" $libdir
54 includedir="${includedir}/simgear"
55 echo "includedir changed to" $includedir "libdir is" $libdir
58 # Determine version of automake ... important becuase of
59 # incompatibilities between versions
60 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//'`
61 AM_CONDITIONAL(ANCIENT_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 14)
62 AM_CONDITIONAL(OLD_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 15)
64 # set logging default value
66 AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
67 if test "x$with_logging" = "xno" ; then
71 dnl specify if we are building with "electric fence"
72 AC_ARG_WITH(efence, [ --with-efence Specify if we are building with "electric-fence"])
74 if test "x$with_efence" = "xyes" ; then
75 echo "Building with efence"
79 dnl Check for MS Windows environment
80 AC_CHECK_HEADER(windows.h)
82 if test "x$HOSTTYPE" != "xmacintosh" ; then
83 dnl extra library and include directories
84 EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
86 if test -d /opt/X11R6 ; then
87 EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
90 if test "x$ac_cv_header_windows_h" = "xyes" ; then
91 if test -d /usr/mingw/usr ; then
92 EXTRA_DIRS="$EXTRA_DIRS /usr/mingw/usr"
97 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
99 dnl Using AM_CONDITIONAL is a step out of the protected little
100 dnl automake fold so it is potentially dangerous. But, we are
101 dnl beginning to run into cases where the standard checks are not
102 dnl enough. AM_CONDITIONALS are then referenced to conditionally
103 dnl build a Makefile.in from a Makefile.am which lets us define custom
104 dnl includes, compile alternative source files, etc.
106 dnl Enable serial support on Unix type systems
107 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
109 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
110 if test "x$HOSTTYPE" != "xmacintosh" ; then
111 dnl Check for X11 (fancy)
115 dnl Checks for libraries.
121 if test "x$ac_cv_mingw32" = "xyes" ; then
122 LIBS="$LIBS -lwsock32"
127 dnl Thread related checks
128 AC_CHECK_LIB(pthread, pthread_exit)
129 AC_CHECK_HEADER(pthread.h)
130 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
131 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
132 CFLAGS="$CFLAGS -D_REENTRANT"
134 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
136 AC_CHECK_LIB(socket, socket)
138 dnl X11 might be installed, but we don't want to use it for OSX -dw-
139 if test "x$HOSTTYPE" != "xmacintosh" ; then
140 AC_CHECK_LIB(X11, XCreateWindow)
141 AC_CHECK_LIB(Xext, XShmCreateImage)
142 AC_CHECK_LIB(Xi, XGetExtensionVersion)
143 AC_CHECK_LIB(ICE, IceOpenConnection)
144 AC_CHECK_LIB(SM, SmcOpenConnection)
145 AC_CHECK_LIB(Xt, XtMalloc)
146 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
149 dnl check for OpenGL related libraries
151 if test "x$HOSTTYPE" = "xmacintosh" ; then
153 LIBS="$LIBS -framework OpenGL -framework GLUT"
154 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
155 dnl Reasonable stuff for X-Windows based machines
157 AC_CHECK_LIB(GLcore, glNewList)
158 if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
159 dnl if no GLcore, check for GL
160 AC_CHECK_LIB(GL, glNewList)
161 if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
162 dnl if no GL, check for MesaGL
163 AC_CHECK_LIB(MesaGL, glNewList)
166 dnl if GLcore found, then also check for GL
167 AC_CHECK_LIB(GL, glXCreateContext)
170 dnl if using mesa, check for xmesa.h
171 if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
172 AC_CHECK_HEADER(GL/xmesa.h)
173 if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
179 AC_CHECK_LIB(GLU, gluLookAt)
180 if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
181 dnl if no GLU, check for MesaGLU
182 AC_CHECK_LIB(MesaGLU, gluLookAt)
186 AC_CHECK_LIB(glut, glutGetModifiers)
188 dnl test for glutGameModeString, but avoid adding glut a second time into
189 dnl the list of libraries
191 AC_CHECK_LIB(glut, glutGameModeString)
196 echo Win32 specific hacks...
199 dnl force a failed check since we will be building under windoze
200 AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
202 dnl just define these to true and hope for the best
203 ac_cv_lib_glut_glutGetModifiers="yes"
204 ac_cv_lib_glut_glutGameModeString="yes"
206 if test "x$with_sgi_opengl" = "xyes" ; then
207 echo "Building with glut.dll, glu.dll, and opengl.dll"
212 echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
215 WIN32_OPENGL=opengl32
218 LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
219 LIBS="$LIBS -luser32 -lgdi32"
220 if test "x$ac_cv_mingw32" = "xyes" ; then
221 LIBS="$LIBS -wsock32"
223 echo "Will link apps with $LIBS"
226 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
228 echo "Unable to find the necessary OpenGL or GLUT libraries."
229 echo "See config.log for automated test details and results ..."
233 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
235 echo "Your version of glut doesn't support game mode."
236 echo "You need to fetch and install the latest version of glut from:"
238 echo " http://reality.sgi.com/opengl/glut3/glut3.html"
246 AC_SUBST(opengl_LIBS)
248 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
250 dnl Check for "plib" without which we cannot go on
251 AC_CHECK_HEADER(plib/pu.h)
252 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
254 echo "You *must* have the plib library installed on your system to build"
255 echo "the FGFS simulator!"
257 echo "Please see README.plib for more details."
259 echo "configure aborted."
263 dnl Check for system installed metakit
264 AC_CHECK_HEADER(mk4.h)
265 if test "x$ac_cv_header_mk4_h" != "xyes"; then
266 echo "Metakit not found, you will need to install this first."
267 echo "Please read the README.metakit for more information."
272 dnl Specify if we want logging (testing build) or not (release build)
274 dnl Check for system installed zlib
275 AC_CHECK_HEADER(zlib.h)
276 if test "x$ac_cv_header_zlib_h" != "xyes"; then
277 echo "zlib not found, you will need to install this first."
278 echo "Please read the README.zlib for more information."
282 dnl Checks for header files.
285 fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
286 sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
288 if test "x$ac_cv_header_stdint_h" = "xyes"; then
289 AC_DEFINE( HAVE_STDINT_H )
292 dnl Checks for typedefs, structures, and compiler characteristics.
298 dnl Checks for library functions.
301 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
302 random setitimer getitimer signal GetLocalTime rint getrusage )
304 AM_CONFIG_HEADER(simgear/simgear_config.h)
311 simgear/bucket/Makefile \
312 simgear/debug/Makefile \
313 simgear/ephemeris/Makefile \
314 simgear/io/Makefile \
315 simgear/magvar/Makefile \
316 simgear/math/Makefile \
317 simgear/metar/Makefile \
318 simgear/misc/Makefile \
319 simgear/route/Makefile \
320 simgear/screen/Makefile \
321 simgear/serial/Makefile \
322 simgear/sky/Makefile \
323 simgear/threads/Makefile \
324 simgear/timing/Makefile \
325 simgear/xgl/Makefile \
326 simgear/xml/Makefile \
329 # AC_OUTPUT_COMMANDS([])
332 echo "Configure Summary"
333 echo "================="
335 echo "Prefix: $prefix"
337 if test "x$with_logging" != "x"; then
338 echo "Debug messages: $with_logging"
340 echo "Debug messages: yes"
343 if test "x$with_efence" != "x"; then
344 echo "Electric fence: $with_efence"
346 echo "Electric fence: no"
349 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
350 automake --version | head -1
352 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
353 echo "Threads: pthread lib found."
355 echo "Threads: no threads (pthread lib not found.)"
358 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
359 if test "$CXX" = "CC"; then
360 echo "\nRemember to run: sh ../FlightGear/irix-hack.sh!\07\n"