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