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

Revision 18842, 22.9 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18841, 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.2 2003-02-12 22:34:21 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.12)
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=`$CC -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 call before we do the berkeley DB checks
200CMU_SOCKETS
201
202dnl we extracted this to config/sasldb.m4
203SASL_DB_PATH_CHECK()
204SASL_DB_CHECK()
205
206AC_CHECK_LIB(dl, dlopen, SASL_DL_LIB="-ldl", SASL_DL_LIB="")
207AC_SUBST(SASL_DL_LIB)
208
209dnl Do we need leading underscores on our symbols?
210
211AC_CHECK_PROGS(NM, nm)
212
213AC_MSG_CHECKING(for underscore before symbols)
214AC_CACHE_VAL(sasl_cv_uscore,[
215    echo "main(){int i=1;}
216    foo(){int i=6;}" > conftest.c
217    ${CC} -o a.out conftest.c > /dev/null
218    if (${NM} a.out | grep _foo) > /dev/null; then
219      sasl_cv_uscore=yes
220    else
221      sasl_cv_uscore=no
222    fi])
223AC_MSG_RESULT($sasl_cv_uscore)
224rm -f conftest.c a.out
225
226if test $sasl_cv_uscore = yes; then
227  if test $ac_cv_lib_dl_dlopen = yes ; then
228        AC_MSG_CHECKING(whether dlsym adds the underscore for us)
229        AC_CACHE_VAL(sasl_cv_dlsym_adds_uscore,AC_TRY_RUN( [
230#include <dlfcn.h>
231#include <stdio.h>
232foo() { int i=0;}
233main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
234    if(self) { ptr1=dlsym(self,"foo"); ptr2=dlsym(self,"_foo");
235    if(ptr1 && !ptr2) exit(0); } exit(1); }
236], [sasl_cv_dlsym_adds_uscore=yes], sasl_cv_dlsym_adds_uscore=no
237        AC_DEFINE(DLSYM_NEEDS_UNDERSCORE),
238        AC_MSG_WARN(cross-compiler, we'll do our best)))
239
240      AC_MSG_RESULT($sasl_cv_dlsym_adds_uscore)
241  fi
242fi
243
244dnl See if we can provide a default logging function...
245AC_CHECK_FUNCS(syslog)
246
247AC_ARG_WITH(pam, [  --with-pam=DIR          use PAM (rooted in DIR) [yes] ],
248        with_pam=$withval,
249        with_pam=yes)
250if test "$with_pam" != no; then
251  if test -d $with_pam; then
252    CPPFLAGS="$CPPFLAGS -I${with_pam}/include"
253    LDFLAGS="$LDFLAGS -L${with_pam}/lib"
254  fi
255  cmu_save_LIBS="$LIBS"
256  AC_CHECK_LIB(pam, pam_start, [
257          AC_CHECK_HEADER(security/pam_appl.h,,
258                          with_pam=no)],
259                with_pam=no, $SASL_DL_LIB)
260  LIBS="$cmu_save_LIBS"
261fi
262
263AC_MSG_CHECKING(for PAM support)
264AC_MSG_RESULT($with_pam)
265LIB_PAM=""
266if test "$with_pam" != no; then
267  AC_DEFINE(HAVE_PAM)
268  LIB_PAM="-lpam"
269fi
270AC_SUBST(LIB_PAM)
271
272AC_ARG_WITH(saslauthd, [  --with-saslauthd=DIR    enable use of the saslauth daemon using state dir DIR ],
273                with_saslauthd=$withval,
274                with_saslauthd=yes)
275if test "$with_saslauthd" != no; then
276  if test "$with_saslauthd" = yes; then
277    with_saslauthd="/var/state/saslauthd"
278  fi
279  AC_DEFINE(HAVE_SASLAUTHD)
280  AC_DEFINE_UNQUOTED(PATH_SASLAUTHD_RUNDIR, "$with_saslauthd")
281fi
282AM_CONDITIONAL(SASLAUTHD, test "$with_saslauthd" != no)
283AC_MSG_CHECKING(if I should include saslauthd)
284AC_MSG_RESULT($with_saslauthd)
285
286AC_ARG_WITH(pwcheck,
287[  --with-pwcheck=DIR     enable deprecated pwcheck daemon using statedir DIR ],
288        with_pwcheck=$withval,
289        with_pwcheck=no)
290if test "$with_pwcheck" != no; then
291   if test "$with_pwcheck" = yes; then
292     with_pwcheck=/var/pwcheck
293   fi
294   AC_DEFINE(HAVE_PWCHECK)
295   AC_DEFINE_UNQUOTED(PWCHECKDIR, "$with_pwcheck")
296   AC_CHECK_FUNC(getspnam,PWCHECKMETH="getspnam",PWCHECKMETH="getpwnam")
297   AC_SUBST(PWCHECKMETH)
298fi
299AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no)
300AC_MSG_CHECKING(if I should include pwcheck)
301AC_MSG_RESULT($with_pwcheck)
302
303AC_ARG_WITH(ipctype, [  --with-ipctype={unix,doors}    use ipctype [unix] ],
304       with_ipctype=$withval,
305       with_ipctype="unix")
306IPCTYPE=$with_ipctype
307AC_SUBST(IPCTYPE)
308if test "$with_ipctype" = "doors"; then
309   LIBS="$LIBS -ldoor -lpthread"
310   AC_DEFINE(USE_DOORS)
311fi
312
313AC_ARG_ENABLE(alwaystrue, [  --enable-alwaystrue     enable the alwaystrue password verifier (discouraged)],
314                enable_alwaystrue=$enableval,
315                enable_alwaystrue=no)
316if test "$enable_alwaystrue" = yes; then
317  AC_DEFINE(HAVE_ALWAYSTRUE)
318fi
319AC_MSG_CHECKING(if I should include the alwaystrue verifier)
320AC_MSG_RESULT($enable_alwaystrue)
321
322dnl sasl_checkapop support
323AC_ARG_ENABLE(checkapop, [  --enable-checkapop      enable use of sasl_checkapop [yes] ],
324  checkapop=$enableval,
325  checkapop=yes)
326
327AC_MSG_CHECKING(if we should enable sasl_checkapop)
328if test "$checkapop" != no; then
329  AC_MSG_RESULT(enabled)
330  AC_DEFINE(DO_SASL_CHECKAPOP)
331else
332  AC_MSG_RESULT(disabled)
333fi
334
335dnl CRAM-MD5
336AC_ARG_ENABLE(cram, [  --enable-cram           enable CRAM-MD5 authentication [yes] ],
337  cram=$enableval,
338  cram=yes)
339
340AC_MSG_CHECKING(CRAM-MD5)
341if test "$cram" != no; then
342  AC_MSG_RESULT(enabled)
343  SASL_MECHS="$SASL_MECHS libcrammd5.la"
344  if test "$enable_static" = yes; then
345    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/cram.o"
346    AC_DEFINE(STATIC_CRAMMD5)
347  fi
348else
349  AC_MSG_RESULT(disabled)
350fi
351
352SASL_DES_CHK
353
354dnl DIGEST-MD5
355AC_ARG_ENABLE(digest, [  --enable-digest         enable DIGEST-MD5 authentication [yes] ],
356  digest=$enableval,
357  digest=yes)
358
359if test "$digest" != no; then
360  dnl In order to compile digest, we should look for need libdes.
361  if test -d $digest; then
362    CPPFLAGS="$CPPFLAGS -I$digest/include"
363    LDFLAGS="$LDFLAGS -L$digest/lib"
364  fi
365  if test "$with_des" = no; then
366    AC_WARN(No DES support for DIGEST-MD5)
367  fi
368fi
369
370AC_MSG_CHECKING(DIGEST-MD5)
371if test "$digest" != no; then
372  AC_MSG_RESULT(enabled)
373  SASL_MECHS="$SASL_MECHS libdigestmd5.la"
374  if test "$enable_static" = yes; then
375    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/digestmd5.o"
376    AC_DEFINE(STATIC_DIGESTMD5)
377  fi
378else
379  AC_MSG_RESULT(disabled)
380fi
381
382CMU_HAVE_OPENSSL
383AC_MSG_CHECKING(for OpenSSL)
384AC_MSG_RESULT($with_openssl)
385
386dnl OTP
387AC_ARG_ENABLE(otp, [  --enable-otp            enable OTP authentication [yes] ],
388  otp=$enableval,
389  otp=yes)
390
391if test "$with_openssl" = no; then
392  AC_WARN([OpenSSL not found -- OTP will be disabled])
393  otp=no
394fi
395
396AC_MSG_CHECKING(OTP)
397if test "$otp" != no; then
398  AC_MSG_RESULT(enabled)
399  OTP_LIBS="-lcrypto $LIB_RSAREF"
400
401  SASL_MECHS="$SASL_MECHS libotp.la"
402  if test "$enable_static" = yes; then
403    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/otp.o"
404    AC_DEFINE(STATIC_OTP)
405  fi
406
407  dnl Test for OPIE
408  AC_ARG_WITH(with-opie,[  --with-opie=PATH        use OPIE (One Time Passwords in Everything) from PATH],
409        with_opie="${withval}")
410
411  case "$with_opie" in
412        ""|yes)
413                AC_CHECK_LIB(opie, opiechallenge, [
414                        AC_CHECK_HEADER(opie.h, with_opie="yes",
415                                        with_opie="no")],
416                        with_opie="no")
417                ;;
418        *)
419                if test -d $with_opie; then
420                  CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
421                  LDFLAGS="${LDFLAGS} -L${with_opie}/lib"
422                else
423                  with_opie="no"
424                fi
425                ;;
426  esac
427
428  AC_MSG_CHECKING(for OPIE)
429  AC_MSG_RESULT($with_opie)
430
431  if test "$with_opie" != no; then
432    AC_DEFINE(HAVE_OPIE)
433    OTP_LIBS="$OTP_LIBS -lopie"
434  else
435    OTP_LIBS="$OTP_LIBS ../sasldb/libsasldb.la \$(SASL_DB_LIB)"
436  fi
437
438  AC_SUBST(OTP_LIBS)
439
440else
441  AC_MSG_RESULT(disabled)
442fi
443
444dnl SRP
445AC_ARG_ENABLE(srp, [  --enable-srp            enable SRP authentication [no] ],
446  srp=$enableval,
447  srp=no)
448
449if test "$with_openssl" = no; then
450  AC_WARN([OpenSSL not found -- SRP will be disabled])
451  srp=no
452fi
453
454AC_MSG_CHECKING(SRP)
455if test "$srp" != no; then
456  AC_MSG_RESULT(enabled)
457  SRP_LIBS="-lcrypto $LIB_RSAREF"
458
459  SASL_MECHS="$SASL_MECHS libsrp.la"
460  if test "$enable_static" = yes; then
461    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/srp.o"
462    AC_DEFINE(STATIC_SRP)
463  fi
464
465dnl srp_setpass support
466  AC_ARG_ENABLE(srp_setpass, [  --enable-srp-setpass    enable setting SRP secrets with saslpasswd [no]],
467      srp_setpass=$enableval,
468      srp_setpass=no)
469
470  AC_MSG_CHECKING(if we should enable setting SRP secrets with saslpasswd)
471  if test "$srp_setpass" != no; then
472    AC_MSG_RESULT(enabled)
473    AC_DEFINE(DO_SRP_SETPASS)
474    SRP_LIBS="$SRP_LIBS ../sasldb/libsasldb.la \$(SASL_DB_LIB)"
475  else
476    AC_MSG_RESULT(disabled)
477  fi
478
479  AC_SUBST(SRP_LIBS)
480else
481  AC_MSG_RESULT(disabled)
482fi
483
484SASL_KERBEROS_V4_CHK
485SASL_GSSAPI_CHK
486SASL_PLAIN_CHK
487
488if test "$gssapi" != "no"; then
489  AC_DEFINE(STATIC_GSSAPIV2)
490fi
491
492dnl ANONYMOUS
493AC_ARG_ENABLE(anon, [  --enable-anon           enable ANONYMOUS authentication [yes] ],
494  anon=$enableval,
495  anon=yes)
496
497AC_MSG_CHECKING(ANONYMOUS)
498if test "$anon" != no; then
499  AC_MSG_RESULT(enabled)
500  SASL_MECHS="$SASL_MECHS libanonymous.la"
501  if test "$enable_static" = yes; then
502    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/anonymous.o"
503    AC_DEFINE(STATIC_ANONYMOUS)
504  fi
505else
506  AC_MSG_RESULT(disabled)
507fi
508
509dnl LOGIN
510AC_ARG_ENABLE(login, [  --enable-login          enable unsupported LOGIN authentication [no] ],
511  login=$enableval,
512  login=no)
513
514AC_MSG_CHECKING(LOGIN)
515if test "$login" != no; then
516  AC_MSG_RESULT(enabled)
517  SASL_MECHS="$SASL_MECHS liblogin.la"
518  if test "$enable_static" = yes; then
519    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/login.o"
520    AC_DEFINE(STATIC_LOGIN)
521  fi
522else
523  AC_MSG_RESULT(disabled)
524fi
525
526dnl NTLM
527AC_ARG_ENABLE(ntlm, [  --enable-ntlm           enable unsupported NTLM authentication [no] ],
528  ntlm=$enableval,
529  ntlm=no)
530
531if test "$with_openssl" = no; then
532  AC_WARN([OpenSSL not found -- NTLM will be disabled])
533  ntlm=no
534fi
535
536AC_MSG_CHECKING(NTLM)
537if test "$ntlm" != no; then
538  AC_MSG_RESULT(enabled)
539  NTLM_LIBS="-lcrypto $LIB_RSAREF"
540  AC_SUBST(NTLM_LIBS)
541
542  SASL_MECHS="$SASL_MECHS libntlm.la"
543  if test "$enable_static" = yes; then
544    SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/ntlm.o"
545    AC_DEFINE(STATIC_NTLM)
546  fi
547else
548  AC_MSG_RESULT(disabled)
549fi
550
551
552# make the option show up so people don't whine that it is only in the
553# saslauthd configure script --help
554AC_ARG_WITH(ldap,   [  --with-ldap=DIR         use LDAP (in DIR) for saslauthd (experimental) [no] ],,)
555
556
557############################################################################
558# Simon Loader tries to do auto conf
559dnl MySQL
560AC_ARG_WITH(mysql,  [  --with-mysql=PATH       enable authentication against a MySQL db                                        (experimental) [no] ],
561  with_mysql=$withval,
562  with_mysql=no)
563
564# find location of library
565# presuing if one given then correct
566if test "${with_mysql}" = "yes"; then
567  for mysqlloc in lib/mysql lib mysql/lib
568  do
569    if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then
570      with_mysql="${prefix}"
571      break
572    elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then
573      with_mysql="/usr/local"
574      break
575    elif test -f /usr/${mysqlloc}/libmysqlclient.a; then
576      with_mysql="/usr"
577      break
578    fi
579  done
580fi
581
582LIB_MYSQL=""
583
584case "$with_mysql" in
585    no) true;;
586    *)
587     if test -d ${with_mysql}/lib/mysql; then
588         LIB_MYSQL="-L${with_mysql}/lib/mysql"
589     elif test -d ${with_mysql}/mysql/lib; then
590         LIB_MYSQL="-L${with_mysql}/mysql/lib"
591     elif test -d ${with_mysql}/lib; then
592         LIB_MYSQL="-L${with_mysql}/lib"
593     else
594         LIB_MYSQL="-L${with_mysql}"
595     fi
596
597     LIB_MYSQL_DIR=$LIB_MYSQL
598     LIB_MYSQL="$LIB_MYSQL -lmysqlclient"
599
600     if test -d ${with_mysql}/include/mysql; then
601         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql"
602     elif test -d ${with_mysql}/mysql/include; then
603         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/mysql/include"
604     elif test -d ${with_mysql}/include; then
605         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include"
606     else
607         CPPFLAGS="${CPPFLAGS} -I${with_mysql}"
608     fi
609       AC_CHECK_LIB(mysqlclient, mysql_select_db,[
610           SASL_MECHS="$SASL_MECHS libmysql.la"
611           if test "$enable_static" = yes; then
612               SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/mysql.o"
613               AC_DEFINE(STATIC_MYSQL)
614           fi
615           ],
616           [AC_ERROR([MYSQL libarary mysqlclient not found])], $LIB_MYSQL_DIR);;
617         
618esac
619AC_SUBST(LIB_MYSQL)
620
621# simon finishes trying to do autoconf
622###############################################################################
623
624if test "$ac_cv_can_build_shared" = yes; then
625        AC_DEFINE(DO_DLOPEN)
626fi
627
628AC_SUBST(SASL_MECHS)
629AC_SUBST(SASL_STATIC_OBJS)
630AC_SUBST(SASL_STATIC_LIBS)
631
632AC_ARG_WITH(plugindir, [  --with-plugindir=DIR    set the directory where plugins will
633                          be found [/usr/lib/sasl2] ],
634  plugindir=$withval,
635  plugindir=/usr/lib/sasl2)
636AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir")
637AC_SUBST(plugindir)
638
639dnl look for rc4 libraries. we accept the CMU one or one from openSSL
640AC_ARG_WITH(rc4, [  --with-rc4              use internal rc4 routines [yes] ],
641        with_rc4=$withval,
642        with_rc4=yes)
643
644if test "$with_rc4" != no; then
645    AC_DEFINE(WITH_RC4)
646fi
647
648building_for_macosx=no
649case "$host_os" in
650        darwin*)
651            building_for_macosx=yes
652        ;;
653esac
654AM_CONDITIONAL(MACOSX, test "$building_for_macosx" = yes)
655
656dnl dmalloc tests
657AC_MSG_CHECKING(for dmalloc library)
658AC_ARG_WITH(dmalloc, [  --with-dmalloc=DIR      with DMALLOC support (for test applications) [no] ],
659        with_dmalloc=$withval,
660        with_dmalloc=no)
661
662DMALLOC_LIBS=""
663
664if test "$with_dmalloc" != "no"; then
665   if test "$with_dmalloc" = "yes"; then
666        with_dmalloc="/usr/local"
667   fi
668
669   if test -r "$with_dmalloc/libdmalloc.a"; then
670        DMALLOC_LIBS="$with_dmalloc/libdmalloc.a"
671        AC_DEFINE(WITH_DMALLOC)
672        AC_MSG_RESULT(yes)
673   elif test -r "$with_dmalloc/lib/libdmalloc.a"; then
674        DMALLOC_LIBS="$with_dmalloc/lib/libdmalloc.a"
675        AC_DEFINE(WITH_DMALLOC)
676        AC_MSG_RESULT(yes)
677   else
678        AC_MSG_ERROR(cannot find dmalloc library, please check your installation.)
679   fi
680else
681   AC_MSG_RESULT(no)
682fi
683
684AC_SUBST(DMALLOC_LIBS)
685
686dnl sfio tests
687AC_MSG_CHECKING(for sfio library)
688AC_ARG_WITH(sfio, [  --with-sfio=DIR         with SFIO support (for smtptest/libsfsasl) [no] ],
689        with_sfio=$withval,
690        with_sfio=no)
691
692if test "$with_sfio" != "no"; then
693   if test "$with_sfio" = "yes"; then
694        with_sfio="/usr/local"
695   fi
696
697   AC_DEFUN(SFIO_INC_CHK,
698        [if test -r "$with_sfio$1/sfio.h"; then SFIO_DIR=$with_sfio;
699                                              SFIO_INC_DIR=$with_sfio$1])
700
701   AC_DEFUN(SFIO_LIB_CHK,[
702                str="$SFIO_DIR/$1/libsfio.*"
703                for i in `echo $str`; do
704                        if test -r $i; then
705                                SFIO_LIBDIR=$SFIO_DIR/$1
706                                break 2
707                        fi
708                done
709                ])
710
711   SFIO_INC_CHK()
712   el[]SFIO_INC_CHK(/include)
713   el[]SFIO_INC_CHK(/include/sfio)
714   fi
715
716   if test -z "$SFIO_DIR"; then
717        AC_MSG_ERROR(Cannot find sfio.h, Please check your SFIO installation.)
718   fi
719
720   SFIO_LIB_CHK(lib)
721   SFIO_LIB_CHK(lib/sfio)
722
723   if test -z "$SFIO_LIBDIR"; then
724        AC_MSG_ERROR(Cannot find sfio library, Please check your SFIO installation.)
725   fi
726
727   SFIO_INC_FLAGS="-I$SFIO_INC_DIR"
728   SFIO_LIB_FLAGS="-L$SFIO_LIBDIR -lsfio"
729   SMTPTEST_PROGRAM="smtptest"
730   SASL_UTIL_LIBS_EXTRA=libsfsasl2.la
731   SASL_UTIL_HEADERS_EXTRA=sfsasl.h
732
733   AC_MSG_RESULT(yes)
734else
735   AC_MSG_RESULT(no)
736   SFIO_INC_FLAGS=""
737   SFIO_LIB_FLAGS=""
738   SMTPTEST_PROGRAM=""
739   SASL_UTIL_LIBS_EXTRA=""
740   SASL_UTIL_HEADERS_EXTRA=""
741fi
742
743AC_SUBST(SFIO_INC_FLAGS)
744AC_SUBST(SFIO_LIB_FLAGS)
745AC_SUBST(SMTPTEST_PROGRAM)
746AC_SUBST(SASL_UTIL_LIBS_EXTRA)
747AC_SUBST(SASL_UTIL_HEADERS_EXTRA)
748
749dnl Backwards compatibility with autoconf 2.13
750ifdef([m4_pattern_allow],[m4_pattern_allow([^LIBOBJS$])])
751
752dnl check for getsubopt
753sasl_cv_getsubopt=no
754AC_CHECK_FUNC(getsubopt, [AC_DEFINE(HAVE_GETSUBOPT)], [sasl_cv_getsubopt=yes])
755if test $sasl_cv_getsubopt = yes; then
756        LIBOBJS="$LIBOBJS getsubopt.o"
757        GETSUBOPT="getsubopt.lo"
758fi
759AC_SUBST(GETSUBOPT)
760
761dnl Check for snprintf
762sasl_cv_snprintf=no
763SNPRINTFOBJS=""
764AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)], [sasl_cv_snprintf=yes])
765AC_CHECK_FUNC(vsnprintf, [AC_DEFINE(HAVE_VSNPRINTF)], [sasl_cv_snprintf=yes])
766if test $sasl_cv_snprintf = yes; then
767        LIBOBJS="$LIBOBJS snprintf.o"
768        SNPRINTFOBJS="snprintf.o"
769        LTSNPRINTFOBJS="snprintf.lo"
770fi
771AC_SUBST(SNPRINTFOBJS)
772AC_SUBST(LTSNPRINTFOBJS)
773
774dnl do we need to link in -lresolv?
775AC_CHECK_LIB(resolv, inet_aton)
776
777dnl Check for getaddrinfo
778GETADDRINFOOBJS=""
779sasl_cv_getaddrinfo=yes
780IPv6_CHECK_FUNC(getaddrinfo, [IPv6_CHECK_FUNC(gai_strerror,
781                [AC_DEFINE(HAVE_GETADDRINFO)
782                sasl_cv_getaddrinfo=no])])
783if test $sasl_cv_getaddrinfo = yes; then
784    LIBOBJS="$LIBOBJS getaddrinfo.o"
785    GETADDRINFOOBJS="getaddrinfo.o"
786    LTGETADDRINFOOBJS="getaddrinfo.lo"
787fi
788AC_SUBST(GETADDRINFOOBJS)
789AC_SUBST(LTGETADDRINFOOBJS)
790
791dnl Check for getnameinfo
792GETNAMEINFOOBJS=""
793sasl_cv_getnameinfo=no
794IPv6_CHECK_FUNC(getnameinfo,
795                [AC_DEFINE(HAVE_GETNAMEINFO)], [sasl_cv_getnameinfo=yes])
796if test $sasl_cv_getnameinfo = yes; then
797        LIBOBJS="$LIBOBJS getnameinfo.o"
798        GETNAMEINFOOBJS="getnameinfo.o"
799        LTGETNAMEINFOOBJS="getnameinfo.lo"
800fi
801AC_SUBST(GETNAMEINFOOBJS)
802AC_SUBST(LTGETNAMEINFOOBJS)
803
804LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
805AC_SUBST(LIBOBJS)
806AC_SUBST(LTLIBOBJS)
807
808AC_C_CONST
809AC_C_INLINE
810AC_TYPE_MODE_T
811AC_TYPE_PID_T
812AC_TYPE_SIGNAL
813
814AC_HEADER_TIME
815AC_HEADER_STDC
816AC_HEADER_DIRENT
817AC_HEADER_SYS_WAIT
818AC_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)
819
820IPv6_CHECK_SS_FAMILY()
821IPv6_CHECK_SA_LEN()
822IPv6_CHECK_SOCKLEN_T()
823
824#AC_FUNC_MEMCMP
825#AC_FUNC_VPRINTF
826AC_CHECK_FUNCS(gethostname getdomainname getpwnam getspnam gettimeofday inet_aton memcpy mkdir select socket strchr strdup strerror strspn strstr strtol jrand48)
827
828if test $enable_cmulocal = yes; then
829    AC_WARN([enabling CMU local kludges])
830    AC_DEFINE(KRB4_IGNORE_IP_ADDRESS)
831    AC_DEFINE_UNQUOTED(PREFER_MECH, "KERBEROS_V4")
832fi
833
834AC_EGREP_HEADER(sockaddr_storage, sys/socket.h, [
835                AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)])
836
837AC_SUBST(DIRS)
838
839AC_CONFIG_SUBDIRS(saslauthd)
840
841AC_OUTPUT(Makefile
842include/Makefile
843sasldb/Makefile
844plugins/Makefile
845lib/Makefile
846utils/Makefile
847doc/Makefile
848sample/Makefile
849java/Makefile
850java/CyrusSasl/Makefile
851java/Test/Makefile
852java/javax/Makefile
853java/javax/security/Makefile
854java/javax/security/auth/Makefile
855java/javax/security/auth/callback/Makefile
856pwcheck/Makefile
857man/Makefile)
858
859echo Configuration Complete.  Type \'make\' to build.
Note: See TracBrowser for help on using the repository browser.