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