OSDN Git Service

Mac: correct comment about when the generated .nib file is a directory
[hengbandforosx/hengbandosx.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(hengband, 1.6.2)
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="`pwd`"
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
49 AC_ARG_ENABLE(japanese,
50 [  --disable-japanese      build english version], use_japanese=no, [AC_DEFINE(JP, 1, [Enable Japanese]) AC_DEFINE(EUC, 1, [Use Extended Unix Code])])
51
52 AC_ARG_ENABLE(xim,
53 [  --disable-xim           disable xim support], use_xim=no, use_xim=yes)
54 AC_ARG_ENABLE(fontset,
55 [  --disable-fontset       disable fontset support], use_fontset=no, use_fontset=yes)
56 AC_ARG_ENABLE(worldscore,
57 [  --disable-worldscore    disable worldscore support], ,AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server]))
58 AC_ARG_ENABLE(chuukei,
59 [  --enable-chuukei        enable internet chuukei support], AC_DEFINE(CHUUKEI, 1, [Chuukei mode]))
60 AC_ARG_ENABLE([cocoa],
61 [  --enable-cocoa          enable a Cocoa user interface (OS X only)],
62 AC_DEFINE([MACH_O_COCOA], [1], [Use a Cocoa interface (OS X only)]), [])
63 AM_CONDITIONAL([COCOA], [test x$enable_cocoa = xyes])
64 dnl Since AC_PROG_OBJC has the side effect of setting this conditional,
65 dnl guarantee that is is always set, regardless of what happens in the if
66 dnl statement.
67 AM_CONDITIONAL([am__fastdepOBJC], false)
68 if test x"$enable_cocoa" = xyes ; then
69   dnl Use AC_LANG_PUSH and AC_LANG_POP to try to get back to the state that
70   dnl AC_LANG_C set in case there are side effects.
71   AC_LANG_PUSH([Objective C])
72   AC_PROG_OBJC
73   AC_LANG_POP([Objective C])
74   AC_DEFINE(USE_TRANSPARENCY, 1, [Use transparency mode])
75   AC_DEFINE(SAFE_DIRECTORY, 1, [Mark var directory with version string])
76   AC_DEFINE(VERSION_STRING, "1.6.2", [Version string to use for var directory])
77 fi
78
79 dnl -fno-strength-reduce prevents a bug in some versions of gcc
80 if test "$GCC" = yes; then
81   AC_MSG_CHECKING([if gcc supports -fno-strength-reduce])
82   _gcc_cflags_save=$CFLAGS
83   CFLAGS="$CFLAGS -fno-strength-reduce -Werror"
84   AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],_gcc_stropt=yes,_gcc_stropt=no)
85   AC_MSG_RESULT($_gcc_stropt)
86   CFLAGS=$_gcc_cflags_save
87   if test x"$_gcc_stropt" = xyes ; then
88       CFLAGS="$CFLAGS -fno-strength-reduce"
89   fi
90 fi
91
92 dnl Checks for libraries.
93 dnl Replace `main' with a function in -lncurses:
94 AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncurses"])
95 if test "$ac_cv_lib_ncurses_initscr" != yes; then
96   AC_CHECK_LIB(curses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) LIBS="$LIBS -lcurses"])
97   if test "$ac_cv_lib_curses_initscr" != yes; then
98     AC_CHECK_LIB(termcap, tgetent, [AC_DEFINE(USE_CAP, 1, [Allow -mCAP environment]) LIBS="$LIBS -ltermcap"])
99   fi
100 fi
101
102 dnl Checks for header files.
103 dnl AC_PATH_XTRA has side effects on CPP which are beneficial on Mac OS X.
104 dnl Removing it or conditionally executing it will likely lead to warnings
105 dnl on that platform about the preprocessor disagreeing with the compiler on
106 dnl the tests in AC_CHECK_HEADERS.
107 AC_PATH_XTRA
108 if test "$have_x" = yes && test x"$enable_cocoa" != xyes ; then
109   LIBS="$LIBS -lX11"
110   AC_DEFINE(USE_X11, 1, [Allow -mX11 environment])
111   AC_DEFINE(USE_TRANSPARENCY, 1, [Use transparency mode])
112   CFLAGS="$X_CFLAGS $CFLAGS"
113   LDFLAGS="$X_LIBS $LDFLAGS"
114   if test "$use_japanese" != no; then
115     if test "$use_fontset" = yes; then
116       AC_DEFINE(USE_FONTSET, 1, [Use FontSet])
117     else
118       AC_DEFINE(_JP, 1, [Use Kanji without FontSet])
119     fi
120     if test "$use_xim" = yes; then
121       AC_DEFINE(USE_XIM, 1, [Use X Imput Method])
122     fi
123     if test "$use_fontset" = yes || test "$use_xim" = yes; then
124       AC_DEFINE(USE_LOCALE, 1, [Support Locale])
125       AC_DEFINE(DEFAULT_LOCALE, "ja_JP.eucJP", Default Japanese Locale)
126       AC_CHECK_LIB(X11, _Xsetlocale, AC_DEFINE(X_LOCALE, 1, [Use XLocale]))
127       AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4")
128     fi
129   fi
130 fi
131
132 AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h stdint.h)
133
134 dnl Checks for typedefs, structures, and compiler characteristics.
135 AC_C_CONST
136 AC_TYPE_PID_T
137 AC_TYPE_SIZE_T
138 AC_STRUCT_TM
139
140 dnl Checks for library functions.
141 AC_PROG_GCC_TRADITIONAL
142 AC_FUNC_MEMCMP
143 AC_FUNC_STRFTIME
144 AC_FUNC_VPRINTF
145 AC_CHECK_FUNCS(gethostname mkdir select socket strstr strtol vasprintf vsnprintf mkstemp usleep)
146
147 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/font/Makefile lib/xtra/graf/Makefile lib/xtra/music/Makefile lib/xtra/sound/Makefile)
148 AC_OUTPUT()