d9898ee8 |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | dnl |
dd184caf |
3 | dnl $Id: configure.in,v 1.152 2007/10/07 18:33:22 mrsam Exp $ |
d9898ee8 |
4 | dnl |
5 | dnl Copyright 1998 - 2007 Double Precision, Inc. See COPYING for |
6 | dnl distribution information. |
7 | |
8 | AC_PREREQ(2.59) |
dd184caf |
9 | AC_INIT(courier-authlib, 0.60.1, [courier-users@lists.sourceforge.net]) |
d9898ee8 |
10 | |
11 | AC_CONFIG_SRCDIR([courierauth.h]) |
12 | AM_CONFIG_HEADER([courier_auth_config.h]) |
13 | |
14 | AM_INIT_AUTOMAKE |
15 | >confdefs.h # Kill PACKAGE_ macros |
16 | |
17 | LPATH="$PATH:/usr/local/bin" |
18 | |
19 | dnl Checks for programs. |
20 | AC_PROG_AWK |
21 | AC_PROG_CC |
22 | AC_PROG_CPP |
23 | AC_PROG_INSTALL |
24 | AC_PROG_LN_S |
25 | AC_PROG_SYSCONFTOOL |
26 | AC_LIBLTDL_INSTALLABLE |
27 | AC_LIBTOOL_DLOPEN |
28 | AM_PROG_LIBTOOL |
29 | AC_SUBST(LTDLINCL) |
30 | AC_SUBST(LIBLTDL) |
31 | AC_PATH_PROGS(PERL, perl5 perl, perl, $LPATH) |
32 | AC_PATH_PROGS(COURIERCONFIG, courier-config, courier-config, $LPATH) |
33 | |
34 | if test "$PERL" = "perl" |
35 | then |
36 | AC_MSG_ERROR(Perl is required) |
37 | fi |
38 | |
39 | test "x$prefix" = xNONE && prefix=$ac_default_prefix |
40 | test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' |
41 | eval "prefix=$prefix" |
42 | eval "exec_prefix=$exec_prefix" |
43 | eval "sysconfdir=$sysconfdir" |
44 | eval "bindir=$bindir" |
45 | eval "sbindir=$sbindir" |
46 | eval "localstatedir=$localstatedir" |
47 | eval "libexecdir=$libexecdir" |
48 | |
49 | AC_ARG_WITH(redhat, [], [ redhat=$withval ], [redhat=no]) |
50 | |
51 | if test "$srcdir" = "." |
52 | then |
53 | case `./config.guess` in |
54 | *-redhat-*) |
55 | if test "$redhat" = "no" |
56 | then |
57 | hash='#' |
58 | AC_MSG_WARN(=== I think you are trying to run this configure script) |
59 | AC_MSG_WARN([=== on Red Hat/Fedora. You're doing too much work!]) |
60 | AC_MSG_WARN([=== It's much faster to create installable binary RPMs]) |
61 | AC_MSG_WARN([=== like this: http://www.courier-mta.org/FAQ.html${hash}rpm]) |
62 | AC_MSG_WARN(=== When you do this you may find that RPM will tell you) |
63 | AC_MSG_WARN([=== to install some other software first, before trying to]) |
64 | AC_MSG_WARN([=== build this one, and even tell you the name of RPMs you]) |
65 | AC_MSG_WARN([=== need to install from the distribution CD. That's much]) |
66 | AC_MSG_WARN([=== easier than trying to figure out the same from some]) |
67 | AC_MSG_WARN([=== cryptic error message.]) |
68 | AC_MSG_WARN([]) |
69 | AC_MSG_WARN([=== Even if you don't intend to use everything you need to]) |
70 | AC_MSG_WARN([=== have in order to build via RPM, you should still do as]) |
71 | AC_MSG_WARN([=== you're told. All the extra stuff (LDAP, SQL, etc...)]) |
72 | AC_MSG_WARN([=== goes into RPM sub-packages, which do not need to be]) |
73 | AC_MSG_WARN([=== installed.]) |
74 | AC_MSG_WARN([=== But, if you insist, you can simply add '--with-redhat']) |
75 | AC_MSG_WARN(=== parameter to this configure script and not see this) |
76 | AC_MSG_WARN(=== error message. You should also do this when upgrading) |
77 | AC_MSG_WARN([=== and you didn't use RPM with the older version.]) |
78 | AC_MSG_ERROR(... in either case you better know what you're doing!) |
79 | fi |
80 | ;; |
81 | *) |
82 | ;; |
83 | esac |
84 | fi |
85 | AC_PATH_PROGS(EXPECT, expect, expect, $LPATH) |
86 | |
87 | if test "$EXPECT" = "expect" |
88 | then |
89 | AC_MSG_WARN(-----------------------------------------------------) |
90 | AC_MSG_WARN(expect not found - will not be able to change passwds) |
91 | AC_MSG_WARN(in webmail) |
92 | AC_MSG_WARN(-----------------------------------------------------) |
93 | sleep 5 |
94 | else |
95 | AC_DEFINE_UNQUOTED(HAVE_EXPECT, 1, [ Whether expect(1) is installed ]) |
96 | fi |
97 | |
98 | AC_PATH_PROGS(PASSWD, passwd, passwd, $LPATH) |
99 | AC_SUBST(PASSWD) |
100 | |
101 | if test "$GCC" = "yes" |
102 | then |
103 | CFLAGS="$CFLAGS -Wall" |
104 | fi |
105 | |
106 | CFLAGS="$CFLAGS -I.. -I${srcdir}/.." |
107 | |
108 | AC_MSG_CHECKING(whether -lm is needed for floor) |
109 | AC_TRY_LINK_FUNC(floor, |
110 | AC_MSG_RESULT(no), |
111 | LIBM="-lm" |
112 | AC_MSG_RESULT(yes)) |
113 | |
114 | AC_ARG_WITH(pkgconfdir, |
115 | [ --with-pkgconfdir=d Install config files in directory ], |
116 | [pkgconfdir="$withval"], |
117 | [pkgconfdir="$sysconfdir/authlib"]) |
118 | |
119 | SASL_LIST="SASL(\"PLAIN\", authsasl_plain, authsaslclient_plain) SASL(\"LOGIN\", authsasl_login, authsaslclient_login)" |
120 | |
121 | dnl ######################################################################### |
122 | |
123 | dnl Check if the MD5 library is available |
124 | |
125 | dnl ######################################################################### |
126 | |
127 | |
128 | if test -d ${srcdir}/md5 |
129 | then |
130 | MD5=1 |
131 | AC_DEFINE_UNQUOTED(HAVE_MD5LIB, 1, |
132 | [ Whether we have the MD5 library available ]) |
133 | MD5LIB=md5/libmd5.la |
134 | if test -d ${srcdir}/md5 |
135 | then |
136 | SASL_LIST="SASL(\"CRAM-MD5\", authsasl_cram, authsaslclient_crammd5) $SASL_LIST" |
137 | fi |
138 | else |
139 | MD5LIB="" |
140 | MD5=0 |
141 | fi |
142 | AC_SUBST(MD5LIB) |
143 | AM_CONDITIONAL(HAVE_MD5, test "$MD5" = 1) |
144 | |
145 | dnl ######################################################################### |
146 | |
147 | dnl Check if the SHA1 library is available |
148 | |
149 | dnl ######################################################################### |
150 | |
151 | |
152 | if test -d ${srcdir}/sha1 |
153 | then |
154 | SHA1=1 |
155 | AC_DEFINE_UNQUOTED(HAVE_SHA1LIB, 1, |
156 | [ Whether we have the SHA1 library available ]) |
157 | SHA1LIB=sha1/libsha1.la |
158 | if test -d ${srcdir}/sha1 |
159 | then |
160 | SASL_LIST="SASL(\"CRAM-SHA1\", authsasl_cram, authsaslclient_cramsha1) $SASL_LIST" |
161 | SASL_LIST="SASL(\"CRAM-SHA256\", authsasl_cram, authsaslclient_cramsha256) $SASL_LIST" |
162 | fi |
163 | else |
164 | SHA1LIB="" |
165 | SHA1=0 |
166 | fi |
167 | AC_SUBST(SHA1LIB) |
168 | AM_CONDITIONAL(HAVE_SHA1, test "$SHA1" = 1) |
169 | |
170 | |
171 | |
172 | dnl ######################################################################### |
173 | |
174 | dnl Check if the HMAC library is available |
175 | |
176 | dnl ######################################################################### |
177 | |
178 | if test -d ${srcdir}/libhmac |
179 | then |
180 | HMAC=1 |
181 | AC_DEFINE_UNQUOTED(HAVE_HMACLIB, 1, |
182 | [ Whether we have the HMAC library available ]) |
183 | HMACLIB=libhmac/libhmac.la |
184 | else |
185 | HMACLIB="" |
186 | HMAC=0 |
187 | fi |
188 | AC_SUBST(HMACLIB) |
189 | AM_CONDITIONAL(HAVE_HMACLIB, test "$HMAC" = 1) |
190 | |
191 | saveLIBS="$LIBS" |
192 | NETLIBS="" |
193 | USENSL=no |
194 | |
195 | AC_CHECK_LIB(socket,socket,result=yes,result=no) |
196 | if test $result = yes; then |
197 | NETLIBS="-lsocket" |
198 | else |
199 | AC_CHECK_LIB(socket,socket,result=yes,result=no,-lnsl) |
200 | if test $result = yes; then |
201 | NETLIBS = "-lsocket -lnsl" |
202 | USENSL=yes |
203 | else |
204 | AC_CHECK_LIB(socket,connect,result=yes,result=no) |
205 | if test $result = yes; then |
206 | NETLIBS="-lsocket" |
207 | else |
208 | AC_CHECK_LIB(socket,connect,result=yes,result=no,-lnsl) |
209 | if test $result = yes; then |
210 | NETLIBS="-lsocket -lnsl" |
211 | USENSL=yes |
212 | fi |
213 | fi |
214 | fi |
215 | fi |
216 | |
217 | if test $USENSL != yes; then |
218 | LIBS="$LIBS $NETLIBS" |
219 | AC_TRY_LINK_FUNC(inet_addr, [ : ], |
220 | [ |
221 | AC_CHECK_LIB(nsl,inet_addr,result=yes,result=no) |
222 | if test $result = yes; then |
223 | NETLIBS="$NETLIBS -lnsl" |
224 | fi |
225 | ]) |
226 | fi |
227 | |
228 | LIBS="$saveLIBS" |
229 | AC_SUBST(NETLIBS) |
230 | |
231 | dnl ######################################################################### |
232 | |
233 | dnl Prepare authuserdb module if userdb library is available |
234 | |
235 | dnl ######################################################################### |
236 | |
237 | |
238 | AC_ARG_WITH(db, [ --with-db=gdbm Use the GDBM library. |
239 | --with-db=db Use the libdb.a library.], |
240 | db="$withval", needs_withdb=1) |
241 | |
242 | case "$db" in |
243 | gdbm) |
244 | ;; |
245 | db) |
246 | ;; |
247 | "") |
248 | ;; |
249 | *) |
250 | AC_MSG_ERROR(Invalid --with-db option.) |
251 | ;; |
252 | esac |
253 | |
254 | saveLIBS="$LIBS" |
255 | |
256 | if test "$db" != "db" |
257 | then |
258 | AC_CHECK_LIB(gdbm, gdbm_open, |
259 | [ LIBGDBM=-lgdbm ; LIBS="-lgdbm $LIBS" ]) |
260 | AC_CHECK_FUNC(gdbm_open, [ HAVE_GDBM=y ]) |
261 | fi |
262 | |
263 | LIBS="$saveLIBS" |
264 | |
265 | if test "$db" != "gdbm" |
266 | then |
267 | AC_CHECK_LIB(db, dbopen, [ LIBDB=-ldb ; LIBS="-ldb $LIBS" ], |
268 | [ AC_CHECK_LIB(db, db_open, [ LIBDB=-ldb ; LIBS="-ldb $LIBS"], |
269 | [ AC_CHECK_LIB(db, db_env_create, |
270 | [ LIBDB=-ldb; LIBS="-ldb $LIBS"]) ] |
271 | )]) |
272 | |
273 | AC_CHECK_FUNC(dbopen, HAVE_BDB=1) |
274 | AC_CHECK_FUNC(db_open, HAVE_BDB=1) |
275 | AC_CHECK_FUNC(db_env_create, HAVE_BDB=1) |
276 | fi |
277 | |
278 | LIBS="$saveLIBS" |
279 | |
280 | if test "$HAVE_GDBM$HAVE_BDB" = "" |
281 | then |
282 | AC_MSG_ERROR(Cannot find either the gdbm or the db library.) |
283 | fi |
284 | |
285 | USE_GDBM=0 |
286 | USE_DB=0 |
287 | |
288 | if test "$HAVE_GDBM" = "y" |
289 | then |
290 | LIBDB="" |
291 | USE_GDBM=1 |
292 | DBSUBDIR=gdbmobj |
293 | if test "$needs_withdb" = 1 |
294 | then |
295 | ac_configure_args="$ac_configure_args --with-db=gdbm" |
296 | fi |
297 | dblibrary=gdbmobj/libgdbmobj.la |
298 | else |
299 | LIBGDBM="" |
300 | USE_DB=1 |
301 | DBSUBDIR=bdbobj |
302 | if test "$needs_withdb" = 1 |
303 | then |
304 | ac_configure_args="$ac_configure_args --with-db=db" |
305 | fi |
306 | dblibrary=bdbobj/libbdbobj.la |
307 | fi |
308 | |
309 | AC_SUBST(DBSUBDIR) |
310 | AC_SUBST(USE_GDBM) |
311 | AC_SUBST(USE_DB) |
312 | AC_SUBST(LIBDB) |
313 | AC_SUBST(LIBGDBM) |
314 | |
315 | AC_ARG_WITH(authuserdb, |
316 | [ --without-authuserdb Do not include the authuserdb module ], |
317 | doauthuserdb="$withval", |
318 | doauthuserdb="no" |
319 | if test -d ${srcdir}/userdb |
320 | then |
321 | doauthuserdb="yes" |
322 | fi) |
323 | |
324 | if test "$doauthuserdb" = "no" |
325 | then |
326 | AUTHUSERDB="" |
327 | else |
328 | AUTHUSERDB="authuserdb" |
329 | LIBAUTHUSERDB="libauthuserdb.la" |
330 | |
331 | fi |
332 | |
333 | AC_ARG_WITH(makedatprog, [ ], [ : ], |
334 | [ |
335 | ac_configure_args="$ac_configure_args --with-makedatprog=$libexecdir/courier-authlib/makedatprog" |
336 | ]) |
337 | |
338 | cat >dbobj.config <<EOF |
339 | LIBDB=$LIBDB |
340 | LIBGDBM=$LIBGDBM |
341 | dblibrary=$dblibrary |
342 | EOF |
343 | |
344 | AC_SUBST(USE_GDBM) |
345 | AC_SUBST(USE_DB) |
346 | |
347 | AC_SUBST(dblibrary) |
348 | AC_SUBST(LIBGDBM) |
349 | AC_SUBST(LIBDB) |
350 | AC_SUBST(LIBAUTHUSERDB) |
351 | |
352 | userdb="$pkgconfdir/userdb" |
353 | AC_ARG_WITH(userdb, [], [ userdb="$withval" ], [ac_configure_args="$ac_configure_args '--with-userdb=$userdb'"]) |
354 | |
355 | AC_DEFINE_UNQUOTED(USERDB,"$userdb", [ Location of the userdb database ]) |
356 | AC_SUBST(userdb) |
357 | |
358 | dnl Checks for header files. |
359 | dnl |
360 | dnl Because autoconf sets macros for C preprocessor where |
361 | dnl AC_CHECK_HEADERS appears first, the first AC_CHECK_HEADERS |
362 | dnl must not place in conditional level but top level. |
363 | dnl This is a dummy AC_CHECK_HEADERS for it. |
364 | dnl |
365 | AC_CHECK_HEADERS(stdio.h) |
366 | |
367 | dnl ######################################################################### |
368 | |
369 | dnl Prepare authpam module if libpam is available. |
370 | |
371 | dnl ######################################################################### |
372 | |
373 | AC_ARG_WITH(authpam, |
374 | [ --without-authpam Do not include the authpam module ], |
375 | doauthpam="$withval") |
376 | |
377 | AC_CHECK_HEADERS(security/pam_appl.h Pam/pam_appl.h) |
378 | if test "$doauthpam" = "no" |
379 | then |
380 | LIBDL="" |
381 | else |
382 | saveLIBS="$LIBS" |
383 | LIBDL="" |
384 | AC_CHECK_LIB(dl, dlopen, [ LIBDL="-ldl" ]) |
385 | LIBS="$saveLIBS" |
386 | |
387 | AC_CHECK_LIB(pam, pam_start, |
388 | [ HAVE_PAM=1 |
389 | LIBS="-lpam $LIBDL $LIBS" |
390 | AC_CHECK_FUNCS(pam_setcred)], |
391 | |
392 | HAVE_PAM=0, |
393 | $LIBDL) |
394 | LIBS="$saveLIBS" |
395 | fi |
396 | AC_SUBST(LIBDL) |
397 | |
398 | LIBAUTHPAM="" |
399 | if test "$HAVE_PAM" = 1 |
400 | then |
401 | LIBAUTHPAM=libauthpam.la |
402 | fi |
403 | |
404 | AC_ARG_WITH(authpam-libraries, |
405 | [ --with-authpam-libraries="libs" Link 'libs' with authpam, this may be |
406 | required for FreeBSD 3.3], |
407 | authpamcrypt="$withval") |
408 | |
409 | AUTHPAMCRYPT="$authpamcrypt" |
410 | AC_SUBST(AUTHPAMCRYPT) |
411 | AC_SUBST(LIBAUTHPAM) |
412 | |
413 | dnl ######################################################################### |
414 | |
415 | dnl Prepare authldap module if ldap functions are available. |
416 | |
417 | dnl ######################################################################### |
418 | |
419 | AC_ARG_WITH(authldap, |
420 | [ --without-authldap Do not include the authldap module ], |
421 | doauthldap="$withval", |
422 | doauthldap="yes") |
423 | |
424 | AC_CHECK_HEADERS(lber.h) |
425 | AC_CHECK_HEADERS(ldap.h) |
426 | AC_CHECK_HEADERS(netinet/in.h) |
427 | |
428 | if test "$doauthldap" = "no" |
429 | then |
430 | HAVE_LDAP=0 |
431 | else |
432 | saveLIBS="$LIBS" |
433 | LIBS="$NETLIBS $LIBS" |
434 | LDAPLIBS="" |
435 | |
436 | AC_MSG_CHECKING(whether -lresolv is needed for res_query) |
437 | AC_LINK_IFELSE(AC_LANG_PROGRAM([ |
438 | #include <sys/types.h> |
439 | #if HAVE_NETINET_IN_H |
440 | #include <netinet/in.h> |
441 | #endif |
442 | #include <resolv.h> |
443 | |
444 | void (*func)()= (void (*)())res_query; |
445 | ], |
446 | [ (*func)(); ]), |
447 | AC_MSG_RESULT(no), |
448 | [ |
449 | LIBS="-lresolv $LIBS" |
450 | |
451 | AC_LINK_IFELSE(AC_LANG_PROGRAM([ |
452 | #include <sys/types.h> |
453 | #if HAVE_NETINET_IN_H |
454 | #include <netinet/in.h> |
455 | #endif |
456 | #include <resolv.h> |
457 | |
458 | void (*func)()= (void (*)())res_query; |
459 | ], |
460 | [ (*func)(); ]), [ |
461 | LDAPLIBS="-lresolv $LDAPLIBS" |
462 | HAVE_LDAP=1 |
463 | AC_MSG_RESULT(yes) |
464 | ], |
465 | AC_MSG_ERROR(Cannot find function res_query)) |
466 | ]) |
467 | |
468 | AC_CHECK_LIB(lber, ber_scanf, |
469 | [ LDAPLIBS="-llber $LDAPLIBS" LIBS="-llber $LIBS" ]) |
470 | AC_CHECK_LIB(ldap, ldap_open, |
471 | [ LDAPLIBS="-lldap $LDAPLIBS" ; LIBS="-lldap $LIBS" ]) |
472 | AC_CHECK_FUNC(ldap_search_st, HAVE_LDAP=1, HAVE_LDAP=0) |
473 | AC_CHECK_FUNC(ldap_start_tls_s, HAVE_LDAP_TLS=1, HAVE_LDAP_TLS=0) |
474 | AC_CHECK_FUNC(ldap_result2error, HAVE_LDAP_RESULT2ERROR=1, HAVE_LDAP_RESULT2ERROR=0) |
475 | AC_CHECK_FUNC(ldap_parse_result, HAVE_LDAP_PARSE_RESULT=1, HAVE_LDAP_PARSE_RESULT=0) |
476 | LIBS="$saveLIBS" |
477 | fi |
478 | |
479 | AC_ARG_WITH(authldaprc, |
480 | [ --with-authldaprc=filename Expect to find authldaprc here ], |
481 | authldaprc="$withval", |
482 | authldaprc="$pkgconfdir/authldaprc") |
483 | AC_SUBST(authldaprc) |
484 | |
485 | LIBAUTHLDAP="" |
486 | if test "$HAVE_LDAP" = 1 |
487 | then |
488 | LIBAUTHLDAP="libauthldap.la" |
489 | else |
490 | authldaprc="" |
491 | fi |
492 | AC_SUBST(LDAPLIBS) |
493 | AC_SUBST(LIBAUTHLDAP) |
494 | |
495 | AM_CONDITIONAL(HAVE_LDAP, test "$HAVE_LDAP" = 1) |
496 | AC_DEFINE_UNQUOTED(HAVE_LDAP_TLS,$HAVE_LDAP_TLS, |
497 | [ Whether we have ldap_start_tls_s ]) |
498 | AC_DEFINE_UNQUOTED(HAVE_LDAP_RESULT2ERROR, $HAVE_LDAP_RESULT2ERROR, |
499 | [ Whether we have ldap_result2error() function ]) |
500 | AC_DEFINE_UNQUOTED(HAVE_LDAP_PARSE_RESULT, $HAVE_LDAP_PARSE_RESULT, |
501 | [ Whether we have ldap_parse_result() function]) |
502 | dnl ######################################################################### |
503 | |
504 | dnl Prepare authpwd module |
505 | |
506 | dnl ######################################################################### |
507 | |
508 | AC_ARG_WITH(authpwd, |
509 | [ --without-authpwd Do not include the authpwd module ], |
510 | doauthpwd="$withval", |
511 | doauthpwd="yes" |
512 | test "$HAVE_PAM" = 1 && doauthpwd="no" |
513 | test "$HAVE_LDAP" = 1 && doauthpwd="no" |
514 | ) |
515 | |
516 | HAVE_PWD=1 |
517 | if test "$doauthpwd" = "no" |
518 | then |
519 | HAVE_PWD=0 |
520 | fi |
521 | AC_CHECK_FUNCS(endpwent) |
522 | |
523 | dnl ######################################################################### |
524 | |
525 | dnl Prepare authshadow module if shadow functions are available. |
526 | |
527 | dnl ######################################################################### |
528 | |
529 | AC_ARG_WITH(authshadow, |
530 | [ --without-authshadow Do not include the authshadow module ], |
531 | doauthshadow="$withval", |
532 | doauthshadow="yes" |
533 | test "$HAVE_PAM" = 1 && doauthshadow="no" |
534 | test "$HAVE_LDAP" = 1 && doauthshadow="no") |
535 | |
536 | AC_CHECK_HEADERS(shadow.h) |
537 | saveLIBS="$LIBS" |
538 | SHADOWLIBS="" |
539 | AC_CHECK_LIB(shadow, getspent, |
540 | [ SHADOWLIBS="-lshadow" ; LIBS="-lshadow $LIBS" ]) |
541 | AC_CHECK_FUNCS(endspent getspent) |
542 | LIBS="$saveLIBS" |
543 | |
544 | if test "$doauthshadow" = "no" |
545 | then |
546 | HAVE_SHADOW=0 |
547 | else |
548 | |
549 | saveLIBS="$LIBS" |
550 | AC_CHECK_LIB(shadow, getspent) |
551 | AC_CHECK_FUNC(getspent, HAVE_SHADOW=1, HAVE_SHADOW=0) |
552 | LIBS="$saveLIBS" |
553 | fi |
554 | |
555 | LIBAUTHSHADOW="" |
556 | if test "$HAVE_SHADOW" = 1 |
557 | then |
558 | LIBAUTHSHADOW="libauthshadow.la" |
559 | fi |
560 | AC_SUBST(SHADOWLIBS) |
561 | AC_SUBST(LIBAUTHSHADOW) |
562 | |
563 | LIBAUTHPWD="" |
564 | if test "$HAVE_PWD" = 1 |
565 | then |
566 | LIBAUTHPWD="libauthpwd.la" |
567 | fi |
568 | AC_SUBST(LIBAUTHPWD) |
569 | |
570 | dnl ######################################################################### |
571 | |
572 | dnl Prepare authvchkpw module if vchkpw is installed. |
573 | |
574 | dnl ######################################################################### |
575 | |
576 | changequote(<<,>>) |
577 | |
578 | vpopmail_home=`$PERL -e '@a=getpwnam("vpopmail"); print "$a[7]";'` |
579 | |
580 | changequote([,]) |
581 | |
582 | AC_ARG_WITH(authvchkpw, |
583 | [ --without-authvchkpw Do not include the authvchkpw module ], |
584 | doauthvchkpw="$withval", |
585 | doauthvchkpw=no |
586 | if test "$vpopmail_home" != "" |
587 | then |
588 | doauthvchkpw=yes |
589 | fi) |
590 | |
591 | if test "$doauthvchkpw" = "no" |
592 | then |
593 | HAVE_VCHKPW=0 |
594 | vpopmail_home=. |
595 | else |
596 | HAVE_VCHKPW=1 |
597 | |
598 | |
599 | cat <<EOF |
600 | ---------------------------------------------------- |
601 | NOTE |
602 | |
603 | |
604 | All questions regarding ANY vpopmail-related problems, |
605 | such as compiling/building failures, or login errors |
606 | should be referred to the vpopmail mailing list. |
607 | Vpopmail questions sent to the Courier mailing lists |
608 | will be IGNORED. |
609 | ---------------------------------------------------- |
610 | \a |
611 | EOF |
612 | sleep 5 |
613 | |
614 | if test -f ${vpopmail_home}/etc/lib_deps |
615 | then |
616 | CFLAGS="`cat ${vpopmail_home}/etc/inc_deps` $CFLAGS" |
617 | VPOPMAILLIBS="`cat ${vpopmail_home}/etc/lib_deps`" |
618 | else |
619 | AC_MSG_ERROR(${vpopmail_home}/etc/lib_deps does not exist - upgrade vpopmail to the current version or fix the permissions on this file) |
620 | fi |
621 | fi |
622 | AC_SUBST(vpopmail_home) |
623 | AC_SUBST(VPOPMAILLIBS) |
624 | |
625 | LIBAUTHVCHKPW="" |
626 | if test "$HAVE_VCHKPW" = 1 |
627 | then |
628 | LIBAUTHVCHKPW="libauthvchkpw.la" |
629 | HAVE_VCHKPW="1" |
630 | |
631 | dnl Check if vpopmail has open_smtp_relay() function |
632 | |
633 | _SAVE_LIBS=$LIBS |
634 | LIBS="$VPOPMAILLIBS $CRYPTLIBS $LIBS" |
635 | AC_CHECK_FUNC(open_smtp_relay, |
636 | AC_DEFINE(HAVE_OPEN_SMTP_RELAY, 1, |
637 | [ Whether -lvpopmail has the open_smtp_relay() function ]) ) |
638 | AC_CHECK_FUNC(vset_lastauth, |
639 | AC_DEFINE(HAVE_VSET_LASTAUTH, 1, |
640 | [ Whether -lvpopmail has the vset_lastauth() function ])) |
641 | LIBS=$_SAVE_LIBS |
642 | fi |
643 | |
644 | AC_SUBST(LIBAUTHVCHKPW) |
645 | |
646 | dnl ######################################################################### |
647 | |
648 | dnl Prepare authpgsql module |
649 | |
650 | dnl ######################################################################### |
651 | |
652 | AC_ARG_WITH(authpgsqlrc, |
653 | [ --with-authpgsqlrc=filename Expect to find authpgsql here ], |
654 | authpgsqlrc="$withval", |
655 | authpgsqlrc="$pkgconfdir/authpgsqlrc") |
656 | AC_SUBST(authpgsqlrc) |
657 | |
658 | AC_ARG_WITH(authpgsql, |
659 | [ --without-authpgsql Do not include the authpgsql module ], |
660 | doauthpgsql="$withval") |
661 | |
662 | AC_PATH_PROGS(PG_CONFIG, pg_config, pg_config, $LPATH) |
663 | |
664 | PGSQL_LIBS="-lpq" |
665 | AC_ARG_WITH(pgsql-libs, |
666 | [ --with-pgsql-libs=DIR Look for pgsql libs in this dir ], |
667 | PGSQL_LIBS="-L$withval $PGSQL_LIBS", |
668 | if test -x $PG_CONFIG |
669 | then |
670 | PGSQL_LIBS="-L`$PG_CONFIG --libdir` $PGSQL_LIBS" |
671 | fi |
672 | ) |
673 | AC_ARG_WITH(pgsql-includes, |
674 | [ --with-pgsql-includes=DIR Look for pgsql includes in this dir ], |
675 | PGSQL_CFLAGS="-I$withval", |
676 | if test -x $PG_CONFIG |
677 | then |
678 | PGSQL_CFLAGS="-I`$PG_CONFIG --includedir`" |
679 | fi |
680 | ) |
681 | |
682 | if test "$doauthpgsql" = "" |
683 | then |
684 | LIBS="$PGSQL_LIBS $LIBS" |
685 | AC_CHECK_FUNC(PQsetdbLogin, |
686 | doauthpgsql="yes" |
687 | ) |
688 | LIBS="$saveLIBS" |
689 | fi |
690 | |
691 | if test "$doauthpgsql" != "yes" |
692 | then |
693 | LIBAUTHPGSQL="" |
694 | HAVE_AUTHPGSQL=0 |
695 | else |
696 | saveLIBS="$LIBS" |
697 | LIBS="$PGSQL_LIBS $LIBS" |
698 | AC_CHECK_FUNC(PQsetdbLogin, |
699 | AUTHPGSQL="authpgsql" |
700 | HAVE_AUTHPGSQL=1, |
701 | AC_MSG_ERROR([--with-authpgsql specified but no libpq.so])) |
702 | LIBS="$saveLIBS" |
703 | HAVE_AUTHPGSQL=1 |
704 | CFLAGS="$PGSQL_CFLAGS $CFLAGS" |
705 | LIBAUTHPGSQL="libauthpgsql.la" |
706 | fi |
707 | |
708 | AC_SUBST(PGSQL_LIBS) |
709 | AC_SUBST(LIBAUTHPGSQL) |
710 | AM_CONDITIONAL(HAVE_AUTHPGSQL, test "$HAVE_AUTHPGSQL" = 1) |
711 | |
712 | dnl ######################################################################### |
713 | |
714 | dnl Prepare authmysql module |
715 | |
716 | dnl ######################################################################### |
717 | |
718 | AC_ARG_WITH(authmysqlrc, |
719 | [ --with-authmysqlrc=filename Expect to find authmysql here ], |
720 | authmysqlrc="$withval", |
721 | authmysqlrc="$pkgconfdir/authmysqlrc") |
722 | AC_SUBST(authmysqlrc) |
723 | |
724 | AC_ARG_WITH(authmysql, |
725 | [ --without-authmysql Do not include the authmysql module ], |
726 | doauthmysql="$withval") |
727 | AC_ARG_WITH(mysql-libs, |
728 | [ --with-mysql-libs=DIR Look for mysql libs in this dir ], |
729 | MYSQL_LIBS="-L$withval -lmysqlclient" |
730 | ) |
731 | AC_ARG_WITH(mysql-includes, |
732 | [ --with-mysql-includes=DIR Look for mysql includes in this dir ], |
733 | MYSQL_CFLAGS="-I$withval" |
734 | ) |
735 | |
736 | AC_PATH_PROGS(MYSQL_CONFIG, mysql_config, mysql_config, $LPATH) |
737 | |
738 | if test -x "$MYSQL_CONFIG" |
739 | then |
740 | MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`" |
741 | MYSQL_LIBS="`$MYSQL_CONFIG --libs`" |
742 | |
743 | eval "MYSQL_CFLAGS=\"\`echo $MYSQL_CFLAGS\`\"" |
744 | eval "MYSQL_LIBS=\"\`echo $MYSQL_LIBS\`\"" |
745 | fi |
746 | |
747 | if test "$doauthmysql" = "" |
748 | then |
749 | LIBS="$MYSQL_LIBS $LIBS" |
750 | AC_CHECK_FUNC(mysql_connect, |
751 | doauthmysql="yes" |
752 | ) |
753 | AC_CHECK_FUNC(mysql_real_connect, |
754 | doauthmysql="yes" |
755 | ) |
756 | LIBS="$saveLIBS" |
757 | fi |
758 | |
759 | if test "$doauthmysql" != "yes" |
760 | then |
761 | LIBAUTHMYSQL="" |
762 | HAVE_AUTHMYSQL=0 |
763 | else |
764 | saveLIBS="$LIBS" |
765 | LIBS="$MYSQL_LIBS $LIBS" |
766 | AC_CHECK_FUNC(mysql_connect, |
767 | LIBAUTHMYSQL="libauthmysql.la" |
768 | HAVE_AUTHMYSQL=1, |
769 | [ |
770 | AC_CHECK_FUNC(mysql_real_connect, |
771 | LIBAUTHMYSQL="libauthmysql.la" |
772 | HAVE_AUTHMYSQL=1, |
773 | |
774 | AC_MSG_ERROR([--with-authmysql specified but no mysqlclient.so]) |
775 | ) |
776 | ] |
777 | ) |
778 | LIBS="$saveLIBS" |
779 | HAVE_AUTHMYSQL=1 |
780 | CFLAGS="$MYSQL_CFLAGS $CFLAGS" |
781 | fi |
782 | AC_SUBST(LIBAUTHMYSQL) |
783 | AC_SUBST(MYSQL_LIBS) |
784 | AM_CONDITIONAL(HAVE_AUTHMYSQL, test "$HAVE_AUTHMYSQL" = 1) |
785 | |
786 | |
787 | dnl ######################################################################### |
788 | |
789 | dnl Prepare authcustom stub module. |
790 | |
791 | dnl ######################################################################### |
792 | |
793 | |
794 | AC_ARG_WITH(authcustom, |
795 | [ --without-authcustom Do not include the authcustom module ], |
796 | doauthcustom="$withval", |
797 | doauthcustom=yes) |
798 | |
799 | LIBAUTHCUSTOM="" |
800 | |
801 | if test "$doauthcustom" = "yes" |
802 | then |
803 | LIBAUTHCUSTOM="libauthcustom.la" |
804 | fi |
805 | |
806 | AM_CONDITIONAL(HAVE_CUSTOM, test "$AUTHCUSTOM" != "") |
807 | AC_SUBST(LIBAUTHCUSTOM) |
808 | |
809 | |
810 | dnl ######################################################################### |
811 | |
812 | dnl Prepare authpipe module. |
813 | |
814 | dnl ######################################################################### |
815 | |
816 | |
817 | AC_ARG_WITH(pipeprog, |
818 | [ --with-pipeprog=filename Expect to find the pipe-prog here ], |
819 | authProg="$withval", |
820 | authProg="$pkgconfdir/authProg") |
821 | AC_SUBST(authProg) |
822 | |
823 | AC_ARG_WITH(authpipe, |
824 | [ --without-authpipe Do not include the authpipe module ], |
825 | doauthpipe="$withval", |
826 | doauthpipe=yes) |
827 | |
828 | LIBAUTHPIPE="" |
829 | |
830 | if test "$doauthpipe" = "yes" |
831 | then |
832 | LIBAUTHPIPE="libauthpipe.la" |
833 | fi |
834 | |
835 | AM_CONDITIONAL(HAVE_PIPE, test "$AUTHPIPE" != "") |
836 | AC_SUBST(LIBAUTHPIPE) |
837 | |
838 | |
839 | |
840 | dnl Checks for header files. |
841 | AC_HEADER_STDC |
842 | AC_HEADER_SYS_WAIT |
843 | AC_CHECK_HEADERS(sys/stat.h sys/time.h sys/wait.h sys/select.h unistd.h fcntl.h crypt.h termios.h) |
844 | |
845 | dnl Checks for typedefs, structures, and compiler characteristics. |
846 | AC_C_CONST |
847 | AC_PID_T |
848 | AC_TYPE_UID_T |
849 | AC_TYPE_SIGNAL |
850 | |
851 | dnl Other checks |
852 | AC_CHECK_FUNCS(setsid setlogin) |
853 | AC_CHECK_LIB(crypt, crypt, CRYPTLIBS="-lcrypt") |
854 | saveLIBS="$LIBS" |
855 | LIBS="$CRYPTLIBS $LIBS" |
856 | AC_CHECK_FUNC(crypt, AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, |
857 | [ Whether we have the crypt() function ])) |
858 | LIBS="$saveLIBS" |
859 | AC_CACHE_CHECK([for crypt() prototype],userdb_cv_NEED_CRYPT_PROTOTYPE, |
860 | |
861 | AC_TRY_COMPILE( [ |
862 | #if HAVE_CRYPT_H |
863 | #include <crypt.h> |
864 | #endif |
865 | #if HAVE_UNISTD_H |
866 | #include <unistd.h> |
867 | #endif |
868 | int crypt(int, int); |
869 | |
870 | ], [], userdb_cv_NEED_CRYPT_PROTOTYPE=1, |
871 | userdb_cv_NEED_CRYPT_PROTOTYPE=0 ) |
872 | |
873 | ) |
874 | |
875 | AC_DEFINE_UNQUOTED(NEED_CRYPT_PROTOTYPE, $userdb_cv_NEED_CRYPT_PROTOTYPE, |
876 | [ Whether we must a prototype for crypt()] ) |
877 | AC_SUBST(CRYPTLIBS) |
878 | |
879 | dnl ######################################################################### |
880 | |
881 | dnl Prepare the authdaemon module. |
882 | |
883 | dnl ######################################################################### |
884 | |
885 | AC_ARG_WITH(authdaemonrc, |
886 | [ --with-authdaemonrc=filename Expect to find authdaemonrc here ], |
887 | authdaemonrc="$withval", |
888 | authdaemonrc="$pkgconfdir/authdaemonrc") |
889 | AC_SUBST(authdaemonrc) |
890 | |
891 | AC_ARG_WITH(authdaemonvar, |
892 | [ --with-authdaemonvar=directory Directory where authdaemon.pid and |
893 | the listening socket is created], |
894 | authdaemonvar="$withval", |
895 | authdaemonvar="$localstatedir/spool/authdaemon") |
896 | |
897 | AC_SUBST(authdaemonvar) |
898 | |
899 | AC_SUBST(LIBM) |
900 | |
901 | AC_DEFINE_UNQUOTED(SASL_LIST,$SASL_LIST, |
902 | [ This macro is used to build the list of SASL modules ]) |
903 | |
904 | rm -f authdaemonrc.h authldaprc.h authmysqlrc.h authpgsqlrc.h vpopmail_config.h |
905 | |
906 | |
907 | dnl |
908 | dnl Need to settle on our uid/gids here |
909 | dnl |
910 | |
911 | result="" |
912 | |
913 | if test -x "$COURIERCONFIG" |
914 | then |
915 | $COURIERCONFIG >conftest.out || exit 1 |
916 | sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1 |
917 | . conftest2.out |
918 | rm -f conftest.out conftest2.out |
919 | |
920 | cmailuser="$mailuser" |
921 | cmailgroup="$mailgroup" |
922 | result=" (from courier-config)" |
923 | fi |
924 | |
925 | if test -x "$bindir/courierauthconfig" |
926 | then |
927 | $bindir/courierauthconfig --configfiles >conftest.out || exit 1 |
928 | sed -n '/^mail/p' <conftest.out >conftest2.out || exit 1 |
929 | . conftest2.out |
930 | rm -f conftest.out conftest2.out |
931 | |
932 | cmailuser="$mailuser" |
933 | cmailgroup="$mailgroup" |
934 | result=" (from previous courierauthconfig)" |
935 | fi |
936 | |
937 | changequote() |
938 | |
939 | LB='[' |
940 | RB=']' |
941 | |
942 | changequote([,]) |
943 | |
944 | AC_MSG_CHECKING(for mail userid) |
945 | |
946 | AC_ARG_WITH(mailuser,[ --with-mailuser=user Specify mail user name (defaults to |
947 | courier, daemon, admin, bin, or root)], |
948 | mailuser="$withval", |
949 | |
950 | if test "$cmailuser" = "" |
951 | then |
952 | AC_TRY_RUN([ |
953 | #include <stdio.h> |
954 | #include <pwd.h> |
955 | #include <stdlib.h> |
956 | |
957 | static const char *ids $LB $RB={"courier","daemon","adm","bin","root", 0}; |
958 | |
959 | int main() |
960 | { |
961 | int i; |
962 | FILE *f; |
963 | char *p; |
964 | |
965 | for (i=0; ids $LB i $RB; i++) |
966 | if (getpwnam(ids $LB i $RB)) break; |
967 | |
968 | f=fopen("conftest.out", "w"); |
969 | if (f && ids $LB i $RB) |
970 | { |
971 | fprintf(f, "%s\n", ids $LB i $RB); |
972 | fclose(f); |
973 | exit(0); |
974 | } |
975 | fclose(f); |
976 | exit (1); |
977 | return (1); |
978 | } |
979 | ], |
980 | mailuser=`cat conftest.out`, |
981 | AC_MSG_ERROR(Cannot determine mail user, use --with-mailuser.), |
982 | AC_MSG_ERROR(Must use --with-mailuser when cross compiling.)) |
983 | else |
984 | mailuser="$cmailuser" |
985 | fi |
986 | ac_configure_args="$ac_configure_args --with-mailuser=$mailuser") |
987 | |
988 | AC_MSG_RESULT([$mailuser $result]) |
989 | |
990 | AC_MSG_CHECKING(for mail group id) |
991 | |
992 | AC_ARG_WITH(mailgroup, [ --with-mailgroup=group Specify mail group name (defaults to courier, |
993 | daemon, sys, adm, or root)], |
994 | mailgroup="$withval", |
995 | |
996 | if test "$cmailgroup" = "" |
997 | then |
998 | AC_TRY_RUN([ |
999 | #include <stdio.h> |
1000 | #include <grp.h> |
1001 | #include <stdlib.h> |
1002 | |
1003 | static const char *ids $LB $RB={"courier", "daemon","sys","adm", "root", 0}; |
1004 | |
1005 | int main() |
1006 | { |
1007 | int i; |
1008 | FILE *f; |
1009 | |
1010 | for (i=0; ids $LB i $RB; i++) |
1011 | if (getgrnam(ids $LB i $RB)) break; |
1012 | |
1013 | f=fopen("conftest.out", "w"); |
1014 | if (f && ids $LB i $RB) |
1015 | { |
1016 | fprintf(f, "%s\n", ids $LB i $RB); |
1017 | fclose(f); |
1018 | exit(0); |
1019 | } |
1020 | fclose(f); |
1021 | exit (1); |
1022 | return (1); |
1023 | } |
1024 | ], |
1025 | |
1026 | mailgroup=`cat conftest.out`, |
1027 | AC_MSG_ERROR(Cannot determine mail group, use --with-mailgroup.), |
1028 | AC_MSG_ERROR(Must use --with-mailgroup when cross compiling.)) |
1029 | else |
1030 | mailgroup="$cmailgroup" |
1031 | fi |
1032 | ac_configure_args="$ac_configure_args --with-mailgroup=$mailgroup" |
1033 | ) |
1034 | AC_MSG_RESULT([$mailgroup $result]) |
1035 | AC_SUBST(mailuser) |
1036 | AC_SUBST(mailgroup) |
1037 | rm -f conftest.out |
1038 | |
1039 | AC_ARG_WITH(stdheaderdir, |
1040 | [ --without-stdheaderdir Header files will be installed into a directory |
1041 | not in the compiler's default search path.], |
1042 | [ |
1043 | if test "$withval" = "no" |
1044 | then |
1045 | AC_DEFINE_UNQUOTED(HAVE_NOSTDHEADERDIR, 1, |
1046 | [ Whether header installation directory is nontstandard ]) |
1047 | fi |
1048 | ]) |
1049 | |
1050 | AC_CACHE_CHECK([for socklen_t], |
1051 | authlib_cv_hassocklen_t, |
1052 | |
1053 | AC_COMPILE_IFELSE( |
1054 | AC_LANG_SOURCE( [ |
1055 | #include <sys/types.h> |
1056 | #include <sys/socket.h> |
1057 | |
1058 | socklen_t sl_t; |
1059 | ],[ |
1060 | accept(0, 0, &sl_t); |
1061 | ]), |
1062 | authlib_cv_hassocklen_t=yes, |
1063 | authlib_cv_hassocklen_t=no) |
1064 | ) |
1065 | |
1066 | socklen_t="int" |
1067 | |
1068 | if test $authlib_cv_hassocklen_t = yes |
1069 | then |
1070 | : |
1071 | else |
1072 | AC_DEFINE_UNQUOTED(socklen_t, int, [ Default definition for socklen_t ]) |
1073 | fi |
1074 | |
1075 | if test x"$enable_ltdl_install" = x"yes" |
1076 | then |
1077 | LIBLTDL_SUBDIR=libltdl |
1078 | fi |
1079 | |
1080 | AC_SUBST(LIBLTDL_SUBDIR) |
1081 | |
1082 | AC_ARG_WITH(repository, [], REPOSITORY="$withval") |
1083 | AC_SUBST(REPOSITORY) |
1084 | |
1085 | AM_CONDITIONAL(HAVE_SGML, test -d ${srcdir}/docbook) |
1086 | AC_CONFIG_SUBDIRS(libltdl bdbobj gdbmobj md5 sha1 libhmac numlib makedat userdb rfc822 random128 liblock liblog) |
1087 | |
1088 | AC_CONFIG_FILES(Makefile authdaemond authdaemonrc authsystem.passwd README.authdebug.html dbobj.h authmigrate courier-authlib.spec courier-authlib.lpspec courier-authlib.sysvinit userdb-test-cram-md5.pl) |
1089 | AC_OUTPUT |
1090 | |