Commit | Line | Data |
---|---|---|
d9898ee8 | 1 | dnl Process this file with autoconf to produce a configure script. |
2 | dnl | |
d9898ee8 | 3 | dnl |
b0322a85 | 4 | dnl Copyright 1998 - 2013 Double Precision, Inc. See COPYING for |
d9898ee8 | 5 | dnl distribution information. |
6 | ||
8d138742 | 7 | AC_PREREQ(2.63) |
b0322a85 | 8 | AC_INIT([courier-authlib],[0.66.1],[courier-users@lists.sourceforge.net]) |
d9898ee8 | 9 | |
10 | AC_CONFIG_SRCDIR([courierauth.h]) | |
d9898ee8 | 11 | |
12 | AM_INIT_AUTOMAKE | |
b0322a85 | 13 | AM_CONFIG_HEADER([courier_auth_config.h]) |
d9898ee8 | 14 | >confdefs.h # Kill PACKAGE_ macros |
15 | ||
16 | LPATH="$PATH:/usr/local/bin" | |
17 | ||
18 | dnl Checks for programs. | |
19 | AC_PROG_AWK | |
20 | AC_PROG_CC | |
21 | AC_PROG_CPP | |
22 | AC_PROG_INSTALL | |
23 | AC_PROG_LN_S | |
24 | AC_PROG_SYSCONFTOOL | |
8d138742 CE |
25 | LT_INIT(dlopen) |
26 | LTDL_INIT | |
d9898ee8 | 27 | AC_SUBST(LTDLINCL) |
28 | AC_SUBST(LIBLTDL) | |
29 | AC_PATH_PROGS(PERL, perl5 perl, perl, $LPATH) | |
30 | AC_PATH_PROGS(COURIERCONFIG, courier-config, courier-config, $LPATH) | |
31 | ||
b0322a85 CE |
32 | AC_CHECK_HEADER(ltdl.h, [ : ], |
33 | AC_MSG_ERROR([Unable to find ltdl.h. Please install Libtool's ltdl library])) | |
34 | ||
d9898ee8 | 35 | if test "$PERL" = "perl" |
36 | then | |
37 | AC_MSG_ERROR(Perl is required) | |
38 | fi | |
39 | ||
40 | test "x$prefix" = xNONE && prefix=$ac_default_prefix | |
41 | test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' | |
42 | eval "prefix=$prefix" | |
43 | eval "exec_prefix=$exec_prefix" | |
44 | eval "sysconfdir=$sysconfdir" | |
45 | eval "bindir=$bindir" | |
46 | eval "sbindir=$sbindir" | |
47 | eval "localstatedir=$localstatedir" | |
48 | eval "libexecdir=$libexecdir" | |
b0322a85 CE |
49 | eval "datarootdir=$datarootdir" |
50 | eval "datedir=$datadir" | |
d9898ee8 | 51 | |
d9898ee8 | 52 | AC_PATH_PROGS(EXPECT, expect, expect, $LPATH) |
53 | ||
54 | if test "$EXPECT" = "expect" | |
55 | then | |
56 | AC_MSG_WARN(-----------------------------------------------------) | |
57 | AC_MSG_WARN(expect not found - will not be able to change passwds) | |
58 | AC_MSG_WARN(in webmail) | |
59 | AC_MSG_WARN(-----------------------------------------------------) | |
60 | sleep 5 | |
61 | else | |
62 | AC_DEFINE_UNQUOTED(HAVE_EXPECT, 1, [ Whether expect(1) is installed ]) | |
63 | fi | |
64 | ||
65 | AC_PATH_PROGS(PASSWD, passwd, passwd, $LPATH) | |
66 | AC_SUBST(PASSWD) | |
67 | ||
68 | if test "$GCC" = "yes" | |
69 | then | |
70 | CFLAGS="$CFLAGS -Wall" | |
71 | fi | |
72 | ||
b0322a85 | 73 | CFLAGS="$CFLAGS -Ilibs -I${srcdir}/libs" |
d9898ee8 | 74 | |
75 | AC_MSG_CHECKING(whether -lm is needed for floor) | |
76 | AC_TRY_LINK_FUNC(floor, | |
77 | AC_MSG_RESULT(no), | |
78 | LIBM="-lm" | |
79 | AC_MSG_RESULT(yes)) | |
80 | ||
81 | AC_ARG_WITH(pkgconfdir, | |
82 | [ --with-pkgconfdir=d Install config files in directory ], | |
83 | [pkgconfdir="$withval"], | |
84 | [pkgconfdir="$sysconfdir/authlib"]) | |
85 | ||
d9898ee8 | 86 | saveLIBS="$LIBS" |
87 | NETLIBS="" | |
88 | USENSL=no | |
89 | ||
90 | AC_CHECK_LIB(socket,socket,result=yes,result=no) | |
91 | if test $result = yes; then | |
92 | NETLIBS="-lsocket" | |
93 | else | |
94 | AC_CHECK_LIB(socket,socket,result=yes,result=no,-lnsl) | |
95 | if test $result = yes; then | |
96 | NETLIBS = "-lsocket -lnsl" | |
97 | USENSL=yes | |
98 | else | |
99 | AC_CHECK_LIB(socket,connect,result=yes,result=no) | |
100 | if test $result = yes; then | |
101 | NETLIBS="-lsocket" | |
102 | else | |
103 | AC_CHECK_LIB(socket,connect,result=yes,result=no,-lnsl) | |
104 | if test $result = yes; then | |
105 | NETLIBS="-lsocket -lnsl" | |
106 | USENSL=yes | |
107 | fi | |
108 | fi | |
109 | fi | |
110 | fi | |
111 | ||
112 | if test $USENSL != yes; then | |
113 | LIBS="$LIBS $NETLIBS" | |
114 | AC_TRY_LINK_FUNC(inet_addr, [ : ], | |
115 | [ | |
116 | AC_CHECK_LIB(nsl,inet_addr,result=yes,result=no) | |
117 | if test $result = yes; then | |
118 | NETLIBS="$NETLIBS -lnsl" | |
119 | fi | |
120 | ]) | |
121 | fi | |
122 | ||
123 | LIBS="$saveLIBS" | |
124 | AC_SUBST(NETLIBS) | |
125 | ||
126 | dnl ######################################################################### | |
127 | ||
128 | dnl Prepare authuserdb module if userdb library is available | |
129 | ||
130 | dnl ######################################################################### | |
131 | ||
132 | ||
133 | AC_ARG_WITH(db, [ --with-db=gdbm Use the GDBM library. | |
134 | --with-db=db Use the libdb.a library.], | |
135 | db="$withval", needs_withdb=1) | |
136 | ||
137 | case "$db" in | |
138 | gdbm) | |
139 | ;; | |
140 | db) | |
141 | ;; | |
142 | "") | |
143 | ;; | |
144 | *) | |
145 | AC_MSG_ERROR(Invalid --with-db option.) | |
146 | ;; | |
147 | esac | |
148 | ||
149 | saveLIBS="$LIBS" | |
150 | ||
151 | if test "$db" != "db" | |
152 | then | |
153 | AC_CHECK_LIB(gdbm, gdbm_open, | |
154 | [ LIBGDBM=-lgdbm ; LIBS="-lgdbm $LIBS" ]) | |
155 | AC_CHECK_FUNC(gdbm_open, [ HAVE_GDBM=y ]) | |
156 | fi | |
157 | ||
158 | LIBS="$saveLIBS" | |
159 | ||
160 | if test "$db" != "gdbm" | |
161 | then | |
162 | AC_CHECK_LIB(db, dbopen, [ LIBDB=-ldb ; LIBS="-ldb $LIBS" ], | |
163 | [ AC_CHECK_LIB(db, db_open, [ LIBDB=-ldb ; LIBS="-ldb $LIBS"], | |
164 | [ AC_CHECK_LIB(db, db_env_create, | |
165 | [ LIBDB=-ldb; LIBS="-ldb $LIBS"]) ] | |
166 | )]) | |
167 | ||
168 | AC_CHECK_FUNC(dbopen, HAVE_BDB=1) | |
169 | AC_CHECK_FUNC(db_open, HAVE_BDB=1) | |
170 | AC_CHECK_FUNC(db_env_create, HAVE_BDB=1) | |
171 | fi | |
172 | ||
173 | LIBS="$saveLIBS" | |
174 | ||
175 | if test "$HAVE_GDBM$HAVE_BDB" = "" | |
176 | then | |
177 | AC_MSG_ERROR(Cannot find either the gdbm or the db library.) | |
178 | fi | |
179 | ||
180 | USE_GDBM=0 | |
181 | USE_DB=0 | |
182 | ||
183 | if test "$HAVE_GDBM" = "y" | |
184 | then | |
185 | LIBDB="" | |
186 | USE_GDBM=1 | |
d9898ee8 | 187 | if test "$needs_withdb" = 1 |
188 | then | |
189 | ac_configure_args="$ac_configure_args --with-db=gdbm" | |
190 | fi | |
b0322a85 | 191 | dblibrary=libs/gdbmobj/libgdbmobj.la |
d9898ee8 | 192 | else |
193 | LIBGDBM="" | |
194 | USE_DB=1 | |
d9898ee8 | 195 | if test "$needs_withdb" = 1 |
196 | then | |
197 | ac_configure_args="$ac_configure_args --with-db=db" | |
198 | fi | |
b0322a85 | 199 | dblibrary=libs/bdbobj/libbdbobj.la |
d9898ee8 | 200 | fi |
201 | ||
d9898ee8 | 202 | AC_SUBST(USE_GDBM) |
203 | AC_SUBST(USE_DB) | |
d9898ee8 | 204 | |
205 | AC_ARG_WITH(authuserdb, | |
206 | [ --without-authuserdb Do not include the authuserdb module ], | |
207 | doauthuserdb="$withval", | |
208 | doauthuserdb="no" | |
209 | if test -d ${srcdir}/userdb | |
210 | then | |
211 | doauthuserdb="yes" | |
212 | fi) | |
213 | ||
214 | if test "$doauthuserdb" = "no" | |
215 | then | |
216 | AUTHUSERDB="" | |
217 | else | |
218 | AUTHUSERDB="authuserdb" | |
219 | LIBAUTHUSERDB="libauthuserdb.la" | |
220 | ||
221 | fi | |
222 | ||
223 | AC_ARG_WITH(makedatprog, [ ], [ : ], | |
224 | [ | |
225 | ac_configure_args="$ac_configure_args --with-makedatprog=$libexecdir/courier-authlib/makedatprog" | |
226 | ]) | |
227 | ||
228 | cat >dbobj.config <<EOF | |
229 | LIBDB=$LIBDB | |
230 | LIBGDBM=$LIBGDBM | |
231 | dblibrary=$dblibrary | |
232 | EOF | |
233 | ||
234 | AC_SUBST(USE_GDBM) | |
235 | AC_SUBST(USE_DB) | |
236 | ||
237 | AC_SUBST(dblibrary) | |
238 | AC_SUBST(LIBGDBM) | |
239 | AC_SUBST(LIBDB) | |
240 | AC_SUBST(LIBAUTHUSERDB) | |
241 | ||
242 | userdb="$pkgconfdir/userdb" | |
243 | AC_ARG_WITH(userdb, [], [ userdb="$withval" ], [ac_configure_args="$ac_configure_args '--with-userdb=$userdb'"]) | |
244 | ||
245 | AC_DEFINE_UNQUOTED(USERDB,"$userdb", [ Location of the userdb database ]) | |
246 | AC_SUBST(userdb) | |
247 | ||
248 | dnl Checks for header files. | |
249 | dnl | |
250 | dnl Because autoconf sets macros for C preprocessor where | |
251 | dnl AC_CHECK_HEADERS appears first, the first AC_CHECK_HEADERS | |
252 | dnl must not place in conditional level but top level. | |
253 | dnl This is a dummy AC_CHECK_HEADERS for it. | |
254 | dnl | |
255 | AC_CHECK_HEADERS(stdio.h) | |
256 | ||
257 | dnl ######################################################################### | |
258 | ||
259 | dnl Prepare authpam module if libpam is available. | |
260 | ||
261 | dnl ######################################################################### | |
262 | ||
263 | AC_ARG_WITH(authpam, | |
264 | [ --without-authpam Do not include the authpam module ], | |
265 | doauthpam="$withval") | |
266 | ||
267 | AC_CHECK_HEADERS(security/pam_appl.h Pam/pam_appl.h) | |
268 | if test "$doauthpam" = "no" | |
269 | then | |
270 | LIBDL="" | |
271 | else | |
272 | saveLIBS="$LIBS" | |
273 | LIBDL="" | |
274 | AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ]) | |
275 | LIBS="$saveLIBS" | |
276 | ||
277 | AC_CHECK_LIB(pam, pam_start, | |
278 | [ HAVE_PAM=1 | |
279 | LIBS="-lpam $LIBDL $LIBS" | |
280 | AC_CHECK_FUNCS(pam_setcred)], | |
281 | ||
282 | HAVE_PAM=0, | |
283 | $LIBDL) | |
284 | LIBS="$saveLIBS" | |
285 | fi | |
286 | AC_SUBST(LIBDL) | |
287 | ||
288 | LIBAUTHPAM="" | |
289 | if test "$HAVE_PAM" = 1 | |
290 | then | |
291 | LIBAUTHPAM=libauthpam.la | |
292 | fi | |
293 | ||
294 | AC_ARG_WITH(authpam-libraries, | |
295 | [ --with-authpam-libraries="libs" Link 'libs' with authpam, this may be | |
296 | required for FreeBSD 3.3], | |
297 | authpamcrypt="$withval") | |
298 | ||
299 | AUTHPAMCRYPT="$authpamcrypt" | |
300 | AC_SUBST(AUTHPAMCRYPT) | |
301 | AC_SUBST(LIBAUTHPAM) | |
302 | ||
303 | dnl ######################################################################### | |
304 | ||
305 | dnl Prepare authldap module if ldap functions are available. | |
306 | ||
307 | dnl ######################################################################### | |
308 | ||
309 | AC_ARG_WITH(authldap, | |
310 | [ --without-authldap Do not include the authldap module ], | |
311 | doauthldap="$withval", | |
312 | doauthldap="yes") | |
313 | ||
314 | AC_CHECK_HEADERS(lber.h) | |
315 | AC_CHECK_HEADERS(ldap.h) | |
316 | AC_CHECK_HEADERS(netinet/in.h) | |
317 | ||
318 | if test "$doauthldap" = "no" | |
319 | then | |
320 | HAVE_LDAP=0 | |
321 | else | |
322 | saveLIBS="$LIBS" | |
323 | LIBS="$NETLIBS $LIBS" | |
324 | LDAPLIBS="" | |
325 | ||
326 | AC_MSG_CHECKING(whether -lresolv is needed for res_query) | |
b0322a85 | 327 | AC_LINK_IFELSE([AC_LANG_PROGRAM([ |
d9898ee8 | 328 | #include <sys/types.h> |
329 | #if HAVE_NETINET_IN_H | |
330 | #include <netinet/in.h> | |
331 | #endif | |
332 | #include <resolv.h> | |
333 | ||
334 | void (*func)()= (void (*)())res_query; | |
335 | ], | |
b0322a85 | 336 | [ (*func)(); ])], |
d9898ee8 | 337 | AC_MSG_RESULT(no), |
338 | [ | |
339 | LIBS="-lresolv $LIBS" | |
340 | ||
b0322a85 | 341 | AC_LINK_IFELSE([AC_LANG_PROGRAM([ |
d9898ee8 | 342 | #include <sys/types.h> |
343 | #if HAVE_NETINET_IN_H | |
344 | #include <netinet/in.h> | |
345 | #endif | |
346 | #include <resolv.h> | |
347 | ||
348 | void (*func)()= (void (*)())res_query; | |
349 | ], | |
b0322a85 | 350 | [ (*func)(); ])], [ |
d9898ee8 | 351 | LDAPLIBS="-lresolv $LDAPLIBS" |
352 | HAVE_LDAP=1 | |
353 | AC_MSG_RESULT(yes) | |
354 | ], | |
355 | AC_MSG_ERROR(Cannot find function res_query)) | |
356 | ]) | |
357 | ||
358 | AC_CHECK_LIB(lber, ber_scanf, | |
359 | [ LDAPLIBS="-llber $LDAPLIBS" LIBS="-llber $LIBS" ]) | |
360 | AC_CHECK_LIB(ldap, ldap_open, | |
361 | [ LDAPLIBS="-lldap $LDAPLIBS" ; LIBS="-lldap $LIBS" ]) | |
362 | AC_CHECK_FUNC(ldap_search_st, HAVE_LDAP=1, HAVE_LDAP=0) | |
363 | AC_CHECK_FUNC(ldap_start_tls_s, HAVE_LDAP_TLS=1, HAVE_LDAP_TLS=0) | |
364 | AC_CHECK_FUNC(ldap_result2error, HAVE_LDAP_RESULT2ERROR=1, HAVE_LDAP_RESULT2ERROR=0) | |
365 | AC_CHECK_FUNC(ldap_parse_result, HAVE_LDAP_PARSE_RESULT=1, HAVE_LDAP_PARSE_RESULT=0) | |
366 | LIBS="$saveLIBS" | |
367 | fi | |
368 | ||
369 | AC_ARG_WITH(authldaprc, | |
370 | [ --with-authldaprc=filename Expect to find authldaprc here ], | |
371 | authldaprc="$withval", | |
372 | authldaprc="$pkgconfdir/authldaprc") | |
373 | AC_SUBST(authldaprc) | |
374 | ||
375 | LIBAUTHLDAP="" | |
376 | if test "$HAVE_LDAP" = 1 | |
377 | then | |
378 | LIBAUTHLDAP="libauthldap.la" | |
379 | else | |
380 | authldaprc="" | |
381 | fi | |
382 | AC_SUBST(LDAPLIBS) | |
383 | AC_SUBST(LIBAUTHLDAP) | |
384 | ||
385 | AM_CONDITIONAL(HAVE_LDAP, test "$HAVE_LDAP" = 1) | |
386 | AC_DEFINE_UNQUOTED(HAVE_LDAP_TLS,$HAVE_LDAP_TLS, | |
387 | [ Whether we have ldap_start_tls_s ]) | |
388 | AC_DEFINE_UNQUOTED(HAVE_LDAP_RESULT2ERROR, $HAVE_LDAP_RESULT2ERROR, | |
389 | [ Whether we have ldap_result2error() function ]) | |
390 | AC_DEFINE_UNQUOTED(HAVE_LDAP_PARSE_RESULT, $HAVE_LDAP_PARSE_RESULT, | |
391 | [ Whether we have ldap_parse_result() function]) | |
392 | dnl ######################################################################### | |
393 | ||
394 | dnl Prepare authpwd module | |
395 | ||
396 | dnl ######################################################################### | |
397 | ||
398 | AC_ARG_WITH(authpwd, | |
399 | [ --without-authpwd Do not include the authpwd module ], | |
400 | doauthpwd="$withval", | |
401 | doauthpwd="yes" | |
402 | test "$HAVE_PAM" = 1 && doauthpwd="no" | |
403 | test "$HAVE_LDAP" = 1 && doauthpwd="no" | |
404 | ) | |
405 | ||
406 | HAVE_PWD=1 | |
407 | if test "$doauthpwd" = "no" | |
408 | then | |
409 | HAVE_PWD=0 | |
410 | fi | |
411 | AC_CHECK_FUNCS(endpwent) | |
412 | ||
413 | dnl ######################################################################### | |
414 | ||
415 | dnl Prepare authshadow module if shadow functions are available. | |
416 | ||
417 | dnl ######################################################################### | |
418 | ||
419 | AC_ARG_WITH(authshadow, | |
420 | [ --without-authshadow Do not include the authshadow module ], | |
421 | doauthshadow="$withval", | |
422 | doauthshadow="yes" | |
423 | test "$HAVE_PAM" = 1 && doauthshadow="no" | |
424 | test "$HAVE_LDAP" = 1 && doauthshadow="no") | |
425 | ||
426 | AC_CHECK_HEADERS(shadow.h) | |
427 | saveLIBS="$LIBS" | |
428 | SHADOWLIBS="" | |
429 | AC_CHECK_LIB(shadow, getspent, | |
430 | [ SHADOWLIBS="-lshadow" ; LIBS="-lshadow $LIBS" ]) | |
431 | AC_CHECK_FUNCS(endspent getspent) | |
432 | LIBS="$saveLIBS" | |
433 | ||
434 | if test "$doauthshadow" = "no" | |
435 | then | |
436 | HAVE_SHADOW=0 | |
437 | else | |
438 | ||
439 | saveLIBS="$LIBS" | |
440 | AC_CHECK_LIB(shadow, getspent) | |
441 | AC_CHECK_FUNC(getspent, HAVE_SHADOW=1, HAVE_SHADOW=0) | |
442 | LIBS="$saveLIBS" | |
443 | fi | |
444 | ||
445 | LIBAUTHSHADOW="" | |
446 | if test "$HAVE_SHADOW" = 1 | |
447 | then | |
448 | LIBAUTHSHADOW="libauthshadow.la" | |
449 | fi | |
450 | AC_SUBST(SHADOWLIBS) | |
451 | AC_SUBST(LIBAUTHSHADOW) | |
452 | ||
453 | LIBAUTHPWD="" | |
454 | if test "$HAVE_PWD" = 1 | |
455 | then | |
456 | LIBAUTHPWD="libauthpwd.la" | |
457 | fi | |
458 | AC_SUBST(LIBAUTHPWD) | |
459 | ||
460 | dnl ######################################################################### | |
461 | ||
d9898ee8 | 462 | dnl Prepare authpgsql module |
463 | ||
464 | dnl ######################################################################### | |
465 | ||
466 | AC_ARG_WITH(authpgsqlrc, | |
467 | [ --with-authpgsqlrc=filename Expect to find authpgsql here ], | |
468 | authpgsqlrc="$withval", | |
469 | authpgsqlrc="$pkgconfdir/authpgsqlrc") | |
470 | AC_SUBST(authpgsqlrc) | |
471 | ||
472 | AC_ARG_WITH(authpgsql, | |
473 | [ --without-authpgsql Do not include the authpgsql module ], | |
474 | doauthpgsql="$withval") | |
475 | ||
476 | AC_PATH_PROGS(PG_CONFIG, pg_config, pg_config, $LPATH) | |
477 | ||
478 | PGSQL_LIBS="-lpq" | |
479 | AC_ARG_WITH(pgsql-libs, | |
480 | [ --with-pgsql-libs=DIR Look for pgsql libs in this dir ], | |
481 | PGSQL_LIBS="-L$withval $PGSQL_LIBS", | |
482 | if test -x $PG_CONFIG | |
483 | then | |
484 | PGSQL_LIBS="-L`$PG_CONFIG --libdir` $PGSQL_LIBS" | |
485 | fi | |
486 | ) | |
487 | AC_ARG_WITH(pgsql-includes, | |
488 | [ --with-pgsql-includes=DIR Look for pgsql includes in this dir ], | |
489 | PGSQL_CFLAGS="-I$withval", | |
490 | if test -x $PG_CONFIG | |
491 | then | |
492 | PGSQL_CFLAGS="-I`$PG_CONFIG --includedir`" | |
493 | fi | |
494 | ) | |
495 | ||
496 | if test "$doauthpgsql" = "" | |
497 | then | |
498 | LIBS="$PGSQL_LIBS $LIBS" | |
499 | AC_CHECK_FUNC(PQsetdbLogin, | |
500 | doauthpgsql="yes" | |
501 | ) | |
502 | LIBS="$saveLIBS" | |
503 | fi | |
504 | ||
505 | if test "$doauthpgsql" != "yes" | |
506 | then | |
507 | LIBAUTHPGSQL="" | |
508 | HAVE_AUTHPGSQL=0 | |
509 | else | |
510 | saveLIBS="$LIBS" | |
511 | LIBS="$PGSQL_LIBS $LIBS" | |
512 | AC_CHECK_FUNC(PQsetdbLogin, | |
513 | AUTHPGSQL="authpgsql" | |
514 | HAVE_AUTHPGSQL=1, | |
515 | AC_MSG_ERROR([--with-authpgsql specified but no libpq.so])) | |
516 | LIBS="$saveLIBS" | |
517 | HAVE_AUTHPGSQL=1 | |
518 | CFLAGS="$PGSQL_CFLAGS $CFLAGS" | |
519 | LIBAUTHPGSQL="libauthpgsql.la" | |
520 | fi | |
521 | ||
522 | AC_SUBST(PGSQL_LIBS) | |
523 | AC_SUBST(LIBAUTHPGSQL) | |
524 | AM_CONDITIONAL(HAVE_AUTHPGSQL, test "$HAVE_AUTHPGSQL" = 1) | |
525 | ||
526 | dnl ######################################################################### | |
527 | ||
528 | dnl Prepare authmysql module | |
529 | ||
530 | dnl ######################################################################### | |
531 | ||
532 | AC_ARG_WITH(authmysqlrc, | |
533 | [ --with-authmysqlrc=filename Expect to find authmysql here ], | |
534 | authmysqlrc="$withval", | |
535 | authmysqlrc="$pkgconfdir/authmysqlrc") | |
536 | AC_SUBST(authmysqlrc) | |
537 | ||
538 | AC_ARG_WITH(authmysql, | |
539 | [ --without-authmysql Do not include the authmysql module ], | |
540 | doauthmysql="$withval") | |
541 | AC_ARG_WITH(mysql-libs, | |
542 | [ --with-mysql-libs=DIR Look for mysql libs in this dir ], | |
543 | MYSQL_LIBS="-L$withval -lmysqlclient" | |
544 | ) | |
545 | AC_ARG_WITH(mysql-includes, | |
546 | [ --with-mysql-includes=DIR Look for mysql includes in this dir ], | |
547 | MYSQL_CFLAGS="-I$withval" | |
548 | ) | |
549 | ||
550 | AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $LPATH) | |
551 | ||
552 | if test -x "$MYSQL_CONFIG" | |
553 | then | |
554 | MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" | |
555 | MYSQL_LIBS="`$MYSQL_CONFIG --libs`" | |
556 | ||
557 | eval "MYSQL_CFLAGS=\"\`echo $MYSQL_CFLAGS\`\"" | |
558 | eval "MYSQL_LIBS=\"\`echo $MYSQL_LIBS\`\"" | |
559 | fi | |
560 | ||
561 | if test "$doauthmysql" = "" | |
562 | then | |
563 | LIBS="$MYSQL_LIBS $LIBS" | |
564 | AC_CHECK_FUNC(mysql_connect, | |
565 | doauthmysql="yes" | |
566 | ) | |
567 | AC_CHECK_FUNC(mysql_real_connect, | |
568 | doauthmysql="yes" | |
569 | ) | |
570 | LIBS="$saveLIBS" | |
571 | fi | |
572 | ||
573 | if test "$doauthmysql" != "yes" | |
574 | then | |
575 | LIBAUTHMYSQL="" | |
576 | HAVE_AUTHMYSQL=0 | |
577 | else | |
578 | saveLIBS="$LIBS" | |
579 | LIBS="$MYSQL_LIBS $LIBS" | |
580 | AC_CHECK_FUNC(mysql_connect, | |
581 | LIBAUTHMYSQL="libauthmysql.la" | |
582 | HAVE_AUTHMYSQL=1, | |
583 | [ | |
584 | AC_CHECK_FUNC(mysql_real_connect, | |
585 | LIBAUTHMYSQL="libauthmysql.la" | |
586 | HAVE_AUTHMYSQL=1, | |
587 | ||
588 | AC_MSG_ERROR([--with-authmysql specified but no mysqlclient.so]) | |
589 | ) | |
590 | ] | |
591 | ) | |
592 | LIBS="$saveLIBS" | |
593 | HAVE_AUTHMYSQL=1 | |
594 | CFLAGS="$MYSQL_CFLAGS $CFLAGS" | |
595 | fi | |
596 | AC_SUBST(LIBAUTHMYSQL) | |
597 | AC_SUBST(MYSQL_LIBS) | |
598 | AM_CONDITIONAL(HAVE_AUTHMYSQL, test "$HAVE_AUTHMYSQL" = 1) | |
599 | ||
b0322a85 CE |
600 | dnl ######################################################################### |
601 | ||
602 | dnl Prepare authsqlite module | |
603 | ||
604 | dnl ######################################################################### | |
605 | ||
606 | AC_ARG_WITH(authsqliterc, | |
607 | [ --with-authsqliterc=filename Expect to find authmysql here ], | |
608 | authsqliterc="$withval", | |
609 | authsqliterc="$pkgconfdir/authsqliterc") | |
610 | AC_SUBST(authsqliterc) | |
611 | ||
612 | AC_ARG_WITH(authsqlite, | |
613 | [ --without-authsqlite Do not include the authsqlite module ], | |
614 | doauthsqlite="$withval") | |
615 | ||
616 | AC_ARG_WITH(sqlite-libs, | |
617 | [ --with-sqlite-libs=DIR Look for sqlite libs in this dir ], | |
618 | ||
619 | SQLITE_LIBS="-lsqlite3" | |
620 | ) | |
621 | AC_ARG_WITH(sqlite-includes, | |
622 | [ --with-sqlite-includes=DIR Look for sqlite includes in this dir ], | |
623 | SQLITE_CFLAGS="-I$withval" | |
624 | ) | |
625 | ||
626 | if test "$doauthsqlite" = "" | |
627 | then | |
628 | SQLITE_CFLAGS="`pkg-config --cflags sqlite3 2>/dev/null`" | |
629 | SQLITE_LIBS="`pkg-config --libs sqlite3 2>/dev/null`" | |
630 | saveLIBS="$LIBS" | |
631 | LIBS="$SQLITE_LIBS $LIBS" | |
632 | AC_CHECK_FUNC(sqlite3_version, | |
633 | doauthsqlite="yes" | |
634 | ) | |
635 | LIBS="$saveLIBS" | |
636 | fi | |
637 | ||
638 | if test "$doauthsqlite" != "yes" | |
639 | then | |
640 | SQLITE_LIBS="" | |
641 | SQLITE_CFLAGS="" | |
642 | HAVE_AUTHSQLITE=0 | |
643 | LIBAUTHSQLITE="" | |
644 | else | |
645 | saveLIBS="$LIBS" | |
646 | LIBS="$SQLITE_LIBS $LIBS" | |
647 | AC_CHECK_FUNC(sqlite3_version, | |
648 | [ : ], | |
649 | [ AC_MSG_ERROR([Cannot link with $SQLITE_LIBS]) ] | |
650 | ) | |
651 | LIBS="$saveLIBS" | |
652 | HAVE_AUTHSQLITE=1 | |
653 | CFLAGS="$SQLITE_CFLAGS $CFLAGS" | |
654 | LIBAUTHSQLITE="libauthsqlite.la" | |
655 | ||
656 | fi | |
657 | AC_SUBST(SQLITE_LIBS) | |
658 | AC_SUBST(LIBAUTHSQLITE) | |
659 | AM_CONDITIONAL(HAVE_AUTHSQLITE, test "$HAVE_AUTHSQLITE" = 1) | |
d9898ee8 | 660 | |
661 | dnl ######################################################################### | |
662 | ||
663 | dnl Prepare authcustom stub module. | |
664 | ||
665 | dnl ######################################################################### | |
666 | ||
667 | ||
668 | AC_ARG_WITH(authcustom, | |
669 | [ --without-authcustom Do not include the authcustom module ], | |
670 | doauthcustom="$withval", | |
671 | doauthcustom=yes) | |
672 | ||
673 | LIBAUTHCUSTOM="" | |
674 | ||
675 | if test "$doauthcustom" = "yes" | |
676 | then | |
677 | LIBAUTHCUSTOM="libauthcustom.la" | |
678 | fi | |
679 | ||
680 | AM_CONDITIONAL(HAVE_CUSTOM, test "$AUTHCUSTOM" != "") | |
681 | AC_SUBST(LIBAUTHCUSTOM) | |
682 | ||
683 | ||
684 | dnl ######################################################################### | |
685 | ||
686 | dnl Prepare authpipe module. | |
687 | ||
688 | dnl ######################################################################### | |
689 | ||
690 | ||
691 | AC_ARG_WITH(pipeprog, | |
692 | [ --with-pipeprog=filename Expect to find the pipe-prog here ], | |
693 | authProg="$withval", | |
694 | authProg="$pkgconfdir/authProg") | |
695 | AC_SUBST(authProg) | |
696 | ||
697 | AC_ARG_WITH(authpipe, | |
698 | [ --without-authpipe Do not include the authpipe module ], | |
699 | doauthpipe="$withval", | |
700 | doauthpipe=yes) | |
701 | ||
702 | LIBAUTHPIPE="" | |
703 | ||
704 | if test "$doauthpipe" = "yes" | |
705 | then | |
706 | LIBAUTHPIPE="libauthpipe.la" | |
707 | fi | |
708 | ||
709 | AM_CONDITIONAL(HAVE_PIPE, test "$AUTHPIPE" != "") | |
710 | AC_SUBST(LIBAUTHPIPE) | |
711 | ||
712 | ||
713 | ||
714 | dnl Checks for header files. | |
715 | AC_HEADER_STDC | |
716 | AC_HEADER_SYS_WAIT | |
717 | AC_CHECK_HEADERS(sys/stat.h sys/time.h sys/wait.h sys/select.h unistd.h fcntl.h crypt.h termios.h) | |
718 | ||
719 | dnl Checks for typedefs, structures, and compiler characteristics. | |
720 | AC_C_CONST | |
8d138742 | 721 | AC_TYPE_PID_T |
d9898ee8 | 722 | AC_TYPE_UID_T |
d9898ee8 | 723 | dnl Other checks |
724 | AC_CHECK_FUNCS(setsid setlogin) | |
725 | AC_CHECK_LIB(crypt, crypt, CRYPTLIBS="-lcrypt") | |
726 | saveLIBS="$LIBS" | |
727 | LIBS="$CRYPTLIBS $LIBS" | |
728 | AC_CHECK_FUNC(crypt, AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, | |
729 | [ Whether we have the crypt() function ])) | |
730 | LIBS="$saveLIBS" | |
731 | AC_CACHE_CHECK([for crypt() prototype],userdb_cv_NEED_CRYPT_PROTOTYPE, | |
732 | ||
8d138742 | 733 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
d9898ee8 | 734 | #if HAVE_CRYPT_H |
735 | #include <crypt.h> | |
736 | #endif | |
737 | #if HAVE_UNISTD_H | |
738 | #include <unistd.h> | |
739 | #endif | |
740 | int crypt(int, int); | |
741 | ||
8d138742 | 742 | ]], [[]])],[userdb_cv_NEED_CRYPT_PROTOTYPE=1],[userdb_cv_NEED_CRYPT_PROTOTYPE=0 ]) |
d9898ee8 | 743 | |
744 | ) | |
745 | ||
746 | AC_DEFINE_UNQUOTED(NEED_CRYPT_PROTOTYPE, $userdb_cv_NEED_CRYPT_PROTOTYPE, | |
747 | [ Whether we must a prototype for crypt()] ) | |
748 | AC_SUBST(CRYPTLIBS) | |
749 | ||
750 | dnl ######################################################################### | |
751 | ||
752 | dnl Prepare the authdaemon module. | |
753 | ||
754 | dnl ######################################################################### | |
755 | ||
756 | AC_ARG_WITH(authdaemonrc, | |
757 | [ --with-authdaemonrc=filename Expect to find authdaemonrc here ], | |
758 | authdaemonrc="$withval", | |
759 | authdaemonrc="$pkgconfdir/authdaemonrc") | |
760 | AC_SUBST(authdaemonrc) | |
761 | ||
762 | AC_ARG_WITH(authdaemonvar, | |
763 | [ --with-authdaemonvar=directory Directory where authdaemon.pid and | |
764 | the listening socket is created], | |
765 | authdaemonvar="$withval", | |
766 | authdaemonvar="$localstatedir/spool/authdaemon") | |
767 | ||
768 | AC_SUBST(authdaemonvar) | |
769 | ||
770 | AC_SUBST(LIBM) | |
771 | ||
d9898ee8 | 772 | rm -f authdaemonrc.h authldaprc.h authmysqlrc.h authpgsqlrc.h vpopmail_config.h |
773 | ||
d9898ee8 | 774 | dnl |
775 | dnl Need to settle on our uid/gids here | |
776 | dnl | |
777 | ||
778 | result="" | |
779 | ||
780 | if test -x "$COURIERCONFIG" | |
781 | then | |
782 | $COURIERCONFIG >conftest.out || exit 1 | |
783 | sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1 | |
ac40fd9e | 784 | . ./conftest2.out |
d9898ee8 | 785 | rm -f conftest.out conftest2.out |
786 | ||
787 | cmailuser="$mailuser" | |
788 | cmailgroup="$mailgroup" | |
789 | result=" (from courier-config)" | |
790 | fi | |
791 | ||
792 | if test -x "$bindir/courierauthconfig" | |
793 | then | |
794 | $bindir/courierauthconfig --configfiles >conftest.out || exit 1 | |
795 | sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1 | |
ac40fd9e | 796 | . ./conftest2.out |
d9898ee8 | 797 | rm -f conftest.out conftest2.out |
798 | ||
799 | cmailuser="$mailuser" | |
800 | cmailgroup="$mailgroup" | |
801 | result=" (from previous courierauthconfig)" | |
802 | fi | |
803 | ||
804 | changequote() | |
805 | ||
806 | LB='[' | |
807 | RB=']' | |
808 | ||
809 | changequote([,]) | |
810 | ||
811 | AC_MSG_CHECKING(for mail userid) | |
812 | ||
813 | AC_ARG_WITH(mailuser,[ --with-mailuser=user Specify mail user name (defaults to | |
814 | courier, daemon, admin, bin, or root)], | |
815 | mailuser="$withval", | |
816 | ||
817 | if test "$cmailuser" = "" | |
818 | then | |
8d138742 | 819 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
d9898ee8 | 820 | #include <stdio.h> |
821 | #include <pwd.h> | |
822 | #include <stdlib.h> | |
823 | ||
824 | static const char *ids $LB $RB={"courier","daemon","adm","bin","root", 0}; | |
825 | ||
826 | int main() | |
827 | { | |
828 | int i; | |
829 | FILE *f; | |
830 | char *p; | |
831 | ||
832 | for (i=0; ids $LB i $RB; i++) | |
833 | if (getpwnam(ids $LB i $RB)) break; | |
834 | ||
835 | f=fopen("conftest.out", "w"); | |
836 | if (f && ids $LB i $RB) | |
837 | { | |
838 | fprintf(f, "%s\n", ids $LB i $RB); | |
839 | fclose(f); | |
840 | exit(0); | |
841 | } | |
842 | fclose(f); | |
843 | exit (1); | |
844 | return (1); | |
845 | } | |
8d138742 | 846 | ]])],[mailuser=`cat conftest.out`],[AC_MSG_ERROR(Cannot determine mail user, use --with-mailuser.)],[AC_MSG_ERROR(Must use --with-mailuser when cross compiling.)]) |
d9898ee8 | 847 | else |
848 | mailuser="$cmailuser" | |
849 | fi | |
850 | ac_configure_args="$ac_configure_args --with-mailuser=$mailuser") | |
851 | ||
852 | AC_MSG_RESULT([$mailuser $result]) | |
853 | ||
854 | AC_MSG_CHECKING(for mail group id) | |
855 | ||
856 | AC_ARG_WITH(mailgroup, [ --with-mailgroup=group Specify mail group name (defaults to courier, | |
857 | daemon, sys, adm, or root)], | |
858 | mailgroup="$withval", | |
859 | ||
860 | if test "$cmailgroup" = "" | |
861 | then | |
8d138742 | 862 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
d9898ee8 | 863 | #include <stdio.h> |
864 | #include <grp.h> | |
865 | #include <stdlib.h> | |
866 | ||
867 | static const char *ids $LB $RB={"courier", "daemon","sys","adm", "root", 0}; | |
868 | ||
869 | int main() | |
870 | { | |
871 | int i; | |
872 | FILE *f; | |
873 | ||
874 | for (i=0; ids $LB i $RB; i++) | |
875 | if (getgrnam(ids $LB i $RB)) break; | |
876 | ||
877 | f=fopen("conftest.out", "w"); | |
878 | if (f && ids $LB i $RB) | |
879 | { | |
880 | fprintf(f, "%s\n", ids $LB i $RB); | |
881 | fclose(f); | |
882 | exit(0); | |
883 | } | |
884 | fclose(f); | |
885 | exit (1); | |
886 | return (1); | |
887 | } | |
8d138742 | 888 | ]])],[mailgroup=`cat conftest.out`],[AC_MSG_ERROR(Cannot determine mail group, use --with-mailgroup.)],[AC_MSG_ERROR(Must use --with-mailgroup when cross compiling.)]) |
d9898ee8 | 889 | else |
890 | mailgroup="$cmailgroup" | |
891 | fi | |
892 | ac_configure_args="$ac_configure_args --with-mailgroup=$mailgroup" | |
893 | ) | |
894 | AC_MSG_RESULT([$mailgroup $result]) | |
895 | AC_SUBST(mailuser) | |
896 | AC_SUBST(mailgroup) | |
897 | rm -f conftest.out | |
898 | ||
899 | AC_ARG_WITH(stdheaderdir, | |
900 | [ --without-stdheaderdir Header files will be installed into a directory | |
901 | not in the compiler's default search path.], | |
902 | [ | |
903 | if test "$withval" = "no" | |
904 | then | |
905 | AC_DEFINE_UNQUOTED(HAVE_NOSTDHEADERDIR, 1, | |
906 | [ Whether header installation directory is nontstandard ]) | |
907 | fi | |
908 | ]) | |
909 | ||
910 | AC_CACHE_CHECK([for socklen_t], | |
911 | authlib_cv_hassocklen_t, | |
912 | ||
b0322a85 | 913 | AC_COMPILE_IFELSE([ |
d9898ee8 | 914 | AC_LANG_SOURCE( [ |
915 | #include <sys/types.h> | |
916 | #include <sys/socket.h> | |
917 | ||
918 | socklen_t sl_t; | |
919 | ],[ | |
920 | accept(0, 0, &sl_t); | |
b0322a85 | 921 | ])], |
d9898ee8 | 922 | authlib_cv_hassocklen_t=yes, |
923 | authlib_cv_hassocklen_t=no) | |
924 | ) | |
925 | ||
926 | socklen_t="int" | |
927 | ||
928 | if test $authlib_cv_hassocklen_t = yes | |
929 | then | |
930 | : | |
931 | else | |
932 | AC_DEFINE_UNQUOTED(socklen_t, int, [ Default definition for socklen_t ]) | |
933 | fi | |
934 | ||
d9898ee8 | 935 | AC_ARG_WITH(repository, [], REPOSITORY="$withval") |
936 | AC_SUBST(REPOSITORY) | |
937 | ||
b0322a85 CE |
938 | AM_CONDITIONAL(HAVE_SGML, test -d ${srcdir}/libs/docbook) |
939 | AC_CONFIG_SUBDIRS(libs/bdbobj libs/gdbmobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/unicode libs/rfc822 libs/random128 libs/liblock liblog) | |
d9898ee8 | 940 | |
b0322a85 | 941 | AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.config dbobj.h authmigrate courier-authlib.spec courier-authlib.lpspec courier-authlib.sysvinit courier-authlib.service userdb-test-cram-md5.pl) |
d9898ee8 | 942 | AC_OUTPUT |
943 |