root/trunk/configure.ac

Revision 167, 7.5 kB (checked in by takkaria, 3 years ago)

Fix automake handling of SDL and everything; works on Linux again now.

Line 
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([angband], [3.0.8], [http://angband.rogueforge.net/trac])
3 AC_PREREQ([2.50])
4
5 AC_CANONICAL_HOST
6 AC_CANONICAL_TARGET
7
8 AC_CONFIG_HEADER(src/autoconf.h)
9
10 dnl OMK bootstrap
11 AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])
12 AC_SUBST([VERSION], [AC_PACKAGE_VERSION])
13
14 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
15 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])
16
17 dnl Check for C compiler
18 AC_PROG_CC
19 AC_PROG_CXX
20 AC_ISC_POSIX
21 AC_C_BIGENDIAN
22
23 test "$GCC" = "yes" && CFLAGS="$CFLAGS -Wall -pipe -g -fno-strength-reduce"
24 PICFLAGS="-fPIC"
25 AC_SUBST(PICFLAGS)
26
27 dnl Checks for various programs
28 AC_PROG_INSTALL
29 AC_PROG_LN_S
30 AC_PROG_MAKE_SET
31
32 AC_PATH_PROG(RM, rm)
33 AC_PATH_PROG(MV, mv)
34 AC_PATH_PROG(CP, cp)
35 AC_PATH_PROG(AR, ar)
36 AC_PATH_PROG(RANLIB, ranlib)
37
38 AC_ARG_WITH(setgid,
39 [  --with-setgid=NAME      install angband as group NAME],
40 [case "${withval}" in
41   no) SETEGID="games";;
42   yes) AC_MSG_ERROR(missing argument for --with-setgid);;
43   *) SETEGID="$withval";;
44 esac])
45 AC_SUBST(SETEGID)
46
47 AC_LANG([C])
48
49 dnl generate the installation path for the ./lib/ folder
50 if test "$GAMEGROUP" != ""; then
51   MY_EXPAND_DIR(game_datadir, "$datadir/$PACKAGE/")
52 else
53   MY_EXPAND_DIR(game_datadir, "./lib/")
54   bindir=".."
55 fi
56
57 dnl overwrite the path with an user-specified value
58 AC_ARG_WITH(libpath,
59 [  --with-libpath=path     specify the path to the Angband lib folder],
60
61 [case "/$withval" in
62   */) game_datadir="$withval"  ;;
63   *)  game_datadir="$withval/" ;;
64 esac])
65
66 AC_DEFINE_UNQUOTED([DEFAULT_PATH], "$game_datadir",
67                    [Path to the game's lib directory])
68 DATA_PATH="$game_datadir"
69 AC_SUBST(DATA_PATH)
70
71 dnl Frontends
72 AC_ARG_ENABLE(gtk,
73         [  --enable-gtk                         Enables GTK 2.x frontend (default: disabled)],
74         [enable_gtk=$enableval],
75         [enable_gtk=no])
76 AC_ARG_ENABLE(curses,
77         [  --enable-curses                      Enables Curses frontend],
78         [enable_curses=$enableval],
79         [enable_curses=yes])
80 AC_ARG_ENABLE(x11,
81         [  --enable-x11                         Enables X11 frontend],
82         [enable_x11=$enableval],
83         [enable_x11=yes])
84 AC_ARG_ENABLE(sdl,
85         [  --enable-sdl                         Enables SDL frontend],
86         [enable_sdl=$enableval],
87         [enable_sdl=yes])
88
89 dnl Sound modules
90 AC_ARG_ENABLE(sdl_mixer,
91         [  --disable-sdl-mixer                  Disables SDL mixer sound support],
92         [disable_sdl_mixer=$disable_sdl_mixer],
93         [disable_sdl_mixer=no])
94
95
96 dnl curses checking
97 if test "$enable_curses" = "yes"; then
98         AC_CHECK_LIB(curses  , initscr, found_curses=yes,found_curses=no)
99         AC_CHECK_LIB(ncurses , initscr, found_ncurses=yes,found_ncurses=no)
100         AC_CHECK_LIB(pdcurses, initscr, found_pdcurses=yes,found_pdcurses=no)
101         if test "$found_ncurses" = "no"; then
102                 if test "$found_pdcurses" = "no"; then
103                         if test "$found_curses" = "no"; then
104                                 AC_DEFINE(USE_NCURSES, 0, [Define to 1 if NCurses is found.])
105                                 AC_DEFINE(USE_CURSES, 0, [Define to 1 if Curses or PDCurses is found, but NCurses is not.])
106                                 AC_DEFINE(USE_GCU, 0, [Define to 1 if using the Curses frontend.])
107                         else
108                                 AC_DEFINE(USE_NCURSES, 0, [Define to 1 if NCurses is found.])
109                                 AC_DEFINE(USE_CURSES, 1, [Define to 1 if Curses or PDCurses is found, but NCurses is not.])
110                                 AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.])
111                                 LDFLAGS="${LDFLAGS} -lcurses"
112                                 with_curses=yes
113                         fi
114                 else
115                         AC_DEFINE(USE_NCURSES, 0, [Define to 1 if NCurses is found.])
116                         AC_DEFINE(USE_CURSES, 1, [Define to 1 if Curses or PDCurses is found, but NCurses is not.])
117                         AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.])
118                         LDFLAGS="${LDFLAGS} -lpdcurses"
119                         with_curses=yes
120                 fi
121         else
122                 AC_DEFINE(USE_CURSES, 0, [Define to 1 if Curses or PDCurses is found, but NCurses is not.])
123                 AC_DEFINE(USE_NCURSES, 1, [Define to 1 if NCurses is found.])
124                 AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.])
125                 LDFLAGS="${LDFLAGS} -lncurses"
126                 with_curses=yes
127         fi
128 fi
129
130 dnl X11 checking
131 if test "$enable_x11" = "yes"; then
132         AC_PATH_XTRA
133
134         if test "$X_DISPLAY_MISSING" != ""; then
135                 AC_DEFINE(USE_X11, 0, [Define to 1 if using the X11 frontend and X11 libraries are found.])
136                 with_x11=no
137         else
138                 AC_DEFINE(USE_X11, 1, [Define to 1 if using the X11 frontend and X11 libraries are found.])
139                 CFLAGS="$CFLAGS $X_CFLAGS"
140                 LDFLAGS="$LDFLAGS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
141                 with_x11=yes
142         fi
143 fi
144
145 dnl SDL checking
146 if test "$enable_sdl" = "yes"; then
147         AM_PATH_SDL(1.2.0,,)
148
149         if test "$SDL_CONFIG" = "no"; then
150                 with_sdl=no
151                 AC_DEFINE(USE_SDL, 0, [Define to 1 if using the SDL interface and SDL & SDL_ttf are found.])
152         else
153                 AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, sdl_image=yes, sdl_image=no)
154                 AC_CHECK_LIB(SDL_ttf, TTF_Init, sdl_ttf=yes, sdl_ttf=no)
155
156                 if test "$sdl_image" = "yes"; then
157                 if test "$sdl_ttf" = "yes"; then
158                         AC_DEFINE(USE_SDL, 1, [Define to 1 if using the SDL interface and SDL is found.])
159                         CFLAGS="${CFLAGS} ${SDL_CFLAGS}"
160                         LDFLAGS="${LDFLAGS} ${SDL_LIBS} -lSDL_image -lSDL_ttf"
161                         with_sdl=yes
162                 fi; fi
163         fi
164 fi
165
166 dnl GTK checking
167 if test "$enable_gtk" = "yes"; then
168         PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.6.0 gtk+-2.0 >= 2.6.0 gthread-2.0 pango],
169                 [with_gtk=yes],
170                 [with_gtk=no]
171         )
172         PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0],
173                 [with_get=yes],
174                 [with_gtk=no]
175         )
176         if test "$with_gtk" = "yes"; then
177                 AC_DEFINE(USE_GTK, 1, [Define to 1 if using the GTK+ 2.x interface and GTK+ 2.x is found.])
178                 CFLAGS="${CFLAGS} $GTK_CFLAGS"
179                 LDFLAGS="${LDFLAGS} $GTK_LIBS"
180         else
181                 AC_DEFINE(USE_GTK, 0, [Define to 1 if using the GTK+ 2.x interface and GTK+ 2.x is found.])
182         fi
183 fi
184
185 dnl SDL mixer checking
186
187 if test "$disable_sdl_mixer" != "yes"; then
188         AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, found_sdl_mixer=yes, found_sdl_mixer=no)
189
190         if test "$found_sdl_mixer" = "yes"; then
191                 AC_DEFINE(SDL_SOUND, 1, [Enabled SDL_mixer sound support])
192                 LDFLAGS="${LDFLAGS} -lSDL_mixer"
193         else
194                 AC_DEFINE(SDL_SOUND, 0, [Disabled SDL_mixer sound support])
195         fi
196 fi
197
198
199 dnl Check for headers.
200 dnl AC_HEADER_STDBOOL -- not yet
201 AC_HEADER_TIME
202 AC_CHECK_HEADERS([unistd.h fcntl.h dirent.h limits.h stdint.h sys/time.h termios.h])
203
204 dnl Check for types.
205 AC_TYPE_SIGNAL
206
207 dnl Check for structs.
208 AC_STRUCT_TM
209
210 dnl Check for functions.
211 AC_FUNC_STAT
212 AC_CHECK_FUNCS([memmove memset mkdir strtol mkstemp setegid can_change_color])
213
214 dnl XXX: Work around some autoconf bugs.
215 if test "$prefix" = "NONE"; then
216         prefix="${ac_default_prefix}"
217 fi
218 if test -z "$datadir"; then
219         datadir="${prefix}/share"
220 fi
221
222
223 AC_CONFIG_FILES([
224         mk/rules.mk
225 ])
226
227 AC_OUTPUT
228
229
230 echo
231 echo "Configuration:"
232 echo
233 echo "  Install path:                           ${prefix}"
234 echo
235 echo "-- Frontends --"
236 if test "$enable_curses" = "yes"; then
237         if test "$with_curses" = "no"; then
238                 echo "- Curses                                  No; missing libraries"
239         else
240                 echo "- Curses                                  Yes"
241         fi
242 else
243         echo "- Curses                                  Disabled"
244 fi
245 if test "$enable_gtk" = "yes"; then
246         if test "$with_gtk" = "no"; then
247                 echo "- GTK 2.x                                 No; missing libraries"
248         else
249                 echo "- GTK 2.x                                 Yes"
250         fi
251 else
252         echo "- GTK 2.x                                 Disabled"
253 fi
254 if test "$enable_x11" = "yes"; then
255         if test "$with_x11" = "no"; then
256                 echo "- X11                                     No; missing libraries"
257         else
258                 echo "- X11                                     Yes"
259         fi
260 else
261         echo "- X11                                     Disabled"
262 fi
263 if test "$enable_sdl" = "yes"; then
264         if test "$with_sdl" = "no"; then
265                 echo "- SDL                                     No; missing libraries"
266         else
267                 echo "- SDL                                     Yes"
268         fi
269 else
270         echo "- SDL                                     Disabled"
271 fi
Note: See TracBrowser for help on using the browser.