OSDN Git Service

7ba4769c949f3e4085aa6b4da5426e415755ae9a
[modchxj/mod_chxj.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3 AC_INIT([mod_chxj],[0.13.1rc3],[konn@users.sourceforge.jp])
4 AC_PREREQ(2.59)
5 AC_CONFIG_SRCDIR([src/mod_chxj.c])
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
8 AM_CONFIG_HEADER(include/config.h)
9
10
11 # Checks for programs.
12 AC_PROG_CC
13 AC_PROG_INSTALL
14
15
16 AM_PROG_LIBTOOL
17 AC_SUBST(LIBTOOL_DEPS)
18
19
20 # Checks for libraries.
21 AC_CHECK_LIB([apr-1],  [main])
22
23 AC_ARG_WITH(apache-header, [  --with-apache-header=ARG The directory with the header file of apache2.0 is specified. ]) 
24 if test "x$with_apache_header" = "xyes"; then
25     AC_MSG_ERROR([
26 Please specify the --with-apache-header option. And, please specify the place of the header file. 
27
28 ])
29 fi
30
31 dnl ==================================================
32 dnl
33 dnl apxs
34 dnl
35 dnl ==================================================
36 AC_ARG_WITH(apxs, [  --with-apxs=ARG Path of apxs program file.])
37 if test "x$with_apxs" = "x" ; then
38   APXS=""
39 fi
40 if test "x$with_apxs" = "xyes" ; then
41     AC_MSG_ERROR([
42 Please specify the --with-apxs option. And, please specify the place of the apxs program. 
43 ])
44 fi
45
46 dnl ==================================================
47 dnl
48 dnl apr-config
49 dnl
50 dnl ==================================================
51 AC_ARG_WITH(apr-config, [  --with-apr-config=ARG  Path of apr-config program file.])
52 if test "x$with_apr_config" = "xyes" ; then
53     AC_MSG_ERROR([
54 Please specify the --with-apr-config option. And, please specify the place of the apr-config program. 
55 ])
56 fi
57
58 dnl ==================================================
59 dnl
60 dnl apu-config
61 dnl
62 dnl ==================================================
63 AC_ARG_WITH(apu-config, [  --with-apu-config=ARG  Path of apu-config program file.])
64 if test "x$with_apu_config" = "xyes" ; then
65     AC_MSG_ERROR([
66 Please specify the --with-apu-config option. And, please specify the place of the apu-config program. 
67 ])
68 fi
69
70 AC_ARG_WITH(pcre-config, [  --with-pcre-config=ARG  Path of pcre-config program file.])
71 if test "x$with_pcre_config" = "xyes" ; then
72     AC_MSG_ERROR([
73 Please specify the --with-pcre-config option. And, please specify the place of the pcre-config program.
74 ])
75 fi
76
77
78
79 dnl ==================================================
80 dnl
81 dnl filename in img tag convertion.
82 dnl
83 dnl ==================================================
84 AC_ARG_ENABLE(img-conv-f, [  --enable-img-conv-f      Please specify it when you change the file name of the image being written in the 
85 source by the automatic operation.])
86 if test "x$enable_img_conv_f" = "xyes"; then
87   QDEFS=""
88 else
89   QDEFS="-DIMG_NOT_CONVERT_FILENAME"
90 fi
91
92
93 dnl ==================================================
94 dnl
95 dnl SAVE COOKIE to memcached Mode
96 dnl
97 dnl ==================================================
98 AC_ARG_ENABLE(memcache-cookie,   [  --enable-memcache-cookie Please specify it when you save Cookie in memcached. ])
99 AC_ARG_ENABLE(memcached-static,  [  --enable-memcached-static use static link. ])
100 AC_ARG_WITH(memcached-header,    [  --with-memcached-header Path of "memcached.h"])
101 AC_ARG_WITH(memcached-lib-dir,   [  --with-memcached-lib-dir Path of "libmemcached.so"])
102 if test "x$enable_memcache_cookie" = "xyes" ; then
103   dnl ======================================
104   dnl use MEMCACHE COOKIE
105   dnl ======================================
106   if test "x${with_memcached_header}" = "x" -o "x${with_memcached_header}" = "xyes" ; then
107     AC_MSG_ERROR([
108 Please specify the --with-memcached-header And, please specify the place of the "memcached.h" header file directory. 
109 ])
110   fi
111   if test "x${with_memcached_lib_dir}" = "x" -o "x${with_memcached_lib_dir}" = "xyes" ; then
112     AC_MSG_ERROR([
113 Please specify the --with-memcached-lib-dir And, please specify the place of libmemcached library directory. 
114 ])
115   fi
116   if test "x$enable_memcached_static" = "xyes" ; then
117     MEMCACHE_COOKIE_DEFS="-DUSE_MEMCACHE_COOKIE -I${with_memcached_header} "
118     MEMCACHE_COOKIE_LIBS=" ${with_memcached_lib_dir}/libmemcached.a "
119   else
120     MEMCACHE_COOKIE_DEFS="-DUSE_MEMCACHE_COOKIE -I${with_memcached_header} "
121     MEMCACHE_COOKIE_LIBS="-L${with_memcached_lib_dir} -lmemcached "
122   fi
123 else
124   dnl ======================================
125   dnl no use MEMCACHE COOKIE
126   dnl ======================================
127   MEMCACHE_COOKIE_DEFS=""
128   MEMCACHE_COOKIE_LIBS=""
129 fi
130 dnl ==================================================
131 dnl
132 dnl SAVE COOKIE to MySQL Mode
133 dnl
134 dnl ==================================================
135 AC_ARG_ENABLE(mysql-cookie, [  --enable-mysql-cookie    Please specify it when you save Cookie in MySQL. ])
136 AC_ARG_WITH(mysql-header,   [  --with-mysql-header=ARG  Path of "mysql.h"])
137 AC_ARG_WITH(mysql-lib-dir,  [  --with-mysql-lib-dir=ARG Path of libmysqlclient])
138 if test "x$enable_mysql_cookie" = "xyes"; then
139   dnl ======================================
140   dnl use MYSQL COOKIE
141   dnl ======================================
142   if test "x$with_mysql_header" = "x" -o "x$with_mysql_header" = "xyes" ; then
143     AC_MSG_ERROR([
144 Please specify the --with-mysql-header And, please specify the place of the "mysql.h" header file. 
145 ])
146   fi
147   if test "x$with_mysql_lib_dir" = "x" -o "x$with_mysql_lib_dir" = "xyes" ; then
148     AC_MSG_ERROR([
149 Please specify the --with-mysql-lib-dir And, please specify the place of mysql library directory. 
150 ])
151   fi
152   MYSQL_COOKIE_DEFS="-DUSE_MYSQL_COOKIE -I${with_mysql_header}"
153   MYSQL_COOKIE_LIBS="-L${with_mysql_lib_dir} -lmysqlclient_r"
154 else
155   dnl ======================================
156   dnl no use MYSQL COOKIE
157   dnl ======================================
158   MYSQL_COOKIE_DEFS=""
159   MYSQL_COOKIE_LIBS=""
160 fi
161
162 dnl ==================================================
163 dnl
164 dnl OpenSSL
165 dnl
166 dnl ==================================================
167 OPENSSL_PATH=""
168 AC_ARG_WITH(openssl,
169   APR_HELP_STRING([--with-openssl=PATH],[Path to OpenSSL (eg. /usr/local/ssl)]),
170 [
171   if test "$withval" = "yes"; then
172     AC_MSG_ERROR([--with-openssl requires a path])
173   else
174     openssl_prefix=$withval
175
176     if test "x$openssl_prefix" != "x" -a ! -d "$openssl_prefix"; then
177       AC_MSG_ERROR('--with-openssl requires a path to a directory')
178     fi
179
180     CPPFLAGS="${CPPFLAGS} -I${openssl_prefix}/include"
181     LDFLAGS="${LDFLAGS} -L${openssl_prefix}/lib"
182     LDFLAGS="${LDFLAGS} -R${openssl_prefix}/lib"
183     OPENSSL_PATH="--with-openssl=${openssl_prefix}"
184   fi
185 ])
186
187 dnl Look for OpenSSL
188 AC_CHECK_HEADER([openssl/opensslv.h], [],
189                 [AC_MSG_ERROR([We require OpenSSL; try --with-openssl])])
190
191 dnl ==================================================
192 dnl
193 dnl dump log for DEBUG
194 dnl
195 dnl ==================================================
196 AC_ARG_ENABLE(dump-log, [  --enable-dump-log   When the log of conversion is output, it specifies it with the output file. ])
197 if test "x$enable_dump_log" = "xyes"; then
198   DDEFS="-DDUMP_LOG=\\\"/tmp/dump.log\\\""
199 else
200     if test "x$enable_dump_log" != "x" ; then
201         DDEFS="-DDUMP_LOG=\\\"${enable_dump_log}\\\""
202     fi
203 fi
204
205
206 if test "x$with_apxs" = "x" ; then
207   AC_PATH_PROG(APXS2, apxs2, no,
208       /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin)
209   if test "x$APXS2" = "xno"; then
210     AC_PATH_PROG(APXS, apxs, no,
211       /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin)
212     if test "x$APXS" = "xno" ; then
213       AC_MSG_ERROR([apxs not found.])
214     fi
215   else
216     APXS="$APXS2"
217   fi
218 fi
219 if test "x$with_apxs" != "x" ; then
220   APXS=$with_apxs
221 fi 
222
223 AC_PATH_PROG(LIBTOOL, libtool, no,
224     /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
225 if test "x$LIBTOOL" = "xno"; then
226     AC_MSG_ERROR([libtool not found.])
227 fi
228
229
230 AC_PATH_PROG(WAND_CONFIG, Wand-config, no,
231    /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
232 if test "x$WAND_CONFIG" = "xno" ; then
233     AC_MSG_ERROR([wand-config not found.])
234 fi
235
236 if test "x$with_apr_config" = "x" ; then
237   AC_PATH_PROG(APR_CONFIG, apr-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
238   if test "x$APR_CONFIG" = "xno" ; then
239     AC_PATH_PROG(APR_1_CONFIG, apr-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
240     if test "x$APR_1_CONFIG" = "xno" ; then
241       AC_MSG_ERROR([apr-config and apr-1-config not found.])
242     else
243       APR_CONFIG="$APR_1_CONFIG"
244     fi
245   fi
246 fi
247 if test "x$with_apr_config" != "x" ; then
248   APR_CONFIG=$with_apr_config
249 fi
250 if test "x$with_apu_config" = "x" ; then
251   AC_PATH_PROG(APU_CONFIG, apu-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
252   if test "x$APU_CONFIG" = "xno" ; then
253     AC_PATH_PROG(APU_1_CONFIG, apu-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
254     if test "x$APU_1_CONFIG" = "xno" ; then
255       AC_MSG_ERROR([apu-config and apu-1-config not found.])
256     else
257       APU_CONFIG="$APU_1_CONFIG"
258     fi
259   fi
260 fi
261 if test "x$with_apu_config" != "x" ; then
262   APU_CONFIG=$with_apu_config
263 fi
264
265 case $host_os in
266   freebsd*)
267     CFLAGS="${CFLAGS} -I/usr/local/include "
268     ;;
269 esac
270
271 if test "x${with_apache_header}" = "x" ; then
272   with_apache_header=`${APXS} -q includedir`
273 fi
274
275 LIBS="${LIBS} `${WAND_CONFIG} --ldflags` `${WAND_CONFIG} --libs | sed -e s/-ldpstk//` "
276 LIBS="${LIBS} `${APR_CONFIG} --ldflags` `${APR_CONFIG} --libs` "
277 LIBS="${LIBS} `${APU_CONFIG} --ldflags` `${APU_CONFIG} --libs` "
278 LIBS="${LIBS} ${MYSQL_COOKIE_LIBS}"
279 LIBS="${LIBS} ${MEMCACHE_COOKIE_LIBS} "
280 LIBS="${LIBS} css/src/.libs/libscss.a"
281 LIBS="${LIBS} -lcrypto -lssl "
282 CFLAGS="${CFLAGS} `${WAND_CONFIG} --cppflags` `${WAND_CONFIG} --cflags`"
283 CFLAGS="${CFLAGS} `${APR_CONFIG} --includes` `${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags`"
284 CFLAGS="${CFLAGS} `${APU_CONFIG} --includes`"
285 CFLAGS="${CFLAGS} ${MYSQL_COOKIE_DEFS}"
286 CFLAGS="${CFLAGS} ${MEMCACHE_COOKIE_DEFS}"
287 CPPFLAGS="${CPPFLAGS} `${APR_CONFIG} --includes` -I${with_apache_header}"
288 CPPFLAGS="${CPPFLAGS} ${MYSQL_COOKIE_DEFS}"
289 CPPFLAGS="${CPPFLAGS} ${MEMCACHE_COOKIE_DEFS}"
290
291 # Checks for header files.
292 AC_HEADER_STDC
293 AC_CHECK_HEADERS([string.h strings.h unistd.h fcntl.h sys/types.h sys/stat.h sys/mman.h libgen.h])
294 APR_HEADER_DIR="`${APR_CONFIG} --includes | sed -e 's/-I//g' | sed -e 's/ //g'`"
295 AC_CHECK_HEADERS([apr_shm.h apr_global_mutex.h])
296 AC_CHECK_HEADERS([apr.h])
297 AC_CHECK_HEADERS([ap_config.h])
298 AC_CHECK_HEADERS([libgen.h])
299 #AC_CHECK_HEADERS([ap_regex.h],
300 #  AC_DEFINE([HAVE_AP_REGEX_H], [], [Define to 1 if you have the <ap_regex.h> header file.]),[],
301 #[[
302 ##ifdef HAVE_APR_H
303 ##include "apr.h"
304 ##endif
305 ##ifdef HAVE_AP_CONFIG_H
306 ##include "ap_config.h"
307 ##endif
308 #]])
309 AC_CHECK_HEADERS([ap_regex.h],use_pcre_flag="no",use_pcre_flag="yes",
310 [[#ifdef HAVE_APR_H
311 # include "apr.h"
312 #endif
313 #ifdef HAVE_AP_CONFIG_H
314 # include "ap_config.h"
315 #endif
316 ]])
317 if test "x$use_pcre_flag" = "xyes" ; then
318   if test "x$with_pcre_config" = "x" ; then
319     AC_PATH_PROG(PCRE_CONFIG, pcre-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
320     if test "x$PCRE_CONFIG" = "xno" ; then
321       AC_PATH_PROG(PCRE_1_CONFIG, pcre-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
322       if test "x$PCRE_1_CONFIG" = "xno" ; then
323         AC_MSG_ERROR([pcre-config and pcre-1-config not found.])
324       else
325         PCRE_CONFIG="$PCRE_1_CONFIG"
326       fi
327     fi
328   fi
329   if test "x$with_pcre_config" != "x" ; then
330     PCRE_CONFIG=$with_pcre_config
331   fi
332   CFLAGS="${CFLAGS} `${PCRE_CONFIG} --cflags`"
333 else
334   AC_DEFINE([HAVE_AP_REGEX_H], [1], [Define to 1 if you have the <ap_regex.h> header file.])
335 fi
336
337 # Checks for typedefs, structures, and compiler characteristics.
338 AC_C_CONST
339
340 # Checks for library functions.
341 AC_FUNC_MALLOC
342 AC_CHECK_FUNCS([open mmap close memset memcpy strcasecmp strncasecmp strstr])
343
344 AC_SUBST(with_apache_header)
345 AC_SUBST(CC)
346 AC_SUBST(QDEFS)
347 AC_SUBST(DDEFS)
348 AC_SUBST(LIBS)
349 AC_SUBST(CFLAGS)
350 AC_SUBST(APR_CONFIG)
351 AC_SUBST(APU_CONFIG)
352 AC_SUBST(OPENSSL_PATH)
353
354
355 AC_CONFIG_FILES([Makefile src/Makefile support/centos/mod-chxj.spec])
356 AC_OUTPUT