| 1 |
dnl Process this file with autoconf to produce a configure script. |
|---|
| 2 |
AC_INIT([Angband], [3.0.9b], [bugs@rephial.org], [angband]) |
|---|
| 3 |
AC_PREREQ([2.50]) |
|---|
| 4 |
|
|---|
| 5 |
AC_CONFIG_HEADER(src/autoconf.h) |
|---|
| 6 |
|
|---|
| 7 |
dnl OMK bootstrap |
|---|
| 8 |
AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME]) |
|---|
| 9 |
AC_SUBST([VERSION], [AC_PACKAGE_VERSION]) |
|---|
| 10 |
|
|---|
| 11 |
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) |
|---|
| 12 |
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]) |
|---|
| 13 |
|
|---|
| 14 |
dnl Check for C compiler |
|---|
| 15 |
AC_LANG([C]) |
|---|
| 16 |
AC_PROG_CC |
|---|
| 17 |
|
|---|
| 18 |
test "$GCC" = "yes" && CFLAGS="$CFLAGS -Wall -pipe -g -fno-strength-reduce" |
|---|
| 19 |
|
|---|
| 20 |
dnl Checks for various programs |
|---|
| 21 |
AC_PROG_INSTALL |
|---|
| 22 |
AC_PROG_LN_S |
|---|
| 23 |
AC_PROG_MAKE_SET |
|---|
| 24 |
|
|---|
| 25 |
AC_PATH_PROG(RM, rm) |
|---|
| 26 |
AC_PATH_PROG(MV, mv) |
|---|
| 27 |
AC_PATH_PROG(CP, cp) |
|---|
| 28 |
|
|---|
| 29 |
dnl Work around an autoconf bugs. |
|---|
| 30 |
if test "$prefix" = "NONE"; then |
|---|
| 31 |
prefix="${ac_default_prefix}" |
|---|
| 32 |
fi |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 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]) |
|---|
| 37 |
|
|---|
| 38 |
if test "$with_libpath" != ""; then |
|---|
| 39 |
libpath="${with_libpath}" |
|---|
| 40 |
elif test "$with_setgid" != ""; then |
|---|
| 41 |
libpath="${prefix}/share/${PACKAGE}/" |
|---|
| 42 |
else |
|---|
| 43 |
libpath="./lib/" |
|---|
| 44 |
bindir=".." |
|---|
| 45 |
fi |
|---|
| 46 |
|
|---|
| 47 |
case "/$libpath" in |
|---|
| 48 |
*/) MY_EXPAND_DIR(game_datadir, "$libpath") ;; |
|---|
| 49 |
*) MY_EXPAND_DIR(game_datadir, "$libpath/") ;; |
|---|
| 50 |
esac |
|---|
| 51 |
|
|---|
| 52 |
AC_DEFINE_UNQUOTED([DEFAULT_PATH], "${game_datadir}", [Path to the game's lib directory]) |
|---|
| 53 |
|
|---|
| 54 |
SETEGID="$with_setgid"; AC_SUBST(SETEGID) |
|---|
| 55 |
DATA_PATH="$game_datadir"; AC_SUBST(DATA_PATH) |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
dnl Frontends |
|---|
| 59 |
AC_ARG_ENABLE(gtk, |
|---|
| 60 |
[ --enable-gtk Enables GTK 2.x frontend, can't use on system-wide installs (default: disabled)], |
|---|
| 61 |
[enable_gtk=$enableval], |
|---|
| 62 |
[enable_gtk=no]) |
|---|
| 63 |
AC_ARG_ENABLE(curses, |
|---|
| 64 |
[ --enable-curses Enables Curses frontend (default: enabled)], |
|---|
| 65 |
[enable_curses=$enableval], |
|---|
| 66 |
[enable_curses=yes]) |
|---|
| 67 |
AC_ARG_ENABLE(x11, |
|---|
| 68 |
[ --enable-x11 Enables X11 frontend (default: enabled)], |
|---|
| 69 |
[enable_x11=$enableval], |
|---|
| 70 |
[enable_x11=yes]) |
|---|
| 71 |
AC_ARG_ENABLE(sdl, |
|---|
| 72 |
[ --enable-sdl Enables SDL frontend (default: disabled)], |
|---|
| 73 |
[enable_sdl=$enableval], |
|---|
| 74 |
[enable_sdl=no]) |
|---|
| 75 |
|
|---|
| 76 |
dnl Sound modules |
|---|
| 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]) |
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
dnl curses checking |
|---|
| 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 |
|---|
| 93 |
with_curses=no |
|---|
| 94 |
else |
|---|
| 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" |
|---|
| 98 |
with_curses=yes |
|---|
| 99 |
fi |
|---|
| 100 |
else |
|---|
| 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" |
|---|
| 104 |
with_curses=yes |
|---|
| 105 |
fi |
|---|
| 106 |
else |
|---|
| 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" |
|---|
| 110 |
with_curses=yes |
|---|
| 111 |
fi |
|---|
| 112 |
fi |
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
dnl X11 checking |
|---|
| 116 |
if test "$enable_x11" = "yes"; then |
|---|
| 117 |
AC_PATH_XTRA |
|---|
| 118 |
|
|---|
| 119 |
if test "x$have_x" != "xyes"; then |
|---|
| 120 |
with_x11=no |
|---|
| 121 |
else |
|---|
| 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" |
|---|
| 125 |
with_x11=yes |
|---|
| 126 |
fi |
|---|
| 127 |
fi |
|---|
| 128 |
|
|---|
| 129 |
dnl SDL checking |
|---|
| 130 |
if test "$enable_sdl" = "yes"; then |
|---|
| 131 |
AM_PATH_SDL(1.2.10,,) |
|---|
| 132 |
|
|---|
| 133 |
if test "$SDL_CONFIG" = "no"; then |
|---|
| 134 |
with_sdl=no |
|---|
| 135 |
else |
|---|
| 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) |
|---|
| 138 |
|
|---|
| 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" |
|---|
| 143 |
fi |
|---|
| 144 |
fi |
|---|
| 145 |
fi |
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
dnl GTK checking |
|---|
| 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], |
|---|
| 151 |
[with_gtk=yes], |
|---|
| 152 |
[with_gtk=no] |
|---|
| 153 |
) |
|---|
| 154 |
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0], |
|---|
| 155 |
[with_gtkx=yes], |
|---|
| 156 |
[with_gtk=no] |
|---|
| 157 |
) |
|---|
| 158 |
|
|---|
| 159 |
if [ "x$SETEGID" != "x"]; then |
|---|
| 160 |
enable_gtk=no |
|---|
| 161 |
with_gtk=no |
|---|
| 162 |
fi |
|---|
| 163 |
|
|---|
| 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" |
|---|
| 168 |
fi |
|---|
| 169 |
fi |
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 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) |
|---|
| 175 |
|
|---|
| 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" |
|---|
| 181 |
fi |
|---|
| 182 |
fi |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
dnl Check for headers, types, functions |
|---|
| 187 |
AC_CHECK_HEADERS([fcntl.h stdint.h dirent.h]) |
|---|
| 188 |
AC_HEADER_STDBOOL |
|---|
| 189 |
AC_C_CONST |
|---|
| 190 |
AC_TYPE_SIGNAL |
|---|
| 191 |
AC_CHECK_FUNCS([mkstemp setresgid setegid can_change_color]) |
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
AC_CONFIG_FILES([mk/rules.mk]) |
|---|
| 196 |
AC_OUTPUT |
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
echo |
|---|
| 200 |
echo "Configuration:" |
|---|
| 201 |
echo |
|---|
| 202 |
echo " Install path: ${prefix}" |
|---|
| 203 |
echo " lib/ path: ${game_datadir}" |
|---|
| 204 |
echo |
|---|
| 205 |
echo "-- Frontends --" |
|---|
| 206 |
if test "$enable_curses" = "yes"; then |
|---|
| 207 |
if test "$with_curses" = "no"; then |
|---|
| 208 |
echo "- Curses No; missing libraries" |
|---|
| 209 |
else |
|---|
| 210 |
echo "- Curses Yes" |
|---|
| 211 |
fi |
|---|
| 212 |
else |
|---|
| 213 |
echo "- Curses Disabled" |
|---|
| 214 |
fi |
|---|
| 215 |
if test "$enable_gtk" = "yes"; then |
|---|
| 216 |
if test "$with_gtk" = "no"; then |
|---|
| 217 |
echo "- GTK 2.x No; missing libraries" |
|---|
| 218 |
else |
|---|
| 219 |
echo "- GTK 2.x Yes" |
|---|
| 220 |
fi |
|---|
| 221 |
else |
|---|
| 222 |
echo "- GTK 2.x Disabled" |
|---|
| 223 |
fi |
|---|
| 224 |
if test "$enable_x11" = "yes"; then |
|---|
| 225 |
if test "$with_x11" = "no"; then |
|---|
| 226 |
echo "- X11 No; missing libraries" |
|---|
| 227 |
else |
|---|
| 228 |
echo "- X11 Yes" |
|---|
| 229 |
fi |
|---|
| 230 |
else |
|---|
| 231 |
echo "- X11 Disabled" |
|---|
| 232 |
fi |
|---|
| 233 |
if test "$enable_sdl" = "yes"; then |
|---|
| 234 |
if test "$with_sdl" = "no"; then |
|---|
| 235 |
echo "- SDL No; missing libraries" |
|---|
| 236 |
else |
|---|
| 237 |
echo "- SDL Yes" |
|---|
| 238 |
fi |
|---|
| 239 |
else |
|---|
| 240 |
echo "- SDL Disabled" |
|---|
| 241 |
fi |
|---|