| 1 |
dnl Process this file with autoconf to produce a configure script. |
|---|
| 2 |
AC_INIT([Angband], [3.0.9], [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 |
AC_ARG_WITH(setgid, [ --with-setgid=NAME install angband as group NAME]) |
|---|
| 15 |
AC_ARG_WITH(private_dirs, [ --with-private-dirs use private scorefiles/savefiles/datafiles], |
|---|
| 16 |
[], [with_private_dirs=yes]) |
|---|
| 17 |
AC_ARG_WITH(noinstall, [ --with-noinstall don't install globally at all]) |
|---|
| 18 |
|
|---|
| 19 |
if test "x$with_setgid" != "xyes"; then |
|---|
| 20 |
if test "x$with_setgid" != "x"; then |
|---|
| 21 |
wsetgid=yes |
|---|
| 22 |
with_private_dirs= |
|---|
| 23 |
fi |
|---|
| 24 |
fi |
|---|
| 25 |
if test "x$with_noinstall" == "xyes"; then |
|---|
| 26 |
with_private_dirs= |
|---|
| 27 |
fi |
|---|
| 28 |
#if test "x$with_segtid" == "xyes"; then |
|---|
| 29 |
# with_private_dirs= |
|---|
| 30 |
#fi |
|---|
| 31 |
if test "x$wsetgid$with_private_dirs$with_noinstall" != "xyes"; then |
|---|
| 32 |
|
|---|
| 33 |
echo "Please run ./configure with one of: |
|---|
| 34 |
|
|---|
| 35 |
--with-setgid=<groupname> |
|---|
| 36 |
This configures the game to store savefiles and scorefiles in a central |
|---|
| 37 |
location on the system, writeable only by the group \"groupname\". If you |
|---|
| 38 |
want a traditional installation of Angband, where all users share a |
|---|
| 39 |
scorefile, then use this option, and set the groupname to your \"games\" |
|---|
| 40 |
group. This option requires the game to have the \"setgid\" bit set on its |
|---|
| 41 |
permissions, and thus this option requires root when installing. |
|---|
| 42 |
|
|---|
| 43 |
--with-private-dirs |
|---|
| 44 |
This configures the game to store savefiles and scorefiles for each user |
|---|
| 45 |
in that user's home directory. The game requires no special privileges if |
|---|
| 46 |
you do this, and should be used for most installations of the game. |
|---|
| 47 |
|
|---|
| 48 |
--with-noinstall |
|---|
| 49 |
This configures the game to store savefiles and scorefiles in the "lib" |
|---|
| 50 |
directory that the game uses. This is useful if you don't want to install |
|---|
| 51 |
system-wide at all; \"make install\" will just move the executable to the |
|---|
| 52 |
directory above \"src\" if you choose this option. This option is |
|---|
| 53 |
recommended for developers. |
|---|
| 54 |
" |
|---|
| 55 |
|
|---|
| 56 |
AC_MSG_ERROR([Please specify an installation method.]) |
|---|
| 57 |
fi |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
dnl Check for C compiler |
|---|
| 61 |
AC_LANG([C]) |
|---|
| 62 |
AC_PROG_CC |
|---|
| 63 |
|
|---|
| 64 |
test "$GCC" = "yes" && CFLAGS="$CFLAGS -fno-strength-reduce -Wall" |
|---|
| 65 |
|
|---|
| 66 |
dnl Checks for various programs |
|---|
| 67 |
AC_PROG_INSTALL |
|---|
| 68 |
AC_PROG_LN_S |
|---|
| 69 |
AC_PROG_MAKE_SET |
|---|
| 70 |
|
|---|
| 71 |
AC_PATH_PROG(RM, rm) |
|---|
| 72 |
AC_PATH_PROG(MV, mv) |
|---|
| 73 |
AC_PATH_PROG(CP, cp) |
|---|
| 74 |
|
|---|
| 75 |
dnl Work around an autoconf bug. |
|---|
| 76 |
if test "$prefix" = "NONE"; then |
|---|
| 77 |
prefix="${ac_default_prefix}" |
|---|
| 78 |
fi |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
if test "x$with_private_dirs" != "x"; then |
|---|
| 83 |
AC_DEFINE(USE_PRIVATE_PATHS, 1, [Define to use private user paths.]) |
|---|
| 84 |
fi |
|---|
| 85 |
|
|---|
| 86 |
AC_ARG_WITH(libpath, [ --with-libpath=PATH use PATH as the path to the Angband lib folder]) |
|---|
| 87 |
|
|---|
| 88 |
if test "$with_libpath" != ""; then |
|---|
| 89 |
libpath="${with_libpath}" |
|---|
| 90 |
elif test "$with_noinstall" != ""; then |
|---|
| 91 |
libpath="./lib/" |
|---|
| 92 |
bindir=".." |
|---|
| 93 |
else |
|---|
| 94 |
libpath="${prefix}/share/${PACKAGE}/" |
|---|
| 95 |
fi |
|---|
| 96 |
|
|---|
| 97 |
case "/$libpath" in |
|---|
| 98 |
*/) MY_EXPAND_DIR(game_datadir, "$libpath") ;; |
|---|
| 99 |
*) MY_EXPAND_DIR(game_datadir, "$libpath/") ;; |
|---|
| 100 |
esac |
|---|
| 101 |
|
|---|
| 102 |
AC_DEFINE_UNQUOTED([DEFAULT_PATH], "${game_datadir}", [Path to the game's lib directory]) |
|---|
| 103 |
|
|---|
| 104 |
NOINSTALL="$with_noinstall"; AC_SUBST(NOINSTALL) |
|---|
| 105 |
SETEGID="$with_setgid"; AC_SUBST(SETEGID) |
|---|
| 106 |
DATA_PATH="$game_datadir"; AC_SUBST(DATA_PATH) |
|---|
| 107 |
|
|---|
| 108 |
dnl Frontends |
|---|
| 109 |
AC_ARG_ENABLE(gtk, |
|---|
| 110 |
[AS_HELP_STRING([--enable-gtk], [Enables GTK 2.x frontend (default: disabled)])], |
|---|
| 111 |
[enable_gtk=$enableval], |
|---|
| 112 |
[enable_gtk=no]) |
|---|
| 113 |
AC_ARG_ENABLE(curses, |
|---|
| 114 |
[AS_HELP_STRING([--enable-curses], [Enables Curses frontend (default: enabled)])], |
|---|
| 115 |
[enable_curses=$enableval], |
|---|
| 116 |
[enable_curses=yes]) |
|---|
| 117 |
AC_ARG_ENABLE(x11, |
|---|
| 118 |
[AS_HELP_STRING([--enable-x11], [Enables X11 frontend (default: enabled)])], |
|---|
| 119 |
[enable_x11=$enableval], |
|---|
| 120 |
[enable_x11=yes]) |
|---|
| 121 |
AC_ARG_ENABLE(sdl, |
|---|
| 122 |
[AS_HELP_STRING([--enable-sdl], [Enables SDL frontend (default: disabled)])], |
|---|
| 123 |
[enable_sdl=$enableval], |
|---|
| 124 |
[enable_sdl=no]) |
|---|
| 125 |
|
|---|
| 126 |
dnl Sound modules |
|---|
| 127 |
AC_ARG_ENABLE(sdl_mixer, |
|---|
| 128 |
[AS_HELP_STRING([--enable-sdl-mixer], [Enables SDL mixer sound support (default: enabled)])], |
|---|
| 129 |
[enable_sdl_mixer=$enable_sdl_mixer], |
|---|
| 130 |
[enable_sdl_mixer=yes]) |
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
if test "x$enable_gtk" = "xyes"; then |
|---|
| 134 |
if test "x$wsetgid" = "xyes"; then |
|---|
| 135 |
AC_MSG_ERROR([The "setgid" option and the GTK port are incompatible.]) |
|---|
| 136 |
fi |
|---|
| 137 |
fi |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
dnl curses checking |
|---|
| 141 |
if test "$enable_curses" = "yes"; then |
|---|
| 142 |
AC_CHECK_LIB(curses , initscr, found_curses=yes,found_curses=no) |
|---|
| 143 |
AC_CHECK_LIB(ncurses , initscr, found_ncurses=yes,found_ncurses=no) |
|---|
| 144 |
AC_CHECK_LIB(pdcurses, initscr, found_pdcurses=yes,found_pdcurses=no) |
|---|
| 145 |
if test "x$found_ncurses" = "xno"; then |
|---|
| 146 |
if test "x$found_pdcurses" = "xno"; then |
|---|
| 147 |
if test "x$found_curses" = "xno"; then |
|---|
| 148 |
with_curses=no |
|---|
| 149 |
else |
|---|
| 150 |
AC_DEFINE(USE_CURSES, 1, [Define to 1 if Curses or PDCurses is found, but NCurses is not.]) |
|---|
| 151 |
AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.]) |
|---|
| 152 |
LDFLAGS="${LDFLAGS} -lcurses" |
|---|
| 153 |
with_curses=yes |
|---|
| 154 |
fi |
|---|
| 155 |
else |
|---|
| 156 |
AC_DEFINE(USE_CURSES, 1, [Define to 1 if Curses or PDCurses is found, but NCurses is not.]) |
|---|
| 157 |
AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.]) |
|---|
| 158 |
LDFLAGS="${LDFLAGS} -lpdcurses" |
|---|
| 159 |
with_curses=yes |
|---|
| 160 |
fi |
|---|
| 161 |
else |
|---|
| 162 |
AC_DEFINE(USE_NCURSES, 1, [Define to 1 if NCurses is found.]) |
|---|
| 163 |
AC_DEFINE(USE_GCU, 1, [Define to 1 if using the Curses frontend.]) |
|---|
| 164 |
LDFLAGS="${LDFLAGS} -lncurses" |
|---|
| 165 |
with_curses=yes |
|---|
| 166 |
fi |
|---|
| 167 |
fi |
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
dnl X11 checking |
|---|
| 171 |
if test "$enable_x11" = "yes"; then |
|---|
| 172 |
AC_PATH_XTRA |
|---|
| 173 |
|
|---|
| 174 |
if test "x$have_x" != "xyes"; then |
|---|
| 175 |
with_x11=no |
|---|
| 176 |
else |
|---|
| 177 |
AC_DEFINE(USE_X11, 1, [Define to 1 if using the X11 frontend and X11 libraries are found.]) |
|---|
| 178 |
CFLAGS="$CFLAGS $X_CFLAGS" |
|---|
| 179 |
LDFLAGS="$LDFLAGS $X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS" |
|---|
| 180 |
with_x11=yes |
|---|
| 181 |
fi |
|---|
| 182 |
fi |
|---|
| 183 |
|
|---|
| 184 |
dnl SDL checking |
|---|
| 185 |
if test "$enable_sdl" = "yes"; then |
|---|
| 186 |
AM_PATH_SDL(1.2.10,,) |
|---|
| 187 |
|
|---|
| 188 |
if test "$SDL_CONFIG" = "no"; then |
|---|
| 189 |
with_sdl=no |
|---|
| 190 |
else |
|---|
| 191 |
AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, with_sdl=yes, with_sdl=no) |
|---|
| 192 |
AC_CHECK_LIB(SDL_ttf, TTF_Init, with_sdlx=yes, with_sdl=no) |
|---|
| 193 |
|
|---|
| 194 |
if test "$with_sdl" = "yes"; then |
|---|
| 195 |
AC_DEFINE(USE_SDL, 1, [Define to 1 if using the SDL interface and SDL is found.]) |
|---|
| 196 |
CFLAGS="${CFLAGS} ${SDL_CFLAGS}" |
|---|
| 197 |
LDFLAGS="${LDFLAGS} ${SDL_LIBS} -lSDL_image -lSDL_ttf" |
|---|
| 198 |
fi |
|---|
| 199 |
fi |
|---|
| 200 |
fi |
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
dnl GTK checking |
|---|
| 204 |
if test "$enable_gtk" = "yes"; then |
|---|
| 205 |
PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.6.0 gtk+-2.0 >= 2.6.0 gthread-2.0 pango libglade-2.0], |
|---|
| 206 |
[with_gtk=yes], |
|---|
| 207 |
[with_gtk=no] |
|---|
| 208 |
) |
|---|
| 209 |
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0], |
|---|
| 210 |
[with_gtkx=yes], |
|---|
| 211 |
[with_gtk=no] |
|---|
| 212 |
) |
|---|
| 213 |
|
|---|
| 214 |
if [ "x$SETEGID" != "x"]; then |
|---|
| 215 |
enable_gtk=no |
|---|
| 216 |
with_gtk=no |
|---|
| 217 |
fi |
|---|
| 218 |
|
|---|
| 219 |
if test "$with_gtk" = "yes"; then |
|---|
| 220 |
AC_DEFINE(USE_GTK, 1, [Define to 1 if using the GTK+ 2.x interface and GTK+ 2.x is found.]) |
|---|
| 221 |
CFLAGS="${CFLAGS} $GTK_CFLAGS" |
|---|
| 222 |
LDFLAGS="${LDFLAGS} $GTK_LIBS -rdynamic -export-dynamic" |
|---|
| 223 |
fi |
|---|
| 224 |
fi |
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
dnl SDL mixer checking |
|---|
| 228 |
if test "$enable_sdl_mixer" = "yes"; then |
|---|
| 229 |
AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, found_sdl_mixer=yes, found_sdl_mixer=no) |
|---|
| 230 |
|
|---|
| 231 |
if test "$found_sdl_mixer" = "yes"; then |
|---|
| 232 |
AC_DEFINE(SOUND_SDL, 1, [Define to 1 if using SDL_mixer sound support and it's found.]) |
|---|
| 233 |
SDL_CFLAGS=`sdl-config --cflags` |
|---|
| 234 |
CFLAGS="${CFLAGS} ${SDL_CFLAGS}" |
|---|
| 235 |
LDFLAGS="${LDFLAGS} -lSDL_mixer" |
|---|
| 236 |
fi |
|---|
| 237 |
fi |
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
|
|---|
| 241 |
dnl Check for headers, types, functions |
|---|
| 242 |
AC_CHECK_HEADERS([fcntl.h stdint.h dirent.h]) |
|---|
| 243 |
AC_HEADER_STDBOOL |
|---|
| 244 |
AC_C_CONST |
|---|
| 245 |
AC_TYPE_SIGNAL |
|---|
| 246 |
AC_CHECK_FUNCS([setresgid setegid can_change_color stat]) |
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 |
AC_CONFIG_FILES([mk/rules.mk]) |
|---|
| 251 |
AC_OUTPUT |
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 |
echo |
|---|
| 255 |
echo "Configuration:" |
|---|
| 256 |
echo |
|---|
| 257 |
echo " Install path: ${prefix}" |
|---|
| 258 |
echo " lib/ path: ${game_datadir}" |
|---|
| 259 |
echo |
|---|
| 260 |
echo "-- Frontends --" |
|---|
| 261 |
if test "$enable_curses" = "yes"; then |
|---|
| 262 |
if test "$with_curses" = "no"; then |
|---|
| 263 |
echo "- Curses No; missing libraries" |
|---|
| 264 |
else |
|---|
| 265 |
echo "- Curses Yes" |
|---|
| 266 |
fi |
|---|
| 267 |
else |
|---|
| 268 |
echo "- Curses Disabled" |
|---|
| 269 |
fi |
|---|
| 270 |
if test "$enable_gtk" = "yes"; then |
|---|
| 271 |
if test "$with_gtk" = "no"; then |
|---|
| 272 |
echo "- GTK 2.x No; missing libraries" |
|---|
| 273 |
else |
|---|
| 274 |
echo "- GTK 2.x Yes" |
|---|
| 275 |
fi |
|---|
| 276 |
else |
|---|
| 277 |
echo "- GTK 2.x Disabled" |
|---|
| 278 |
fi |
|---|
| 279 |
if test "$enable_x11" = "yes"; then |
|---|
| 280 |
if test "$with_x11" = "no"; then |
|---|
| 281 |
echo "- X11 No; missing libraries" |
|---|
| 282 |
else |
|---|
| 283 |
echo "- X11 Yes" |
|---|
| 284 |
fi |
|---|
| 285 |
else |
|---|
| 286 |
echo "- X11 Disabled" |
|---|
| 287 |
fi |
|---|
| 288 |
if test "$enable_sdl" = "yes"; then |
|---|
| 289 |
if test "$with_sdl" = "no"; then |
|---|
| 290 |
echo "- SDL No; missing libraries" |
|---|
| 291 |
else |
|---|
| 292 |
echo "- SDL Yes" |
|---|
| 293 |
fi |
|---|
| 294 |
else |
|---|
| 295 |
echo "- SDL Disabled" |
|---|
| 296 |
fi |
|---|
| 297 |
|
|---|
| 298 |
echo |
|---|
| 299 |
|
|---|
| 300 |
if test "$enable_sdl_mixer" = "yes"; then |
|---|
| 301 |
if test "$found_sdl_mixer" = "no"; then |
|---|
| 302 |
echo "- SDL sound No; missing libraries" |
|---|
| 303 |
else |
|---|
| 304 |
echo "- SDL sound Yes" |
|---|
| 305 |
fi |
|---|
| 306 |
else |
|---|
| 307 |
echo "- SDL sound Disabled" |
|---|
| 308 |
fi |
|---|