]> git.mxchange.org Git - simgear.git/blob - configure.in
aab124510de5d34febb2c54cecba06cd68991aeb
[simgear.git] / configure.in
1 dnl Process this file with aclocal ; automake -a ; autoconf to produce a 
2 dnl working configure script.
3 dnl
4 dnl $Id$
5
6 AC_INIT(simgear/bucket/newbucket.cxx)
7
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(SimGear, 0.0.17)
10
11 dnl Specify KAI C++ compiler and flags.
12 dnl Borrowed with slight modification from blitz distribution.
13 AC_ARG_WITH(cxx,
14   [  --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
15   [case "$withval" in
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"
21     ;;
22   esac
23 ])
24
25 echo CXX = $CXX
26 echo CC = $CC
27
28 dnl Checks for programs.
29 AC_PROG_MAKE_SET
30 AC_PROG_CC
31 AC_PROG_CPP
32 AC_PROG_CXX
33 AC_PROG_RANLIB
34 AC_PROG_INSTALL
35 AC_PROG_LN_S
36
37 AR="ar"
38 OS=`uname -s`
39 if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
40     if test "$CXX" = "CC"; then
41         AR="CC -ar"
42         AC_SUBST(AR)
43     fi
44 fi
45
46 if echo $includedir | egrep "simgear$" > /dev/null; then
47     echo "includedir is" $includedir "libdir is" $libdir
48 else
49     includedir="${includedir}/simgear"
50     echo "includedir changed to" $includedir "libdir is" $libdir
51 fi
52          
53 # Determine version of automake ... important because of
54 # incompatibilities between versions
55 AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\-p[[0-9]]$//' | sed -e 's/\.//'`
56 AM_CONDITIONAL(ANCIENT_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 14)
57 AM_CONDITIONAL(OLD_AUTOMAKE, test $AUTO_MAKE_VERSION -lt 15)
58
59 # set logging default value
60 # with_logging=yes
61 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
62 if test "x$with_logging" = "xno" ; then
63     AC_DEFINE(FG_NDEBUG)
64 fi
65
66 dnl specify if we are building with "electric fence"
67 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
68
69 if test "x$with_efence" = "xyes" ; then
70     echo "Building with efence"
71     LIBS="$LIBS -lefence"
72 fi
73
74 # Specify if we want to build with Norman's jpeg image server support.
75 # This requires libjpeg to be installed and available.
76 # Default to with_jpeg_server=no
77 JPEGLIB=''
78 AC_ARG_WITH(jpeg_factory, [  --with-jpeg-factory     Include Norman's jpeg image factory support code])
79 if test "x$with_jpeg_factory" = "xyes" ; then
80     echo "Building with Norman's jpeg image factory support"
81     AC_CHECK_LIB(jpeg, jpeg_start_compress)
82     if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
83         echo
84         echo "In order to build the jpeg factory code you need libjpeg installed."
85         echo "otherwise please configure with the --with-jpeg-sever=no option"
86         echo
87         echo "libjpeg is available at :"
88         echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
89         exit 1
90     fi
91 else
92     echo "Building without Norman's jpeg image server support"
93 fi
94 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
95
96
97 dnl Check for MS Windows environment
98 AC_CHECK_HEADER(windows.h)
99
100 AC_EGREP_CPP(yes,
101 [#ifdef __MINGW32__
102  yes
103  #endif
104 ],is_mingw=yes, is_mingw=no)
105
106 echo "IS_MINGW =" $is_mingw
107 AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
108
109 AC_EGREP_CPP(yes,
110 [#ifdef __CYGWIN__
111  yes
112  #endif
113 ],is_cygwin=yes, is_cygwin=no)
114
115 echo "IS_CYGWIN =" $is_cygwin
116 AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
117
118 if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
119     dnl extra library and include directories
120     EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6"
121
122     if test -d /opt/X11R6 ; then
123         EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
124     fi
125 fi
126
127 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
128
129 dnl Using AM_CONDITIONAL is a step out of the protected little 
130 dnl automake fold so it is potentially dangerous.  But, we are
131 dnl beginning to run into cases where the standard checks are not
132 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
133 dnl build a Makefile.in from a Makefile.am which lets us define custom
134 dnl includes, compile alternative source files, etc.
135
136 dnl Enable serial support on Unix type systems
137 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
138
139 dnl X11 might be installed on Mac OS X, don't want to use it if it is.
140 if test "x$HOSTTYPE" != "xmacintosh" ; then
141     dnl Check for X11 (fancy)
142     AC_PATH_XTRA
143 fi
144
145 dnl Checks for libraries.
146
147 null_LIBS="$LIBS"
148
149 AC_CHECK_LIB(m, cos)
150
151 base_LIBS="$LIBS"
152
153 dnl Thread related checks
154 AC_CHECK_LIB(pthread, pthread_exit)
155 AC_CHECK_HEADER(pthread.h)
156 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
157     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
158     CFLAGS="$CFLAGS -D_REENTRANT"
159 fi
160 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
161
162 AC_CHECK_LIB(socket, socket)
163
164 dnl X11 might be installed, but we don't want to use it for OSX -dw-
165 if test "x$HOSTTYPE" != "xmacintosh" ; then
166     AC_CHECK_LIB(X11, XCreateWindow)
167     AC_CHECK_LIB(Xext, XShmCreateImage)
168     AC_CHECK_LIB(Xi, XGetExtensionVersion)
169     AC_CHECK_LIB(ICE, IceOpenConnection)
170     AC_CHECK_LIB(SM, SmcOpenConnection)
171     AC_CHECK_LIB(Xt, XtMalloc)
172     AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
173 fi
174
175 dnl check for OpenGL related libraries
176
177 if test "x$HOSTTYPE" = "xmacintosh" ; then
178     dnl Macintosh OSX
179     LIBS="$LIBS -framework OpenGL -framework GLUT"
180 elif test "x$ac_cv_header_windows_h" != "xyes" ; then
181     dnl Reasonable stuff for X-Windows based machines
182
183     AC_CHECK_LIB(GLcore, glNewList)
184     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
185         dnl if no GLcore, check for GL
186         AC_CHECK_LIB(GL, glNewList)
187         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
188             dnl if no GL, check for MesaGL
189             AC_CHECK_LIB(MesaGL, glNewList)
190         fi
191     else
192         dnl if GLcore found, then also check for GL
193         AC_CHECK_LIB(GL, glXCreateContext)
194     fi
195
196     dnl if using mesa, check for xmesa.h
197     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
198         AC_CHECK_HEADER(GL/xmesa.h)
199         if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then
200             AC_DEFINE( XMESA )
201             AC_DEFINE( FX )
202         fi
203     fi
204
205     AC_CHECK_LIB(GLU, gluLookAt)
206     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
207         dnl if no GLU, check for MesaGLU
208         AC_CHECK_LIB(MesaGLU, gluLookAt)
209     fi
210
211     dnl check for glut
212     AC_CHECK_LIB(glut, glutGetModifiers)
213
214     dnl test for glutGameModeString, but avoid adding glut a second time into
215     dnl the list of libraries
216     save_LIBS="$LIBS"
217     AC_CHECK_LIB(glut, glutGameModeString)
218     LIBS="$save_LIBS"
219 else
220     dnl Win32 libs
221
222     echo Win32 specific hacks...
223     AC_DEFINE(WIN32)
224
225     dnl force a failed check since we will be building under windoze
226     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
227
228     dnl just define these to true and hope for the best
229     ac_cv_lib_glut_glutGetModifiers="yes"
230     ac_cv_lib_glut_glutGameModeString="yes"
231
232     if test "x$with_sgi_opengl" = "xyes" ; then
233         echo "Building with glut.dll, glu.dll, and opengl.dll"
234         WIN32_GLUT=glut
235         WIN32_GLU=glu
236         WIN32_OPENGL=opengl
237     else 
238         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
239         WIN32_GLUT=glut32
240         WIN32_GLU=glu32
241         WIN32_OPENGL=opengl32
242     fi
243
244     LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
245     LIBS="$LIBS -luser32 -lgdi32"
246     if test "x$is_mingw" = "xyes" ; then
247         EXTRA_DIRS="${EXTRA_DIRS}"
248     fi
249     echo "Will link apps with $LIBS"
250 fi
251
252 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
253     echo 
254     echo "Unable to find the necessary OpenGL or GLUT libraries."
255     echo "See config.log for automated test details and results ..."
256     exit 1
257 fi
258
259 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
260     echo
261     echo "Your version of glut doesn't support game mode."
262     echo "You need to fetch and install the latest version of glut from:"
263     echo
264     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
265     exit 1
266 fi
267
268 opengl_LIBS="$LIBS"
269 LIBS="$base_LIBS"
270
271 AC_SUBST(base_LIBS)
272 AC_SUBST(opengl_LIBS)
273
274 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
275
276 dnl Check for "plib" without which we cannot go on
277 AC_CHECK_HEADER(plib/pu.h)
278 if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
279     echo
280     echo "You *must* have the plib library installed on your system to build"
281     echo "the FGFS simulator!"
282     echo
283     echo "Please see README.plib for more details."
284     echo
285     echo "configure aborted."
286     exit
287 fi
288
289 dnl Check for system installed metakit
290 AC_CHECK_HEADER(mk4.h)
291 if test "x$ac_cv_header_mk4_h" != "xyes"; then
292     echo "Metakit not found, you will need to install this first."
293     echo "Please read the README.metakit for more information."
294     exit
295 fi
296
297
298 dnl Specify if we want logging (testing build) or not (release build)
299
300 dnl Check for system installed zlib
301 AC_CHECK_HEADER(zlib.h)
302 if test "x$ac_cv_header_zlib_h" != "xyes"; then
303     echo "zlib not found, you will need to install this first."
304     echo "Please read the README.zlib for more information."
305     exit
306 fi
307
308 dnl Checks for header files.
309 AC_HEADER_STDC
310 AC_CHECK_HEADERS( \
311         fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
312         sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
313
314 if test "x$ac_cv_header_stdint_h" = "xyes"; then
315     AC_DEFINE( HAVE_STDINT_H )
316 fi
317
318 dnl Checks for typedefs, structures, and compiler characteristics.
319 AC_C_CONST
320 AC_TYPE_SIZE_T
321 AC_HEADER_TIME
322 AC_STRUCT_TM
323
324 dnl Checks for library functions.
325 AC_TYPE_SIGNAL
326 AC_FUNC_VPRINTF
327 AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
328         random setitimer getitimer signal GetLocalTime rint getrusage )
329
330 AM_CONFIG_HEADER(simgear/simgear_config.h)
331
332 AC_OUTPUT( \
333         Makefile \
334         SimGear.spec \
335         simgear/Makefile \
336         simgear/version.h \
337         simgear/bucket/Makefile \
338         simgear/debug/Makefile \
339         simgear/ephemeris/Makefile \
340         simgear/io/Makefile \
341         simgear/magvar/Makefile \
342         simgear/math/Makefile \
343         simgear/metar/Makefile \
344         simgear/misc/Makefile \
345         simgear/route/Makefile \
346         simgear/screen/Makefile \
347         simgear/serial/Makefile \
348         simgear/sky/Makefile \
349         simgear/threads/Makefile \
350         simgear/timing/Makefile \
351         simgear/xgl/Makefile \
352         simgear/xml/Makefile \
353 )
354
355 # AC_OUTPUT_COMMANDS([])
356
357 echo ""
358 echo "Configure Summary"
359 echo "================="
360
361 echo "Prefix: $prefix"
362
363 if test "x$with_logging" != "x"; then
364     echo "Debug messages: $with_logging"
365 else
366     echo "Debug messages: yes"
367 fi
368
369 if test "x$with_efence" != "x"; then
370     echo "Electric fence: $with_efence"
371 else
372     echo "Electric fence: no"
373 fi
374
375 echo -n "Automake version: ($AUTO_MAKE_VERSION) "
376 automake --version | head -1
377
378 if test "x$with_jpeg_factory" = "xyes"; then
379    echo "With JPEG Factory support"
380 else
381    echo "Without JPEG Factory support"
382 fi
383
384 if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
385    echo "Threads: pthread lib found."
386 else
387    echo "Threads: no threads (pthread lib not found.)"
388 fi