source: trunk/third/cyrus-sasl/configure.in @ 17977

Revision 17977, 23.7 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17976, which included commits to RCS files with non-trunk default branches.
Line 
1dnl configure.in for the SASL library
2dnl Rob Siemborski
3dnl Rob Earhart
4dnl $Id: configure.in,v 1.1.1.1 2002-10-13 18:02:19 ghudson Exp $
5dnl
6dnl Copyright (c) 2001 Carnegie Mellon University.  All rights reserved.
7dnl
8dnl Redistribution and use in source and binary forms, with or without
9dnl modification, are permitted provided that the following conditions
10dnl are met:
11dnl
12dnl 1. Redistributions of source code must retain the above copyright
13dnl    notice, this list of conditions and the following disclaimer.
14dnl
15dnl 2. Redistributions in binary form must reproduce the above copyright
16dnl    notice, this list of conditions and the following disclaimer in
17dnl    the documentation and/or other materials provided with the
18dnl    distribution.
19dnl
20dnl 3. The name "Carnegie Mellon University" must not be used to
21dnl    endorse or promote products derived from this software without
22dnl    prior written permission. For permission or any other legal
23dnl    details, please contact 
24dnl      Office of Technology Transfer
25dnl      Carnegie Mellon University
26dnl      5000 Forbes Avenue
27dnl      Pittsburgh, PA  15213-3890
28dnl      (412) 268-4387, fax: (412) 268-7395
29dnl      tech-transfer@andrew.cmu.edu
30dnl
31dnl 4. Redistributions of any form whatsoever must retain the following
32dnl    acknowledgment:
33dnl    \"This product includes software developed by Computing Services
34dnl     at Carnegie Mellon University (http://www.cmu.edu/computing/).\"
35dnl
36dnl CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
37dnl THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38dnl AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
39dnl FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
40dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
41dnl AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
42dnl OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
43dnl
44AC_INIT(lib/saslint.h)
45
46dnl use ./config.cache as the default cache file.
47dnl we require a cache file to successfully configure our build.
48if test $cache_file = "/dev/null"; then
49cache_file="./config.cache"
50AC_CACHE_LOAD
51fi
52
53AC_CONFIG_AUX_DIR(config)
54AM_CONFIG_HEADER(config.h)
55AC_CANONICAL_HOST
56
57dnl
58dnl REMINDER: When changing the version number here, please also update
59dnl the values in win32/include/config.h and include/sasl.h as well.
60dnl
61AM_INIT_AUTOMAKE(cyrus-sasl, 2.1.8)
62CMU_INIT_AUTOMAKE
63
64# and include our config dir scripts
65ACLOCAL="$ACLOCAL -I \$(top_srcdir)/config"
66
67DIRS=""
68
69AC_ARG_ENABLE(cmulocal, [  --enable-cmulocal       enable local mods for CMU [no]],,enable_cmulocal=no)
70
71AC_ARG_ENABLE(sample, [  --enable-sample         compile sample code [yes]],,enable_sample=yes)
72
73AC_PROG_CC
74AC_PROG_CPP
75AC_PROG_AWK
76AC_PROG_LN_S
77AC_PROG_MAKE_SET
78AC_PROG_RANLIB
79AC_PROG_INSTALL
80CMU_C___ATTRIBUTE__
81
82dnl check for -R, etc. switch
83CMU_GUESS_RUNPATH_SWITCH
84dnl let's just link against local.  otherwise we never find anything useful.
85if test "$ac_cv_prog_gcc" = yes; then
86  dnl xxx we should add -W at some point (but that might scare people)
87  CFLAGS="-Wall ${CFLAGS}"
88  GCC_VERSION=`gcc -v 2>&1 | sed -n -e '/version/s/.*version \([[0-9]]\)\..*/\1/p'`
89  if test "$GCC_VERSION" != "3"; then
90    CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
91  fi
92else
93  CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
94fi
95CMU_ADD_LIBPATH("/usr/local/lib")
96
97AM_DISABLE_STATIC
98
99dnl xxx compatibility
100AC_ARG_WITH(staticsasl)
101if test "$with_staticsasl" = yes; then
102        enable_shared=yes
103        enable_static=yes
104fi
105
106save_target=$target
107if test -z "$target"; then
108        target="NONE"
109fi
110
111CMU_PROG_LIBTOOL
112
113target=$save_target
114
115dnl ltconfig might not have found support for shared libs
116dnl just do static libs if so.
117if test "$ac_cv_can_build_shared" = no; then
118        enable_shared=no
119        enable_static=yes
120fi
121
122if test "$enable_static" = yes; then
123        SASL_STATIC_LIBS=libsasl2.a
124else
125        SASL_STATIC_LIBS=
126fi
127
128AC_ARG_ENABLE(staticdlopen, [  --enable-staticdlopen   try dynamic plugins when we are a static libsasl [no] ],
129                enable_staticdlopen=$enableval,
130                enable_staticdlopen=no)
131
132if test "$enable_staticdlopen" = yes; then
133  AC_DEFINE(TRY_DLOPEN_WHEN_STATIC)
134fi
135
136if test "$ac_cv_prog_gcc" = yes; then
137  CFLAGS="-Wall -W ${CFLAGS}"
138fi
139
140AC_ARG_WITH(purecov,[  --with-purecov          link with purecov])
141if test "$with_purecov" = yes; then
142  AC_CHECK_PROGS(PURECOV, purecov)
143fi
144AC_ARG_WITH(purify,[  --with-purify           link with purify])
145if test "$with_purify" = yes; then
146  AC_CHECK_PROGS(PURIFY, purify)
147fi
148
149AC_ARG_ENABLE(java, [  --enable-java           compile Java support [no]],
150        enable_java=yes, enable_java=no)
151if test "$enable_java" = yes; then
152  AC_PATH_PROG(JAVAC, javac, no)
153  AC_PATH_PROGS(JAVAH, javah kaffeh, no)
154  AC_CHECK_PROGS(JAVADOC, javadoc, :)   
155  if test "$JAVAC" = "no" -o "$JAVAH" = "no"; then
156    AC_WARN([Disabling Java support])
157    enable_java=no
158  fi
159else
160# Make distcheck work
161  JAVAC="true"
162  JAVAH="true"
163  JAVADOC="true"
164fi
165AM_CONDITIONAL(JAVA, test "$enable_java" = yes)
166
167if test "$enable_java" = yes; then
168  AC_MSG_CHECKING([JNI cpp flags])
169  AC_CACHE_VAL(sasl_cv_java_includes,[
170  if test `echo $JAVAH | sed 's,.*/,,'` = "kaffeh"; then
171    sasl_cv_java_includes=-I`echo $JAVAH | sed -e 's,/bin.*,/include/kaffe,'`
172  else
173    java_base=`echo $JAVAC | sed 's,/bin.*,'','`
174
175    AC_ARG_WITH(javabase, [  --with-javabase=PATH    set path to find jni.h in [/usr/java/include] ],
176        java_base=$withval,)
177       
178
179    sasl_cv_java_includes=''
180    for dir in `find ${java_base}/include -follow -type d -print | grep -v green_threads`; do
181      sasl_cv_java_includes="${sasl_cv_java_includes} -I$dir"
182    done
183  fi
184
185  sasl_cv_java_includes="${sasl_cv_java_includes} -I$javapath/include"])
186
187  JAVA_INCLUDES=$sasl_cv_java_includes
188  AC_SUBST(JAVA_INCLUDES)
189  AC_MSG_RESULT(ok)
190
191  JAVAROOT=".."
192  AC_SUBST(JAVAROOT)
193  JAVAC=`echo "$JAVAC" | sed 's,.*/,,'`
194  JAVAH=`echo "$JAVAH" | sed 's,.*/,,'`
195fi
196
197AM_CONDITIONAL(SAMPLE, test "$enable_sample" = yes)
198
199dnl we extracted this to config/sasldb.m4
200SASL_DB_PATH_CHECK()
201SASL_DB_CHECK()
202
203AC_CHECK_LIB(dl, dlopen, SASL_DL_LIB="-ldl", SASL_DL_LIB="")
204AC_SUBST(SASL_DL_LIB)
205
206dnl Do we need leading underscores on our symbols?
207
208AC_CHECK_PROGS(NM, nm)
209
210AC_MSG_CHECKING(for underscore before symbols)
211AC_CACHE_VAL(sasl_cv_uscore,[
212    echo "main(){int i=1;}
213    foo(){int i=6;}" > conftest.c
214    ${CC} -o a.out conftest.c > /dev/null
215    if (${NM} a.out | grep _foo) > /dev/null; then
216      sasl_cv_uscore=yes
217    else
218      sasl_cv_uscore=no
219    fi])
220AC_MSG_RESULT($sasl_cv_uscore)
221rm -f conftest.c a.out
222
223if test $sasl_cv_uscore = yes; then
224  if test $ac_cv_lib_dl_dlopen = yes ; then
225        AC_MSG_CHECKING(whether dlsym adds the underscore for us)
226        AC_CACHE_VAL(sasl_cv_dlsym_adds_uscore,AC_TRY_RUN( [
227#include <dlfcn.h>
228#include <stdio.h>
229foo() { int i=0;}
230main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
231    if(self) { ptr1=dlsym(self,"foo"); ptr2=dlsym(self,"_foo");
232    if(ptr1 && !ptr2) exit(0); } exit(1); }
233], [sasl_cv_dlsym_adds_uscore=yes], sasl_cv_dlsym_adds_uscore=no
234        AC_DEFINE(DLSYM_NEEDS_UNDERSCORE),
235        AC_MSG_WARN(cross-compiler, we'll do our best)))
236
237      AC_MSG_RESULT($sasl_cv_dlsym_adds_uscore)
238  fi
239fi
240
241dnl See if we can provide a default logging function...
242AC_CHECK_FUNCS(syslog)
243
244CMU_SOCKETS
245
246AC_ARG_WITH(pam, [  --with-pam=DIR          use PAM (rooted in DIR) [yes] ],
247        with_pam=$withval,
248        with_pam=yes)
249if test "$with_pam" != no; then
250  if test -d $with_pam; then
251    CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
252    LDFLAGS="$LDFLAGS -L${with_pam}/lib"
253  fi
254  cmu_save_LIBS="$LIBS"
255  AC_CHECK_LIB(pam, pam_start, [
256          AC_CHECK_HEADER(security/pam_appl.h,,
257                          with_pam=no)],
258                with_pam=no, $SASL_DL_LIB)
259  LIBS="$cmu_save_LIBS"
260fi
261
262AC_MSG_CHECKING(for PAM support)
263AC_MSG_RESULT($with_pam)
264LIB_PAM=""
265if test "$with_pam" != no; then
266  AC_DEFINE(HAVE_PAM)
267  LIB_PAM="-lpam"
268fi
269AC_SUBST(LIB_PAM)
270
271AC_ARG_WITH(saslauthd, [  --with-saslauthd=DIR    enable use of the saslauth daemon using state dir DIR ],
272                with_saslauthd=$withval,
273                with_saslauthd=yes)
274if test "$with_saslauthd" != no; then
275  if test "$with_saslauthd" = yes; then
276    with_saslauthd="/var/state/saslauthd"
277  fi
278  AC_DEFINE(HAVE_SASLAUTHD)
279  AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd")
280fi
281AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no)
282AC_MSG_CHECKING(if I should include saslauthd)
283AC_MSG_RESULT($with_saslauthd)
284
285AC_ARG_WITH(pwcheck,
286[  --with-pwcheck=DIR     enable deprecated pwcheck daemon using statedir DIR ],
287        with_pwcheck=$withval,
288        with_pwcheck=no)
289if test "$with_pwcheck" != no; then
290   if test "$with_pwcheck" = yes; then
291     with_pwcheck=/var/pwcheck
292   fi
293   AC_DEFINE(HAVE_PWCHECK)
294   AC_DEFINE_UNQUOTED(PWCHECKDIR, "$with_pwcheck")
295   AC_CHECK_FUNC(getspnam,PWCHECKMETH="getspnam",PWCHECKMETH="getpwnam")
296   AC_SUBST(PWCHECKMETH)
297fi
298AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no)
299AC_MSG_CHECKING(if I should include pwcheck)
300AC_MSG_RESULT($with_pwcheck)
301
302AC_ARG_WITH(ipctype, [  --with-ipctype={unix,doors}    use ipctype [unix] ],
303       with_ipctype=$withval,
304       with_ipctype="unix")
305IPCTYPE=$with_ipctype
306AC_SUBST(IPCTYPE)
307if test "$with_ipctype" = "doors"; then
308   LIBS="$LIBS -ldoor -lpthread"
309   AC_DEFINE(USE_DOORS)
310fi
311
312AC_ARG_ENABLE(alwaystrue, [  --enable-alwaystrue     enable the alwaystrue password verifier (discouraged)],
313                enable_alwaystrue=$enableval,
314                enable_alwaystrue=no)
315if test "$enable_alwaystrue" = yes; then
316  AC_DEFINE(HAVE_ALWAYSTRUE)
317fi
318AC_MSG_CHECKING(if I should include the alwaystrue verifier)
319AC_MSG_RESULT($enable_alwaystrue)
320
321dnl sasl_checkapop support
322AC_ARG_ENABLE(checkapop, [  --enable-checkapop      enable use of sasl_checkapop [yes] ],
323  checkapop=$enableval,
324  checkapop=yes)
325
326AC_MSG_CHECKING(if we should enable sasl_checkapop)
327if test "$checkapop" != no; then
328  AC_MSG_RESULT(enabled)
329  AC_DEFINE(DO_SASL_CHECKAPOP)
330else
331  AC_MSG_RESULT(disabled)
332fi
333
334dnl CRAM-MD5
335AC_ARG_ENABLE(cram, [  --enable-cram           enable CRAM-MD5 authentication [yes] ],
336  cram=$enableval,
337  cram=yes)
338
339AC_MSG_CHECKING(CRAM-MD5)
340if test "$cram" != no; then
341  AC_MSG_RESULT(enabled)
342  SASL_MECHS="$SASL_MECHS libcrammd5.la"
343  if test "$enable_static" = yes; then
344    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/cram.o"
345    AC_DEFINE(STATIC_CRAMMD5)
346  fi
347else
348  AC_MSG_RESULT(disabled)
349fi
350
351SASL_DES_CHK
352
353dnl DIGEST-MD5
354AC_ARG_ENABLE(digest, [  --enable-digest         enable DIGEST-MD5 authentication [yes] ],
355  digest=$enableval,
356  digest=yes)
357
358if test "$digest" != no; then
359  dnl In order to compile digest, we should look for need libdes.
360  if test -d $digest; then
361    CPPFLAGS="$CPPFLAGS -I$digest/include"
362    LDFLAGS="$LDFLAGS -L$digest/lib"
363  fi
364  if test "$with_des" = no; then
365    AC_WARN(No DES support for DIGEST-MD5)
366  fi
367fi
368
369AC_MSG_CHECKING(DIGEST-MD5)
370if test "$digest" != no; then
371  AC_MSG_RESULT(enabled)
372  SASL_MECHS="$SASL_MECHS libdigestmd5.la"
373  if test "$enable_static" = yes; then
374    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/digestmd5.o"
375    AC_DEFINE(STATIC_DIGESTMD5)
376  fi
377else
378  AC_MSG_RESULT(disabled)
379fi
380
381dnl Test for OpenSSL (required for OTP, SRP and NTLM)
382AC_ARG_WITH(with-openssl,[  --with-openssl=PATH     use OpenSSL from PATH],
383        with_openssl="${withval}")
384
385case "$with_openssl" in
386        no) with_openssl="no";;
387        ""|yes)
388          dnl if openssl has been compiled with the rsaref2 libraries,
389          dnl we need to include the rsaref libraries in the crypto check
390                LIB_RSAREF=""
391                AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
392                       LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes,
393                       cmu_have_rsaref=no)
394
395                AC_CHECK_HEADER(openssl/evp.h, [
396                        AC_CHECK_LIB(crypto, EVP_DigestInit,
397                                        with_openssl="yes",
398                                        with_openssl="no", $LIB_RSAREF)],
399                        with_openssl=no)
400                ;;
401        *)
402                if test -d $with_openssl; then
403                  CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include"
404                  LDFLAGS="${LDFLAGS} -L${with_openssl}/lib"
405                else
406                  with_openssl="no"
407                fi
408                ;;
409esac
410
411AC_MSG_CHECKING(for OpenSSL)
412AC_MSG_RESULT($with_openssl)
413
414dnl OTP
415AC_ARG_ENABLE(otp, [  --enable-otp            enable OTP authentication [yes] ],
416  otp=$enableval,
417  otp=yes)
418
419if test "$with_openssl" = no; then
420  AC_WARN([OpenSSL not found -- OTP will be disabled])
421  otp=no
422fi
423
424AC_MSG_CHECKING(OTP)
425if test "$otp" != no; then
426  AC_MSG_RESULT(enabled)
427  OTP_LIBS="-lcrypto $LIB_RSAREF"
428
429  SASL_MECHS="$SASL_MECHS libotp.la"
430  if test "$enable_static" = yes; then
431    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/otp.o"
432    AC_DEFINE(STATIC_OTP)
433  fi
434
435  dnl Test for OPIE
436  AC_ARG_WITH(with-opie,[  --with-opie=PATH        use OPIE (One Time Passwords in Everything) from PATH],
437        with_opie="${withval}")
438
439  case "$with_opie" in
440        ""|yes)
441                AC_CHECK_LIB(opie, opiechallenge, [
442                        AC_CHECK_HEADER(opie.h, with_opie="yes",
443                                        with_opie="no")],
444                        with_opie="no")
445                ;;
446        *)
447                if test -d $with_opie; then
448                  CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
449                  LDFLAGS="${LDFLAGS} -L${with_opie}/lib"
450                else
451                  with_opie="no"
452                fi
453                ;;
454  esac
455
456  AC_MSG_CHECKING(for OPIE)
457  AC_MSG_RESULT($with_opie)
458
459  if test "$with_opie" != no; then
460    AC_DEFINE(HAVE_OPIE)
461    OTP_LIBS="$OTP_LIBS -lopie"
462  else
463    OTP_LIBS="$OTP_LIBS ../sasldb/libsasldb.la \$(SASL_DB_LIB)"
464  fi
465
466  AC_SUBST(OTP_LIBS)
467
468else
469  AC_MSG_RESULT(disabled)
470fi
471
472dnl SRP
473AC_ARG_ENABLE(srp, [  --enable-srp            enable SRP authentication [no] ],
474  srp=$enableval,
475  srp=no)
476
477if test "$with_openssl" = no; then
478  AC_WARN([OpenSSL not found -- SRP will be disabled])
479  srp=no
480fi
481
482AC_MSG_CHECKING(SRP)
483if test "$srp" != no; then
484  AC_MSG_RESULT(enabled)
485  SRP_LIBS="-lcrypto $LIB_RSAREF"
486
487  SASL_MECHS="$SASL_MECHS libsrp.la"
488  if test "$enable_static" = yes; then
489    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/srp.o"
490    AC_DEFINE(STATIC_SRP)
491  fi
492
493dnl srp_setpass support
494  AC_ARG_ENABLE(srp_setpass, [  --enable-srp-setpass    enable setting SRP secrets with saslpasswd [no]],
495      srp_setpass=$enableval,
496      srp_setpass=no)
497
498  AC_MSG_CHECKING(if we should enable setting SRP secrets with saslpasswd)
499  if test "$srp_setpass" != no; then
500    AC_MSG_RESULT(enabled)
501    AC_DEFINE(DO_SRP_SETPASS)
502    SRP_LIBS="$SRP_LIBS ../sasldb/libsasldb.la \$(SASL_DB_LIB)"
503  else
504    AC_MSG_RESULT(disabled)
505  fi
506
507  AC_SUBST(SRP_LIBS)
508else
509  AC_MSG_RESULT(disabled)
510fi
511
512SASL_KERBEROS_V4_CHK
513SASL_GSSAPI_CHK
514SASL_PLAIN_CHK
515
516if test "$gssapi" != "no"; then
517  AC_DEFINE(STATIC_GSSAPIV2)
518fi
519
520dnl ANONYMOUS
521AC_ARG_ENABLE(anon, [  --enable-anon           enable ANONYMOUS authentication [yes] ],
522  anon=$enableval,
523  anon=yes)
524
525AC_MSG_CHECKING(ANONYMOUS)
526if test "$anon" != no; then
527  AC_MSG_RESULT(enabled)
528  SASL_MECHS="$SASL_MECHS libanonymous.la"
529  if test "$enable_static" = yes; then
530    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/anonymous.o"
531    AC_DEFINE(STATIC_ANONYMOUS)
532  fi
533else
534  AC_MSG_RESULT(disabled)
535fi
536
537dnl LOGIN
538AC_ARG_ENABLE(login, [  --enable-login          enable unsupported LOGIN authentication [no] ],
539  login=$enableval,
540  login=no)
541
542AC_MSG_CHECKING(LOGIN)
543if test "$login" != no; then
544  AC_MSG_RESULT(enabled)
545  SASL_MECHS="$SASL_MECHS liblogin.la"
546  if test "$enable_static" = yes; then
547    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/login.o"
548    AC_DEFINE(STATIC_LOGIN)
549  fi
550else
551  AC_MSG_RESULT(disabled)
552fi
553
554dnl NTLM
555AC_ARG_ENABLE(ntlm, [  --enable-ntlm           enable unsupported NTLM authentication [no] ],
556  ntlm=$enableval,
557  ntlm=no)
558
559if test "$with_openssl" = no; then
560  AC_WARN([OpenSSL not found -- NTLM will be disabled])
561  ntlm=no
562fi
563
564AC_MSG_CHECKING(NTLM)
565if test "$ntlm" != no; then
566  AC_MSG_RESULT(enabled)
567  NTLM_LIBS="-lcrypto $LIB_RSAREF"
568  AC_SUBST(NTLM_LIBS)
569
570  SASL_MECHS="$SASL_MECHS libntlm.la"
571  if test "$enable_static" = yes; then
572    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/ntlm.o"
573    AC_DEFINE(STATIC_NTLM)
574  fi
575else
576  AC_MSG_RESULT(disabled)
577fi
578
579
580# make the option show up so people don't whine that it is only in the
581# saslauthd configure script --help
582AC_ARG_WITH(ldap,   [  --with-ldap=DIR         use LDAP (in DIR) for saslauthd (experimental) [no] ],,)
583
584
585############################################################################
586# Simon Loader tries to do auto conf
587dnl MySQL
588AC_ARG_WITH(mysql,  [  --with-mysql=PATH       enable authentication against a MySQL db                                        (experimental) [no] ],
589  with_mysql=$withval,
590  with_mysql=no)
591
592# find location of library
593# presuing if one given then correct
594if test "${with_mysql}" = "yes"; then
595  for mysqlloc in lib/mysql lib mysql/lib
596  do
597    if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then
598      with_mysql="${prefix}"
599      break
600    elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then
601      with_mysql="/usr/local"
602      break
603    elif test -f /usr/${mysqlloc}/libmysqlclient.a; then
604      with_mysql="/usr"
605      break
606    fi
607  done
608fi
609
610LIB_MYSQL=""
611
612case "$with_mysql" in
613    no) true;;
614    *)
615     if test -d ${with_mysql}/lib/mysql; then
616         LIB_MYSQL="-L${with_mysql}/lib/mysql"
617     elif test -d ${with_mysql}/mysql/lib; then
618         LIB_MYSQL="-L${with_mysql}/mysql/lib"
619     elif test -d ${with_mysql}/lib; then
620         LIB_MYSQL="-L${with_mysql}/lib"
621     else
622         LIB_MYSQL="-L${with_mysql}"
623     fi
624
625     LIB_MYSQL_DIR=$LIB_MYSQL
626     LIB_MYSQL="$LIB_MYSQL -lmysqlclient"
627
628     if test -d ${with_mysql}/include/mysql; then
629         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql"
630     elif test -d ${with_mysql}/mysql/include; then
631         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/mysql/include"
632     elif test -d ${with_mysql}/include; then
633         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include"
634     else
635         CPPFLAGS="${CPPFLAGS} -I${with_mysql}"
636     fi
637       AC_CHECK_LIB(mysqlclient, mysql_select_db,[
638           SASL_MECHS="$SASL_MECHS libmysql.la"
639           if test "$enable_static" = yes; then
640               SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/mysql.o"
641               AC_DEFINE(STATIC_MYSQL)
642           fi
643           ],
644           [AC_ERROR([MYSQL libarary mysqlclient not found])], $LIB_MYSQL_DIR);;
645         
646esac
647AC_SUBST(LIB_MYSQL)
648
649# simon finishes trying to do autoconf
650###############################################################################
651
652if test "$ac_cv_can_build_shared" = yes; then
653        AC_DEFINE(DO_DLOPEN)
654fi
655
656AC_SUBST(SASL_MECHS)
657AC_SUBST(SASL_STATIC_OBJS)
658AC_SUBST(SASL_STATIC_LIBS)
659
660AC_ARG_WITH(plugindir, [  --with-plugindir=DIR    set the directory where plugins will
661                          be found [/usr/lib/sasl2] ],
662  plugindir=$withval,
663  plugindir=/usr/lib/sasl2)
664AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir")
665AC_SUBST(plugindir)
666
667dnl look for rc4 libraries. we accept the CMU one or one from openSSL
668AC_ARG_WITH(rc4, [  --with-rc4              use internal rc4 routines [yes] ],
669        with_rc4=$withval,
670        with_rc4=yes)
671
672if test "$with_rc4" != no; then
673    AC_DEFINE(WITH_RC4)
674fi
675
676building_for_macosx=no
677case "$host_os" in
678        darwin*)
679            building_for_macosx=yes
680        ;;
681esac
682AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes)
683
684dnl dmalloc tests
685AC_MSG_CHECKING(for dmalloc library)
686AC_ARG_WITH(dmalloc, [  --with-dmalloc=DIR      with DMALLOC support (for test applications) [no] ],
687        with_dmalloc=$withval,
688        with_dmalloc=no)
689
690DMALLOC_LIBS=""
691
692if test "$with_dmalloc" != "no"; then
693   if test "$with_dmalloc" = "yes"; then
694        with_dmalloc="/usr/local"
695   fi
696
697   if test -r "$with_dmalloc/libdmalloc.a"; then
698        DMALLOC_LIBS="$with_dmalloc/libdmalloc.a"
699        AC_DEFINE(WITH_DMALLOC)
700        AC_MSG_RESULT(yes)
701   elif test -r "$with_dmalloc/lib/libdmalloc.a"; then
702        DMALLOC_LIBS="$with_dmalloc/lib/libdmalloc.a"
703        AC_DEFINE(WITH_DMALLOC)
704        AC_MSG_RESULT(yes)
705   else
706        AC_MSG_ERROR(cannot find dmalloc library, please check your installation.)
707   fi
708else
709   AC_MSG_RESULT(no)
710fi
711
712AC_SUBST(DMALLOC_LIBS)
713
714dnl sfio tests
715AC_MSG_CHECKING(for sfio library)
716AC_ARG_WITH(sfio, [  --with-sfio=DIR         with SFIO support (for smtptest/libsfsasl) [no] ],
717        with_sfio=$withval,
718        with_sfio=no)
719
720if test "$with_sfio" != "no"; then
721   if test "$with_sfio" = "yes"; then
722        with_sfio="/usr/local"
723   fi
724
725   AC_DEFUN(SFIO_INC_CHK,
726        [if test -r "$with_sfio$1/sfio.h"; then SFIO_DIR=$with_sfio;
727                                              SFIO_INC_DIR=$with_sfio$1])
728
729   AC_DEFUN(SFIO_LIB_CHK,[
730                str="$SFIO_DIR/$1/libsfio.*"
731                for i in `echo $str`; do
732                        if test -r $i; then
733                                SFIO_LIBDIR=$SFIO_DIR/$1
734                                break 2
735                        fi
736                done
737                ])
738
739   SFIO_INC_CHK()
740   el[]SFIO_INC_CHK(/include)
741   el[]SFIO_INC_CHK(/include/sfio)
742   fi
743
744   if test -z "$SFIO_DIR"; then
745        AC_MSG_ERROR(Cannot find sfio.h, Please check your SFIO installation.)
746   fi
747
748   SFIO_LIB_CHK(lib)
749   SFIO_LIB_CHK(lib/sfio)
750
751   if test -z "$SFIO_LIBDIR"; then
752        AC_MSG_ERROR(Cannot find sfio library, Please check your SFIO installation.)
753   fi
754
755   SFIO_INC_FLAGS="-I$SFIO_INC_DIR"
756   SFIO_LIB_FLAGS="-L$SFIO_LIBDIR -lsfio"
757   SMTPTEST_PROGRAM="smtptest"
758   SASL_UTIL_LIBS_EXTRA=libsfsasl2.la
759   SASL_UTIL_HEADERS_EXTRA=sfsasl.h
760
761   AC_MSG_RESULT(yes)
762else
763   AC_MSG_RESULT(no)
764   SFIO_INC_FLAGS=""
765   SFIO_LIB_FLAGS=""
766   SMTPTEST_PROGRAM=""
767   SASL_UTIL_LIBS_EXTRA=""
768   SASL_UTIL_HEADERS_EXTRA=""
769fi
770
771AC_SUBST(SFIO_INC_FLAGS)
772AC_SUBST(SFIO_LIB_FLAGS)
773AC_SUBST(SMTPTEST_PROGRAM)
774AC_SUBST(SASL_UTIL_LIBS_EXTRA)
775AC_SUBST(SASL_UTIL_HEADERS_EXTRA)
776
777dnl Backwards compatibility with autoconf 2.13
778ifdef([m4_pattern_allow],[m4_pattern_allow([^LIBOBJS$])])
779
780dnl check for getsubopt
781sasl_cv_getsubopt=no
782AC_CHECK_FUNC(getsubopt, [AC_DEFINE(HAVE_GETSUBOPT)], [sasl_cv_getsubopt=yes])
783if test $sasl_cv_getsubopt = yes; then
784        LIBOBJS="$LIBOBJS getsubopt.o"
785        GETSUBOPT="getsubopt.lo"
786fi
787AC_SUBST(GETSUBOPT)
788
789dnl Check for snprintf
790sasl_cv_snprintf=no
791SNPRINTFOBJS=""
792AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)], [sasl_cv_snprintf=yes])
793AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)], [sasl_cv_snprintf=yes])
794if test $sasl_cv_snprintf = yes; then
795        LIBOBJS="$LIBOBJS snprintf.o"
796        SNPRINTFOBJS="snprintf.o"
797        LTSNPRINTFOBJS="snprintf.lo"
798fi
799AC_SUBST(SNPRINTFOBJS)
800AC_SUBST(LTSNPRINTFOBJS)
801
802dnl do we need to link in -lresolv?
803AC_CHECK_LIB(resolv, inet_aton)
804
805dnl Check for getaddrinfo
806GETADDRINFOOBJS=""
807sasl_cv_getaddrinfo=yes
808IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror,
809                [AC_DEFINE(HAVE_GETADDRINFO)
810                sasl_cv_getaddrinfo=no])])
811if test $sasl_cv_getaddrinfo = yes; then
812    LIBOBJS="$LIBOBJS getaddrinfo.o"
813    GETADDRINFOOBJS="getaddrinfo.o"
814    LTGETADDRINFOOBJS="getaddrinfo.lo"
815fi
816AC_SUBST(GETADDRINFOOBJS)
817AC_SUBST(LTGETADDRINFOOBJS)
818
819dnl Check for getnameinfo
820GETNAMEINFOOBJS=""
821sasl_cv_getnameinfo=no
822IPv6_CHECK_FUNC(getnameinfo,
823                [AC_DEFINE(HAVE_GETNAMEINFO)], [sasl_cv_getnameinfo=yes])
824if test $sasl_cv_getnameinfo = yes; then
825        LIBOBJS="$LIBOBJS getnameinfo.o"
826        GETNAMEINFOOBJS="getnameinfo.o"
827        LTGETNAMEINFOOBJS="getnameinfo.lo"
828fi
829AC_SUBST(GETNAMEINFOOBJS)
830AC_SUBST(LTGETNAMEINFOOBJS)
831
832LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
833AC_SUBST(LIBOBJS)
834AC_SUBST(LTLIBOBJS)
835
836AC_C_CONST
837AC_C_INLINE
838AC_TYPE_MODE_T
839AC_TYPE_PID_T
840AC_TYPE_SIGNAL
841
842AC_HEADER_TIME
843AC_HEADER_STDC
844AC_HEADER_DIRENT
845AC_HEADER_SYS_WAIT
846AC_CHECK_HEADERS(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)
847
848IPv6_CHECK_SS_FAMILY()
849IPv6_CHECK_SA_LEN()
850IPv6_CHECK_SOCKLEN_T()
851
852#AC_FUNC_MEMCMP
853#AC_FUNC_VPRINTF
854AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48)
855
856if test $enable_cmulocal = yes; then
857    AC_WARN([enabling CMU local kludges])
858    AC_DEFINE(KRB4_IGNORE_IP_ADDRESS)
859    AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4")
860fi
861
862AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [
863                AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)])
864
865AC_SUBST(DIRS)
866
867AC_CONFIG_SUBDIRS(saslauthd)
868
869AC_OUTPUT(Makefile
870include/Makefile
871sasldb/Makefile
872plugins/Makefile
873lib/Makefile
874utils/Makefile
875doc/Makefile
876sample/Makefile
877java/Makefile
878java/CyrusSasl/Makefile
879java/Test/Makefile
880java/javax/Makefile
881java/javax/security/Makefile
882java/javax/security/auth/Makefile
883java/javax/security/auth/callback/Makefile
884pwcheck/Makefile
885man/Makefile)
886
887echo Configuration Complete.  Type \'make\' to build.
Note: See TracBrowser for help on using the repository browser.