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