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