GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / configure.in
1 dnl configure.in for the SASL library
2 dnl Rob Siemborski
3 dnl Rob Earhart
4 dnl $Id: configure.in,v 1.213.2.1 2009/04/27 17:58:25 murch Exp $
5 dnl
6 dnl Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
7 dnl
8 dnl Redistribution and use in source and binary forms, with or without
9 dnl modification, are permitted provided that the following conditions
10 dnl are met:
11 dnl
12 dnl 1. Redistributions of source code must retain the above copyright
13 dnl    notice, this list of conditions and the following disclaimer. 
14 dnl
15 dnl 2. Redistributions in binary form must reproduce the above copyright
16 dnl    notice, this list of conditions and the following disclaimer in
17 dnl    the documentation and/or other materials provided with the
18 dnl    distribution.
19 dnl
20 dnl 3. The name "Carnegie Mellon University" must not be used to
21 dnl    endorse or promote products derived from this software without
22 dnl    prior written permission. For permission or any other legal
23 dnl    details, please contact  
24 dnl      Office of Technology Transfer
25 dnl      Carnegie Mellon University
26 dnl      5000 Forbes Avenue
27 dnl      Pittsburgh, PA  15213-3890
28 dnl      (412) 268-4387, fax: (412) 268-7395
29 dnl      tech-transfer@andrew.cmu.edu
30 dnl
31 dnl 4. Redistributions of any form whatsoever must retain the following
32 dnl    acknowledgment:
33 dnl    \"This product includes software developed by Computing Services
34 dnl     at Carnegie Mellon University (http://www.cmu.edu/computing/).\"
35 dnl
36 dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
37 dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38 dnl AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
39 dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
40 dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
41 dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
42 dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
43 dnl
44 AC_INIT(lib/saslint.h)
45 AC_PREREQ([2.54])
46 AC_CONFIG_MACRO_DIR([config])
47
48 dnl use ./config.cache as the default cache file.
49 dnl we require a cache file to successfully configure our build.
50 if test $cache_file = "/dev/null"; then
51 cache_file="./config.cache"
52 AC_CACHE_LOAD
53 fi
54
55 AC_CONFIG_AUX_DIR(config)
56 AC_CANONICAL_HOST
57 AC_CANONICAL_TARGET
58
59 dnl
60 dnl REMINDER: When changing the version number here, please also update
61 dnl the values in win32/include/config.h and include/sasl.h as well.
62 dnl
63 AM_INIT_AUTOMAKE(cyrus-sasl, 2.1.23)
64 CMU_INIT_AUTOMAKE
65
66 # and include our config dir scripts
67 ACLOCAL="$ACLOCAL -I \$(top_srcdir)/config"
68
69 DIRS=""
70
71 AC_ARG_ENABLE(cmulocal,
72               [AC_HELP_STRING([--enable-cmulocal],
73                               [enable local mods for CMU [[no]]])],
74               [],
75               enable_cmulocal=no)
76
77 AC_ARG_ENABLE(sample,
78               [AC_HELP_STRING([--enable-sample],
79                               [compile sample code [[yes]]])],
80               enable_sample=yes)
81
82 AC_PROG_CC
83 AC_PROG_CPP
84 AC_PROG_AWK
85 AC_PROG_LN_S
86 AC_PROG_MAKE_SET
87 AC_PROG_INSTALL
88 CMU_C___ATTRIBUTE__
89
90 dnl check for -R, etc. switch
91 CMU_GUESS_RUNPATH_SWITCH
92
93 dnl xxx compatibility
94 AC_ARG_WITH(staticsasl)
95 if test "$with_staticsasl" = yes; then
96         enable_shared=yes
97         enable_static=yes
98 fi
99
100 save_target=$target
101 if test -z "$target"; then
102         target="NONE"
103 fi
104
105 # new libtool
106 AM_DISABLE_STATIC
107 AC_PROG_LIBTOOL
108
109 target=$save_target
110
111 if test "$enable_static" = yes; then
112         SASL_STATIC_LIBS=libsasl2.a
113 else
114         SASL_STATIC_LIBS=
115 fi
116
117 AC_ARG_ENABLE(staticdlopen, [  --enable-staticdlopen   try dynamic plugins when we are a static libsasl [[no]] ],
118                 enable_staticdlopen=$enableval,
119                 enable_staticdlopen=no)
120
121 if test "$enable_staticdlopen" = yes; then
122   AC_DEFINE(TRY_DLOPEN_WHEN_STATIC,[],[Should we try to dlopen() plugins while staticly compiled?])
123 fi
124
125 if test "$ac_cv_prog_gcc" = yes; then
126   CFLAGS="-Wall -W ${CFLAGS}"
127 fi
128
129 AC_ARG_WITH(purecov,[  --with-purecov          link with purecov])
130 if test "$with_purecov" = yes; then
131   AC_CHECK_PROGS(PURECOV, purecov)
132 fi
133 AC_ARG_WITH(purify,[  --with-purify           link with purify])
134 if test "$with_purify" = yes; then
135   AC_CHECK_PROGS(PURIFY, purify)
136 fi
137
138 AC_ARG_ENABLE(java, [  --enable-java           compile Java support [[no]]],
139         enable_java=$enableval, enable_java=no)
140 if test "$enable_java" = yes; then
141   AC_PATH_PROG(JAVAC, javac, no)
142   AC_PATH_PROGS(JAVAH, javah kaffeh, no)
143   AC_CHECK_PROGS(JAVADOC, javadoc, :)   
144   if test "$JAVAC" = "no" -o "$JAVAH" = "no"; then
145     AC_WARN([Disabling Java support])
146     enable_java=no
147   fi
148 else
149 # Make distcheck work
150   JAVAC="true"
151   JAVAH="true"
152   JAVADOC="true"
153 fi
154 AM_CONDITIONAL(JAVA, test "$enable_java" = yes)
155
156 if test "$enable_java" = yes; then
157   AC_MSG_CHECKING([JNI cpp flags])
158   AC_CACHE_VAL(sasl_cv_java_includes,[
159   if test `echo $JAVAH | sed 's,.*/,,'` = "kaffeh"; then
160     sasl_cv_java_includes=-I`echo $JAVAH | sed -e 's,/bin.*,/include/kaffe,'`
161   else
162     java_base=`echo $JAVAC | sed 's,/bin.*,'','`
163
164     AC_ARG_WITH(javabase, [  --with-javabase=PATH    set path to find jni.h in [/usr/java/include] ],
165         java_base=$withval,)
166         
167
168     sasl_cv_java_includes=''
169     for dir in `find ${java_base}/include -follow -type d -print | grep -v green_threads`; do
170       sasl_cv_java_includes="${sasl_cv_java_includes} -I$dir"
171     done
172   fi
173
174   sasl_cv_java_includes="${sasl_cv_java_includes} -I$javapath/include"])
175
176   JAVA_INCLUDES=$sasl_cv_java_includes
177   AC_SUBST(JAVA_INCLUDES)
178   AC_MSG_RESULT(ok)
179
180   JAVAROOT=".."
181   AC_SUBST(JAVAROOT)
182   JAVAC=`echo "$JAVAC" | sed 's,.*/,,'`
183   JAVAH=`echo "$JAVAH" | sed 's,.*/,,'`
184 fi
185
186 AM_CONDITIONAL(SAMPLE, test "$enable_sample" = yes)
187
188 dnl call before we do the berkeley DB checks
189 CMU_SOCKETS
190
191 dnl we extracted this to config/sasldb.m4
192 SASL_DB_PATH_CHECK()
193 SASL_DB_CHECK()
194
195 # Do we not install the SASL DB man pages?
196 AM_CONDITIONAL(NO_SASL_DB_MANS, test "x$SASL_DB_MANS" = "x")
197
198 AC_ARG_ENABLE(keep_db_open, [  --enable-keep-db-open   keep handle to Berkeley DB open for improved performance [[no]] ],
199                 keep_db_open=$enableval,
200                 keep_db_open=no)
201
202 # Disable if Berkeley DB is not used
203 if test "$dblib" != berkeley; then
204   keep_db_open=no
205 fi
206
207 if test "$keep_db_open" = yes; then
208   AC_DEFINE(KEEP_DB_OPEN,[],[Should we keep handle to Berkeley DB open in SASLDB plugin?])
209 fi
210 AC_MSG_CHECKING(if Berkeley DB handle is kept open in SASLDB)
211 AC_MSG_RESULT($keep_db_open)
212
213 AC_CHECK_LIB(dl, dlopen, SASL_DL_LIB="-ldl", SASL_DL_LIB="")
214 AC_SUBST(SASL_DL_LIB)
215
216 dnl /dev/random ?
217
218 AC_ARG_WITH(devrandom, [  --with-devrandom=PATH   set the path to /dev/random [[/dev/random]] ],
219   devrandom=$withval,
220   devrandom=/dev/random)
221 AC_MSG_CHECKING(/dev/random to use)
222 AC_MSG_RESULT($devrandom)
223 AC_DEFINE_UNQUOTED(SASL_DEV_RANDOM, "$devrandom", [File to use for source of randomness])
224
225 dnl Do we need leading underscores on our symbols?
226
227 AC_CHECK_PROGS(NM, nm)
228
229 AC_MSG_CHECKING(for underscore before symbols)
230 AC_CACHE_VAL(sasl_cv_uscore,[
231     echo "main(){int i=1;}
232     foo(){int i=6;}" > conftest.c
233     ${CC} -o a.out conftest.c > /dev/null
234     if (${NM} a.out | grep _foo) > /dev/null; then
235       sasl_cv_uscore=yes
236     else
237       sasl_cv_uscore=no
238     fi])
239 AC_MSG_RESULT($sasl_cv_uscore)
240 rm -f conftest.c a.out
241
242 if test $sasl_cv_uscore = yes; then
243   if test $ac_cv_lib_dl_dlopen = yes ; then
244         AC_MSG_CHECKING(whether dlsym adds the underscore for us)
245         cmu_save_LIBS="$LIBS"
246         LIBS="$LIBS $SASL_DL_LIB"
247         AC_CACHE_VAL(sasl_cv_dlsym_adds_uscore,AC_TRY_RUN( [
248 #include <dlfcn.h>
249 #include <stdio.h>
250 foo() { int i=0;}
251 main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
252     if(self) { ptr1=dlsym(self,"foo"); ptr2=dlsym(self,"_foo");
253     if(ptr1 && !ptr2) exit(0); } exit(1); } 
254 ], [sasl_cv_dlsym_adds_uscore=yes], sasl_cv_dlsym_adds_uscore=no
255         AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, [], [Do we need a leading _ for dlsym?]),
256         AC_MSG_WARN(cross-compiler, we'll do our best)))
257         LIBS="$cmu_save_LIBS"
258       AC_MSG_RESULT($sasl_cv_dlsym_adds_uscore)
259   fi
260 fi
261
262 dnl See if we can provide a default logging function...
263 AC_CHECK_FUNCS(syslog)
264
265 AC_ARG_WITH(pam, [  --with-pam=DIR          use PAM (rooted in DIR) [[yes]] ],
266         with_pam=$withval,
267         with_pam=yes)
268 if test "$with_pam" != no; then
269   if test -d $with_pam; then
270     CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
271     LDFLAGS="$LDFLAGS -L${with_pam}/lib"
272   fi
273   AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
274   cmu_save_LIBS="$LIBS"
275   AC_CHECK_FUNC(pam_start, :, 
276         LIBS="-lpam $LIBS" 
277         AC_TRY_LINK([[
278 #include <sys/types.h>
279 #ifdef HAVE_PAM_PAM_APPL_H
280 #include <pam/pam_appl.h>
281 #endif
282 #ifdef HAVE_SECURITY_PAM_H
283 #include <security/pam_appl.h>
284 #endif]],[[
285 const char *service="foo";
286 const char *user="bar";
287 pam_handle_t *pamh;
288 struct pam_conv *conv;
289 int baz;
290 baz = pam_start(service, user, conv, &pamh);
291 return 0;
292 ]], LIBPAM="-lpam")
293 )
294   LIBS="$cmu_save_LIBS $LIBPAM"
295 fi
296
297 AC_ARG_WITH(saslauthd, [  --with-saslauthd=DIR    enable use of the saslauth daemon using state dir DIR ],
298                 with_saslauthd=$withval,
299                 with_saslauthd=yes)
300 if test "$with_saslauthd" != no; then
301   if test "$with_saslauthd" = yes; then
302     with_saslauthd="/var/state/saslauthd"
303   fi
304   AC_DEFINE(HAVE_SASLAUTHD,[],[Include support for saslauthd?])
305   AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd",
306                      [Where do we look for saslauthd's socket?])
307 fi
308 AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no)
309 AC_MSG_CHECKING(if I should include saslauthd)
310 AC_MSG_RESULT($with_saslauthd)
311
312 AC_ARG_WITH(authdaemond, [  --with-authdaemond=PATH enable use of authdaemon with default socket=PATH [[yes]] ],
313                 with_authdaemon=$withval,
314                 with_authdaemon=yes)
315 if test "$with_authdaemon" != no; then
316   if test "$with_authdaemon" = yes; then
317     with_authdaemon="/dev/null"
318   fi
319   AC_DEFINE(HAVE_AUTHDAEMON,[],[Include support for Courier's authdaemond?])
320   AC_DEFINE_UNQUOTED(PATH_AUTHDAEMON_SOCKET, "$with_authdaemon",
321                      [Where do we look for Courier authdaemond's socket?])
322 fi
323 AC_MSG_CHECKING(to include Courier authdaemond support)
324 AC_MSG_RESULT($with_authdaemon)
325
326 AC_ARG_WITH(pwcheck,
327 [  --with-pwcheck=DIR     enable deprecated pwcheck daemon using statedir DIR ],
328         with_pwcheck=$withval,
329         with_pwcheck=no)
330 if test "$with_pwcheck" != no; then
331    if test "$with_pwcheck" = yes; then
332      with_pwcheck=/var/pwcheck
333    fi
334    AC_DEFINE(HAVE_PWCHECK,[],[Include Support for pwcheck daemon?])
335    AC_DEFINE_UNQUOTED(PWCHECKDIR, "$with_pwcheck", [Location of pwcheck socket])
336    AC_CHECK_FUNC(getspnam,PWCHECKMETH="getspnam",PWCHECKMETH="getpwnam")
337    AC_SUBST(PWCHECKMETH)
338 fi
339 AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no)
340 AC_MSG_CHECKING(if I should include pwcheck)
341 AC_MSG_RESULT($with_pwcheck)
342
343 AC_ARG_WITH(ipctype, [  --with-ipctype={unix,doors}    use ipctype [[unix]] ],
344        with_ipctype=$withval,
345        with_ipctype="unix")
346 IPCTYPE=$with_ipctype
347 AC_SUBST(IPCTYPE)
348 LIB_DOOR=
349 if test "$with_ipctype" = "doors"; then
350    LIB_DOOR="-ldoor"
351    AC_DEFINE(USE_DOORS,[],[use the doors IPC API for saslauthd?])
352 fi
353 AC_SUBST(LIB_DOOR)
354
355 AC_ARG_ENABLE(alwaystrue, [  --enable-alwaystrue     enable the alwaystrue password verifier (discouraged)],
356                 enable_alwaystrue=$enableval,
357                 enable_alwaystrue=no)
358 if test "$enable_alwaystrue" = yes; then
359   AC_DEFINE(HAVE_ALWAYSTRUE, [], [Enable 'alwaystrue' password verifier?])
360 fi
361 AC_MSG_CHECKING(if I should include the alwaystrue verifier)
362 AC_MSG_RESULT($enable_alwaystrue)
363
364 dnl sasl_checkapop support
365 AC_ARG_ENABLE(checkapop, [  --enable-checkapop      enable use of sasl_checkapop [[yes]] ],
366   checkapop=$enableval,
367   checkapop=yes)
368
369 AC_MSG_CHECKING(if we should enable sasl_checkapop)
370 if test "$checkapop" != no; then
371   AC_MSG_RESULT(enabled)
372   AC_DEFINE(DO_SASL_CHECKAPOP, [], [should we support sasl_checkapop?])
373 else
374   AC_MSG_RESULT(disabled)
375 fi
376
377 dnl CRAM-MD5
378 AC_ARG_ENABLE(cram, [  --enable-cram           enable CRAM-MD5 authentication [[yes]] ],
379   cram=$enableval,
380   cram=yes)
381
382 AC_MSG_CHECKING(CRAM-MD5)
383 if test "$cram" != no; then
384   AC_MSG_RESULT(enabled)
385   SASL_MECHS="$SASL_MECHS libcrammd5.la"
386   if test "$enable_static" = yes; then
387     SASL_STATIC_OBJS="$SASL_STATIC_OBJS cram.o"
388     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/cram.c"
389     AC_DEFINE(STATIC_CRAMMD5, [], [Link CRAM-MD5 Staticly])
390   fi
391 else
392   AC_MSG_RESULT(disabled)
393 fi
394
395 CMU_HAVE_OPENSSL
396 AC_MSG_CHECKING(for OpenSSL)
397 AC_MSG_RESULT($with_openssl)
398
399 SASL_DES_CHK
400
401 dnl DIGEST-MD5
402 AC_ARG_ENABLE(digest, [  --enable-digest         enable DIGEST-MD5 authentication [[yes]] ],
403   digest=$enableval,
404   digest=yes)
405
406 if test "$digest" != no; then
407   dnl In order to compile digest, we should look for need libdes.
408   if test -d $digest; then
409     CPPFLAGS="$CPPFLAGS -I$digest/include"
410     LDFLAGS="$LDFLAGS -L$digest/lib"
411   fi
412   if test "$with_des" = no; then
413     AC_WARN(No DES support for DIGEST-MD5)
414   fi
415 fi
416
417 AC_MSG_CHECKING(DIGEST-MD5)
418 if test "$digest" != no; then
419   AC_MSG_RESULT(enabled)
420   SASL_MECHS="$SASL_MECHS libdigestmd5.la"
421   if test "$enable_static" = yes; then
422     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/digestmd5.c"
423     SASL_STATIC_OBJS="$SASL_STATIC_OBJS digestmd5.o"
424     AC_DEFINE(STATIC_DIGESTMD5, [], [Link DIGEST-MD5 Staticly])
425   fi
426 else
427   AC_MSG_RESULT(disabled)
428 fi
429
430 dnl OTP
431 AC_ARG_ENABLE(otp, [  --enable-otp            enable OTP authentication [[yes]] ],
432   otp=$enableval,
433   otp=yes)
434
435 if test "$with_openssl" = no; then
436   AC_WARN([OpenSSL not found -- OTP will be disabled])
437   otp=no
438 fi
439
440 AC_MSG_CHECKING(OTP)
441 if test "$otp" != no; then
442   AC_MSG_RESULT(enabled)
443   OTP_LIBS="-lcrypto $LIB_RSAREF"
444
445   SASL_MECHS="$SASL_MECHS libotp.la"
446   if test "$enable_static" = yes; then
447     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/otp.c"
448     SASL_STATIC_OBJS="$SASL_STATIC_OBJS otp.o"
449     AC_DEFINE(STATIC_OTP, [], [Link OTP Staticly])
450   fi
451
452   dnl Test for OPIE
453   AC_ARG_WITH(with-opie,[  --with-opie=PATH        use OPIE (One Time Passwords in Everything) from PATH],
454         with_opie="${withval}")
455
456   case "$with_opie" in
457         ""|yes) 
458                 AC_CHECK_LIB(opie, opiechallenge, [
459                         AC_CHECK_HEADER(opie.h, with_opie="yes",
460                                         with_opie="no")],
461                         with_opie="no")
462                 ;;
463         *)
464                 if test -d $with_opie; then
465                   CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
466                   LDFLAGS="${LDFLAGS} -L${with_opie}/lib"
467                 else
468                   with_opie="no"
469                 fi
470                 ;;
471   esac
472
473   AC_MSG_CHECKING(for OPIE)
474   AC_MSG_RESULT($with_opie)
475
476   if test "$with_opie" != no; then
477     AC_DEFINE(HAVE_OPIE,[],[Use OPIE for server-side OTP?])
478     OTP_LIBS="$OTP_LIBS -lopie"
479   fi
480
481   AC_SUBST(OTP_LIBS)
482
483 else
484   AC_MSG_RESULT(disabled)
485 fi
486
487 dnl SRP
488 AC_ARG_ENABLE(srp, [  --enable-srp            enable SRP authentication [[no]] ],
489   srp=$enableval,
490   srp=no)
491
492 if test "$with_openssl" = no; then
493   AC_WARN([OpenSSL not found -- SRP will be disabled])
494   srp=no
495 fi
496
497 AC_MSG_CHECKING(SRP)
498 if test "$srp" != no; then
499   AC_MSG_RESULT(enabled)
500   SRP_LIBS="-lcrypto $LIB_RSAREF"
501
502   SASL_MECHS="$SASL_MECHS libsrp.la"
503   if test "$enable_static" = yes; then
504     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/srp.c"
505     SASL_STATIC_OBJS="$SASL_STATIC_OBJS srp.o"
506     AC_DEFINE(STATIC_SRP, [], [Link SRP Staticly])
507   fi
508
509 dnl srp_setpass support
510   AC_ARG_ENABLE(srp_setpass, [  --enable-srp-setpass    enable setting SRP secrets with saslpasswd [[no]]],
511       srp_setpass=$enableval,
512       srp_setpass=no)
513
514   AC_MSG_CHECKING(if we should enable setting SRP secrets with saslpasswd)
515   if test "$srp_setpass" != no; then
516     AC_MSG_RESULT(enabled)
517     AC_DEFINE(DO_SRP_SETPASS, [], [should we support setpass() for SRP?])
518   else
519     AC_MSG_RESULT(disabled)
520   fi
521
522   AC_SUBST(SRP_LIBS)
523 else
524   AC_MSG_RESULT(disabled)
525 fi
526
527 dnl Kerberos based Mechanisms
528 SASL_KERBEROS_V4_CHK
529 SASL_GSSAPI_CHK
530
531 if test "$gssapi" != "no"; then
532   AC_DEFINE(STATIC_GSSAPIV2,[],[Link GSSAPI Staticly])
533   mutex_default="no"
534   if test "$gss_impl" = "mit"; then
535      mutex_default="yes"
536   fi
537   AC_MSG_CHECKING(to use mutexes aroung GSS calls)
538   AC_ARG_ENABLE(gss_mutexes, [  --enable-gss_mutexes     use mutexes around calls to the GSS library],
539                 use_gss_mutexes=$enableval,
540                 use_gss_mutexes=$mutex_default)
541   if test $use_gss_mutexes = "yes"; then
542      AC_DEFINE(GSS_USE_MUTEXES, [], [should we mutex-wrap calls into the GSS library?])
543   fi
544   AC_MSG_RESULT($use_gss_mutexes)
545 fi
546
547 dnl PLAIN
548 SASL_PLAIN_CHK
549
550 dnl ANONYMOUS
551 AC_ARG_ENABLE(anon, [  --enable-anon           enable ANONYMOUS authentication [[yes]] ],
552   anon=$enableval,
553   anon=yes)
554
555 AC_MSG_CHECKING(ANONYMOUS)
556 if test "$anon" != no; then
557   AC_MSG_RESULT(enabled)
558   SASL_MECHS="$SASL_MECHS libanonymous.la"
559   if test "$enable_static" = yes; then
560     SASL_STATIC_OBJS="$SASL_STATIC_OBJS anonymous.o"
561     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/anonymous.c"
562     AC_DEFINE(STATIC_ANONYMOUS, [], [Link ANONYMOUS Staticly])
563   fi
564 else
565   AC_MSG_RESULT(disabled)
566 fi
567
568 dnl LOGIN
569 AC_ARG_ENABLE(login, [  --enable-login          enable unsupported LOGIN authentication [[no]] ],
570   login=$enableval,
571   login=no)
572
573 AC_MSG_CHECKING(LOGIN)
574 if test "$login" != no; then
575   AC_MSG_RESULT(enabled)
576   SASL_MECHS="$SASL_MECHS liblogin.la"
577   if test "$enable_static" = yes; then
578     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/login.c"
579     SASL_STATIC_OBJS="$SASL_STATIC_OBJS login.o"
580     AC_DEFINE(STATIC_LOGIN,[],[Link LOGIN Staticly])
581   fi
582 else
583   AC_MSG_RESULT(disabled)
584 fi
585
586 dnl NTLM
587 AC_ARG_ENABLE(ntlm, [  --enable-ntlm           enable unsupported NTLM authentication [[no]] ],
588   ntlm=$enableval,
589   ntlm=no)
590
591 if test "$with_openssl" = no; then
592   AC_WARN([OpenSSL not found -- NTLM will be disabled])
593   ntlm=no
594 fi
595
596 AC_MSG_CHECKING(NTLM)
597 if test "$ntlm" != no; then
598   AC_MSG_RESULT(enabled)
599   NTLM_LIBS="-lcrypto $LIB_RSAREF"
600   AC_SUBST(NTLM_LIBS)
601
602   SASL_MECHS="$SASL_MECHS libntlm.la"
603   if test "$enable_static" = yes; then
604     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/ntlm.c"
605     SASL_STATIC_OBJS="$SASL_STATIC_OBJS ntlm.o"
606     AC_DEFINE(STATIC_NTLM,[],[Link NTLM Staticly])
607   fi
608 else
609   AC_MSG_RESULT(disabled)
610 fi
611
612 dnl PASSDSS
613 AC_ARG_ENABLE(passdss, [  --enable-passdss        enable PASSDSS authentication (experimental) [[no]] ],
614   passdss=$enableval,
615   passdss=no)
616
617 if test "$with_openssl" = no; then
618   AC_WARN([OpenSSL not found -- PASSDSS will be disabled])
619   passdss=no
620 fi
621
622 AC_MSG_CHECKING(PASSDSS)
623 if test "$passdss" != no; then
624   AC_MSG_RESULT(enabled)
625   PASSDSS_LIBS="-lcrypto $LIB_RSAREF"
626   AC_SUBST(PASSDSS_LIBS)
627
628   SASL_MECHS="$SASL_MECHS libpassdss.la"
629   if test "$enable_static" = yes; then
630     SASL_STATIC_OBJS="$SASL_STATIC_OBJS passdss.o"
631     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/passdss.c"
632     AC_DEFINE(STATIC_PASSDSS,[],[Link PASSDSS Staticly])
633   fi
634 else
635   AC_MSG_RESULT(disabled)
636 fi
637
638
639 # make the option show up so people don't whine that it is only in the
640 # saslauthd configure script --help
641 AC_ARG_WITH(ldap,   [  --with-ldap=DIR         use LDAP (in DIR) for saslauthd [no] ],,with_ldap=no)
642
643
644 dnl SQL
645 dnl This flag also changes the requirements of --with-mysql and --with-pgsql
646 dnl
647 dnl Desired behavior:
648 dnl
649 dnl doesn't require mysql or postgres if --disable-sql is chosen
650 dnl requires at least one (but not both) if --enable-sql is chosen
651
652 AC_ARG_ENABLE(sql, [  --enable-sql            enable SQL auxprop [[no]] ],
653   sql=$enableval,
654   sql=no)
655
656 AC_MSG_CHECKING(SQL)
657 if test "$sql" != no; then
658   AC_MSG_RESULT(enabled)
659   SASL_MECHS="$SASL_MECHS libsql.la"
660   if test "$enable_static" = yes; then
661     SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/sql.c"
662     SASL_STATIC_OBJS="$SASL_STATIC_OBJS sql.o"
663     AC_DEFINE(STATIC_SQL,[],[Link SQL plugin staticly])
664   fi
665 else
666   AC_MSG_RESULT(disabled)
667 fi
668
669 dnl MySQL
670 AC_ARG_WITH(mysql,  [  --with-mysql=PATH       use MySQL from PATH ],
671   with_mysql=$withval,
672   with_mysql=$sql)
673
674 # find location of library 
675 # presuming if one given then correct
676 if test "${with_mysql}" = "yes"; then
677   with_mysql=notfound
678   for mysqlloc in lib/mysql lib mysql/lib
679   do
680     if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then
681       with_mysql="${prefix}"
682       break
683     elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then
684       with_mysql="/usr/local"
685       break
686     elif test -f /usr/${mysqlloc}/libmysqlclient.a; then
687       with_mysql="/usr"
688       break
689     fi
690   done
691 fi
692
693 LIB_MYSQL=""
694
695 case "$with_mysql" in
696     no) true;;
697     notfound) AC_WARN([MySQL Library not found]); true;;
698     *)
699      if test -d ${with_mysql}/lib/mysql; then
700         CMU_ADD_LIBPATH_TO(${with_mysql}/lib/mysql, LIB_MYSQL)
701      elif test -d ${with_mysql}/mysql/lib; then
702         CMU_ADD_LIBPATH_TO(${with_mysql}/mysql/lib, LIB_MYSQL)
703      elif test -d ${with_mysql}/lib; then
704         CMU_ADD_LIBPATH_TO(${with_mysql}/lib, LIB_MYSQL)
705      else
706         CMU_ADD_LIBPATH_TO(${with_mysql}, LIB_MYSQL)
707      fi
708
709      LIB_MYSQL_DIR=$LIB_MYSQL
710      LIB_MYSQL="$LIB_MYSQL -lmysqlclient"
711
712      if test -d ${with_mysql}/include/mysql; then
713          CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql"
714      elif test -d ${with_mysql}/mysql/include; then
715          CPPFLAGS="${CPPFLAGS} -I${with_mysql}/mysql/include"
716      elif test -d ${with_mysql}/include; then
717          CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include"
718      else
719          CPPFLAGS="${CPPFLAGS} -I${with_mysql}"
720      fi
721
722        save_LDFLAGS=$LDFLAGS
723        LDFLAGS="$LDFLAGS $LIB_MYSQL_DIR"
724        AC_CHECK_LIB(mysqlclient, mysql_select_db,
725            AC_DEFINE(HAVE_MYSQL, [], [Do we have mysql support?]),
726            [AC_WARN([MySQL library mysqlclient does not work])
727             with_mysql=no])
728        LDFLAGS=$save_LDFLAGS;;
729          
730 esac
731 AC_SUBST(LIB_MYSQL)
732
733 dnl PgSQL
734 AC_ARG_WITH(pgsql,  [  --with-pgsql=PATH       use PostgreSQL from PATH ],
735   with_pgsql=$withval,
736   with_pgsql=$sql)
737
738 # find location of library 
739 # presuing if one given then correct
740 if test "${with_pgsql}" = "yes"; then
741   with_pgsql=notfound
742   for pgsqlloc in lib/pgsql lib pgsql/lib
743   do
744     if test -f ${prefix}/${pgsqlloc}/libpq.a; then
745       with_pgsql="${prefix}"
746       break
747     elif test -f /usr/local/${pgsqlloc}/libpq.a; then
748       with_pgsql="/usr/local"
749       break
750     elif test -f /usr/${pgsqlloc}/libpq.a; then
751       with_pgsql="/usr"
752       break
753     fi
754   done
755 fi
756
757 LIB_PGSQL=""
758
759 case "$with_pgsql" in
760     no) true;;
761     notfound) AC_WARN([PostgreSQL Library not found]); true;;
762     *)
763      if test -d ${with_pgsql}/lib/pgsql; then
764         CMU_ADD_LIBPATH_TO(${with_pgsql}/lib/pgsql, LIB_PGSQL)
765      elif test -d ${with_pgsql}/pgsql/lib; then
766         CMU_ADD_LIBPATH_TO(${with_pgsql}/pgsql/lib, LIB_PGSQL)
767      elif test -d ${with_pgsql}/lib; then
768         CMU_ADD_LIBPATH_TO(${with_pgsql}/lib, LIB_PGSQL)
769      else
770         CMU_ADD_LIBPATH_TO(${with_pgsql}, LIB_PGSQL)
771      fi
772
773      LIB_PGSQL_DIR=$LIB_PGSQL
774      LIB_PGSQL="$LIB_PGSQL -lpq"
775
776      if test -d ${with_pgsql}/include/pgsql; then
777          CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include/pgsql"
778      elif test -d ${with_pgsql}/pgsql/include; then
779          CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/pgsql/include"
780      elif test -d ${with_pgsql}/include; then
781          CPPFLAGS="${CPPFLAGS} -I${with_pgsql}/include"
782      else
783          CPPFLAGS="${CPPFLAGS} -I${with_pgsql}"
784      fi
785
786
787        save_LDFLAGS=$LDFLAGS
788        LDFLAGS="$LDFLAGS $LIB_PGSQL_DIR"
789        AC_CHECK_LIB(pq, PQsetdbLogin, AC_DEFINE(HAVE_PGSQL,[],
790            [Do we have Postgres support?]),
791            [AC_WARN([PostgreSQL Library pq does not work])
792             with_pgsql=no])
793        LDFLAGS=$save_LDFLAGS;;
794          
795 esac
796 AC_SUBST(LIB_PGSQL)
797
798 dnl SQLite
799 AC_ARG_WITH(sqlite,  [  --with-sqlite=PATH       use SQLite from PATH ],
800   with_sqlite=$withval,
801   with_sqlite=$sql)
802
803 # find location of library 
804 # presuing if one given then correct
805 if test "${with_sqlite}" = "yes"; then
806   with_sqlite=notfound
807   for sqliteloc in lib
808   do
809     if test -f ${prefix}/${sqliteloc}/libsqlite.a; then
810       with_sqlite="${prefix}"
811       break
812     elif test -f /usr/local/${sqliteloc}/libsqlite.a; then
813       with_sqlite="/usr/local"
814       break
815     elif test -f /usr/${sqliteloc}/libsqlite.a; then
816       with_sqlite="/usr"
817       break
818     fi
819   done
820 fi
821
822 LIB_SQLITE=""
823
824 case "$with_sqlite" in
825     no) true;;
826     notfound) AC_WARN([SQLite Library not found]); true;;
827     *)
828      if test -d ${with_sqlite}/lib; then
829          LIB_SQLITE="-L${with_sqlite}/lib -R${with_sqlite}/lib"
830      else
831          LIB_SQLITE="-L${with_sqlite} -R${with_sqlite}"
832      fi
833
834      LIB_SQLITE_DIR=$LIB_SQLITE
835      LIB_SQLITE="$LIB_SQLITE -lsqlite"
836
837      if test -d ${with_sqlite}/include; then
838          CPPFLAGS="${CPPFLAGS} -I${with_sqlite}/include"
839      else
840          CPPFLAGS="${CPPFLAGS} -I${with_sqlite}"
841      fi
842        AC_CHECK_LIB(sqlite, sqlite_open, AC_DEFINE(HAVE_SQLITE,[],
843            [Do we have SQLite support?]),
844            [AC_WARN([SQLite Library sqlite does not work])
845             with_sqlite=no], $LIB_SQLITE_DIR);;
846          
847 esac
848 AC_SUBST(LIB_SQLITE)
849
850 if test "$sql" = yes -a "$with_pgsql" = no -a "$with_mysql" = no -a "$with_sqlite" = no; then
851     AC_ERROR([--enable-sql chosen but neither Postgres nor MySQL nor SQLite found])
852 fi
853
854 if test "$enable_shared" = yes; then
855         AC_DEFINE(DO_DLOPEN,[],[Should we build a shared plugin (via dlopen) library?])
856 fi
857
858 dnl LDAPDB
859 AC_ARG_ENABLE(ldapdb, [  --enable-ldapdb         enable LDAPDB plugin [no] ],
860   ldapdb=$enableval,
861   ldapdb=no)
862 AC_MSG_CHECKING(LDAPDB)
863 if test "$ldapdb" != no; then
864     AC_MSG_RESULT(enabled)
865
866     if test "$with_ldap" = no; then
867         AC_MSG_ERROR([Cannot enable LDAPDB plugin: You need to specify --with-ldap])
868     fi
869
870     save_CPPFLAGS=$CPPFLAGS
871     save_LDFLAGS=$LDFLAGS
872
873     if test -d $with_ldap; then
874         CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include"
875         CMU_ADD_LIBPATH(${with_ldap}/lib)
876     fi
877
878     AC_CHECK_HEADERS(ldap.h lber.h)
879
880     if test $ac_cv_header_ldap_h = yes -a $ac_cv_header_lber_h = yes; then
881         CMU_OPENLDAP_API
882
883         if test "$cmu_cv_openldap_api" = yes; then
884             AC_CHECK_LIB(ldap, ldap_initialize, [ cmu_link_openldap="-lldap -llber" ], [ cmu_link_openldap=no ],-llber)
885         fi
886     fi
887
888     if test "$cmu_cv_openldap_api" = no -o "$cmu_link_openldap" = no; then
889         AC_MSG_ERROR([Cannot enable LDAPDB plugin: Could not locate OpenLDAP])
890     else
891         CMU_OPENLDAP_COMPAT
892
893         if test "$cmu_cv_openldap_compat" = no; then
894             AC_MSG_ERROR([Cannot enable LDAPDB plugin: OpenLDAP library located but incompatible])
895         else
896             LIB_LDAP=$cmu_link_openldap
897             AC_SUBST(LIB_LDAP)
898
899             SASL_MECHS="$SASL_MECHS libldapdb.la"
900             if test "$enable_static" = yes; then
901                 SASL_STATIC_SRCS="$SASL_STATIC_SRCS ../plugins/ldapdb.c"
902                 SASL_STATIC_OBJS="$SASL_STATIC_OBJS ldapdb.o"
903                 AC_DEFINE(STATIC_LDAPDB,[],[Link ldapdb plugin Staticly])
904             fi
905         fi
906     fi
907
908     if test "$cmu_cv_openldap_compat" != yes; then
909         CPPFLAGS=$save_CPPFLAGS
910         LDFLAGS=$save_LDFLAGS
911     fi
912 else
913     AC_MSG_RESULT(disabled)
914 fi
915
916 AC_SUBST(SASL_MECHS)
917 AC_SUBST(SASL_STATIC_SRCS)
918 AC_SUBST(SASL_STATIC_OBJS)
919 AC_SUBST(SASL_STATIC_LIBS)
920
921 AC_ARG_WITH(plugindir, [  --with-plugindir=DIR    set the directory where plugins will
922                           be found [[/usr/lib/sasl2]] ],
923   plugindir=$withval,
924   plugindir=/usr/lib/sasl2)
925 AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir", [Runtime plugin location])
926 AC_SUBST(plugindir)
927
928 AC_ARG_WITH(configdir, [   --with-configdir=DIR    set the directory where config files will
929                           be found [/usr/lib/sasl2] ],
930   configdir=$withval,
931   configdir=$plugindir:/etc/sasl2)
932 AC_DEFINE_UNQUOTED(CONFIGDIR, "$configdir", [Runtime config file location])
933 AC_SUBST(configdir)
934
935 dnl look for rc4 libraries. we accept the CMU one or one from openSSL
936 AC_ARG_WITH(rc4, [  --with-rc4              use internal rc4 routines [[yes]] ],
937         with_rc4=$withval,
938         with_rc4=yes)
939
940 if test "$with_rc4" != no; then
941     AC_DEFINE(WITH_RC4,[],[Use internal RC4 implementation?])
942 fi
943
944 building_for_macosx=no
945 case "$host_os" in
946         darwin*)
947 AC_ARG_ENABLE(macos-framework, [  --disable-macos-framework       disable building and installing replacement SASL2 Framework for MacOS X-provided SASL Framework [[no]]],building_for_macosx=no,building_for_macosx=yes)
948         ;;
949 esac
950 AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes)
951
952 dnl dmalloc tests
953 AC_MSG_CHECKING(for dmalloc library)
954 AC_ARG_WITH(dmalloc, [  --with-dmalloc=DIR      with DMALLOC support (for test applications) [[no]] ],
955         with_dmalloc=$withval,
956         with_dmalloc=no)
957
958 DMALLOC_LIBS=""
959
960 if test "$with_dmalloc" != "no"; then
961    if test "$with_dmalloc" = "yes"; then
962         with_dmalloc="/usr/local"
963    fi
964
965    if test -r "$with_dmalloc/libdmalloc.a"; then
966         DMALLOC_LIBS="$with_dmalloc/libdmalloc.a"
967         AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?])
968         AC_MSG_RESULT(yes)
969    elif test -r "$with_dmalloc/lib/libdmalloc.a"; then
970         DMALLOC_LIBS="$with_dmalloc/lib/libdmalloc.a"
971         AC_DEFINE(WITH_DMALLOC,[],[Linking against dmalloc?])
972         AC_MSG_RESULT(yes)
973    else
974         AC_MSG_ERROR(cannot find dmalloc library, please check your installation.)
975    fi
976 else
977    AC_MSG_RESULT(no)
978 fi
979
980 AC_SUBST(DMALLOC_LIBS)
981
982 dnl sfio tests
983 AC_MSG_CHECKING(for sfio library)
984 AC_ARG_WITH(sfio, [  --with-sfio=DIR         with SFIO support (for smtptest/libsfsasl) [[no]] ],
985         with_sfio=$withval,
986         with_sfio=no)
987
988 if test "$with_sfio" != "no"; then
989    if test "$with_sfio" = "yes"; then
990         with_sfio="/usr/local"
991    fi
992
993    AC_DEFUN([SFIO_INC_CHK],
994         [if test -r "$with_sfio$1/sfio.h"; then SFIO_DIR=$with_sfio;
995                                               SFIO_INC_DIR=$with_sfio$1])
996
997    AC_DEFUN([SFIO_LIB_CHK],[
998                 str="$SFIO_DIR/$1/libsfio.*"
999                 for i in `echo $str`; do
1000                         if test -r $i; then
1001                                 SFIO_LIBDIR=$SFIO_DIR/$1
1002                                 break 2
1003                         fi
1004                 done
1005                 ])
1006
1007    SFIO_INC_CHK()
1008    el[]SFIO_INC_CHK(/include)
1009    el[]SFIO_INC_CHK(/include/sfio)
1010    fi
1011
1012    if test -z "$SFIO_DIR"; then
1013         AC_MSG_ERROR(Cannot find sfio.h, Please check your SFIO installation.)
1014    fi
1015
1016    SFIO_LIB_CHK(lib)
1017    SFIO_LIB_CHK(lib/sfio)
1018
1019    if test -z "$SFIO_LIBDIR"; then
1020         AC_MSG_ERROR(Cannot find sfio library, Please check your SFIO installation.)
1021    fi
1022
1023    SFIO_INC_FLAGS="-I$SFIO_INC_DIR"
1024    SFIO_LIB_FLAGS="-L$SFIO_LIBDIR -lsfio"
1025    SMTPTEST_PROGRAM="smtptest"
1026    SASL_UTIL_LIBS_EXTRA=libsfsasl2.la
1027    SASL_UTIL_HEADERS_EXTRA=sfsasl.h
1028
1029    AC_MSG_RESULT(yes)
1030 else
1031    AC_MSG_RESULT(no)
1032    SFIO_INC_FLAGS=""
1033    SFIO_LIB_FLAGS=""
1034    SMTPTEST_PROGRAM=""
1035    SASL_UTIL_LIBS_EXTRA=""
1036    SASL_UTIL_HEADERS_EXTRA=""
1037 fi
1038
1039 AC_SUBST(SFIO_INC_FLAGS)
1040 AC_SUBST(SFIO_LIB_FLAGS)
1041 AC_SUBST(SMTPTEST_PROGRAM)
1042 AC_SUBST(SASL_UTIL_LIBS_EXTRA)
1043 AC_SUBST(SASL_UTIL_HEADERS_EXTRA)
1044
1045 dnl check for getsubopt
1046 sasl_cv_getsubopt=no
1047 AC_CHECK_FUNC(getsubopt, [AC_DEFINE(HAVE_GETSUBOPT,[],
1048         [do we have getsubopt()?])], [sasl_cv_getsubopt=yes])
1049 if test $sasl_cv_getsubopt = yes; then
1050         AC_LIBOBJ(getsubopt)
1051         GETSUBOPT="getsubopt.lo"
1052 fi
1053 AC_SUBST(GETSUBOPT)
1054
1055 dnl Check for snprintf
1056 sasl_cv_snprintf=no
1057 SNPRINTFOBJS=""
1058 AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF,[],[Does the system have snprintf()?])], [sasl_cv_snprintf=yes])
1059 AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF,[],[Does the system have vsnprintf()?])], [sasl_cv_snprintf=yes])
1060 if test $sasl_cv_snprintf = yes; then
1061         AC_LIBOBJ(snprintf)
1062         SNPRINTFOBJS="snprintf.o"
1063         LTSNPRINTFOBJS="snprintf.lo"
1064 fi
1065 AC_SUBST(SNPRINTFOBJS)
1066 AC_SUBST(LTSNPRINTFOBJS)
1067
1068 dnl do we need to link in -lresolv?
1069 AC_CHECK_LIB(resolv, inet_aton)
1070
1071 dnl Check for getaddrinfo
1072 GETADDRINFOOBJS=""
1073 sasl_cv_getaddrinfo=yes
1074 IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror,
1075                 [AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo() function?])
1076                 sasl_cv_getaddrinfo=no])])
1077 if test $sasl_cv_getaddrinfo = yes; then
1078     AC_LIBOBJ(getaddrinfo)
1079     GETADDRINFOOBJS="getaddrinfo.o"
1080     LTGETADDRINFOOBJS="getaddrinfo.lo"
1081 fi
1082 AC_SUBST(GETADDRINFOOBJS)
1083 AC_SUBST(LTGETADDRINFOOBJS)
1084
1085 dnl Check for getnameinfo
1086 GETNAMEINFOOBJS=""
1087 sasl_cv_getnameinfo=no
1088 IPv6_CHECK_FUNC(getnameinfo,
1089                 [AC_DEFINE(HAVE_GETNAMEINFO,[],[Do we have a getnameinfo() function?])], [sasl_cv_getnameinfo=yes])
1090 if test $sasl_cv_getnameinfo = yes; then
1091         AC_LIBOBJ(getnameinfo)
1092         GETNAMEINFOOBJS="getnameinfo.o"
1093         LTGETNAMEINFOOBJS="getnameinfo.lo"
1094 fi
1095 AC_SUBST(GETNAMEINFOOBJS)
1096 AC_SUBST(LTGETNAMEINFOOBJS)
1097
1098 LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
1099 AC_SUBST(LTLIBOBJS)
1100
1101 AC_C_CONST
1102 AC_C_INLINE
1103 AC_TYPE_MODE_T
1104 AC_TYPE_PID_T
1105 AC_TYPE_SIGNAL
1106
1107 AC_HEADER_TIME
1108 AC_HEADER_STDC
1109 AC_HEADER_DIRENT
1110 AC_HEADER_SYS_WAIT
1111 AC_CHECK_HEADERS(des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h)
1112
1113 IPv6_CHECK_SS_FAMILY()
1114 IPv6_CHECK_SA_LEN()
1115 IPv6_CHECK_SOCKLEN_T()
1116
1117 #AC_FUNC_MEMCMP
1118 #AC_FUNC_VPRINTF
1119 AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48)
1120
1121 if test $enable_cmulocal = yes; then
1122     AC_WARN([enabling CMU local kludges])
1123     AC_DEFINE(KRB4_IGNORE_IP_ADDRESS,[],[Ignore IP Address in Kerberos 4 tickets?])
1124     AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4", [Force a preferred mechanism])
1125 fi
1126
1127 AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [
1128                 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[],[Do we have struct sockaddr_stroage?])])
1129
1130 AC_SUBST(DIRS)
1131
1132 AC_CONFIG_SUBDIRS(saslauthd)
1133
1134 AH_TOP([
1135 /* acconfig.h - autoheader configuration input */
1136 /* 
1137  * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
1138  *
1139  * Redistribution and use in source and binary forms, with or without
1140  * modification, are permitted provided that the following conditions
1141  * are met:
1142  *
1143  * 1. Redistributions of source code must retain the above copyright
1144  *    notice, this list of conditions and the following disclaimer. 
1145  *
1146  * 2. Redistributions in binary form must reproduce the above copyright
1147  *    notice, this list of conditions and the following disclaimer in
1148  *    the documentation and/or other materials provided with the
1149  *    distribution.
1150  *
1151  * 3. The name "Carnegie Mellon University" must not be used to
1152  *    endorse or promote products derived from this software without
1153  *    prior written permission. For permission or any other legal
1154  *    details, please contact  
1155  *      Office of Technology Transfer
1156  *      Carnegie Mellon University
1157  *      5000 Forbes Avenue
1158  *      Pittsburgh, PA  15213-3890
1159  *      (412) 268-4387, fax: (412) 268-7395
1160  *      tech-transfer@andrew.cmu.edu
1161  *
1162  * 4. Redistributions of any form whatsoever must retain the following
1163  *    acknowledgment:
1164  *    "This product includes software developed by Computing Services
1165  *     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
1166  *
1167  * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
1168  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1169  * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
1170  * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1171  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
1172  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
1173  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1174  */
1175
1176 #ifndef CONFIG_H
1177 #define CONFIG_H
1178 ])
1179
1180 AH_BOTTOM([
1181
1182
1183 /* Create a struct iovec if we need one */
1184 #if !defined(_WIN32) && !defined(HAVE_SYS_UIO_H)
1185 /* (win32 is handled in sasl.h) */
1186 struct iovec {
1187     char *iov_base;
1188     long iov_len;
1189 };
1190 #else
1191 #include <sys/types.h>
1192 #include <sys/uio.h>
1193 #endif
1194
1195 /* location of the random number generator */
1196 #ifdef DEV_RANDOM
1197 #undef DEV_RANDOM
1198 #endif
1199 #define DEV_RANDOM SASL_DEV_RANDOM
1200
1201 /* if we've got krb_get_err_txt, we might as well use it;
1202    especially since krb_err_txt isn't in some newer distributions
1203    (MIT Kerb for Mac 4 being a notable example). If we don't have
1204    it, we fall back to the krb_err_txt array */
1205 #ifdef HAVE_KRB_GET_ERR_TEXT
1206 #define get_krb_err_txt krb_get_err_text
1207 #else
1208 #define get_krb_err_txt(X) (krb_err_txt[(X)])
1209 #endif
1210
1211 /* Make Solaris happy... */
1212 #ifndef __EXTENSIONS__
1213 #define __EXTENSIONS__
1214 #endif
1215
1216 /* Make Linux happy... */
1217 #ifndef _GNU_SOURCE
1218 #define _GNU_SOURCE
1219 #endif
1220
1221 #ifndef HAVE___ATTRIBUTE__
1222 /* Can't use attributes... */
1223 #define __attribute__(foo)
1224 #endif
1225
1226 #define SASL_PATH_ENV_VAR "SASL_PATH"
1227 #define SASL_CONF_PATH_ENV_VAR "SASL_CONF_PATH"
1228
1229 #include <stdlib.h>
1230 #include <sys/types.h>
1231 #include <sys/socket.h>
1232 #ifndef WIN32
1233 # include <netdb.h>
1234 # ifdef HAVE_SYS_PARAM_H
1235 #  include <sys/param.h>
1236 # endif
1237 #else /* WIN32 */
1238 # include <winsock2.h>
1239 #endif /* WIN32 */
1240 #include <string.h>
1241
1242 #include <netinet/in.h>
1243
1244 #ifndef HAVE_SOCKLEN_T
1245 typedef unsigned int socklen_t;
1246 #endif /* HAVE_SOCKLEN_T */
1247
1248 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
1249 #define _SS_MAXSIZE     128     /* Implementation specific max size */
1250 #define _SS_PADSIZE     (_SS_MAXSIZE - sizeof (struct sockaddr))
1251
1252 struct sockaddr_storage {
1253         struct  sockaddr ss_sa;
1254         char            __ss_pad2[_SS_PADSIZE];
1255 };
1256 # define ss_family ss_sa.sa_family
1257 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
1258
1259 #ifndef AF_INET6
1260 /* Define it to something that should never appear */
1261 #define AF_INET6        AF_MAX
1262 #endif
1263
1264 #ifndef HAVE_GETADDRINFO
1265 #define getaddrinfo     sasl_getaddrinfo
1266 #define freeaddrinfo    sasl_freeaddrinfo
1267 #define gai_strerror    sasl_gai_strerror
1268 #endif
1269
1270 #ifndef HAVE_GETNAMEINFO
1271 #define getnameinfo     sasl_getnameinfo
1272 #endif
1273
1274 #if !defined(HAVE_GETNAMEINFO) || !defined(HAVE_GETADDRINFO)
1275 #include "gai.h"
1276 #endif
1277
1278 #ifndef AI_NUMERICHOST   /* support glibc 2.0.x */
1279 #define AI_NUMERICHOST  4
1280 #define NI_NUMERICHOST  2
1281 #define NI_NAMEREQD     4
1282 #define NI_NUMERICSERV  8
1283 #endif
1284
1285 /* Defined in RFC 1035. max strlen is only 253 due to length bytes. */
1286 #ifndef MAXHOSTNAMELEN
1287 #define        MAXHOSTNAMELEN  255
1288 #endif
1289
1290 #ifndef HAVE_SYSEXITS_H
1291 #include "exits.h"
1292 #else
1293 #include "sysexits.h"
1294 #endif
1295
1296 /* Get the correct time.h */
1297 #if TIME_WITH_SYS_TIME
1298 # include <sys/time.h>
1299 # include <time.h>
1300 #else
1301 # if HAVE_SYS_TIME_H
1302 #  include <sys/time.h>
1303 # else
1304 #  include <time.h>
1305 # endif
1306 #endif
1307
1308 #ifndef HIER_DELIMITER
1309 #define HIER_DELIMITER '/'
1310 #endif
1311
1312 #endif /* CONFIG_H */
1313 ])
1314
1315 AC_CONFIG_HEADERS(config.h)
1316
1317 AC_OUTPUT(Makefile
1318 include/Makefile
1319 sasldb/Makefile
1320 plugins/Makefile
1321 lib/Makefile
1322 utils/Makefile
1323 doc/Makefile
1324 sample/Makefile
1325 java/Makefile
1326 java/CyrusSasl/Makefile
1327 java/Test/Makefile
1328 java/javax/Makefile
1329 java/javax/security/Makefile
1330 java/javax/security/auth/Makefile
1331 java/javax/security/auth/callback/Makefile
1332 pwcheck/Makefile
1333 man/Makefile)
1334
1335 echo Configuration Complete.  Type \'make\' to build.