OSDN Git Service

[Hotfix] a_info.at() がキー不存在例外を吐いてソフトウェアが落ちる事象を修正した
[hengbandforosx/hengbandosx.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(hengband, 3.0.0.0)
3
4 AC_CONFIG_HEADERS(src/autoconf.h)
5 AC_CONFIG_SRCDIR(src/main.cpp)
6 AM_INIT_AUTOMAKE
7
8 AC_ARG_WITH(setgid,
9 [  --with-setgid=NAME      install hengband as group NAME],
10 [case "${withval}" in
11   no) GAMEGROUP="";;
12   yes) AC_MSG_ERROR(missing argument for --with-setgid);;
13   *) GAMEGROUP="$withval";;
14 esac])
15 AC_SUBST(GAMEGROUP)
16 AM_CONDITIONAL(SET_GID, test "$GAMEGROUP" != "")
17
18 dnl generate the installation path for the ./lib/ folder
19 if test "$GAMEGROUP" != ""; then
20   MY_EXPAND_DIR(game_libpath, "$datadir/games/$PACKAGE/lib/")
21 else
22   MY_EXPAND_DIR(game_libpath, "./lib/")
23   bindir=".."
24 fi
25
26 dnl overwrite the path with an user-specified value
27 AC_ARG_WITH(libpath,
28 [  --with-libpath=path     specify the path to the Hengband lib folder],
29 [game_libpath="$withval"])
30
31 AC_ARG_WITH(varpath,
32 [  --with-varpath=path     specify the path to the Hengband var folder],
33 [game_varpath="$withval"],
34 [game_varpath="$game_libpath"])
35
36 AC_DEFINE_UNQUOTED(DEFAULT_LIB_PATH, "$game_libpath", [Path to the Hengband lib folder])
37 DEFAULT_LIB_PATH="$game_libpath"
38 AC_SUBST(DEFAULT_LIB_PATH)
39
40 AC_DEFINE_UNQUOTED(DEFAULT_VAR_PATH, "$game_varpath", [Path to the Hengband var folder])
41 DEFAULT_VAR_PATH="$game_varpath"
42 AC_SUBST(DEFAULT_VAR_PATH)
43
44 dnl Checks for programs.
45 AC_LANG(C++)
46 AC_PROG_CXX
47 m4_ifdef([AX_CXX_COMPILE_STDCXX_17], [
48   AX_CXX_COMPILE_STDCXX_17
49 ], [
50   AC_MSG_ERROR([AX_CXX_COMPILE_STDCXX_17 macro is not defined. You need to install autoconf-archive.])
51 ])
52 PKG_PROG_PKG_CONFIG
53
54 AC_ARG_ENABLE(japanese,
55 [  --disable-japanese      build english version], use_japanese=no, [AC_DEFINE(JP, 1, [Enable Japanese]) AC_DEFINE(EUC, 1, [Use Extended Unix Code])])
56
57 AC_ARG_ENABLE(xim,
58 [  --disable-xim           disable xim support], use_xim=no, use_xim=yes)
59 AC_ARG_ENABLE(fontset,
60 [  --disable-fontset       disable fontset support], use_fontset=no, use_fontset=yes)
61 AC_ARG_ENABLE([xft],
62         AS_HELP_STRING([--enable-xft], [Enable xft support]))
63 AC_ARG_ENABLE(worldscore,
64 [  --disable-worldscore    disable worldscore support], worldscore=no)
65 AC_ARG_ENABLE(chuukei,
66 [  --enable-chuukei        enable internet chuukei support], AC_DEFINE(CHUUKEI, 1, [Chuukei mode]))
67 AC_ARG_ENABLE([pch],
68 [  --disable-pch           disable use of precompiled headers],
69 enable_pch=no, enable_pch=yes)
70 AM_CONDITIONAL([PCH], [test x$enable_pch = xyes])
71
72 dnl Checks for libraries.
73 dnl Replace `main' with a function in -lncurses:
74 AC_CHECK_LIB(ncursesw, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncursesw"])
75 if test "$ac_cv_lib_ncursesw_initscr" != yes; then
76   AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncurses"])
77   if test "$ac_cv_lib_ncurses_initscr" != yes; then
78     AC_CHECK_LIB(curses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) LIBS="$LIBS -lcurses"])
79     if test "$ac_cv_lib_curses_initscr" != yes; then
80       AC_CHECK_LIB(termcap, tgetent, [AC_DEFINE(USE_CAP, 1, [Allow -mCAP environment]) LIBS="$LIBS -ltermcap"])
81     fi
82   fi
83 fi
84
85 AC_CHECK_LIB(iconv, iconv_open)
86
87 dnl The world score server is currently only available in Japanese.
88 if test "$use_japanese" = no; then
89   worldscore=no
90 fi
91 if test "$worldscore" != no; then
92   PKG_CHECK_MODULES(libcurl, [libcurl])
93   AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server])
94 fi
95
96 dnl Checks for header files.
97 AC_PATH_XTRA
98 if test "$have_x" = yes; then
99   LIBS="$LIBS -lX11"
100   AC_DEFINE(USE_X11, 1, [Allow -mX11 environment])
101   CFLAGS="$X_CFLAGS $CFLAGS"
102   LDFLAGS="$X_LIBS $LDFLAGS"
103
104   if test "$use_fontset" = yes; then
105     AC_DEFINE(USE_FONTSET, 1, [Use FontSet])
106   else
107     if test "$use_japanese" != no; then
108       AC_DEFINE(USE_JP_FONTSTRUCT, 1, [Use Kanji without FontSet])
109     fi
110   fi
111
112   if test "$use_xim" = yes; then
113     AC_DEFINE(USE_XIM, 1, [Use X Imput Method])
114   fi
115
116   if test "$use_fontset" = yes || test "$use_xim" = yes; then
117     AC_DEFINE(USE_LOCALE, 1, [Support Locale])
118     if test "$use_japanese" != no; then
119       AC_DEFINE(DEFAULT_LOCALE, "ja_JP.eucJP", Default Japanese Locale)
120     fi
121     AC_CHECK_LIB(X11, _Xsetlocale, AC_DEFINE(X_LOCALE, 1, [Use XLocale]))
122     AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4")
123   fi
124
125   AS_IF([test "x$enable_xft" = "xyes"], [
126     PKG_CHECK_MODULES(XFT, [xft],
127       [AC_DEFINE([USE_XFT], [1], [Use XFT])])
128   ])
129 fi
130
131 if test "$use_japanese" != no; then
132   AC_CHECK_PROG(NKF, nkf, yes)
133   if test x"$NKF" != x"yes"; then
134     AC_MSG_ERROR([nkf is not found. Please install nkf.])
135   fi
136 fi
137
138 AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h stdint.h)
139
140 dnl Checks for typedefs, structures, and compiler characteristics.
141 AC_C_CONST
142 AC_TYPE_PID_T
143 AC_TYPE_SIZE_T
144 AC_STRUCT_TM
145
146 dnl Checks for library functions.
147 AC_PROG_GCC_TRADITIONAL
148 AC_FUNC_MEMCMP
149 AC_FUNC_STRFTIME
150 AC_FUNC_VPRINTF
151 AC_CHECK_FUNCS(gethostname mkdir select socket strtol vsnprintf mkstemp usleep)
152
153 AC_CONFIG_FILES(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/graf/Makefile lib/xtra/music/Makefile lib/xtra/sound/Makefile)
154 AC_OUTPUT()