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