]> git.mxchange.org Git - simgear.git/blob - configure.ac
Disable smooth lines for certain lightning segments.
[simgear.git] / configure.ac
1 dnl Process this file with autoget.sh to produce a working configure
2 dnl script.
3
4 AC_INIT
5 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
6
7 dnl Require at least automake 2.52
8 AC_PREREQ(2.52)
9
10 dnl Initialize the automake stuff
11 AM_INIT_AUTOMAKE(SimGear, 0.3.9)
12
13 dnl Specify KAI C++ compiler and flags.
14 dnl Borrowed with slight modification from blitz distribution.
15 AC_ARG_WITH(cxx,
16   [  --with-cxx=COMPILER[:name-flags] set options for COMPILER (KCC)],
17   [case "$withval" in
18     KCC*)    # KAI C++ http://www.kai.com/
19       echo "Configuring for KAI C++"
20       AC_SG_SET_COMPILER($withval,"KCC","--restrict --strict_warnings")
21       CXX_OPTIMIZE_FLAGS=="+K3 -O3"
22       CXX_DEBUG_FLAGS="-g +K0"
23     ;;
24   esac
25 ])
26
27 echo CXX = $CXX
28 echo CC = $CC
29
30 dnl Checks for programs.
31 AC_PROG_MAKE_SET
32 AC_PROG_CC
33 AC_PROG_CPP
34 AC_PROG_CXX
35 AC_PROG_RANLIB
36 AC_PROG_INSTALL
37 AC_PROG_LN_S
38
39 dnl set the $host variable based on local machine/os
40 AC_CANONICAL_HOST
41
42 dnl Used on the Irix platform
43 case "${host}" in
44 *-*-irix*)
45     if test "x$CXX" = "xCC" -o "x$CXX" = "xccache CC"; then
46         AR="$CXX -ar"
47         ARFLAGS="-o"
48         CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro740"
49         compatibility_DIR="compatibility"
50         MIPSpro_DIRS="MIPSpro740"
51         AC_MSG_CHECKING([for MIPSpro compiler version 7.4 or newer])
52         AC_TRY_RUN([
53            int main() {
54               if ( _COMPILER_VERSION < 740 ) {
55                  return -1;
56               }
57               return 0;
58            }
59
60         ], AC_MSG_RESULT(yes),
61         [  AC_MSG_RESULT(no)
62            CXXFLAGS="$CXXFLAGS -I$(top_srcdir)/simgear/compatibility/MIPSpro721"
63            MIPSpro_DIRS="$(MIPSpro_DIRS) MIPSpro721"
64            AC_MSG_WARN([Using our own subset of the STL headers])
65         ], AC_MSG_RESULT(yes))
66         AC_SUBST(MIPSpro_DIRS)
67     fi
68     ;;
69 *)
70     AR="ar"
71     ARFLAGS="cru"
72     compatibility_DIR=
73     ;;
74 esac
75 AC_SUBST(AR)
76 AC_SUBST(ARFLAGS)
77 AC_SUBST(compatibility_DIR)
78
79 if echo $includedir | egrep "simgear$" > /dev/null; then
80     echo "includedir is" $includedir "libdir is" $libdir
81 else
82     includedir="${includedir}/simgear"
83     echo "includedir changed to" $includedir "libdir is" $libdir
84 fi
85          
86 dnl set logging; default value of with_logging=yes
87 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
88 if test "x$with_logging" = "xno" ; then
89     AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
90 fi
91
92 # Specify if we want to build with Norman's jpeg image server support.
93 # This requires libjpeg to be installed and available.
94 # Default to with_jpeg_server=no
95 JPEGLIB=''
96 AC_ARG_WITH(jpeg_factory, [  --with-jpeg-factory     Include Norman's jpeg image factory support code])
97 if test "x$with_jpeg_factory" = "xyes" ; then
98     echo "Building with Norman's jpeg image factory support"
99     AC_CHECK_LIB(jpeg, jpeg_start_compress)
100     if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
101         echo
102         echo "In order to build the jpeg factory code you need libjpeg installed."
103         echo "otherwise please configure with the --with-jpeg-sever=no option"
104         echo
105         echo "libjpeg is available at :"
106         echo "  ftp://ftp.uu.net in the directory graphics/jpeg"
107         exit 1
108     fi
109 else
110     echo "Building without Norman's jpeg image server support"
111 fi
112 AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
113
114 # specify the plib location
115 AC_ARG_WITH(plib, [  --with-plib=PREFIX      Specify the prefix path to plib])
116
117 if test "x$with_plib" != "x" ; then
118     echo "plib prefix is $with_plib"
119     EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
120 fi
121
122 dnl Determine an extra directories to add to include/lib search paths
123 case "${host}" in
124 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
125     echo no EXTRA_DIRS for $host
126     ;;
127
128 *)
129     if test -d /usr/X11R6 ; then
130         EXTRA_DIR1="/usr/X11R6"
131     fi
132     if test -d /opt/X11R6 ; then
133         EXTRA_DIR2="/opt/X11R6"
134     fi
135     EXTRA_DIRS="${EXTRA_DIRS} $EXTRA_DIR1 $EXTRA_DIR2"
136     ;;
137
138 esac
139 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
140
141
142 dnl Using AM_CONDITIONAL is a step out of the protected little 
143 dnl automake fold so it is potentially dangerous.  But, we are
144 dnl beginning to run into cases where the standard checks are not
145 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
146 dnl build a Makefile.in from a Makefile.am which lets us define custom
147 dnl includes, compile alternative source files, etc.
148
149 dnl X11 might be installed on Mac OS X or cygwin/mingwin, we don't want
150 dnl to use it if it is.
151 case "${host}" in
152 *-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
153     echo no fancy X11 check
154     ;;
155
156 *)
157     AC_PATH_XTRA
158     ;;
159
160 esac
161
162 dnl Checks for libraries.
163
164 dnl Thread related checks
165 AC_CHECK_HEADER(pthread.h)
166 AC_SEARCH_LIBS(pthread_exit, [pthread c_r])
167 if test "x$ac_cv_header_pthread_h" = "xyes"; then
168     CXXFLAGS="$CXXFLAGS -D_REENTRANT"
169     CFLAGS="$CFLAGS -D_REENTRANT"
170
171   if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
172     CXXFLAGS="-pthread $CXXFLAGS"
173     CFLAGS="-pthread $CFLAGS"
174   fi
175 fi
176
177 AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_header_pthread_h" = "xyes")
178
179 thread_LIBS="$LIBS"
180 LIBS=""
181
182 dnl search for network related libraries
183 AC_SEARCH_LIBS(inet_addr, xnet)
184 AC_SEARCH_LIBS(socket, socket)
185
186 network_LIBS="$LIBS"
187 LIBS=""
188
189 dnl check for some default libraries
190 AC_SEARCH_LIBS(cos, m)
191
192 base_LIBS="$LIBS"
193
194 dnl check for OpenGL related libraries
195 case "${host}" in
196 *-*-cygwin* | *-*-mingw32*)
197     dnl CygWin under Windoze.
198
199     echo Win32 specific hacks...
200     AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
201     AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
202
203     LIBS="$LIBS -lglu32 -lopengl32"
204     LIBS="$LIBS -luser32 -lgdi32 -lwinmm"
205
206     dnl add -lwsock32 for mingwin
207     case "${host}" in
208     *-*-mingw32*)
209         base_LIBS="$base_LIBS -lws2_32"
210         ;;
211     esac
212
213     echo "Will link apps with $LIBS"
214     ;;
215
216 *-apple-darwin*)
217     dnl Mac OS X
218
219     LIBS="$LIBS -framework OpenGL -framework Carbon -lobjc"
220     ;;
221
222 *)
223     dnl X-Windows based machines
224
225     AC_SEARCH_LIBS(XCreateWindow, X11)
226     AC_SEARCH_LIBS(XShmCreateImage, Xext)
227     AC_SEARCH_LIBS(XGetExtensionVersion, Xi)
228     AC_SEARCH_LIBS(IceOpenConnection, ICE)
229     AC_SEARCH_LIBS(SmcOpenConnection, SM)
230     AC_SEARCH_LIBS(XtMalloc, Xt)
231     AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
232     
233     AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
234     if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
235         dnl if GLcore found, then also check for GL
236         AC_SEARCH_LIBS(glXCreateContext, GL)
237     fi
238
239     dnl if using mesa, check for xmesa.h
240     if test "x$ac_cv_search_glNewList" = "x-lMesaGL"; 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])
245         fi
246     fi
247
248     AC_SEARCH_LIBS(gluLookAt, [ GLU MesaGLU ])
249     ;;
250
251 esac
252
253 AC_SEARCH_LIBS(glutGetModifiers, [ glut glut32 freeglut ], have_glut=yes, have_glut=no)
254 AM_CONDITIONAL(HAVE_GLUT, test "x$have_glut" = "xyes")
255
256 opengl_LIBS="$LIBS"
257 LIBS="$base_LIBS"
258
259 dnl check for OpenAL libraries
260 OPENAL_OK="no"
261 case "${host}" in
262 *-*-cygwin* | *-*-mingw32*)
263     dnl CygWin under Windoze.
264     INCLUDES="$INCLUDES -I/usr/local/include"
265     LIBS="$LIBS -L/usr/local/lib"
266     AC_SEARCH_LIBS(alGenBuffers, openal32)
267     AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
268     LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
269     openal_LIBS="$LIBS"
270     OPENAL_OK="$ac_cv_search_alGenBuffers"
271     ;;
272
273 *-apple-darwin*)
274     dnl Mac OS X
275
276     LIBS="$LIBS -framework IOKit -framework OpenAL"
277     openal_LIBS="$LIBS"
278     # not sure how to test if OpenAL exists on MacOS (does it come by default?)
279     OPENAL_OK="yes"
280     ;;
281
282 *)
283     dnl default unix style machines
284
285     save_LIBS=$LIBS
286     LIBS="$LIBS $thread_LIBS"
287     AC_SEARCH_LIBS(alGenBuffers, openal)
288     AC_SEARCH_LIBS(alutInit, [ alut openal ] )
289     OPENAL_OK="$ac_cv_search_alGenBuffers"
290     openal_LIBS="$LIBS"
291     LIBS=$save_LIBS
292     ;;
293
294 esac
295
296 if test "$OPENAL_OK" == "no"; then
297     echo
298     echo "You *must* have the openal library installed on your system to build"
299     echo "SimGear!"
300     echo
301     echo "Please see README.OpenAL for more details."
302     echo
303     echo "configure aborted."
304     exit
305 fi
306
307 LIBS="$base_LIBS"
308
309 AC_SUBST(base_LIBS)
310 AC_SUBST(openal_LIBS)
311 AC_SUBST(opengl_LIBS)
312 AC_SUBST(thread_LIBS)
313 AC_SUBST(network_LIBS)
314
315 dnl Check for MS Windows environment
316 AC_CHECK_HEADER(windows.h)
317 AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
318
319 # The following are C++ items that need to be tested for with the c++
320 # compiler
321
322 AC_LANG_PUSH(C++)
323
324 dnl Check for "plib" without which we cannot go on
325 AC_CHECK_HEADER(plib/ul.h)
326 if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
327     echo
328     echo "You *must* have the plib library installed on your system to build"
329     echo "SimGear!"
330     echo
331     echo "Please see README.plib for more details."
332     echo
333     echo "configure aborted."
334     exit
335 fi
336
337 AC_MSG_CHECKING([for plib 1.8.4 or newer])
338 AC_TRY_RUN([
339 #include <plib/ul.h>
340
341 #define MIN_PLIB_VERSION 184
342
343 int main() {
344     int major, minor, micro;
345
346     if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
347          return -1;
348     }
349
350     return 0;
351 }
352
353 ],
354   AC_MSG_RESULT(yes),
355   [AC_MSG_RESULT(wrong version);
356    AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
357   AC_MSG_RESULT(yes)
358 )
359
360 LIBS="$saved_LIBS"
361
362 AC_LANG_POP
363
364 dnl Check for system installed zlib
365 AC_CHECK_HEADER(zlib.h)
366 if test "x$ac_cv_header_zlib_h" != "xyes"; then
367     echo
368     echo "zlib library not found."
369     echo
370     echo "If your OS does not provide an installable package for zlib"
371     echo "you will have to compile and install it first yourself.  A copy"
372     echo "of zlib-1.1.4.tar.gz is included with SimGear.  You will"
373     echo "have to untar this source code, and follow its included instructions"
374     echo "to compile and install on your system."
375     echo
376     echo "configure aborted."
377     echo
378 fi
379
380 dnl Checks for header files.
381 AC_HEADER_STDC
382 AC_CHECK_HEADERS( \
383         fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
384         sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
385
386 if test "x$ac_cv_header_stdint_h" = "xyes"; then
387     AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
388 fi
389
390 dnl Checks for typedefs, structures, and compiler characteristics.
391 AC_C_CONST
392 AC_TYPE_SIZE_T
393 AC_TYPE_MODE_T
394 AC_HEADER_TIME
395 AC_STRUCT_TM
396
397 dnl Checks for library functions.
398 old_LIBS=$LIBS
399 LIBS="$base_LIBS $network_LIBS $opengl_LIBS"
400 AC_TYPE_SIGNAL
401 AC_FUNC_VPRINTF
402 AC_CHECK_FUNCS( [ \
403         ftime gettimeofday timegm memcpy bcopy mktime strstr rand \
404         random drand48 setitimer getitimer signal GetLocalTime rint getrusage ] )
405 LIBS=$old_LIBS
406
407 AM_CONFIG_HEADER(simgear/simgear_config.h)
408
409 AC_CONFIG_FILES([ \
410         Makefile \
411         SimGear.spec \
412         src-libs/Makefile \
413         simgear/Makefile \
414         simgear/version.h \
415         simgear/compatibility/Makefile \
416         simgear/compatibility/MIPSpro721/Makefile \
417         simgear/compatibility/MIPSpro740/Makefile \
418         simgear/bucket/Makefile \
419         simgear/debug/Makefile \
420         simgear/ephemeris/Makefile \
421         simgear/io/Makefile \
422         simgear/magvar/Makefile \
423         simgear/math/Makefile \
424         simgear/environment/Makefile \
425         simgear/misc/Makefile \
426         simgear/nasal/Makefile \
427         simgear/props/Makefile \
428         simgear/route/Makefile \
429         simgear/scene/Makefile \
430         simgear/scene/material/Makefile \
431         simgear/scene/model/Makefile \
432         simgear/scene/sky/Makefile \
433         simgear/scene/tgdb/Makefile \
434         simgear/screen/Makefile \
435         simgear/serial/Makefile \
436         simgear/sound/Makefile \
437         simgear/structure/Makefile \
438         simgear/threads/Makefile \
439         simgear/timing/Makefile \
440         simgear/xml/Makefile \
441 ])
442 AC_OUTPUT
443
444
445 echo ""
446 echo "Configure Summary"
447 echo "================="
448
449 echo "Prefix: $prefix"
450
451 if test "x$with_logging" != "x"; then
452     echo "Debug messages: $with_logging"
453 else
454     echo "Debug messages: yes"
455 fi
456
457 echo -n "Automake version: "
458 automake --version | head -1
459
460 if test "x$with_jpeg_factory" = "xyes"; then
461    echo "With JPEG Factory support"
462 else
463    echo "Without JPEG Factory support"
464 fi
465
466 if test "x$ac_cv_header_pthread_h" = "xyes"; then
467    echo "Threads: pthread lib found."
468 else
469    echo "Threads: no threads (pthread lib not found.)"
470 fi
471