213
|
1 |
# Process this file with autoconf to produce a configure script.
|
|
2 |
AC_INIT(physfs.c)
|
|
3 |
|
|
4 |
dnl ---------------------------------------------------------------------
|
|
5 |
dnl System/version info
|
|
6 |
dnl ---------------------------------------------------------------------
|
|
7 |
|
|
8 |
# Making releases:
|
|
9 |
# MICRO_VERSION += 1;
|
|
10 |
# INTERFACE_AGE += 1;
|
|
11 |
# BINARY_AGE += 1;
|
|
12 |
# if any functions have been added, set INTERFACE_AGE to 0.
|
|
13 |
# if backwards compatibility has been broken,
|
|
14 |
# set BINARY_AGE and INTERFACE_AGE to 0.
|
|
15 |
|
|
16 |
MAJOR_VERSION=0
|
|
17 |
MINOR_VERSION=1
|
|
18 |
MICRO_VERSION=6
|
|
19 |
INTERFACE_AGE=0
|
|
20 |
BINARY_AGE=0
|
|
21 |
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
|
|
22 |
|
|
23 |
AC_SUBST(MAJOR_VERSION)
|
|
24 |
AC_SUBST(MINOR_VERSION)
|
|
25 |
AC_SUBST(MICRO_VERSION)
|
|
26 |
AC_SUBST(INTERFACE_AGE)
|
|
27 |
AC_SUBST(BINARY_AGE)
|
|
28 |
AC_SUBST(VERSION)
|
|
29 |
|
|
30 |
# libtool versioning
|
|
31 |
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
|
|
32 |
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
|
|
33 |
LT_REVISION=$INTERFACE_AGE
|
|
34 |
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
|
|
35 |
|
|
36 |
AC_SUBST(LT_RELEASE)
|
|
37 |
AC_SUBST(LT_CURRENT)
|
|
38 |
AC_SUBST(LT_REVISION)
|
|
39 |
AC_SUBST(LT_AGE)
|
|
40 |
|
|
41 |
dnl Detect the canonical host and target build environment
|
|
42 |
AC_CANONICAL_HOST
|
|
43 |
AC_CANONICAL_TARGET
|
|
44 |
|
|
45 |
dnl Setup for automake
|
|
46 |
AM_CONFIG_HEADER(config.h)
|
|
47 |
AM_INIT_AUTOMAKE(physfs, $VERSION)
|
|
48 |
|
|
49 |
|
|
50 |
dnl ---------------------------------------------------------------------
|
|
51 |
dnl Compilers and other tools
|
|
52 |
dnl ---------------------------------------------------------------------
|
|
53 |
|
|
54 |
AC_PROG_CC
|
|
55 |
AC_PROG_INSTALL
|
|
56 |
AC_PROG_LN_S
|
|
57 |
AC_PROG_LIBTOOL
|
|
58 |
|
|
59 |
|
|
60 |
dnl ---------------------------------------------------------------------
|
|
61 |
dnl Debug mode?
|
|
62 |
dnl ---------------------------------------------------------------------
|
|
63 |
|
|
64 |
AC_ARG_ENABLE(debug,
|
|
65 |
[ --enable-debug enable debug mode [default=no]],
|
|
66 |
, enable_debug=no)
|
|
67 |
if test x$enable_debug = xyes; then
|
|
68 |
if test x$ac_cv_prog_cc_g = xyes; then
|
|
69 |
CFLAGS="-g -O0"
|
|
70 |
else
|
|
71 |
CFLAGS="-O0"
|
|
72 |
fi
|
|
73 |
CFLAGS="$CFLAGS -Werror"
|
|
74 |
AC_DEFINE(DEBUG)
|
|
75 |
AC_DEFINE(DEBUG_CHATTER)
|
|
76 |
else
|
|
77 |
CFLAGS="-O2"
|
|
78 |
AC_DEFINE(NDEBUG)
|
|
79 |
fi
|
|
80 |
|
|
81 |
|
|
82 |
dnl ---------------------------------------------------------------------
|
|
83 |
dnl Build test program?
|
|
84 |
dnl ---------------------------------------------------------------------
|
|
85 |
|
|
86 |
AC_ARG_ENABLE(testprog,
|
|
87 |
[ --enable-testprog build test program [default=yes]],
|
|
88 |
, enable_testprog=yes)
|
|
89 |
|
|
90 |
|
|
91 |
dnl ---------------------------------------------------------------------
|
|
92 |
dnl Checks for libraries.
|
|
93 |
dnl ---------------------------------------------------------------------
|
|
94 |
|
|
95 |
require_zlib="no"
|
|
96 |
|
|
97 |
dnl Check for zip archiver inclusion...
|
|
98 |
AC_ARG_ENABLE(zip,
|
|
99 |
[ --enable-zip enable ZIP support [default=yes]],
|
|
100 |
, enable_zip=yes)
|
|
101 |
if test x$enable_zip = xyes; then
|
|
102 |
AC_DEFINE(PHYSFS_SUPPORTS_ZIP)
|
|
103 |
require_zlib="yes"
|
|
104 |
fi
|
|
105 |
|
|
106 |
|
|
107 |
dnl Check for zip archiver inclusion...
|
|
108 |
AC_ARG_ENABLE(grp,
|
|
109 |
[ --enable-grp enable Build Engine GRP support [default=yes]],
|
|
110 |
, enable_grp=yes)
|
|
111 |
if test x$enable_grp = xyes; then
|
|
112 |
AC_DEFINE(PHYSFS_SUPPORTS_GRP)
|
|
113 |
fi
|
|
114 |
|
|
115 |
|
|
116 |
AC_ARG_ENABLE(internal-zlib,
|
|
117 |
[ --enable-internal-zlib use included zlib [default=only if needed]],
|
|
118 |
, enable_internal_zlib=maybe)
|
|
119 |
|
|
120 |
dnl Check for zlib if needed.
|
|
121 |
have_external_zlib="no"
|
|
122 |
if test x$enable_internal_zlib != xyes; then
|
|
123 |
if test x$require_zlib = xyes; then
|
|
124 |
AC_CHECK_HEADER(zlib.h, have_zlib_hdr=yes)
|
|
125 |
AC_CHECK_LIB(z, zlibVersion, have_zlib_lib=yes)
|
|
126 |
if test x$have_zlib_hdr = xyes -a x$have_zlib_lib = xyes; then
|
|
127 |
have_external_zlib="yes"
|
|
128 |
fi
|
|
129 |
fi
|
|
130 |
fi
|
|
131 |
|
|
132 |
AC_MSG_CHECKING([what zlib to use])
|
|
133 |
|
|
134 |
dnl no zlib is needed at all if we aren't supporting ZIP files.
|
|
135 |
if test x$require_zlib = xno; then
|
|
136 |
enable_internal_zlib="no"
|
|
137 |
enable_external_zlib="no"
|
|
138 |
AC_MSG_RESULT([no zlib needed])
|
|
139 |
else
|
|
140 |
|
|
141 |
if test x$enable_internal_zlib = xmaybe; then
|
|
142 |
if test x$have_external_zlib = xyes; then
|
|
143 |
enable_internal_zlib="no"
|
|
144 |
enable_external_zlib="yes"
|
|
145 |
else
|
|
146 |
enable_internal_zlib="yes"
|
|
147 |
enable_external_zlib="no"
|
|
148 |
fi
|
|
149 |
else
|
|
150 |
if test x$enable_internal_zlib = xno -a x$have_external_zlib = xyes; then
|
|
151 |
enable_internal_zlib="no"
|
|
152 |
enable_external_zlib="yes"
|
|
153 |
fi
|
|
154 |
fi
|
|
155 |
|
|
156 |
if test x$enable_internal_zlib = xyes; then
|
|
157 |
AC_MSG_RESULT([internal zlib])
|
|
158 |
else
|
|
159 |
if test x$enable_external_zlib = xyes; then
|
|
160 |
AC_MSG_RESULT([external zlib])
|
|
161 |
LIBS="$LIBS -lz"
|
|
162 |
else
|
|
163 |
AC_MSG_ERROR([Need zlib, but you disabled our copy and have no system lib])
|
|
164 |
fi
|
|
165 |
fi
|
|
166 |
fi
|
|
167 |
|
|
168 |
|
|
169 |
dnl !!! FIXME: separate checks for history and readline...
|
|
170 |
|
|
171 |
dnl determine if we should include readline support...
|
|
172 |
AC_ARG_ENABLE(readline,
|
|
173 |
[ --enable-readline use GNU readline in test program [default=yes]],
|
|
174 |
, enable_readline=yes)
|
|
175 |
if test x$enable_readline = xyes; then
|
|
176 |
AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
|
|
177 |
AC_CHECK_LIB(readline, readline, have_readline_lib=yes)
|
|
178 |
AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes)
|
|
179 |
AC_CHECK_LIB(readline, add_history, have_history_lib=yes)
|
|
180 |
if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then
|
|
181 |
if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then
|
|
182 |
AC_DEFINE(PHYSFS_HAVE_READLINE)
|
|
183 |
LIBS="$LIBS -lreadline"
|
|
184 |
fi
|
|
185 |
fi
|
|
186 |
fi
|
|
187 |
|
|
188 |
|
|
189 |
# Checks for header files.
|
|
190 |
AC_HEADER_STDC
|
|
191 |
AC_CHECK_HEADERS([stdlib.h string.h])
|
|
192 |
|
|
193 |
# Checks for typedefs, structures, and compiler characteristics.
|
|
194 |
AC_C_CONST
|
|
195 |
AC_TYPE_SIZE_T
|
|
196 |
|
|
197 |
# Checks for library functions.
|
|
198 |
|
|
199 |
# This is only in the bleeding edge autoconf distro...
|
|
200 |
#AC_FUNC_MALLOC
|
|
201 |
|
|
202 |
AC_FUNC_MEMCMP
|
|
203 |
AC_CHECK_FUNCS([memset strrchr])
|
|
204 |
|
|
205 |
dnl Add Makefile conditionals
|
|
206 |
AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes)
|
|
207 |
AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes)
|
|
208 |
|
|
209 |
AC_OUTPUT([
|
|
210 |
Makefile
|
|
211 |
platform/Makefile
|
|
212 |
archivers/Makefile
|
|
213 |
test/Makefile
|
|
214 |
zlib114/Makefile
|
|
215 |
])
|