1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(hengband, 2.2.1.7)
4 AC_CONFIG_HEADERS(src/autoconf.h)
5 AC_CONFIG_SRCDIR(src/main.c)
9 [ --with-setgid=NAME install hengband as group NAME],
12 yes) AC_MSG_ERROR(missing argument for --with-setgid);;
13 *) GAMEGROUP="$withval";;
16 AM_CONDITIONAL(SET_GID, test "$GAMEGROUP" != "")
20 dnl generate the installation path for the ./lib/ folder
21 if test "$GAMEGROUP" != ""; then
22 MY_EXPAND_DIR(game_datadir, "$datadir/games/$PACKAGE/lib/")
24 MY_EXPAND_DIR(game_datadir, "./lib/")
28 dnl overwrite the path with an user-specified value
30 [ --with-libpath=path specify the path to the Hengband lib folder],
31 [game_datadir="$withval"])
33 AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$game_datadir", [Path to the Hengband lib folder])
34 DEFAULT_PATH="$game_datadir"
35 AC_SUBST(DEFAULT_PATH)
37 dnl Checks for programs.
40 AC_ARG_ENABLE(japanese,
41 [ --disable-japanese build english version], use_japanese=no, [AC_DEFINE(JP, 1, [Enable Japanese]) AC_DEFINE(EUC, 1, [Use Extended Unix Code])])
44 [ --disable-xim disable xim support], use_xim=no, use_xim=yes)
45 AC_ARG_ENABLE(fontset,
46 [ --disable-fontset disable fontset support], use_fontset=no, use_fontset=yes)
47 AC_ARG_ENABLE(worldscore,
48 [ --disable-worldscore disable worldscore support], ,AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server]))
49 AC_ARG_ENABLE(chuukei,
50 [ --enable-chuukei enable internet chuukei support], AC_DEFINE(CHUUKEI, 1, [Chuukei mode]))
51 AC_ARG_ENABLE([cocoa],
52 [ --enable-cocoa enable a Cocoa user interface (OS X only)],
53 AC_DEFINE([MACH_O_COCOA], [1], [Use a Cocoa interface (OS X only)]), [])
54 AM_CONDITIONAL([COCOA], [test x$enable_cocoa = xyes])
55 if test x"$enable_cocoa" = yes; then
59 dnl Checks for libraries.
60 dnl Replace `main' with a function in -lncurses:
61 AC_CHECK_LIB(ncursesw, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncursesw"])
62 if test "$ac_cv_lib_ncursesw_initscr" != yes; then
63 AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncurses"])
64 if test "$ac_cv_lib_ncurses_initscr" != yes; then
65 AC_CHECK_LIB(curses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) LIBS="$LIBS -lcurses"])
66 if test "$ac_cv_lib_curses_initscr" != yes; then
67 AC_CHECK_LIB(termcap, tgetent, [AC_DEFINE(USE_CAP, 1, [Allow -mCAP environment]) LIBS="$LIBS -ltermcap"])
72 AC_CHECK_LIB(iconv, iconv_open)
74 AC_CHECK_FILE(/dev/urandom, AC_DEFINE(RNG_DEVICE, "/dev/urandom", [Random Number Generation device file]))
76 dnl Checks for header files.
78 if test "$have_x" = yes; then
80 AC_DEFINE(USE_X11, 1, [Allow -mX11 environment])
81 CFLAGS="$X_CFLAGS $CFLAGS"
82 LDFLAGS="$X_LIBS $LDFLAGS"
84 if test "$use_fontset" = yes; then
85 AC_DEFINE(USE_FONTSET, 1, [Use FontSet])
87 if test "$use_japanese" != no; then
88 AC_DEFINE(USE_JP_FONTSTRUCT, 1, [Use Kanji without FontSet])
92 if test "$use_xim" = yes; then
93 AC_DEFINE(USE_XIM, 1, [Use X Imput Method])
96 if test "$use_fontset" = yes || test "$use_xim" = yes; then
97 AC_DEFINE(USE_LOCALE, 1, [Support Locale])
98 if test "$use_japanese" != no; then
99 AC_DEFINE(DEFAULT_LOCALE, "ja_JP.eucJP", Default Japanese Locale)
101 AC_CHECK_LIB(X11, _Xsetlocale, AC_DEFINE(X_LOCALE, 1, [Use XLocale]))
102 AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4")
106 if test "$use_japanese" != no; then
107 AC_CHECK_PROG(NKF, nkf, yes)
108 if test x"$NKF" != x"yes"; then
109 AC_MSG_ERROR([nkf is not found. Please install nkf.])
114 AC_CHECK_HEADERS(fcntl.h strings.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h stdint.h)
116 dnl Checks for typedefs, structures, and compiler characteristics.
123 dnl Checks for library functions.
124 AC_PROG_GCC_TRADITIONAL
129 AC_CHECK_FUNCS(gethostname mkdir select socket strtol vsnprintf mkstemp usleep)
131 AC_OUTPUT(Makefile src/Makefile lib/Makefile lib/apex/Makefile lib/bone/Makefile lib/data/Makefile lib/edit/Makefile lib/file/Makefile lib/help/Makefile lib/info/Makefile lib/pref/Makefile lib/save/Makefile lib/script/Makefile lib/user/Makefile lib/xtra/Makefile lib/xtra/font/Makefile lib/xtra/graf/Makefile lib/xtra/music/Makefile lib/xtra/sound/Makefile)