OSDN Git Service

* Added serf library.
[modchxj/mod_chxj.git] / src / serf / configure.in
1 dnl Autoconf file for Serf
2
3 AC_PREREQ(2.50)
4 AC_INIT(context.c)
5
6 AC_CONFIG_AUX_DIR(build)
7
8 sinclude(build/apr_common.m4)
9 sinclude(build/find_apr.m4)
10 sinclude(build/find_apu.m4)
11
12 AC_PREFIX_DEFAULT(/usr/local/serf)
13
14 dnl Get the layout here, so we can pass the required variables to apr
15 APR_ENABLE_LAYOUT(Serf, [])
16
17 dnl reparse the configure arguments.
18 APR_PARSE_ARGUMENTS
19
20 APR_CONFIG_NICE(config.nice)
21
22 nl='
23 '
24 dnl Check that mkdir -p works
25 APR_MKDIR_P_CHECK($top_srcdir/build/mkdir.sh)
26 AC_SUBST(mkdir_p)
27
28 dnl ## Run configure for packages Apache uses
29
30 dnl shared library support for these packages doesn't currently
31 dnl work on some platforms
32
33 AC_CANONICAL_SYSTEM
34
35 orig_prefix="$prefix"
36
37 echo $ac_n "${nl}Configuring Apache Portable Runtime library...${nl}"
38
39 APR_FIND_APR("$srcdir/apr", "./apr", 1, [0 1])
40
41 if test "$apr_found" = "no"; then
42   AC_MSG_ERROR([APR not found.  Please read the documentation.])
43 fi
44
45 if test "$apr_found" = "reconfig"; then
46   APR_SUBDIR_CONFIG(apr,
47                     [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir],
48                     [--enable-layout=*|\'--enable-layout=*])
49   dnl We must be the first to build and the last to be cleaned
50   SERF_BUILD_SRCLIB_DIRS="apr $SERF_BUILD_SRCLIB_DIRS"
51   SERF_CLEAN_SRCLIB_DIRS="$SERF_CLEAN_SRCLIB_DIRS apr"
52 fi
53
54 APR_SETIFNULL(CC, `$apr_config --cc`)
55 APR_SETIFNULL(CPP, `$apr_config --cpp`)
56 APR_SETIFNULL(APR_LIBTOOL, `$apr_config --apr-libtool`)
57 APR_ADDTO(CFLAGS, `$apr_config --cflags`)
58 APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
59 APR_ADDTO(LDFLAGS, `$apr_config --ldflags`)
60 SHLIBPATH_VAR=`$apr_config --shlib-path-var`
61 APR_BINDIR=`$apr_config --bindir`
62 APR_INCLUDEDIR=`$apr_config --includedir`
63 APR_VERSION=`$apr_config --version`
64 APR_CONFIG="$apr_config"
65
66 AC_SUBST(APR_LIBTOOL)
67 AC_SUBST(APR_BINDIR)
68 AC_SUBST(APR_INCLUDEDIR)
69 AC_SUBST(APR_VERSION)
70 AC_SUBST(APR_CONFIG)
71
72 echo $ac_n "${nl}Configuring Apache Portable Runtime Utility library...${nl}"
73
74 APR_FIND_APU("$srcdir/apr-util", "./apr-util", 1, [0 1])
75
76 if test "$apu_found" = "no"; then
77   AC_MSG_ERROR([APR-util not found.  Please read the documentation.])
78 fi
79
80 # Catch some misconfigurations:
81 case ${apr_found}.${apu_found} in
82 reconfig.yes)
83   AC_MSG_ERROR([Cannot use an external APR-util with the bundled APR])
84   ;;
85 yes.reconfig)
86   AC_MSG_ERROR([Cannot use an external APR with the bundled APR-util])
87   ;;
88 esac  
89
90 if test "$apu_found" = "reconfig"; then
91   APR_SUBDIR_CONFIG(apr-util,
92                     [--with-apr=../apr --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir],
93                     [--enable-layout=*|\'--enable-layout=*])
94   dnl We must be the last to build and the first to be cleaned
95   SERF_BUILD_SRCLIB_DIRS="$SERF_BUILD_SRCLIB_DIRS apr-util"
96   SERF_CLEAN_SRCLIB_DIRS="apr-util $SERF_CLEAN_SRCLIB_DIRS"
97 fi
98
99 APR_ADDTO(LDFLAGS, `$apu_config --ldflags`)
100 APU_BINDIR=`$apu_config --bindir`
101 APU_INCLUDEDIR=`$apu_config --includedir`
102 APU_VERSION=`$apu_config --version`
103 APU_CONFIG="$APU_BINDIR/apu-`echo ${APU_VERSION} | sed 's,\..*,,'`-config"
104
105 AC_SUBST(APU_BINDIR)
106 AC_SUBST(APU_INCLUDEDIR)
107 AC_SUBST(APU_VERSION)
108 AC_SUBST(APU_CONFIG)
109
110 dnl In case we picked up CC and CPP from APR, get that info into the
111 dnl config cache so that PCRE uses it.  Otherwise, CC and CPP used for
112 dnl PCRE and for our config tests will be whatever PCRE determines.
113 AC_PROG_CC
114 AC_PROG_CPP
115 AC_PROG_INSTALL
116
117 if test "x${cache_file}" = "x/dev/null"; then
118   # Likewise, ensure that CC and CPP are passed through to the pcre
119   # configure script iff caching is disabled (the autoconf 2.5x default).
120   export CC; export CPP
121 fi
122
123 echo $ac_n "Configuring Serf...${nl}"
124
125 dnl Absolute source/build directory
126 abs_srcdir=`(cd $srcdir && pwd)`
127 abs_builddir=`pwd`
128
129 dnl get our version information
130 get_version="$abs_srcdir/build/get-version.sh"
131 version_hdr="$abs_srcdir/serf.h"
132 SERF_MAJOR_VERSION="`$get_version major $version_hdr SERF`"
133 SERF_DOTTED_VERSION="`$get_version all $version_hdr SERF`"
134
135 AC_SUBST(SERF_MAJOR_VERSION)
136 AC_SUBST(SERF_DOTTED_VERSION)
137
138 AC_SUBST(SERF_BUILD_SRCLIB_DIRS)
139 AC_SUBST(SERF_CLEAN_SRCLIB_DIRS)
140
141 AC_ARG_WITH(openssl,
142   APR_HELP_STRING([--with-openssl=PATH],[Path to OpenSSL (eg. /usr/local/ssl)]),
143 [
144   if test "$withval" = "yes"; then
145     AC_MSG_ERROR([--with-openssl requires a path])
146   else
147     openssl_prefix=$withval
148
149     if test "x$openssl_prefix" != "x" -a ! -d "$openssl_prefix"; then
150       AC_MSG_ERROR('--with-openssl requires a path to a directory')
151     fi
152
153     APR_ADDTO(CPPFLAGS, "-I${openssl_prefix}/include")
154     APR_ADDTO(LDFLAGS, "-L${openssl_prefix}/lib")
155     APR_ADDTO(LDFLAGS, "-R${openssl_prefix}/lib")
156   fi
157 ])
158
159 dnl Look for OpenSSL
160 AC_CHECK_HEADER([openssl/opensslv.h], [],
161                 [AC_MSG_ERROR([We require OpenSSL; try --with-openssl])])
162
163 libs="`$apu_config --link-libtool --libs` `$apr_config --link-libtool --libs`"
164 APR_ADDTO(SERF_LIBS, [$libs])
165 AC_SUBST(SERF_LIBS)
166
167 AC_CONFIG_FILES([Makefile])
168 AC_CONFIG_COMMANDS([mkdir-vpath],[make mkdir-vpath])
169
170 AC_OUTPUT