Increase priority
[debian/mod-auth-mysql] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(mod_auth_mysql, 4.2.0)
3
4 AC_CONFIG_SRCDIR([mod_auth_mysql.c])
5 AC_CONFIG_HEADER([config.h])
6
7 # Checks for programs.
8
9 # Checks for libraries.
10 AC_CHECK_LIB([mysqlclient], [mysql_init])
11
12 AC_ARG_ENABLE(apache13,
13 AC_HELP_STRING([--enable-apache13], [Indicate that the apache 1.3 module should be built]),
14 [
15 if test "x$enableval" = "xyes"; then
16         buildapache13="yes"
17         modules="$modules apache13_mod_auth_mysql.so"
18 fi
19 ],
20 [
21 # Build the apache 1.3 module by default
22 buildapache13="yes"
23 modules="$modules apache13_mod_auth_mysql.so"
24 ])
25
26 AC_ARG_ENABLE(apache2,
27 AC_HELP_STRING([--enable-apache2], [Indicate that the apache 2.0 module should be built]),
28 [
29 if test "x$enableval" = "xyes"; then
30         buildapache2="yes"
31         modules="$modules apache2_mod_auth_mysql.so"
32 fi
33 ])
34 AC_SUBST(modules)
35
36 AC_ARG_WITH(apxs,
37 AC_HELP_STRING([--with-apxs], [location of the apxs module helper]),
38 [
39 if test "x$buildapache13" = "xyes"; then
40         if test ! -x $withval; then
41                 AC_MSG_ERROR($withval not found)
42         else
43                 apxs="$withval"
44         fi
45 fi
46 ],
47 [
48 if test "x$buildapache13" = "xyes"; then
49         # Test common apxs locations; add any others I've missed here
50         if test -x /usr/bin/apxs; then
51                 apxs="/usr/bin/apxs"
52         elif test -x /usr/local/bin/apxs; then
53                 apxs="/usr/local/bin/apxs"
54         else
55                 AC_MSG_ERROR(Apache extension helper apxs not found!)
56         fi
57 fi
58 ])
59 AC_SUBST(apxs)
60
61 AC_ARG_WITH(apxs2,
62 AC_HELP_STRING([--with-apxs2], [location of the apxs2 Apache2 module helper]),
63 [
64 if test "x$buildapache2" = "xyes"; then
65         if test ! -x $withval; then
66                 AC_MSG_ERROR($withval not found)
67         else
68                 apxs2="$withval"
69         fi
70 fi
71 ],
72 [
73 if test "x$buildapache2" = "xyes"; then
74         # Test likely apxs2 locations
75         if test -x /usr/bin/apxs2; then
76                 apxs2="/usr/bin/apxs2"
77         elif test -x /usr/local/bin/apxs2; then
78                 apxs2="/usr/local/bin/apxs2"
79         else
80                 AC_MSG_ERROR(Apache2 extension helper not found!)
81         fi
82 fi
83 ])
84 AC_SUBST(apxs2)
85
86 AC_ARG_WITH(mysql-includes,
87 AC_HELP_STRING([--with-mysql-includes], [MySQL includes directory]),
88 [
89 if test ! -e $withval/mysql.h; then
90         AC_MSG_ERROR(Invalid MySQL includes directory: $withval)
91 else
92         mysql_includes="-I$withval"
93 fi
94 ],
95 [
96 # Common location finder
97 if test -e /usr/include/mysql/mysql.h; then
98         mysql_includes="-I/usr/include/mysql"
99 elif test -e /usr/include/mysql.h; then
100         mysql_includes="-I/usr/include"
101 elif test -e /usr/local/include/mysql/mysql.h; then
102         mysql_includes="-I/usr/local/include/mysql"
103 elif test -e /usr/local/include/mysql.h; then
104         mysql_includes="-I/usr/local/include"
105 else
106         AC_MSG_ERROR(MySQL include files not found!)
107 fi
108 ])
109 AC_SUBST(mysql_includes)
110
111 AC_ARG_WITH(mysql-libs,
112 AC_HELP_STRING([--with-mysql-libs], [MySQL libraries directory]),
113 [
114 if test ! -e $withval/libmysqlclient.so; then
115         AC_MSG_ERROR(Invalid MySQL libs directory: $withval)
116 else
117         mysql_libs="-L$withval"
118 fi
119 ],
120 [
121 # Common location finder
122 if test -e /usr/lib/mysql/libmysqlclient.so; then
123         mysql_libs="-L/usr/lib/mysql"
124 elif test -e /usr/lib/libmysqlclient.so; then
125         mysql_libs="-L/usr/lib"
126 elif test -e /usr/local/lib/mysql/libmysqlclient.so; then
127         mysql_libs="-L/usr/local/lib/mysql"
128 elif test -e /usr/local/lib/libmysqlclient.so ; then
129         mysql_libs="-L/usr/local/lib"
130 else
131         AC_MSG_ERROR(MySQL libraries not found!)
132 fi
133 ])
134 AC_SUBST(mysql_libs)
135
136 AC_SUBST(build_opts, "$mysql_includes $mysql_libs")
137
138 # Checks for header files.
139 AC_CHECK_HEADERS([crypt.h])
140
141 AC_CHECK_LIB([crypt], [crypt])
142
143 if test -n $HAVE_CRYPT_H; then
144         AC_TRY_RUN(
145 [
146 #include <crypt.h>
147 #include <string.h>
148
149 int main()
150 {
151         return strcmp(crypt("a", "\$1\$aaaaaaaa"),
152                         "\$1\$aaaaaaaa\$S270EsVIz5M8Y9/k4SSEf.");
153 }
154 ],
155 AC_DEFINE(CRYPT_MD5, 1, [Enable crypt() MD5 encryption]),
156 ,,)
157         AC_TRY_RUN(
158 [
159 #include <crypt.h>
160 #include <string.h>
161
162 int main()
163 {
164         return strcmp(crypt("a", "aa"),
165                         "aafKPWZb/dLAs");
166 }
167 ],
168 AC_DEFINE(CRYPT_DES, 1, [Enable DES encrpytion]),
169 ,,)
170
171 fi  # if test -n HAVE_CRYPT_H
172
173 # Checks for typedefs, structures, and compiler characteristics.
174 AC_C_CONST
175
176 # Checks for library functions.
177 AC_TYPE_SIGNAL
178
179 AC_CONFIG_FILES([Makefile])
180 AC_OUTPUT