summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 11034949c838fde94409c0b56823a01b49f81bb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
dnl Process this file with autoconf to produce a configure script.
AC_INIT(mod_log_sql.c)

AC_CONFIG_HEADER(config.h:config.in)

dnl OVERRIDABLE DEFAULTS
APDSTDIR="/usr/local/apache"
APSRCDIR="/usr/local/src/apache-1.3.27"
MYSQLHDRDIR="/usr/include/mysql"
MYSQLLIBDIR="/usr/lib"

dnl Check for command line arguments
AC_ARG_WITH(	apache,
				[  --with-apache=DIR            Where to look for Apache's installation],
				APDSTDIR=${withval})

APXSDIR="$APDSTDIR/bin"
APHDRDIR="$APDSTDIR/include"

AC_ARG_WITH(	apache-source,
				[  --with-apache-source=DIR     Where to look for Apache sources [${APSRCDIR}]],
				APSRCDIR=${withval})

AC_ARG_WITH(	apache-headers,
				[  --with-apache-headers=DIR    Where to look for Apache's header files],
				APHDRDIR=${withval})

AC_ARG_WITH(	apxs,
				[  --with-apxs=DIR              Where to look for apxs],
				APXSDIR=${withval})

AC_ARG_WITH(	mysql-headers,
				[  --with-mysql-headers=DIR     Where to look for MySQL headers],
				MYSQLHDRDIR=${withval})

AC_ARG_WITH(	mysql-libs,
				[  --with-mysql-libs=DIR        Where to look for MySQL libraries],
				MYSQLLIBDIR=${withval})

AC_ARG_ENABLE(	ssl,
				[  --disable-ssl                Do not attempt to compile in SSL support],
				WITHSSL=0,
				WITHSSL=1)


AC_SUBST(APDSTDIR)
AC_SUBST(APSRCDIR)
AC_SUBST(MYSQLHDRDIR)
AC_SUBST(MYSQLLIBDIR)
AC_SUBST(APXSDIR)
AC_SUBST(APHDRDIR)

echo "Using the following locations:"
echo "  Apache installed in $APDSTDIR"
echo "  Apache source in $APSRCDIR"
echo "  Apache headers in $APHDRDIR"
echo "  apxs in $APXSDIR"
echo "  MySQL headers in $MYSQLHDRDIR"
echo "  MySQL libraries in $MYSQLLIBDIR"


AC_CANONICAL_HOST
case "$host" in
  *-linux*)
    AC_DEFINE(__LINUX)
    ;;
  *-netbsd*)
    AC_DEFINE(__NETBSD)
    ;;
  *-openbsd*)
    AC_DEFINE(__OPENBSD)
    ;;
  *-solaris*)
    AC_DEFINE(__SOLARIS)
    ;;
  *-sunos4*)
    AC_DEFINE(__SUNOS)
    ;;
  *-freebsd*)
    AC_DEFINE(__FREEBSD)
    ;;
  *-bsdi*)
    AC_DEFINE(__BSDI)
    ;;
  *-apple-darwin*)
    AC_DEFINE(__MACOSX)
    ;;
esac



dnl ====================================================================
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PATH_PROG(RM, rm, no, $PATH:/usr/bin:/usr/local/bin)
if test $RM = no; then
	AC_MSG_ERROR("rm not found in the PATH")
fi
AC_PATH_PROG(APXS, apxs, no, $APXSDIR)
if test $APXS = no; then
	AC_MSG_ERROR("apxs not found. Please specify its location using --with-apxs")
fi

AC_PATH_PROG(LYX,lyx,,$PATH:/usr/local/bin)
AC_PATH_PROG(LATEX,latex,,$PATH:/usr/local/bin)
AC_PATH_PROG(DVIPS,dvips,,$PATH:/usr/local/bin)
AC_PATH_PROG(LINKS,lynx,,$PATH:/usr/local/bin)
AC_PATH_PROG(L2H,latex2html,,$PATH:/usr/local/bin)

AC_SUBST(RM)
AC_SUBST(LYX)
AC_SUBST(LATEX)
AC_SUBST(DVIPS)
AC_SUBST(LINKS)
AC_SUBST(L2H)

dnl ====================================================================
dnl Checks for libraries.
AC_CHECK_LIB(z,
			main,
			LIBS="$LIBS -lz",
			AC_MSG_ERROR("libz not found. Compilation cannot continue without this library.") )
AC_CHECK_FUNC(	nanosleep, ,
				AC_CHECK_LIB(rt,
							nanosleep,
							LIBS="$LIBS -lrt",
							AC_MSG_ERROR("nanosleep function not available in librt.") ) )
AC_CHECK_LIB(	mysqlclient,
				mysql_init,
				LIBS="$LIBS -lmysqlclient",
				AC_MSG_ERROR("libmysqlclient not found. Please specify its location using --with-mysql-libs.") )

dnl ====================================================================
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS($APDSTDIR/include/httpd.h $APDSTDIR/include/http_config.h $APDSTDIR/include/http_log.h $APDSTDIR/include/http_core.h,
				,
				[ echo "** A required header cannot be located."
				  echo "   Please use the --with-apache option."; echo; exit 1])
AC_CHECK_HEADERS($MYSQLHDRDIR/mysql.h $MYSQLHDRDIR/mysqld_error.h,
				,
				[ echo "** A required header cannot be located."
				  echo "   Please use the --with-mysql-headers option."; echo; exit 1])
if test $WITHSSL = 1; then
AC_CHECK_FILES($APSRCDIR/src/modules/ssl/mod_ssl.h,
				AC_CHECK_HEADER(db1/ndbm.h,HAVE_MODSSL=1,HAVE_MODSSL=0),
				HAVE_MODSSL=0)
	if test $HAVE_MODSSL = 0; then
		AC_MSG_WARN("SSL not enabled. Please use the --with-apache-source option if you want it enabled.")
	fi
else
	AC_MSG_WARN("SSL checking/capability disabled by commandline option.")
	HAVE_MODSSL=0
fi
AC_SUBST(HAVE_MODSSL)

dnl ====================================================================
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM

dnl ====================================================================
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strstr atoi mysql_real_connect mysql_escape_string mysql_real_escape_string, , AC_MSG_ERROR("a necessary function is not available."))

dnl ====================================================================
dnl Create the Makefile
AC_OUTPUT(Makefile)

dnl ====================================================================
dnl Final output
echo
if test $HAVE_MODSSL = 1; then
	echo "mod_ssl support has been compiled into this module"
else
	echo "no mod_ssl support"
fi

echo
dnl echo $LIBS