File: configure.in

package info (click to toggle)
abe 1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,068 kB
  • sloc: ansic: 5,468; sh: 2,725; objc: 224; makefile: 48
file content (185 lines) | stat: -rw-r--r-- 5,834 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
dnl This configuration script was based on that of Tuxracer. 
dnl http://www.tuxracer.com/

dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/Common.h)
AM_INIT_AUTOMAKE(abe, "0.61")
AM_CONFIG_HEADER(config.h)

dnl Check system type
AC_CANONICAL_HOST

dnl Check for compilers.  We set CFLAGS and CXXFLAGS to null if unset, so
dnl that these macros won't set them to default values that we don't want.
if test "x${CFLAGS-notset}" = "xnotset" ; then
    export CFLAGS
    CFLAGS=""
fi
AC_PROG_CC

if test "x${CXXFLAGS-notset}" = "xnotset" ; then
    export CXXFLAGS
    CXXFLAGS=""
fi
AC_PROG_CXX

dnl Check for ranlib
AC_PROG_RANLIB

dnl we'll compile subdirectories into .la files.
dnl AM_PROG_LIBTOOL

dnl run make in subdirectories
AC_PROG_MAKE_SET

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME

dnl Checks for library functions.
AC_CHECK_FUNCS(getcwd gettimeofday strdup)

dnl Check for non-standard floating point functions and headers
AC_CHECK_FUNCS(finite isnan)
AC_CHECK_FUNCS(_finite _isnan)
AC_CHECK_HEADERS(ieeefp.h)

dnl --------------------------------------------------------------------------
dnl General options
dnl --------------------------------------------------------------------------
TR_CPPFLAGS=""
TR_CFLAGS="-O2 -Wall -fomit-frame-pointer -ffast-math -fexpensive-optimizations"
TR_CXXFLAGS="-O2 -Wall -fomit-frame-pointer -ffast-math -fexpensive-optimizations"
TR_LIBS=""

case "$host" in
alpha*-*-linux-*) TR_CFLAGS="$TR_CFLAGS -mieee";;
esac

AC_ARG_ENABLE(debug,     [  --enable-debug          Produce an executable with debugging symbols], 
			 [TR_CFLAGS="-g -Wall -fno-inline"; TR_CXXFLAGS="-g -Wall -fno-inline"],
			 [TR_CPPFLAGS="$TR_CPPFLAGS"])

AC_ARG_ENABLE(pedantic,  [  --enable-pedantic       Enable -pedantic (and -ansi for C) when compiling], TR_CFLAGS="$TR_CFLAGS -ansi -pedantic"; TR_CXXFLAGS="$TR_CXXFLAGS -pedantic")

AC_ARG_ENABLE(profile,[  --enable-profile        Produce a profiled executable],  [TR_CFLAGS="$TR_CFLAGS -pg"; TR_CXXFLAGS="$TR_CXXFLAGS -pg"])


dnl --------------------------------------------------------------------------
dnl Check if compiling for Win32
dnl --------------------------------------------------------------------------
AC_MSG_CHECKING([for Win32 platform])
AC_EGREP_CPP(yes,
[ 
#if defined(WIN32) || defined(__CYGWIN__)
  yes
#endif
], is_win32=yes, is_win32=no )
AC_MSG_RESULT([$is_win32])

AC_MSG_CHECKING([for Mac OSX platform])
AC_EGREP_CPP(yes,
[
#if defined(__APPLE__) || defined(__MACH_O__)
  yes
#endif
], is_macosx=yes, is_macosx=no )
AC_MSG_RESULT([$is_macosx])

dnl Add libs required for Windows
dnl I don't use -mwindows since I like having the console around
dnl If the console annoys you then remove "-luser32 -lgdi32" and replace
dnl with "-mwindows"
if test "x$is_win32" = "xyes" ; then
    TR_LIBS="$TR_LIBS -luser32 -lgdi32"
fi

dnl --------------------------------------------------------------------------
dnl Check for X  
dnl Note that we only need libs (so that glut links properly on all systems).
dnl --------------------------------------------------------------------------
if test "x$is_win32" = "xno" ; then
    AC_PATH_XTRA
    if test "x$no_x" = "x" ; then
	TR_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXi -lXext -lXmu -lXt $X_EXTRA_LIBS $TR_LIBS"
    fi
fi

dnl --------------------------------------------------------------------------
dnl Check for some common libraries
dnl --------------------------------------------------------------------------
AC_CHECK_LIB( dl, main, TR_LIBS="$TR_LIBS -ldl" )
AC_CHECK_LIB(  m, main, TR_LIBS="$TR_LIBS -lm" )

dnl --------------------------------------------------------------------------
dnl Check for SDL
dnl --------------------------------------------------------------------------
AC_ARG_ENABLE(sdl,[  --disable-sdl           Disable detction and use of SDL])

if test "x$enable_sdl" != "xno" ; then

    SDL_VERSION=1.0.1
    AM_PATH_SDL($SDL_VERSION, have_SDL=yes, have_SDL=no)

    if test "x$have_SDL" = "xyes" ; then
	TR_CPPFLAGS="$TR_CPPFLAGS -DHAVE_SDL=1"
	TR_CFLAGS="$TR_CFLAGS $SDL_CFLAGS"
	TR_CXXFLAGS="$TR_CXXFLAGS $SDL_CFLAGS"
	TR_LIBS="$TR_LIBS $SDL_LIBS"

	dnl Check for joystick support in SDL
	saved_LIBS="$LIBS"
	LIBS="$saved_LIBS $TR_LIBS"

	AC_CHECK_FUNCS( SDL_JoystickOpen, 
			have_SDL_joystick=yes, have_SDL_joystick=no )

	if test "x$have_SDL_joystick" = "xno" ; then
	    echo "*** This version of SDL doesn't have joystick support."
	    echo "*** Configuring without joystick support."
	fi

	dnl Check for SDL_mixer
	AC_CHECK_LIB( SDL_mixer, Mix_OpenAudio, 
		      have_SDL_mixer=yes, have_SDL_mixer=no )

	if test "x$have_SDL_mixer" = "xyes" ; then 
	    TR_CPPFLAGS="$TR_CPPFLAGS -DHAVE_SDL_MIXER=1" 
	    TR_LIBS="$TR_LIBS -lSDL_mixer"
	else
	    echo "*** SDL_mixer not found.  Configuring without audio support."
	fi

	LIBS="$saved_LIBS"
    else
	echo "*** SDL not found.  Configuring without audio or joystick support."
    fi

fi

dnl --------------------------------------------------------------------------
dnl Other options
dnl --------------------------------------------------------------------------

dnl Turn use of stencil buffer on/off
AC_ARG_ENABLE(stencil-buffer,[  --enable-stencil-buffer Use if your hardware has a stencil buffer],TR_CPPFLAGS="$TR_CPPFLAGS -DUSE_STENCIL_BUFFER")

dnl Specify data directory
AC_ARG_WITH(data-dir,[  --with-data-dir=PATH    Default abe data directory],TR_CPPFLAGS="$TR_CPPFLAGS -DBASE_DIR=\"$withval\"")


AC_SUBST(TR_CPPFLAGS)
AC_SUBST(TR_CFLAGS)
AC_SUBST(TR_CXXFLAGS)
AC_SUBST(TR_LIBS)

CPPFLAGS="$CPPFLAGS $TR_CPPFLAGS"
CFLAGS="$CFLAGS $TR_CFLAGS"
CXXFLAGS="$CXXFLAGS $TR_CXXFLAGS"
LIBS="$LIBS $TR_LIBS"

AC_OUTPUT(Makefile src/Makefile )