OSDN Git Service

[Refactor] #173 引数にconstを付けた / Added const to arguments
[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.c)
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 AC_LANG_C
19
20 dnl generate the installation path for the ./lib/ folder
21 if test "$GAMEGROUP" != ""; then
22   MY_EXPAND_DIR(game_libpath, "$datadir/games/$PACKAGE/lib/")
23 else
24   MY_EXPAND_DIR(game_libpath, "./lib/")
25   bindir=".."
26 fi
27
28 dnl overwrite the path with an user-specified value
29 AC_ARG_WITH(libpath,
30 [  --with-libpath=path     specify the path to the Hengband lib folder],
31 [game_libpath="$withval"])
32
33 AC_ARG_WITH(varpath,
34 [  --with-varpath=path     specify the path to the Hengband var folder],
35 [game_varpath="$withval"],
36 [game_varpath="$game_libpath"])
37
38 AC_DEFINE_UNQUOTED(DEFAULT_LIB_PATH, "$game_libpath", [Path to the Hengband lib folder])
39 DEFAULT_LIB_PATH="$game_libpath"
40 AC_SUBST(DEFAULT_LIB_PATH)
41
42 AC_DEFINE_UNQUOTED(DEFAULT_VAR_PATH, "$game_varpath", [Path to the Hengband var folder])
43 DEFAULT_VAR_PATH="$game_varpath"
44 AC_SUBST(DEFAULT_VAR_PATH)
45
46 dnl Checks for programs.
47 AC_PROG_CC
48 PKG_PROG_PKG_CONFIG
49
50 AC_ARG_ENABLE(japanese,
51 [  --disable-japanese      build english version], use_japanese=no, [AC_DEFINE(JP, 1, [Enable Japanese]) AC_DEFINE(EUC, 1, [Use Extended Unix Code])])
52
53 AC_ARG_ENABLE(xim,
54 [  --disable-xim           disable xim support], use_xim=no, use_xim=yes)
55 AC_ARG_ENABLE(fontset,
56 [  --disable-fontset       disable fontset support], use_fontset=no, use_fontset=yes)
57 AC_ARG_ENABLE([xft],
58         AS_HELP_STRING([--enable-xft], [Enable xft support]))
59 AC_ARG_ENABLE(worldscore,
60 [  --disable-worldscore    disable worldscore support], worldscore=no, AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server]))
61 AC_ARG_ENABLE(chuukei,
62 [  --enable-chuukei        enable internet chuukei support], AC_DEFINE(CHUUKEI, 1, [Chuukei mode]))
63
64 dnl Checks for libraries.
65 dnl Replace `main' with a function in -lncurses:
66 AC_CHECK_LIB(ncursesw, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncursesw"])
67 if test "$ac_cv_lib_ncursesw_initscr" != yes; then
68   AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncurses"])
69   if test "$ac_cv_lib_ncurses_initscr" != yes; then
70     AC_CHECK_LIB(curses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) LIBS="$LIBS -lcurses"])
71     if test "$ac_cv_lib_curses_initscr" != yes; then
72       AC_CHECK_LIB(termcap, tgetent, [AC_DEFINE(USE_CAP, 1, [Allow -mCAP environment]) LIBS="$LIBS -ltermcap"])
73     fi
74   fi
75 fi
76
77 AC_CHECK_LIB(iconv, iconv_open)
78
79 AC_CHECK_FILE(/dev/urandom, AC_DEFINE(RNG_DEVICE, "/dev/urandom", [Random Number Generation device file]))
80
81 if test "$worldscore" != no; then
82   PKG_CHECK_MODULES(libcurl, [libcurl])
83 fi
84
85 dnl Checks for header files.
86 AC_PATH_XTRA
87 if test "$have_x" = yes; then
88   LIBS="$LIBS -lX11"
89   AC_DEFINE(USE_X11, 1, [Allow -mX11 environment])
90   CFLAGS="$X_CFLAGS $CFLAGS"
91   LDFLAGS="$X_LIBS $LDFLAGS"
92
93   if test "$use_fontset" = yes; then
94     AC_DEFINE(USE_FONTSET, 1, [Use FontSet])
95   else
96     if test "$use_japanese" != no; then
97       AC_DEFINE(USE_JP_FONTSTRUCT, 1, [Use Kanji without FontSet])
98     fi
99   fi
100
101   if test "$use_xim" = yes; then
102     AC_DEFINE(USE_XIM, 1, [Use X Imput Method])
103   fi
104
105   if test "$use_fontset" = yes || test "$use_xim" = yes; then
106     AC_DEFINE(USE_LOCALE, 1, [Support Locale])
107     if test "$use_japanese" != no; then
108       AC_DEFINE(DEFAULT_LOCALE, "ja_JP.eucJP", Default Japanese Locale)
109     fi
110     AC_CHECK_LIB(X11, _Xsetlocale, AC_DEFINE(X_LOCALE, 1, [Use XLocale]))
111     AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4")
112   fi
113
114   AS_IF([test "x$enable_xft" = "xyes"], [
115     PKG_CHECK_MODULES(XFT, [xft],
116       [AC_DEFINE([USE_XFT], [1], [Use XFT])])
117   ])
118 fi
119
120 if test "$use_japanese" != no; then
121   AC_CHECK_PROG(NKF, nkf, yes)
122   if test x"$NKF" != x"yes"; then
123     AC_MSG_ERROR([nkf is not found. Please install nkf.])
124   fi
125 fi
126
127 AC_HEADER_STDC
128 AC_CHECK_HEADERS(fcntl.h strings.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h stdint.h)
129
130 dnl Checks for typedefs, structures, and compiler characteristics.
131 AC_C_CONST
132 AC_TYPE_PID_T
133 AC_TYPE_SIZE_T
134 AC_HEADER_TIME
135 AC_STRUCT_TM
136
137 dnl Checks for library functions.
138 AC_PROG_GCC_TRADITIONAL
139 AC_FUNC_MEMCMP
140 AC_TYPE_SIGNAL
141 AC_FUNC_STRFTIME
142 AC_FUNC_VPRINTF
143 AC_CHECK_FUNCS(gethostname mkdir select socket strtol vsnprintf mkstemp usleep)
144
145 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)