]> git.mxchange.org Git - flightgear.git/blob - configure.in
Initial revision.
[flightgear.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl The basis for this file was generated by autoscan(1) [pere 1998-03-19]
4 dnl
5
6 AC_INIT(Simulator/Aircraft/aircraft.cxx)
7
8 dnl Initialize the automake stuff
9 AM_INIT_AUTOMAKE(FlightGear, 0.6.0)
10
11 dnl configure other independant packages included with flight gear for
12 dnl convenience
13 AC_CONFIG_SUBDIRS( Lib/plib )
14
15 dnl Checks for programs.
16 AC_PROG_MAKE_SET
17 AC_PROG_CC
18 AC_PROG_CXX
19 AC_PROG_RANLIB
20 AC_PROG_INSTALL
21 AC_PROG_LN_S
22
23 dnl Initialize libtool
24 dnl AM_PROG_LIBTOOL
25
26 dnl Initialize maintainer mode
27 dnl AM_MAINTAINER_MODE
28
29 dnl This is needed for AC_TRY_COMPILE later
30 dnl AC_ISC_POSIX
31
32 dnl Check to see if this `configure' is being run in the `Cygwin32' environment
33 dnl AM_CYGWIN32
34
35 dnl Specify if we want logging (testing build) or not (release build)
36 # set logging default value
37 # with_logging=yes
38 AC_ARG_WITH(logging, [  --with-logging          Include logging output (default)])
39 if test "x$with_logging" = "xno" ; then
40     AC_DEFINE(FG_NDEBUG)
41 fi
42
43
44 dnl specify if we are building with "checker"
45 AC_ARG_WITH(efence, [  --with-efence           Specify if we are building with "electric-fence"])
46
47 if test "x$with_efence" = "xyes" ; then
48     echo "Building with efence"
49     LIBS= "$LIBS -lefence"
50 fi
51
52 dnl specify the compiled flight model
53 AC_ARG_WITH(flight-model, [  --with-flight-model=xxx Specify the flight model (navion, cherokee)])
54
55 if test "x$with_flight_model" = "xcherokee" ; then
56     echo "Building with cherokee flight model"
57 else 
58     echo "Building with navion flight model"
59 fi
60 AM_CONDITIONAL(ENABLE_CHEROKEE, test "x$with_flight_model" = "xcherokee")
61
62 dnl Let the Win32 user specify if they want to build with the SGI
63 dnl opengl.dll as opposed to the more standard openg32.dll
64 AC_ARG_WITH(sgi-opengl, [  --with-sgi-opengl       Build against SGI's opengl.dll glu.dll and glut.dll])
65
66 dnl Check for MS Windows environment
67 AC_CHECK_HEADER(windows.h)
68
69 dnl Using AM_CONDITIONAL is a step out of the protected little 
70 dnl automake fold so it is potentially dangerous.  But, we are
71 dnl beginning to run into cases where the standard checks are not
72 dnl enough.  AM_CONDITIONALS are then referenced to conditionally
73 dnl build a Makefile.in from a Makefile.am which lets us define custom
74 dnl includes, compile alternative source files, etc.
75
76 dnl Check for external variables daylight and timezone.
77 AC_EXT_DAYLIGHT
78 AM_CONDITIONAL(HAVE_DAYLIGHT, test "$have_daylight" = yes )
79
80 AC_EXT_TIMEZONE
81 AM_CONDITIONAL(HAVE_TIMEZONE, test "$have_timezone" = yes )
82
83 dnl Check for Linux style audio support
84 AM_CONDITIONAL(ENABLE_AUDIO_SUPPORT, \
85         test -r /usr/include/soundcard.h \
86                 -o -r /usr/include/linux/soundcard.h \
87                 -o -r /usr/include/machine/soundcard.h \
88                 -o -r /usr/include/audio.h \
89                 -o "x$ac_cv_header_windows_h" = "xyes" )
90
91 AM_CONDITIONAL(ENABLE_IRIX_AUDIO, test -r /usr/include/audio.h)
92
93 AM_CONDITIONAL(ENABLE_WIN32_AUDIO, test "x$ac_cv_header_windows_h" = "xyes")
94
95 dnl Check for (currently Linux only style) joystick support
96 AM_CONDITIONAL(ENABLE_LINUX_JOYSTICK, test -r /usr/include/linux/joystick.h )
97
98 dnl Enable serial support on Unix type systems
99 AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true)
100
101 dnl extra library and include directories
102 EXTRA_DIRS="/usr/local /usr/X11R6"
103
104 if test -d /opt/X11R6 ; then
105      EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
106 fi
107
108 if test "x$ac_cv_header_windows_h" = "xyes" ; then
109     EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32"
110 # elif test `uname -s` = "SunOS" ; then
111 #   EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS"
112 fi
113 wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
114
115 dnl Check for X11 (fancy)
116 AC_PATH_XTRA
117
118 dnl Checks for libraries.
119
120 null_LIBS="$LIBS"
121
122 AC_CHECK_LIB(m, cos)
123
124 base_LIBS="$LIBS"
125
126 AC_CHECK_LIB(socket, socket)
127 AC_CHECK_LIB(X11, XCreateWindow)
128 AC_CHECK_LIB(Xext, XShmCreateImage)
129 AC_CHECK_LIB(Xi, XGetExtensionVersion)
130 AC_CHECK_LIB(ICE, IceOpenConnection)
131 AC_CHECK_LIB(SM, SmcOpenConnection)
132 AC_CHECK_LIB(Xt, XtMalloc)
133 AC_CHECK_LIB(Xmu, XmuLookupStandardColormap)
134
135 dnl check for OpenGL related libraries
136
137 if test "x$ac_cv_header_windows_h" != "xyes" ; then
138     dnl Reasonable stuff non-windoze variants ... :-)
139
140     AC_CHECK_LIB(GLcore, glNewList)
141     if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
142         dnl if no GLcore, check for GL
143         AC_CHECK_LIB(GL, glNewList)
144         if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then
145             dnl if no GL, check for MesaGL
146             AC_CHECK_LIB(MesaGL, glNewList)
147         fi
148     else
149         dnl if GLcore found, then also check for GL
150         AC_CHECK_LIB(GL, glXCreateContext)
151     fi
152
153     dnl if using mesa, check for xmesa.h
154     if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
155         AC_CHECK_HEADER(GL/xmesa.h)
156         AM_CONDITIONAL(ENABLE_XMESA_FX, \
157                        test "x$ac_cv_header_GL_xmesa_h" = "xyes")
158     else
159         dnl force a failed check
160         AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
161     fi
162
163     AC_CHECK_LIB(GLU, gluLookAt)
164     if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then
165         dnl if no GLU, check for MesaGLU
166         AC_CHECK_LIB(MesaGLU, gluLookAt)
167     fi
168
169     dnl check for glut
170     AC_CHECK_LIB(glut, glutGetModifiers)
171
172     dnl test for glutGameModeString, but avoid adding glut a second time into
173     dnl the list of libraries
174     save_LIBS="$LIBS"
175     AC_CHECK_LIB(glut, glutGameModeString)
176     LIBS="$save_LIBS"
177 else
178     dnl Win32 is a little wierd because it has to try to handle the various
179     dnl winbloze-isms.  We'll just do this manually for now.
180
181     echo Win32 specific hacks...
182     AC_DEFINE(WIN32)
183
184     dnl force a failed check since we will be building under windoze
185     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
186
187     if test "x$with_sgi_opengl" = "xyes" ; then
188         echo "Building with glut.dll, glu.dll, and opengl.dll"
189         WIN32_GLUT=glut
190         WIN32_GLU=glu
191         WIN32_OPENGL=opengl
192     else 
193         echo "Building with glut32.dll, glu32.dll, and opengl32.dll"
194         WIN32_GLUT=glut32
195         WIN32_GLU=glu32
196         WIN32_OPENGL=opengl32
197     fi
198
199     if test -f `pwd`/Win32/${WIN32_GLUT}.dll; then
200         echo "    found ${WIN32_GLUT}.dll, adding -l${WIN32_GLUT}"
201         LIBS="$LIBS -l${WIN32_GLUT}"
202     else
203         echo "    Cannot find ${WIN32_GLUT}.dll"
204         exit 1
205     fi
206
207     if test -f `pwd`/Win32/${WIN32_GLU}.dll; then
208         echo "    found ${WIN32_GLU}.dll"
209     else
210         echo "    Can't find ${WIN32_GLU}.dll, assuming it's someplace"
211     fi
212     echo "    adding -l${WIN32_GLU}"
213     LIBS="$LIBS -l${WIN32_GLU}"
214
215     if test -f `pwd`/Win32/${WIN32_OPENGL}.dll; then
216         echo "    found ${WIN32_OPENGL}.dll"
217     else
218         echo "    Can't find ${WIN32_OPENGL}.dll, assuming it's somplace"
219     fi
220     echo "    adding -l${WIN32_OPENGL}"
221     LIBS="$LIBS -l${WIN32_OPENGL}"
222
223     echo "    adding -luser32 -lgdi32"
224     LIBS="$LIBS -luser32 -lgdi32"
225     ac_cv_lib_glut_glutGetModifiers="yes"
226     ac_cv_lib_glut_glutGameModeString="yes"
227 fi
228
229 if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then
230     echo 
231     echo "Unable to find the necessary OpenGL or GLUT libraries."
232     echo "See config.log for automated test details and results ..."
233     exit 1
234 fi
235
236 if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then
237     echo
238     echo "Your version of glut doesn't support game mode."
239     echo "You need to fetch and install the latest version of glut from:"
240     echo
241     echo "    http://reality.sgi.com/opengl/glut3/glut3.html"
242     exit 1
243 fi
244
245 opengl_LIBS="$LIBS"
246 LIBS="$base_LIBS"
247
248 AC_SUBST(base_LIBS)
249 AC_SUBST(opengl_LIBS)
250
251 AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
252
253 dnl Check if Generic Polygon Clipping library is installed
254 dnl (from http://www.cs.man.ac.uk/aig/staff/alan/software/)
255 AC_CHECK_HEADERS( gpc.h )
256 if test "x$ac_cv_header_gpc_h" != "xyes"; then
257     echo
258     echo "You need to have the GPC library installed on your system to build"
259     echo "some of the scenery generation tools, otherwise you won't be able."
260     echo "to create scenery."
261     echo
262     echo "Please see README.gpc for more details."
263     echo
264     echo "(pausing 2 seconds)"
265     sleep 2
266 fi
267
268 dnl Check if  Geographic Foundation Classes library is installed
269 dnl (from http://www.geog.psu.edu/~qian/gfc/index.html)
270 AC_CHECK_HEADERS( gfc/gdbf.h )
271 if test "x$ac_cv_header_gfc_gdbf_h" != "xyes"; then
272     echo
273     echo "You need to have the GFC library installed on your system to build"
274     echo "some of the scenery generation tools, otherwise, they may fail."
275     echo
276     echo "You can get the original library from:"
277     echo 
278     echo "    http://www.geog.psu.edu/~qian/gfc/index.html"
279     echo
280     echo "However, I recommend you grab a copy with a couple modifications I"
281     echo "have made which should eliminate several gfc build problems:"
282     echo 
283     echo "    ftp://ftp.flightgear.org/pub/fgfs/Source/gfc-0.8.8.1a.tar.gz"
284     echo
285     echo "(pausing 5 seconds)"
286     sleep 5
287 fi
288
289 dnl Checks for header files.
290 AC_HEADER_STDC
291 AC_CHECK_HEADERS( \
292         fcntl.h getopt.h malloc.h memory.h stdlib.h sys/stat.h sys/time.h \
293         sys/timeb.h unistd.h windows.h winbase.h values.h )
294
295 dnl Checks for typedefs, structures, and compiler characteristics.
296 AC_C_CONST
297 AC_TYPE_SIZE_T
298 AC_HEADER_TIME
299 AC_STRUCT_TM
300
301 dnl Checks for library functions.
302 AC_TYPE_SIGNAL
303 AC_FUNC_VPRINTF
304 AC_CHECK_FUNCS( ftime gettimeofday memcpy bcopy mktime strstr rand random \
305         setitimer getitimer signal GetLocalTime rint getrusage )
306
307 AM_CONFIG_HEADER(Include/config.h)
308
309 AC_OUTPUT( \
310         VERSION \
311         Makefile \
312         Include/Makefile \
313         Lib/Makefile \
314         Lib/Bucket/Makefile \
315         Lib/Debug/Makefile \
316         Lib/Math/Makefile \
317         Lib/Misc/Makefile \
318         Lib/Serial/Makefile \
319         Lib/XGL/Makefile \
320         Lib/zlib/Makefile \
321         Simulator/Makefile \
322         Simulator/Aircraft/Makefile \
323         Simulator/Airports/Makefile \
324         Simulator/Astro/Makefile \
325         Simulator/Autopilot/Makefile \
326         Simulator/Cockpit/Makefile \
327         Simulator/Controls/Makefile \
328         Simulator/FDM/External/Makefile \
329         Simulator/FDM/JSBsim/Makefile \
330         Simulator/FDM/LaRCsim/Makefile \
331         Simulator/FDM/Slew/Makefile \
332         Simulator/FDM/Makefile \
333         Simulator/GUI/Makefile \
334         Simulator/Joystick/Makefile \
335         Simulator/Main/Makefile \
336         Simulator/Main/runfgfs \
337         Simulator/Main/runfgfs.bat \
338         Simulator/Makefile \
339         Simulator/Objects/Makefile \
340         Simulator/Scenery/Makefile \
341         Simulator/Time/Makefile \
342         Simulator/Weather/Makefile \
343         Tools/Makefile \
344         Tools/Construct/Makefile \
345         Tools/Construct/Array/Makefile \
346         Tools/Construct/Clipper/Makefile \
347         Tools/Construct/Combine/Makefile \
348         Tools/Construct/GenOutput/Makefile \
349         Tools/Construct/Triangulate/Makefile \
350         Tools/Construct/Main/Makefile \
351         Tools/Lib/Makefile \
352         Tools/Lib/DEM/Makefile \
353         Tools/Lib/Polygon/Makefile \
354         Tools/Lib/Triangle/Makefile \
355         Tools/Prep/Makefile \
356         Tools/Prep/DemChop/Makefile \
357         Tools/Prep/DemInfo/Makefile \
358         Tools/Prep/DemRaw2ascii/Makefile \
359         Tools/Prep/GenAirports/Makefile \
360         Tools/Prep/ShapeFile/Makefile \
361         Tools/Utils/Makefile \
362         Tools/Utils/Makedir/Makefile \
363         Tools/Areas/Makefile \
364         Tests/Makefile \
365 )
366
367 AC_OUTPUT_COMMANDS([chmod 755 Simulator/Main/runfgfs])
368