1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([Angband], [3.0.9b], [bugs@rephial.org], [angband])
5 AC_CONFIG_HEADER(src/autoconf.h)
8 AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])
9 AC_SUBST([VERSION], [AC_PACKAGE_VERSION])
11 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
12 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])
14 dnl Check for C compiler
18 test "$GCC" = "yes" && CFLAGS="$CFLAGS -Wall -pipe -g -fno-strength-reduce"
20 dnl Checks for various programs
29 dnl Work around an autoconf bugs.
30 if test "$prefix" = "NONE"; then
31 prefix="${ac_default_prefix}"
35 AC_ARG_WITH(setgid, [ --with-setgid=NAME install angband as group NAME])
36 AC_ARG_WITH(libpath, [ --with-libpath=PATH use PATH as the path to the Angband lib folder])
38 if test "$with_libpath" != ""; then
39 libpath="${with_libpath}"
40 elif test "$with_setgid" != ""; then
41 libpath="${prefix}/share/${PACKAGE}/"
48 */) MY_EXPAND_DIR(game_datadir, "$libpath") ;;
49 *) MY_EXPAND_DIR(game_datadir, "$libpath/") ;;
52 AC_DEFINE_UNQUOTED([DEFAULT_PATH], "${game_datadir}", [Path to the game's lib directory])
54 SETEGID="$with_setgid"; AC_SUBST(SETEGID)
55 DATA_PATH="$game_datadir"; AC_SUBST(DATA_PATH)
60 [ --enable-gtk Enables GTK 2.x frontend, can't use on system-wide installs (default: disabled)],
61 [enable_gtk=$enableval],
64 [ --enable-curses Enables Curses frontend (default: enabled)],
65 [enable_curses=$enableval],
68 [ --enable-x11 Enables X11 frontend (default: enabled)],
69 [enable_x11=$enableval],
72 [ --enable-sdl Enables SDL frontend (default: disabled)],
73 [enable_sdl=$enableval],
77 AC_ARG_ENABLE(sdl_mixer,
78 [ --enable-sdl-mixer Enables SDL mixer sound support (default: enabled)],
79 [enable_sdl_mixer=$enable_sdl_mixer],
80 [enable_sdl_mixer=yes])
86 if test "$enable_curses" = "yes"; then
87 AC_CHECK_LIB(curses , initscr, found_curses=yes,found_curses=no)
88 AC_CHECK_LIB(ncurses , initscr, found_ncurses=yes,found_ncurses=no)
89 AC_CHECK_LIB(pdcurses, initscr, found_pdcurses=yes,found_pdcurses=no)
90 if test "x$found_ncurses" = "xno"; then
91 if test "x$found_pdcurses" = "xno"; then
92 if test "x$found_curses" = "xno"; then
95 AC_DEFINE(USE_CURSES, 1, [Define to 1 if Curses or PDCurses is found, but NCurses is not.])
96 AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.])
97 LDFLAGS="${LDFLAGS} -lcurses"
101 AC_DEFINE(USE_CURSES, 1, [Define to 1 if Curses or PDCurses is found, but NCurses is not.])
102 AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.])
103 LDFLAGS="${LDFLAGS} -lpdcurses"
107 AC_DEFINE(USE_NCURSES, 1, [Define to 1 if NCurses is found.])
108 AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.])
109 LDFLAGS="${LDFLAGS} -lncurses"
116 if test "$enable_x11" = "yes"; then
119 if test "x$have_x" != "xyes"; then
122 AC_DEFINE(USE_X11, 1, [Define to 1 if using the X11 frontend and X11 libraries are found.])
123 CFLAGS="$CFLAGS $X_CFLAGS"
124 LDFLAGS="$LDFLAGS $X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
130 if test "$enable_sdl" = "yes"; then
131 AM_PATH_SDL(1.2.10,,)
133 if test "$SDL_CONFIG" = "no"; then
136 AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, with_sdl=yes, with_sdl=no)
137 AC_CHECK_LIB(SDL_ttf, TTF_Init, with_sdlx=yes, with_sdl=no)
139 if test "$with_sdl" = "yes"; then
140 AC_DEFINE(USE_SDL, 1, [Define to 1 if using the SDL interface and SDL is found.])
141 CFLAGS="${CFLAGS} ${SDL_CFLAGS}"
142 LDFLAGS="${LDFLAGS} ${SDL_LIBS} -lSDL_image -lSDL_ttf"
149 if test "$enable_gtk" = "yes"; then
150 PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.6.0 gtk+-2.0 >= 2.6.0 gthread-2.0 pango libglade-2.0],
154 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0],
159 if [ "x$SETEGID" != "x"]; then
164 if test "$with_gtk" = "yes"; then
165 AC_DEFINE(USE_GTK, 1, [Define to 1 if using the GTK+ 2.x interface and GTK+ 2.x is found.])
166 CFLAGS="${CFLAGS} $GTK_CFLAGS"
167 LDFLAGS="${LDFLAGS} $GTK_LIBS -rdynamic -export-dynamic"
172 dnl SDL mixer checking
173 if test "$enable_sdl_mixer" = "yes"; then
174 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, found_sdl_mixer=yes, found_sdl_mixer=no)
176 if test "$found_sdl_mixer" = "yes"; then
177 AC_DEFINE(SOUND_SDL, 1, [Define to 1 if using SDL_mixer sound support and it's found.])
178 SDL_CFLAGS=`sdl-config --cflags`
179 CFLAGS="${CFLAGS} ${SDL_CFLAGS}"
180 LDFLAGS="${LDFLAGS} -lSDL_mixer"
186 dnl Check for headers, types, functions
187 AC_CHECK_HEADERS([fcntl.h stdint.h dirent.h])
191 AC_CHECK_FUNCS([mkstemp setresgid setegid can_change_color])
195 AC_CONFIG_FILES([mk/rules.mk])
200 echo "Configuration:"
202 echo " Install path: ${prefix}"
203 echo " lib/ path: ${game_datadir}"
205 echo "-- Frontends --"
206 if test "$enable_curses" = "yes"; then
207 if test "$with_curses" = "no"; then
208 echo "- Curses No; missing libraries"
213 echo "- Curses Disabled"
215 if test "$enable_gtk" = "yes"; then
216 if test "$with_gtk" = "no"; then
217 echo "- GTK 2.x No; missing libraries"
222 echo "- GTK 2.x Disabled"
224 if test "$enable_x11" = "yes"; then
225 if test "$with_x11" = "no"; then
226 echo "- X11 No; missing libraries"
231 echo "- X11 Disabled"
233 if test "$enable_sdl" = "yes"; then
234 if test "$with_sdl" = "no"; then
235 echo "- SDL No; missing libraries"
240 echo "- SDL Disabled"