1 dnl This file is part of the nazghul program
3 dnl Process this file with autogen.sh to produce a configure script.
5 dnl ---------------------------------------------------------------------------
7 dnl This section should include standard boilerplate code, such as the call
8 dnl to AC_INIT (which must be first), AM_INIT_AUTOMAKE, AC_CONFIG_HEADER,
9 dnl and perhaps AC_REVISION.
10 dnl ---------------------------------------------------------------------------
14 dnl This macro performs essential initialization for the
15 dnl generated `configure' script. An optional argument may provide the name of a
16 dnl file from the source directory to ensure that the directory has been
17 dnl specified correctly.
18 AC_INIT(nazghul, 0.7.1, [nazghul-devel@lists.sourceforge.net])
19 AC_CONFIG_SRCDIR([src/nazghul.c])
20 AM_CONFIG_HEADER([config.h])
23 dnl This macro determines the type of the host system and sets the output
24 dnl variable `host', as well as other more obscure variables.
27 dnl AC_CANONICAL_TARGET
28 dnl I'm not certain what this is. The automake book refers to
29 dnl AC_CANONICAL_SYSTEM, but not AC_CANONICAL_TARGET. A Google search only
30 dnl yields scads of mailing list reports about people having weird problems
34 dnl AM_INIT_AUTOMAKE(package, version, [nodefine])
35 dnl This macro is used to do all the standard initialization required by
36 dnl Automake. It has two required arguments: the package name and the version
37 dnl number. This macro sets and calls AC_SUBST on the shell variables PACKAGE
38 dnl and VERSION. By default it also defines these variables (via
39 dnl AC_DEFINE_UNQUOTED). However, this macro also accepts an optional third
40 dnl argument which, if not empty, means that the AC_DEFINE_UNQUOTED calls for
41 dnl PACKAGE and VERSION should be suppressed.
45 dnl ---------------------------------------------------------------------------
47 dnl The next section should include macros which add command-line options
48 dnl to configure, such as AC_ARG_ENABLE. It is typical to put support code
49 dnl for the option in this section as well, if it is short enough.
50 dnl ---------------------------------------------------------------------------
52 dnl ---------------------------------------------------------------------------
54 dnl Next it is traditional to check for programs that are either needed by
55 dnl the configure process, the build process, or by one of the programs
56 dnl being built. This usually involves calls to macros like AC_CHECK_PROG
58 dnl ---------------------------------------------------------------------------
61 dnl This checks for the C compiler to use and sets the shell variable CC to the
62 dnl value. If the GNU C compiler is being used, this sets the shell variable GCC
63 dnl to `yes'. This macro sets the shell variable CFLAGS if it has not already
64 dnl been set. It also calls AC_SUBST on CC and CFLAGS.
68 dnl This is like AC_PROG_CC, but it checks for the C++ compiler, and sets the
73 dnl This macro is the primary way to integrate Libtool support into `configure'.
74 dnl If you are using Libtool, you should call this macro in `configure.in'. Among
75 dnl other things, it adds support for the `--enable-shared' configure flag.
79 dnl This looks for an install program and sets the output variables INSTALL,
80 dnl INSTALL_DATA, INSTALL_PROGRAM, and INSTALL_SCRIPT. This macro assumes that if
81 dnl an install program cannot be found on the system, your package will have
82 dnl `install-sh' available in the directory chosen by AC_CONFIG_AUX_DIR.
87 dnl ---------------------------------------------------------------------------
89 dnl Checks for libraries come before checks for other objects visible to C
90 dnl (or C++, or anything else). This is necessary because some other checks
91 dnl work by trying to link or run a program; by checking for libraries
92 dnl first you ensure that the resulting programs can be linked.
93 dnl ---------------------------------------------------------------------------
95 dnl Check for SDL and SDL features, i.e. -lSDL
97 AM_PATH_SDL($SDL_VERSION,
99 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
102 dnl ---------------------------------------------------------------------------
104 dnl Next come checks for existence of headers.
105 dnl ---------------------------------------------------------------------------
109 AC_CHECK_HEADERS([fcntl.h \
114 dnl ---------------------------------------------------------------------------
115 dnl 6. Typedefs and structures
116 dnl We do checks for typedefs after checking for headers for the simple
117 dnl reason that typedefs appear in headers, and we need to know which headers
118 dnl we can use before we look inside them.
119 dnl ---------------------------------------------------------------------------
120 PETI_ENABLED_DYNAMIC_LINKING
125 dnl ---------------------------------------------------------------------------
127 dnl Finally we check for functions. These come last because functions have
128 dnl dependencies on the preceding items: when searching for functions,
129 dnl libraries are needed in order to correctly link, headers are needed in
130 dnl order to find prototypes (this is especially important for C++, which
131 dnl has stricter prototyping rules than C), and typedefs are needed for
132 dnl those functions which use or return types which are not built in.
133 dnl ---------------------------------------------------------------------------
134 AC_CHECK_FUNCS([malloc \
149 dnl Add in the SDL CFLAGS
150 CFLAGS="$CFLAGS $SDL_CFLAGS"
152 dnl Use the same flags for c++ as for c
155 dnl The preprocessor needs the same info too.
156 CXXCPP="$CXXCPP $CXXFLAGS"
158 dnl Set the compiler to c++ (for now)
161 dnl Add libraries to build process
162 LIBS="$LIBS $SDL_LIBS"
164 dnl Check specifically for libpng, i.e. -lpng switch
165 AC_CHECK_LIB(png, png_create_write_struct)
167 AC_CHECK_HEADER([png.h],
169 [AC_MSG_ERROR([*** png include file not found!
170 You should install development package.])])
172 dnl Check specifically for SDL_image library, i.e. -lSDL_image switch
173 AC_CHECK_LIB(SDL_image, IMG_ReadXPMFromArray)
175 AC_CHECK_HEADER([SDL_image.h],
177 [AC_MSG_ERROR([*** SDL_image include files not found!
178 You should install development package.])])
180 dnl Check specifically for SDL_mixer library, i.e. -lSDL_mixer switch
181 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio)
183 AC_CHECK_HEADER([SDL_mixer.h],
185 [AC_MSG_ERROR([*** SDL_mixer include files not found!
186 You should install development package.])])
188 dnl ---------------------------------------------------------------------------
190 dnl This is done by invoking AC_OUTPUT.
191 dnl ---------------------------------------------------------------------------
193 # User directories for saving game data
195 AC_DEFINE(NAZGHUL_USER_DIR, "/.nazghul",
196 [.nazghul is for Unix users.])
198 AC_DEFINE(NAZGHUL_USER_DIR_WIN, "/_nazghul",
199 [_nazghul is for Windows users.])
201 AC_DEFINE(HOME_ENV, "HOME",
202 [Most likely your home directory is stored in $HOME.])
204 AC_DEFINE(MIN_SCRIPT_MAJOR, 0,
205 [Minimum supported script version])
207 AC_DEFINE(MIN_SCRIPT_MINOR, 6,
208 [Minimum supported script version])
210 AC_DEFINE(MIN_SCRIPT_RELEASE, 0,
211 [Minimum supported script version])
213 AC_DEFINE(USE_SKILLS, 1, [Enable Yuse command and skills])
214 AC_DEFINE(USE_QUESTS, 1, [Enable quest log])
216 # Finally create all the generated files
217 AC_CONFIG_FILES([Makefile \
221 worlds/haxima-1.002/Makefile \
222 worlds/haxima-1.002/music/Makefile])
228 $PACKAGE_NAME $PACKAGE_VERSION configured.
230 You can now type \`gmake' to compile $PACKAGE_NAME.
231 If \`gmake' is not available on your system, try \`make' instead.