cyrus-imspd-v1.8/Makefile.in 0100644 0043101 0000012 00000004531 10035057302 015227 0 ustar shadow staff # Top-level Makefile for cyrus software
#
# (C) Copyright 1994-1996 by Carnegie Mellon University
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of CMU not be
# used in advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
#
# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
# CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
#
SUBDIRS = lib imsp @EXTRA_SUBDIRS@
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = /bin/sh
all::
@for d in $(SUBDIRS); \
do \
(cd $$d; echo "### Making" all "in" `pwd`; \
$(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) all; \
echo "### Done with" `pwd`); \
done
install::
- mkdir ${DESTDIR}/cyrus
- mkdir ${DESTDIR}/cyrus/usr
- mkdir ${DESTDIR}/cyrus/usr/cyrus
- mkdir ${DESTDIR}/cyrus/usr/cyrus/bin
@for d in $(SUBDIRS); \
do \
(cd $$d; echo "### Making" install "in" `pwd`; \
$(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) install ; \
echo "### Done with" `pwd`); \
done
clean::
@-for d in $(SUBDIRS); \
do \
(cd $$d; echo "### Making" clean "in" `pwd`; \
$(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) clean ; \
echo "### Done with" `pwd`); \
done
distclean::
@-for d in $(SUBDIRS); \
do \
(cd $$d; echo "### Making" clean "in" `pwd`; \
$(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) distclean ; \
echo "### Done with" `pwd`); \
done
rm -f Makefile config.*
depend::
@for d in $(SUBDIRS); \
do \
(cd $$d; echo "### Making" depend "in" `pwd`; \
$(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) depend ; \
echo "### Done with" `pwd`); \
done
Makefile: Makefile.in config.status
$(SHELL) config.status
config.status: configure
$(SHELL) config.status --recheck
configure: configure.in
cd $(srcdir); autoconf
cyrus-imspd-v1.8/README 0100644 0043101 0000012 00000002100 07105637052 014042 0 ustar shadow staff $Id: README,v 1.3 2000/05/08 22:22:34 wcw Exp $
This is the Cyrus IMSP server. The location for the software is in
ftp://ftp.andrew.cmu.edu/cyrus-mail.
See the files in the "notes" subdirectory for important information
about this software. In there, you'll find instructions for building
and setting up the server as well as notes on the implementation details.
Please report any problems to cyrus-bugs+@andrew.cmu.edu.
FILES OF INTEREST
-----------------
notes/Build-instructions -- Short guide to configuring and compiling
configure.in -- All the build options are "documented" here
notes/Setup-instructions -- Short guide to getting the server running
imsp/options.sample -- Sample options file to copy to /var/imsp/options
notes/option.registry -- Registered option names as of last update
notes/Changes-Todo -- What been changed and what was left undone
notes/imsp.implementation -- A discussion of implementation details
notes/imsp.implementation.updates
-- Some of the latest details, as of version 1.6a1
cyrus-imspd-v1.8/configure 0100755 0043101 0000012 00000412273 10170575200 015101 0 ustar shadow staff #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
# Defaults:
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--enable-gssapi=
enable GSSAPI authentication [yes] "
ac_help="$ac_help
--with-gss_impl={heimdal|mit|cybersafe|seam|auto} choose specific GSSAPI implementation [[auto]] "
ac_help="$ac_help
--with-sasl=DIR Compile with libsasl2 in "
ac_help="$ac_help
--with-staticsasl=DIR Compile with staticly linked libsasl2 in "
ac_help="$ac_help
--with-ldap=LIBRARY use LDAP address book features
LIBRARY is the name of your LDAP library"
ac_help="$ac_help
--with-lock=METHOD force use of METHOD for locking (flock or fcntl)"
ac_help="$ac_help
"
ac_help="$ac_help
--with-auth=METHOD use authorization module METHOD
METHOD is unix, krb, or krb_pts"
ac_help="$ac_help
--with-krb=PATH use Kerberos from PATH"
ac_help="$ac_help
--with-krbdes use Kerberos DES implementation [[yes]]"
ac_help="$ac_help
--with-afs=PATH use AFS libraries from PATH"
ac_help="$ac_help
--with-statedir=DIR use DIR as state directory for ptclient,
only needed when using krb_pts for authorization"
# Initialize some variables set by options.
# The variables have the same names as the options, with
# dashes changed to underlines.
build=NONE
cache_file=./config.cache
exec_prefix=NONE
host=NONE
no_create=
nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
case "$ac_option" in
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) ac_optarg= ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case "$ac_option" in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir="$ac_optarg" ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build="$ac_optarg" ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file="$ac_optarg" ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
datadir="$ac_optarg" ;;
-disable-* | --disable-*)
ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
fi
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
eval "enable_${ac_feature}=no" ;;
-enable-* | --enable-*)
ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
{ echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
fi
ac_feature=`echo $ac_feature| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes ;;
esac
eval "enable_${ac_feature}='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix="$ac_optarg" ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he)
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat << EOF
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
--cache-file=FILE cache test results in FILE
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
--bindir=DIR user executables in DIR [EPREFIX/bin]
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data in DIR
[PREFIX/share]
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data in DIR
[PREFIX/com]
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
EOF
cat << EOF
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
--target=TARGET configure for TARGET [TARGET=HOST]
Features and packages:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
EOF
if test -n "$ac_help"; then
echo "--enable and --with options recognized:$ac_help"
fi
exit 0 ;;
-host | --host | --hos | --ho)
ac_prev=host ;;
-host=* | --host=* | --hos=* | --ho=*)
host="$ac_optarg" ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir="$ac_optarg" ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir="$ac_optarg" ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir="$ac_optarg" ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir="$ac_optarg" ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
| --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir="$ac_optarg" ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir="$ac_optarg" ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir="$ac_optarg" ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix="$ac_optarg" ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix="$ac_optarg" ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix="$ac_optarg" ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name="$ac_optarg" ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir="$ac_optarg" ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir="$ac_optarg" ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir="$ac_optarg" ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir="$ac_optarg" ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target="$ac_optarg" ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
fi
ac_package=`echo $ac_package| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes ;;
esac
eval "with_${ac_package}='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`echo $ac_option|sed -e 's/-*without-//'`
# Reject names that are not valid shell variable names.
if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
{ echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
fi
ac_package=`echo $ac_package| sed 's/-/_/g'`
eval "with_${ac_package}=no" ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes="$ac_optarg" ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries="$ac_optarg" ;;
-*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
;;
*)
if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
echo "configure: warning: $ac_option: invalid host type" 1>&2
fi
if test "x$nonopt" != xNONE; then
{ echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
fi
nonopt="$ac_option"
;;
esac
done
if test -n "$ac_prev"; then
{ echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
fi
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 6 checking for... messages and results
# 5 compiler messages saved in config.log
if test "$silent" = yes; then
exec 6>/dev/null
else
exec 6>&1
fi
exec 5>./config.log
echo "\
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
" 1>&5
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing shell metacharacters.
ac_configure_args=
for ac_arg
do
case "$ac_arg" in
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c) ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
ac_configure_args="$ac_configure_args '$ac_arg'" ;;
*) ac_configure_args="$ac_configure_args $ac_arg" ;;
esac
done
# NLS nuisances.
# Only set these to C if already set. These must not be set unconditionally
# because not all systems understand e.g. LANG=C (notably SCO).
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
# Non-C LC_CTYPE values break the ctype check.
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo > confdefs.h
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
ac_unique_file=imsp/imsp_server.c
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then its parent.
ac_prog=$0
ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
srcdir=$ac_confdir
if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
else
{ echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
fi
fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
echo "loading site script $ac_site_file"
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
echo "loading cache $cache_file"
. $cache_file
else
echo "creating cache $cache_file"
> $cache_file
fi
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
ac_exeext=
ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f $ac_dir/install.sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
fi
done
if test -z "$ac_aux_dir"; then
{ echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
fi
ac_config_guess=$ac_aux_dir/config.guess
ac_config_sub=$ac_aux_dir/config.sub
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# Make sure we can run config.sub.
if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:580: checking host system type" >&5
host_alias=$host
case "$host_alias" in
NONE)
case $nonopt in
NONE)
if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
fi ;;
*) host_alias=$nonopt ;;
esac ;;
esac
host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:603: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
break
fi
done
IFS="$ac_save_ifs"
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
echo "$ac_t""$CC" 1>&6
else
echo "$ac_t""no" 1>&6
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:633: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
break
fi
done
IFS="$ac_save_ifs"
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# -gt 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
set dummy "$ac_dir/$ac_word" "$@"
shift
ac_cv_prog_CC="$@"
fi
fi
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
echo "$ac_t""$CC" 1>&6
else
echo "$ac_t""no" 1>&6
fi
if test -z "$CC"; then
case "`uname -s`" in
*win32* | *WIN32*)
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:684: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="cl"
break
fi
done
IFS="$ac_save_ifs"
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
echo "$ac_t""$CC" 1>&6
else
echo "$ac_t""no" 1>&6
fi
;;
esac
fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:716: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 727 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
ac_cv_prog_cc_cross=no
else
ac_cv_prog_cc_cross=yes
fi
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:758: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:763: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
fi
fi
echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:791: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
ac_cv_prog_cc_g=yes
else
ac_cv_prog_cc_g=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:834: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
break 2
fi
fi
done
;;
esac
done
IFS="$ac_save_IFS"
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL="$ac_cv_path_install"
else
# As a last resort, use the slow shell script. We don't cache a
# path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the path is relative.
INSTALL="$ac_install_sh"
fi
fi
echo "$ac_t""$INSTALL" 1>&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:889: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_dummy="$PATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_RANLIB="ranlib"
break
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
fi
fi
RANLIB="$ac_cv_prog_RANLIB"
if test -n "$RANLIB"; then
echo "$ac_t""$RANLIB" 1>&6
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:917: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftestmake <<\EOF
all:
@echo 'ac_maketemp="${MAKE}"'
EOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
if test -n "$ac_maketemp"; then
eval ac_cv_prog_make_${ac_make}_set=yes
else
eval ac_cv_prog_make_${ac_make}_set=no
fi
rm -f conftestmake
fi
if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
echo "$ac_t""yes" 1>&6
SET_MAKE=
else
echo "$ac_t""no" 1>&6
SET_MAKE="MAKE=${MAKE-make}"
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:944: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# This must be in double quotes, not single quotes, because CPP may get
# substituted into the Makefile and "${CC-cc}" will confuse make.
CPP="${CC-cc} -E"
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:982: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
CPP=/lib/cpp
fi
rm -f conftest*
fi
rm -f conftest*
fi
rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
CPP="$ac_cv_prog_CPP"
else
ac_cv_prog_CPP="$CPP"
fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for AIX""... $ac_c" 1>&6
echo "configure:1024: checking for AIX" >&5
cat > conftest.$ac_ext <&5 |
egrep "yes" >/dev/null 2>&1; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define _ALL_SOURCE 1
EOF
else
rm -rf conftest*
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
echo "configure:1049: checking for strerror in -lcposix" >&5
ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lcposix $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIBS="$LIBS -lcposix"
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:1091: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
}
; return 0; }
EOF
if { (eval echo configure:1145: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_c_const=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_c_const" 1>&6
if test $ac_cv_c_const = no; then
cat >> confdefs.h <<\EOF
#define const
EOF
fi
echo $ac_n "checking for long file names""... $ac_c" 1>&6
echo "configure:1166: checking for long file names" >&5
if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_sys_long_file_names=yes
# Test for long file names in all the places we know might matter:
# . the current directory, where building will happen
# $prefix/lib where we will be installing things
# $exec_prefix/lib likewise
# eval it to expand exec_prefix.
# $TMPDIR if set, where it might want to write temporary files
# if $TMPDIR is not set:
# /tmp where it might want to write temporary files
# /var/tmp likewise
# /usr/tmp likewise
if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then
ac_tmpdirs="$TMPDIR"
else
ac_tmpdirs='/tmp /var/tmp /usr/tmp'
fi
for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do
test -d $ac_dir || continue
test -w $ac_dir || continue # It is less confusing to not echo anything here.
(echo 1 > $ac_dir/conftest9012345) 2>/dev/null
(echo 2 > $ac_dir/conftest9012346) 2>/dev/null
val=`cat $ac_dir/conftest9012345 2>/dev/null`
if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then
ac_cv_sys_long_file_names=no
rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
break
fi
rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null
done
fi
echo "$ac_t""$ac_cv_sys_long_file_names" 1>&6
if test $ac_cv_sys_long_file_names = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_LONG_FILE_NAMES 1
EOF
fi
if test $ac_cv_sys_long_file_names = no; then
{ echo "configure: error: The Cyrus IMSPD requires support for long file names" 1>&2; exit 1; }
fi
for ac_hdr in unistd.h stdarg.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1216: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <&6
fi
done
for ac_func in memmove strcasecmp ftruncate getdtablesize getaddrinfo getnameinfo
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1255: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <&6
LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
fi
done
for ac_func in strlcat strlcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1312: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:1340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <&6
fi
done
ac_header_dirent=no
for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
echo "configure:1369: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include <$ac_hdr>
int main() {
DIR *dirp = 0;
; return 0; }
EOF
if { (eval echo configure:1382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <&6
fi
done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
echo "configure:1407: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIBS="$LIBS -ldir"
else
echo "$ac_t""no" 1>&6
fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
echo "configure:1448: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIBS="$LIBS -lx"
else
echo "$ac_t""no" 1>&6
fi
fi
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
echo "configure:1494: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char vprintf();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_vprintf) || defined (__stub___vprintf)
choke me
#else
vprintf();
#endif
; return 0; }
EOF
if { (eval echo configure:1522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_vprintf=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_VPRINTF 1
EOF
else
echo "$ac_t""no" 1>&6
fi
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
echo "configure:1546: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char _doprnt();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub__doprnt) || defined (__stub____doprnt)
choke me
#else
_doprnt();
#endif
; return 0; }
EOF
if { (eval echo configure:1574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func__doprnt=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_DOPRNT 1
EOF
else
echo "$ac_t""no" 1>&6
fi
fi
echo $ac_n "checking for strerror""... $ac_c" 1>&6
echo "configure:1599: checking for strerror" >&5
if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char strerror();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_strerror) || defined (__stub___strerror)
choke me
#else
strerror();
#endif
; return 0; }
EOF
if { (eval echo configure:1627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strerror=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_strerror=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'strerror`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAS_STRERROR
EOF
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking nonblocking method""... $ac_c" 1>&6
echo "configure:1651: checking nonblocking method" >&5
if eval "test \"`echo '$''{'cyrus_cv_sys_nonblock'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
#include
#ifndef FNDELAY
#define FNDELAY O_NDELAY
#endif
int main() {
fcntl(0, F_GETFL, 0)&FNDELAY
; return 0; }
EOF
if { (eval echo configure:1668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cyrus_cv_sys_nonblock=fcntl
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
cyrus_cv_sys_nonblock=ioctl
fi
rm -f conftest*
fi
WITH_NONBLOCK=$cyrus_cv_sys_nonblock
echo "$ac_t""$WITH_NONBLOCK" 1>&6
echo $ac_n "checking timezone GMT offset method""... $ac_c" 1>&6
echo "configure:1685: checking timezone GMT offset method" >&5
if eval "test \"`echo '$''{'cyrus_cv_struct_sys_gmtoff'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
struct tm tm;
tm.tm_gmtoff = 0;
; return 0; }
EOF
if { (eval echo configure:1700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cyrus_cv_struct_sys_gmtoff=tm
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
cyrus_cv_struct_sys_gmtoff=gmtime
fi
rm -f conftest*
fi
WITH_GMTOFF=$cyrus_cv_struct_sys_gmtoff
echo "$ac_t""$WITH_GMTOFF" 1>&6
# CMU GUESS RUNPATH SWITCH
echo $ac_n "checking for runpath switch""... $ac_c" 1>&6
echo "configure:1719: checking for runpath switch" >&5
if eval "test \"`echo '$''{'andrew_runpath_switch'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# first, try -R
SAVE_LDFLAGS="${LDFLAGS}"
LDFLAGS="-R /usr/lib"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
andrew_runpath_switch="-R"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
LDFLAGS="-Wl,-rpath,/usr/lib"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
andrew_runpath_switch="-Wl,-rpath,"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
andrew_runpath_switch="none"
fi
rm -f conftest*
fi
rm -f conftest*
LDFLAGS="${SAVE_LDFLAGS}"
fi
echo "$ac_t""$andrew_runpath_switch" 1>&6
CPPFLAGS="-I/usr/local/include ${CPPFLAGS}"
# this is CMU ADD LIBPATH
if test "$andrew_runpath_switch" = "none" ; then
LDFLAGS="-L"/usr/local/lib" ${LDFLAGS}"
else
LDFLAGS="-L"/usr/local/lib" $andrew_runpath_switch"/usr/local/lib" ${LDFLAGS}"
fi
echo $ac_n "checking for dbopen""... $ac_c" 1>&6
echo "configure:1782: checking for dbopen" >&5
if eval "test \"`echo '$''{'ac_cv_func_dbopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dbopen();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_dbopen) || defined (__stub___dbopen)
choke me
#else
dbopen();
#endif
; return 0; }
EOF
if { (eval echo configure:1810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dbopen=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_dbopen=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'dbopen`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_LIBDB
EOF
use_db=1
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
echo "configure:1832: checking for dbopen in -ldb" >&5
ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldb $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_LIBDB
EOF
LIBS=" -ldb ${LIBS}"
use_db=1
else
echo "$ac_t""no" 1>&6
fi
fi
ac_safe=`echo "db_185.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for db_185.h""... $ac_c" 1>&6
echo "configure:1880: checking for db_185.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_DB_185_H
EOF
cat >> confdefs.h <<\EOF
#define HAVE_LIBDB
EOF
LIBS="-ldb ${LIBS}"
use_db=1
else
echo "$ac_t""no" 1>&6
fi
if test -z "use_db"; then
echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
echo "configure:1923: checking for dbm_open in -lndbm" >&5
ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lndbm $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo ndbm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <&6
fi
echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
echo "configure:1970: checking for dbm_open in -ldbm" >&5
ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldbm $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo dbm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <&6
fi
fi
echo $ac_n "checking for accept in -lsocket""... $ac_c" 1>&6
echo "configure:2020: checking for accept in -lsocket" >&5
ac_lib_var=`echo socket'_'accept | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lsocket -lnsl $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIBS="${LIBS} -lsocket -lnsl"
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
echo "configure:2060: checking for res_search in -lresolv" >&5
ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <&6
fi
echo $ac_n "checking for dlopen""... $ac_c" 1>&6
echo "configure:2109: checking for dlopen" >&5
if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dlopen();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_dlopen) || defined (__stub___dlopen)
choke me
#else
dlopen();
#endif
; return 0; }
EOF
if { (eval echo configure:2137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dlopen=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_dlopen=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:2155: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/^a-zA-Z0-9_/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <&6
fi
fi
echo $ac_n "checking for crypt""... $ac_c" 1>&6
echo "configure:2205: checking for crypt" >&5
if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char crypt();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_crypt) || defined (__stub___crypt)
choke me
#else
crypt();
#endif
; return 0; }
EOF
if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_crypt=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_crypt=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'crypt`\" = yes"; then
echo "$ac_t""yes" 1>&6
cmu_have_crypt=yes
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
echo "configure:2252: checking for crypt in -lcrypt" >&5
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes
else
echo "$ac_t""no" 1>&6
cmu_have_crypt=no
fi
fi
save_LIBS="$LIBS"
LIB_SOCKET=""
echo $ac_n "checking for connect""... $ac_c" 1>&6
echo "configure:2300: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char connect();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_connect) || defined (__stub___connect)
choke me
#else
connect();
#endif
; return 0; }
EOF
if { (eval echo configure:2328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_connect=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
echo "configure:2346: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIB_SOCKET="-lnsl $LIB_SOCKET"
else
echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
echo "configure:2386: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIB_SOCKET="-lsocket $LIB_SOCKET"
else
echo "$ac_t""no" 1>&6
fi
fi
LIBS="$LIB_SOCKET $save_LIBS"
echo $ac_n "checking for res_search""... $ac_c" 1>&6
echo "configure:2430: checking for res_search" >&5
if eval "test \"`echo '$''{'ac_cv_func_res_search'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char res_search();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_res_search) || defined (__stub___res_search)
choke me
#else
res_search();
#endif
; return 0; }
EOF
if { (eval echo configure:2458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_res_search=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_res_search=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'res_search`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
echo "configure:2476: checking for res_search in -lresolv" >&5
ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIB_SOCKET="-lresolv $LIB_SOCKET"
else
echo "$ac_t""no" 1>&6
fi
fi
LIBS="$LIB_SOCKET $save_LIBS"
for ac_func in dn_expand dns_lookup
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2522: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:2550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <&6
fi
done
LIBS="$save_LIBS"
# Check whether --enable-gssapi or --disable-gssapi was given.
if test "${enable_gssapi+set}" = set; then
enableval="$enable_gssapi"
gssapi=$enableval
else
gssapi=yes
fi
# Check whether --with-gss_impl or --without-gss_impl was given.
if test "${with_gss_impl+set}" = set; then
withval="$with_gss_impl"
gss_impl=$withval
else
gss_impl=auto
fi
if test "$gssapi" != no; then
platform=
case "${host}" in
*-*-linux*)
platform=__linux
;;
*-*-hpux*)
platform=__hpux
;;
*-*-irix*)
platform=__irix
;;
*-*-solaris2*)
# When should we use __sunos?
platform=__solaris
;;
*-*-aix*)
platform=__aix
;;
*)
echo "configure: warning: The system type is not recognized. If you believe that CyberSafe GSSAPI works on this platform, please update the configure script" 1>&2
if test "$gss_impl" = "cybersafe"; then
{ echo "configure: error: CyberSafe was forced, cannot continue as platform is not supported" 1>&2; exit 1; }
fi
;;
esac
cmu_saved_CPPFLAGS=$CPPFLAGS
if test -d ${gssapi}; then
CPPFLAGS="$CPPFLAGS -I$gssapi/include"
# We want to keep -I in our CPPFLAGS, but only if we succeed
cmu_saved_CPPFLAGS=$CPPFLAGS
LDFLAGS="$LDFLAGS -L$gssapi/lib"
if test -n "$platform"; then
if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
CPPFLAGS="$CPPFLAGS -D$platform"
if test -d "${gssapi}/appsec-sdk/include"; then
CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
fi
fi
fi
fi
ac_safe=`echo "gssapi.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for gssapi.h""... $ac_c" 1>&6
echo "configure:2643: checking for gssapi.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2653: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_GSSAPI_H
EOF
else
echo "$ac_t""no" 1>&6
ac_safe=`echo "gssapi/gssapi.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for gssapi/gssapi.h""... $ac_c" 1>&6
echo "configure:2678: checking for gssapi/gssapi.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
echo "configure: warning: Disabling GSSAPI - no include files found" 1>&2; gssapi=no
fi
fi
CPPFLAGS=$cmu_saved_CPPFLAGS
fi
if test "$gssapi" != no; then
echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
echo "configure:2720: checking for res_search in -lresolv" >&5
ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <&6
fi
if test -d ${gssapi}; then
gssapi_dir="${gssapi}/lib"
GSSAPIBASE_LIBS="-L$gssapi_dir"
GSSAPIBASE_STATIC_LIBS="-L$gssapi_dir"
else
gssapi_dir="/usr/local/lib"
fi
# Check a full link against the Heimdal libraries.
# If this fails, check a full link against the MIT libraries.
# If this fails, check a full link against the CyberSafe libraries.
# If this fails, check a full link against the Solaris 8 and up libgss.
if test "$gss_impl" = "auto" -o "$gss_impl" = "heimdal"; then
gss_failed=0
echo $ac_n "checking for gss_unwrap in -lgssapi""... $ac_c" 1>&6
echo "configure:2782: checking for gss_unwrap in -lgssapi" >&5
ac_lib_var=`echo gssapi'_'gss_unwrap | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lgssapi $GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET} $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
gss_impl="heimdal"
else
echo "$ac_t""no" 1>&6
gss_failed=1
fi
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
if test "$gss_impl" = "auto" -o "$gss_impl" = "mit"; then
gss_failed=0
echo $ac_n "checking for gss_unwrap in -lgssapi_krb5""... $ac_c" 1>&6
echo "configure:2830: checking for gss_unwrap in -lgssapi_krb5" >&5
ac_lib_var=`echo gssapi_krb5'_'gss_unwrap | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lgssapi_krb5 $GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${LIB_SOCKET} $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
gss_impl="mit"
else
echo "$ac_t""no" 1>&6
gss_failed=1
fi
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
# For Cybersafe one has to set a platform define in order to make compilation work
if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_GSSAPIBASE_LIBS=$GSSAPIBASE_LIBS
# FIX ME - Note that the libraries are in .../lib/64 for 64bit kernels
if test -d "${gssapi}/appsec-rt/lib"; then
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -L${gssapi}/appsec-rt/lib"
fi
CPPFLAGS="$CPPFLAGS -D$platform"
if test -d "${gssapi}/appsec-sdk/include"; then
CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
fi
gss_failed=0
# Check for CyberSafe with two libraries first, than fall back to a single
# library (older CyberSafe)
unset ac_cv_lib_gss_csf_gss_acq_user
echo $ac_n "checking for csf_gss_acq_user in -lgss""... $ac_c" 1>&6
echo "configure:2896: checking for csf_gss_acq_user in -lgss" >&5
ac_lib_var=`echo gss'_'csf_gss_acq_user | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lgss $GSSAPIBASE_LIBS -lgss -lcstbk5 $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
gss_impl="cybersafe03"
else
echo "$ac_t""no" 1>&6
unset ac_cv_lib_gss_csf_gss_acq_user;echo $ac_n "checking for csf_gss_acq_user in -lgss""... $ac_c" 1>&6
echo "configure:2935: checking for csf_gss_acq_user in -lgss" >&5
ac_lib_var=`echo gss'_'csf_gss_acq_user | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lgss $GSSAPIBASE_LIBS -lgss $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
gss_impl="cybersafe"
else
echo "$ac_t""no" 1>&6
gss_failed=1
fi
fi
if test "$gss_failed" = "1"; then
# Restore variables
GSSAPIBASE_LIBS=$cmu_saved_GSSAPIBASE_LIBS
CPPFLAGS=$cmu_saved_CPPFLAGS
if test "$gss_impl" != "auto"; then
gss_impl="failed"
fi
fi
fi
if test "$gss_impl" = "auto" -o "$gss_impl" = "seam"; then
gss_failed=0
echo $ac_n "checking for gss_unwrap in -lgss""... $ac_c" 1>&6
echo "configure:2992: checking for gss_unwrap in -lgss" >&5
ac_lib_var=`echo gss'_'gss_unwrap | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lgss -lgss $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
gss_impl="seam"
else
echo "$ac_t""no" 1>&6
gss_failed=1
fi
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
if test "$gss_impl" = "mit"; then
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a"
elif test "$gss_impl" = "heimdal"; then
CPPFLAGS="$CPPFLAGS -DKRB5_HEIMDAL"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err"
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}"
elif test "$gss_impl" = "cybersafe03"; then
# Version of CyberSafe with two libraries
CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss -lcstbk5"
# there is no static libgss for CyberSafe
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "cybersafe"; then
CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss"
# there is no static libgss for CyberSafe
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "seam"; then
GSSAPIBASE_LIBS=-lgss
# there is no static libgss on Solaris 8 and up
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "failed"; then
gssapi="no"
GSSAPIBASE_LIBS=
GSSAPIBASE_STATIC_LIBS=
echo "configure: warning: Disabling GSSAPI - specified library not found" 1>&2
else
gssapi="no"
GSSAPIBASE_LIBS=
GSSAPIBASE_STATIC_LIBS=
echo "configure: warning: Disabling GSSAPI - no library" 1>&2
fi
fi
#
# Cybersafe defines both GSS_C_NT_HOSTBASED_SERVICE and GSS_C_NT_USER_NAME in gssapi\rfckrb5.h
#
if test "$gssapi" != "no"; then
if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
cat > conftest.$ac_ext <
#ifdef GSS_C_NT_HOSTBASED_SERVICE
hostbased_service_gss_nt_yes
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "hostbased_service_gss_nt_yes" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_GSS_C_NT_HOSTBASED_SERVICE
EOF
else
rm -rf conftest*
echo "configure: warning: Cybersafe define not found" 1>&2
fi
rm -f conftest*
elif test "$ac_cv_header_gssapi_h" = "yes"; then
cat > conftest.$ac_ext <
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "GSS_C_NT_HOSTBASED_SERVICE" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_GSS_C_NT_HOSTBASED_SERVICE
EOF
fi
rm -f conftest*
elif test "$ac_cv_header_gssapi_gssapi_h"; then
cat > conftest.$ac_ext <
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "GSS_C_NT_HOSTBASED_SERVICE" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_GSS_C_NT_HOSTBASED_SERVICE
EOF
fi
rm -f conftest*
fi
if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
cat > conftest.$ac_ext <
#ifdef GSS_C_NT_USER_NAME
user_name_yes_gss_nt
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "user_name_yes_gss_nt" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_GSS_C_NT_USER_NAME
EOF
else
rm -rf conftest*
echo "configure: warning: Cybersafe define not found" 1>&2
fi
rm -f conftest*
elif test "$ac_cv_header_gssapi_h" = "yes"; then
cat > conftest.$ac_ext <
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "GSS_C_NT_USER_NAME" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_GSS_C_NT_USER_NAME
EOF
fi
rm -f conftest*
elif test "$ac_cv_header_gssapi_gssapi_h"; then
cat > conftest.$ac_ext <
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "GSS_C_NT_USER_NAME" >/dev/null 2>&1; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_GSS_C_NT_USER_NAME
EOF
fi
rm -f conftest*
fi
fi
GSSAPI_LIBS=""
echo $ac_n "checking GSSAPI""... $ac_c" 1>&6
echo "configure:3195: checking GSSAPI" >&5
if test "$gssapi" != no; then
echo "$ac_t""with implementation ${gss_impl}" 1>&6
echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
echo "configure:3199: checking for res_search in -lresolv" >&5
ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv"
else
echo "$ac_t""no" 1>&6
fi
SASL_MECHS="$SASL_MECHS libgssapiv2.la"
SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/gssapi.o"
cmu_save_LIBS="$LIBS"
LIBS="$LIBS $GSSAPIBASE_LIBS"
for ac_func in gsskrb5_register_acceptor_identity
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:3246: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:3274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <&6
fi
done
LIBS="$cmu_save_LIBS"
else
echo "$ac_t""disabled" 1>&6
fi
# Check whether --with-sasl or --without-sasl was given.
if test "${with_sasl+set}" = set; then
withval="$with_sasl"
with_sasl="$withval"
else
with_sasl="yes"
fi
# Check whether --with-staticsasl or --without-staticsasl was given.
if test "${with_staticsasl+set}" = set; then
withval="$with_staticsasl"
with_staticsasl="$withval";
if test $with_staticsasl != "no"; then
using_static_sasl="static"
fi
else
with_staticsasl="no"; using_static_sasl="no"
fi
SASLFLAGS=""
LIB_SASL=""
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_LDFLAGS=$LDFLAGS
cmu_saved_LIBS=$LIBS
if test ${with_staticsasl} != "no"; then
if test -d ${with_staticsasl}; then
if test -d ${with_staticsasl}/lib64 ; then
ac_cv_sasl_where_lib=${with_staticsasl}/lib64
else
ac_cv_sasl_where_lib=${with_staticsasl}/lib
fi
ac_cv_sasl_where_lib=${with_staticsasl}/lib
ac_cv_sasl_where_inc=${with_staticsasl}/include
SASLFLAGS="-I$ac_cv_sasl_where_inc"
LIB_SASL="-L$ac_cv_sasl_where_lib"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
else
with_staticsasl="/usr"
fi
ac_safe=`echo "sasl/sasl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sasl/sasl.h""... $ac_c" 1>&6
echo "configure:3356: checking for sasl/sasl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "sasl/saslutil.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sasl/saslutil.h""... $ac_c" 1>&6
echo "configure:3385: checking for sasl/saslutil.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
for i42 in lib64 lib; do
if test -r ${with_staticsasl}/$i42/libsasl2.a; then
ac_cv_found_sasl=yes
echo $ac_n "checking for static libsasl""... $ac_c" 1>&6
echo "configure:3416: checking for static libsasl" >&5
LIB_SASL="$LIB_SASL ${with_staticsasl}/$i42/libsasl2.a"
fi
done
if test ! "$ac_cv_found_sasl" = "yes"; then
echo $ac_n "checking for static libsasl""... $ac_c" 1>&6
echo "configure:3422: checking for static libsasl" >&5
{ echo "configure: error: Could not find ${with_staticsasl}/lib*/libsasl2.a" 1>&2; exit 1; }
fi
else
echo "$ac_t""no" 1>&6
fi
else
echo "$ac_t""no" 1>&6
fi
echo "$ac_t""found" 1>&6
if test "x$SASL_GSSAPI_LIBS_SET" = "x"; then
LIB_SASL="$LIB_SASL $GSSAPIBASE_STATIC_LIBS"
else
SASL_GSSAPI_LIBS_SET=""
cmu_saved_LIBS="$GSSAPIBASE_STATIC_LIBS $cmu_saved_LIBS"
fi
fi
if test -d ${with_sasl}; then
ac_cv_sasl_where_lib=${with_sasl}/lib
ac_cv_sasl_where_inc=${with_sasl}/include
DYNSASLFLAGS="-I$ac_cv_sasl_where_inc"
if test "$ac_cv_sasl_where_lib" != ""; then
# this is CMU ADD LIBPATH TO
if test "$andrew_runpath_switch" = "none" ; then
LIB_DYN_SASL="-L$ac_cv_sasl_where_lib ${LIB_DYN_SASL}"
else
LIB_DYN_SASL="-L$ac_cv_sasl_where_lib ${LIB_DYN_SASL} $andrew_runpath_switch$ac_cv_sasl_where_lib"
fi
fi
LIB_DYN_SASL="$LIB_DYN_SASL -lsasl2"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
fi
ac_safe=`echo "sasl/sasl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sasl/sasl.h""... $ac_c" 1>&6
echo "configure:3467: checking for sasl/sasl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3477: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "sasl/saslutil.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sasl/saslutil.h""... $ac_c" 1>&6
echo "configure:3496: checking for sasl/saslutil.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3506: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for prop_get in -lsasl2""... $ac_c" 1>&6
echo "configure:3524: checking for prop_get in -lsasl2" >&5
ac_lib_var=`echo sasl2'_'prop_get | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lsasl2 $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_cv_found_sasl=yes
else
echo "$ac_t""no" 1>&6
ac_cv_found_sasl=no
fi
else
echo "$ac_t""no" 1>&6
ac_cv_found_sasl=no
fi
else
echo "$ac_t""no" 1>&6
ac_cv_found_sasl=no
fi
if test "$ac_cv_found_sasl" = "yes"; then
if test "$ac_cv_sasl_where_lib" != ""; then
# this is CMU ADD LIBPATH TO
if test "$andrew_runpath_switch" = "none" ; then
DYNLIB_SASL="-L$ac_cv_sasl_where_lib ${DYNLIB_SASL}"
else
DYNLIB_SASL="-L$ac_cv_sasl_where_lib ${DYNLIB_SASL} $andrew_runpath_switch$ac_cv_sasl_where_lib"
fi
fi
DYNLIB_SASL="$DYNLIB_SASL -lsasl2"
if test "$using_static_sasl" != "static"; then
LIB_SASL=$DYNLIB_SASL
SASLFLAGS=$DYNSASLFLAGS
fi
else
DYNLIB_SASL=""
DYNSASLFLAGS=""
using_static_sasl="staticonly"
fi
if test "x$SASL_GSSAPI_LIBS_SET" != "x"; then
SASL_GSSAPI_LIBS_SET=""
cmu_saved_LIBS="$GSSAPIBASE_LIBS $cmu_saved_LIBS"
fi
LIBS="$cmu_saved_LIBS"
LDFLAGS="$cmu_saved_LDFLAGS"
CPPFLAGS="$cmu_saved_CPPFLAGS"
if test "$ac_cv_found_sasl" != "yes"; then
{ echo "configure: error: Cannot continue without libsasl2.
Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/." 1>&2; exit 1; }
fi
LIBS="${LIB_SASL} ${LIBS}"
# Check whether --with-ldap or --without-ldap was given.
if test "${with_ldap+set}" = set; then
withval="$with_ldap"
if test "$with_ldap" = "yes"; then
{ echo "configure: error: Must provide a library name for --with-ldap" 1>&2; exit 1; }
fi
if test "$with_ldap" != "no"; then
echo $ac_n "checking for ldap_init in -l"$with_ldap"""... $ac_c" 1>&6
echo "configure:3629: checking for ldap_init in -l"$with_ldap"" >&5
ac_lib_var=`echo "$with_ldap"'_'ldap_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-l"$with_ldap" -llber -lssl -lcrypto $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
#define HAVE_LDAP
EOF
HAVE_LDAP_OBJS="abook_ldap.o"
LIBS="-l$with_ldap -llber -lssl -lcrypto $LIBS"
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: LDAP library does not provide ldap_init" 1>&2; exit 1; }
fi
fi
else
echo $ac_n "checking for library containing ldap_init""... $ac_c" 1>&6
echo "configure:3678: checking for library containing ldap_init" >&5
if eval "test \"`echo '$''{'ac_cv_search_ldap_init'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_func_search_save_LIBS="$LIBS"
ac_cv_search_ldap_init="no"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_ldap_init="none required"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
test "$ac_cv_search_ldap_init" = "no" && for i in ldap10 ldap; do
LIBS="-l$i $ac_func_search_save_LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_search_ldap_init="-l$i"
break
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
done
LIBS="$ac_func_search_save_LIBS"
fi
echo "$ac_t""$ac_cv_search_ldap_init" 1>&6
if test "$ac_cv_search_ldap_init" != "no"; then
test "$ac_cv_search_ldap_init" = "none required" || LIBS="$ac_cv_search_ldap_init $LIBS"
cat >> confdefs.h <<\EOF
#define HAVE_LDAP 1
EOF
HAVE_LDAP_OBJS="abook_ldap.o"
else :
-llber -lssl -lcrypto
fi
fi
# Check whether --with-lock or --without-lock was given.
if test "${with_lock+set}" = set; then
withval="$with_lock"
WITH_LOCK="$withval"
else
echo $ac_n "checking for fcntl""... $ac_c" 1>&6
echo "configure:3753: checking for fcntl" >&5
if eval "test \"`echo '$''{'ac_cv_func_fcntl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char fcntl();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_fcntl) || defined (__stub___fcntl)
choke me
#else
fcntl();
#endif
; return 0; }
EOF
if { (eval echo configure:3781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_fcntl=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_fcntl=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'fcntl`\" = yes"; then
echo "$ac_t""yes" 1>&6
WITH_LOCK="fcntl"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for flock""... $ac_c" 1>&6
echo "configure:3800: checking for flock" >&5
if eval "test \"`echo '$''{'ac_cv_func_flock'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char flock();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_flock) || defined (__stub___flock)
choke me
#else
flock();
#endif
; return 0; }
EOF
if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_flock=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_flock=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'flock`\" = yes"; then
echo "$ac_t""yes" 1>&6
WITH_LOCK="flock"
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: unable to detect locking method" 1>&2; exit 1; }
fi
fi
fi
# Check whether --with-login or --without-login was given.
if test "${with_login+set}" = set; then
withval="$with_login"
{ echo "configure: error: --with-login is no longer supported.
Configure SASL appropriately instead." 1>&2; exit 1; }
fi
# Check whether --with-auth or --without-auth was given.
if test "${with_auth+set}" = set; then
withval="$with_auth"
WITH_AUTH="$withval"
else
if test -f /etc/krb.conf -o -f /etc/kerberosIV/krb.conf ; then
WITH_AUTH="krb"
else
WITH_AUTH="unix"
fi
fi
# Check whether --with-krb or --without-krb was given.
if test "${with_krb+set}" = set; then
withval="$with_krb"
with_krb="$withval"
else
with_krb="yes"
fi
if test "$WITH_AUTH" = "krb" -o "$WITH_AUTH" = "krb_pts" ; then
echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
echo "configure:3892: checking for res_search in -lresolv" >&5
ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <&6
fi
# Check whether --with-krbdes or --without-krbdes was given.
if test "${with_krbdes+set}" = set; then
withval="$with_krbdes"
with_krbdes="$withval"
else
with_krbdes="yes"
fi
if test "$with_krbdes" = "yes"; then
echo $ac_n "checking for des_ecb_encrypt in -ldes""... $ac_c" 1>&6
echo "configure:3949: checking for des_ecb_encrypt in -ldes" >&5
ac_lib_var=`echo des'_'des_ecb_encrypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldes $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIBS="${LIBS} -ldes"
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: The Kerberos DES library is required for Kerberos support." 1>&2; exit 1; }
fi
fi
if test -d ${with_krb}; then
echo $ac_n "checking for Kerberos includes""... $ac_c" 1>&6
echo "configure:3993: checking for Kerberos includes" >&5
if eval "test \"`echo '$''{'cyrus_krbinclude'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
for krbhloc in include/kerberosIV include
do
if test -f ${with_krb}/${krbhloc}/krb.h ; then
cyrus_krbinclude=${with_krb}/${krbhloc}
break
fi
done
fi
echo "$ac_t""$cyrus_krbinclude" 1>&6
if test -n "${cyrus_krbinclude}"; then
CPPFLAGS="$CPPFLAGS -I${cyrus_krbinclude}"
fi
LDFLAGS="$LDFLAGS -L${with_krb}/lib"
fi
ac_safe=`echo "krb.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for krb.h""... $ac_c" 1>&6
echo "configure:4018: checking for krb.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for krb_mk_priv in -lkrb""... $ac_c" 1>&6
echo "configure:4045: checking for krb_mk_priv in -lkrb" >&5
ac_lib_var=`echo krb'_'krb_mk_priv | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lkrb $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_lib=HAVE_LIB`echo krb | sed -e 's/^a-zA-Z0-9_/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <&6
echo "configure: warning: No Kerberos V4 found" 1>&2; krb4=no
fi
else
echo "$ac_t""no" 1>&6
echo "configure: warning: No Kerberos V4 found" 1>&2; krb4=no
fi
if test "${krb4}" != no; then
cat >> confdefs.h <<\EOF
#define HAVE_KRB
EOF
else
{ echo "configure: error: Kerberos not found for authorization module" 1>&2; exit 1; }
fi
fi
# Check whether --with-afs or --without-afs was given.
if test "${with_afs+set}" = set; then
withval="$with_afs"
with_afs="${withval}"
CFLAGS="${CFLAGS} -I${withval}/include"
else
with_afs="/usr/local"
fi
if test "$WITH_AUTH" = "krb_pts" ; then
EXTRA_SUBDIRS="${EXTRA_SUBDIRS} ptclient"
EXTRA_OUTPUT="${EXTRA_OUTPUT} ptclient/Makefile"
AFS_LIBS="${with_afs}/lib/afs/libkauth.a ${with_afs}/lib/afs/libprot.a ${with_afs}/lib/afs/libauth.a ${with_afs}/lib/afs/libsys.a ${with_afs}/lib/librxkad.a ${with_afs}/lib/librx.a ${with_afs}/lib/afs/libsys.a ${with_afs}/lib/libubik.a ${with_afs}/lib/liblwp.a ${with_afs}/lib/afs/util.a"
if test -f ${with_afs}/lib/afs/libaudit.a; then
AFS_LIBS="$AFS_LIBS ${with_afs}/lib/afs/libaudit.a"
fi
if test -f /usr/ucblib/libucb.a; then
# this is CMU ADD LIBPATH TO
if test "$andrew_runpath_switch" = "none" ; then
AFS_LDFLAGS="-L/usr/ucblib ${AFS_LDFLAGS}"
else
AFS_LDFLAGS="-L/usr/ucblib ${AFS_LDFLAGS} $andrew_runpath_switch/usr/ucblib"
fi
AFS_LIBS="$AFS_LIBS -lc -lucb"
fi
if eval "test \"`echo '$''{'cyrus_afs_pr_end'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
SAVE_LIBS="$LIBS"
LIBS="$AFS_LIBS"
echo $ac_n "checking if AFS libraries have pr_End""... $ac_c" 1>&6
echo "configure:4144: checking if AFS libraries have pr_End" >&5
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
cyrus_afs_pr_end="yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
cyrus_afs_pr_end="no"
fi
rm -f conftest*
fi
LIBS="$SAVE_LIBS"
if test "$cyrus_afs_pr_end" = no; then
cat >> confdefs.h <<\EOF
#define HAVE_PR_END 1
EOF
fi
if eval "test \"`echo '$''{'cyrus_afs_sigvec'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
SAVE_LIBS="$LIBS"
LIBS="${with_afs}/lib/liblwp.a"
echo $ac_n "checking if AFS libraries need sigvec""... $ac_c" 1>&6
echo "configure:4186: checking if AFS libraries need sigvec" >&5
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""no" 1>&6
cyrus_afs_sigvec="no"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""yes" 1>&6
cyrus_afs_sigvec="yes"
fi
rm -f conftest*
fi
if test "$cyrus_afs_sigvec" = yes; then
if test "$cant_find_sigvec" = yes; then
echo "configure: warning: Can't find a sigvec for AFS libraries which seem to" 1>&2
echo "configure: warning: need one; ptloader may not build." 1>&2
else
AFS_LIBS="${AFS_LIBS} $cyrus_sigveclib"
fi
fi
LIBS="$SAVE_LIBS"
# Check whether --with-statedir or --without-statedir was given.
if test "${with_statedir+set}" = set; then
withval="$with_statedir"
statedir="$withval"
else
statedir="/var"
fi
cat >> confdefs.h < confcache <<\EOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
EOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
sed -n \
-e "s/'/'\\\\''/g" \
-e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
;;
esac >> confcache
if cmp -s $cache_file confcache; then
:
else
if test -w $cache_file; then
echo "updating cache $cache_file"
cat confcache > $cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# Any assignment to VPATH causes Sun make to only execute
# the first set of double-colon rules, so remove it if not needed.
# If there is a colon in the path, we need to keep it.
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
fi
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
DEFS=-DHAVE_CONFIG_H
# Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status}
echo creating $CONFIG_STATUS
rm -f $CONFIG_STATUS
cat > $CONFIG_STATUS </dev/null | sed 1q`:
#
# $0 $ac_configure_args
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
for ac_option
do
case "\$ac_option" in
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
*) echo "\$ac_cs_usage"; exit 1 ;;
esac
done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile ptclient/Makefile lib/Makefile imsp/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
s%@exec_prefix@%$exec_prefix%g
s%@prefix@%$prefix%g
s%@program_transform_name@%$program_transform_name%g
s%@bindir@%$bindir%g
s%@sbindir@%$sbindir%g
s%@libexecdir@%$libexecdir%g
s%@datadir@%$datadir%g
s%@sysconfdir@%$sysconfdir%g
s%@sharedstatedir@%$sharedstatedir%g
s%@localstatedir@%$localstatedir%g
s%@libdir@%$libdir%g
s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@host@%$host%g
s%@host_alias@%$host_alias%g
s%@host_cpu@%$host_cpu%g
s%@host_vendor@%$host_vendor%g
s%@host_os@%$host_os%g
s%@CC@%$CC%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@RANLIB@%$RANLIB%g
s%@SET_MAKE@%$SET_MAKE%g
s%@CPP@%$CPP%g
s%@LIBOBJS@%$LIBOBJS%g
s%@PRE_SUBDIRS@%$PRE_SUBDIRS%g
s%@EXTRA_SUBDIRS@%$EXTRA_SUBDIRS%g
s%@DEPLIBS@%$DEPLIBS%g
s%@WITH_NONBLOCK@%$WITH_NONBLOCK%g
s%@WITH_GMTOFF@%$WITH_GMTOFF%g
s%@LIB_CRYPT@%$LIB_CRYPT%g
s%@LIB_SOCKET@%$LIB_SOCKET%g
s%@GSSAPI_LIBS@%$GSSAPI_LIBS%g
s%@GSSAPIBASE_LIBS@%$GSSAPIBASE_LIBS%g
s%@LIB_DYN_SASL@%$LIB_DYN_SASL%g
s%@DYNSASLFLAGS@%$DYNSASLFLAGS%g
s%@LIB_SASL@%$LIB_SASL%g
s%@SASLFLAGS@%$SASLFLAGS%g
s%@HAVE_LDAP_OBJS@%$HAVE_LDAP_OBJS%g
s%@WITH_LOCK@%$WITH_LOCK%g
s%@WITH_AUTH@%$WITH_AUTH%g
s%@AFS_LIBS@%$AFS_LIBS%g
s%@AFS_LDFLAGS@%$AFS_LDFLAGS%g
CEOF
EOF
cat >> $CONFIG_STATUS <<\EOF
# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
while $ac_more_lines; do
if test $ac_beg -gt 1; then
sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
else
sed "${ac_end}q" conftest.subs > conftest.s$ac_file
fi
if test ! -s conftest.s$ac_file; then
ac_more_lines=false
rm -f conftest.s$ac_file
else
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f conftest.s$ac_file"
else
ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
fi
ac_file=`expr $ac_file + 1`
ac_beg=$ac_end
ac_end=`expr $ac_end + $ac_max_sed_cmds`
fi
done
if test -z "$ac_sed_cmds"; then
ac_sed_cmds=cat
fi
EOF
cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
# Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dir_suffix.
ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dir_suffix= ac_dots=
fi
case "$ac_given_srcdir" in
.) srcdir=.
if test -z "$ac_dots"; then top_srcdir=.
else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
/*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
*) # Relative path.
srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
case "$ac_given_INSTALL" in
[/$]*) INSTALL="$ac_given_INSTALL" ;;
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
esac
echo creating "$ac_file"
rm -f "$ac_file"
configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
case "$ac_file" in
*Makefile*) ac_comsub="1i\\
# $configure_input" ;;
*) ac_comsub= ;;
esac
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
ac_dC='\3'
ac_dD='%g'
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='\([ ]\)%\1#\2define\3'
ac_uC=' '
ac_uD='\4%g'
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_eB='$%\1#\2define\3'
ac_eC=' '
ac_eD='%g'
if test "${CONFIG_HEADERS+set}" != set; then
EOF
cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF
fi
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
echo creating $ac_file
rm -f conftest.frag conftest.in conftest.out
ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
cat $ac_file_inputs > conftest.in
EOF
# Transform confdefs.h into a sed script conftest.vals that substitutes
# the proper values into config.h.in to produce config.h. And first:
# Protect against being on the right side of a sed subst in config.status.
# Protect against being in an unquoted here document in config.status.
rm -f conftest.vals
cat > conftest.hdr <<\EOF
s/[\\&%]/\\&/g
s%[\\$`]%\\&%g
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%ac_d%ac_u%gp
s%ac_u%ac_e%gp
EOF
sed -n -f conftest.hdr confdefs.h > conftest.vals
rm -f conftest.hdr
# This sed command replaces #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >> conftest.vals <<\EOF
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
EOF
# Break up conftest.vals because some shells have a limit on
# the size of here documents, and old seds have small limits too.
rm -f conftest.tail
while :
do
ac_lines=`grep -c . conftest.vals`
# grep -c gives empty output for an empty file on some AIX systems.
if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
# Write a limited-size here document to conftest.frag.
echo ' cat > conftest.frag <> $CONFIG_STATUS
sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
echo 'CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
' >> $CONFIG_STATUS
sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
rm -f conftest.vals
mv conftest.tail conftest.vals
done
rm -f conftest.vals
cat >> $CONFIG_STATUS <<\EOF
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
cat conftest.in >> conftest.h
rm -f conftest.in
if cmp -s $ac_file conftest.h 2>/dev/null; then
echo "$ac_file is unchanged"
rm -f conftest.h
else
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
fi
rm -f $ac_file
mv conftest.h $ac_file
fi
fi; done
EOF
cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF
exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
cyrus-imspd-v1.8/configure.in 0100644 0043101 0000012 00000020240 10035057302 015466 0 ustar shadow staff dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.in,v 1.24 2004/04/07 20:04:18 rjs3 Exp $
AC_INIT(imsp/imsp_server.c)
AC_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_MAKE_SET
AC_AIX
AC_ISC_POSIX
AC_C_CONST
AC_SYS_LONG_FILE_NAMES
if test $ac_cv_sys_long_file_names = no; then
AC_MSG_ERROR(The Cyrus IMSPD requires support for long file names)
fi
AC_CHECK_HEADERS(unistd.h stdarg.h)
AC_REPLACE_FUNCS(memmove strcasecmp ftruncate getdtablesize getaddrinfo getnameinfo)
AC_CHECK_FUNCS(strlcat strlcpy)
AC_HEADER_DIRENT
AC_SUBST(CPPFLAGS)
AC_SUBST(PRE_SUBDIRS)
AC_SUBST(EXTRA_SUBDIRS)
AC_SUBST(DEPLIBS)
AC_FUNC_VPRINTF
dnl for et routines
AC_FUNC_CHECK(strerror,AC_DEFINE(HAS_STRERROR,[],[Do we have strerror?]))
AC_MSG_CHECKING(nonblocking method)
AC_CACHE_VAL(cyrus_cv_sys_nonblock,AC_TRY_LINK([#include
#include
#include
#ifndef FNDELAY
#define FNDELAY O_NDELAY
#endif],[fcntl(0, F_GETFL, 0)&FNDELAY],
cyrus_cv_sys_nonblock=fcntl,cyrus_cv_sys_nonblock=ioctl))
WITH_NONBLOCK=$cyrus_cv_sys_nonblock
AC_SUBST(WITH_NONBLOCK)
AC_MSG_RESULT($WITH_NONBLOCK)
AC_MSG_CHECKING(timezone GMT offset method)
AC_CACHE_VAL(cyrus_cv_struct_sys_gmtoff,AC_TRY_COMPILE([
#include ],[struct tm tm;
tm.tm_gmtoff = 0;
],cyrus_cv_struct_sys_gmtoff=tm,cyrus_cv_struct_sys_gmtoff=gmtime))
WITH_GMTOFF=$cyrus_cv_struct_sys_gmtoff
AC_SUBST(WITH_GMTOFF)
AC_MSG_RESULT($WITH_GMTOFF)
dnl
dnl check for -R, etc. switch
dnl
CMU_GUESS_RUNPATH_SWITCH
dnl let's just link against local. otherwise we never find anything useful.
CPPFLAGS="-I/usr/local/include ${CPPFLAGS}"
CMU_ADD_LIBPATH("/usr/local/lib")
dnl
dnl Get ready to use DB
dnl
AC_CHECK_FUNC(dbopen, [AC_DEFINE(HAVE_LIBDB,[],[Berkeley DB?])
use_db=1],
AC_CHECK_LIB(db,dbopen,[AC_DEFINE(HAVE_LIBDB,[],[Berkeley DB?])
LIBS=" -ldb ${LIBS}"
use_db=1]))
dnl if db_185.h is present, we're using db2 or 3 and should include db_185.h
dnl instead of db.h; otherwise, include db.h. this is handled in the code
dnl itself.
AC_CHECK_HEADER(db_185.h, [AC_DEFINE(HAVE_DB_185_H,[],[DB 185 h?])
AC_DEFINE(HAVE_LIBDB,[],[Berkeley DB?])
LIBS="-ldb ${LIBS}"
use_db=1])
if test -z "use_db"; then
AC_CHECK_LIB(ndbm, dbm_open)
AC_CHECK_LIB(dbm, dbm_open)
fi
dnl
dnl Random other libraries
dnl
AC_CHECK_LIB(socket, accept, LIBS="${LIBS} -lsocket -lnsl",,-lnsl)
AC_CHECK_LIB(resolv, res_search)
dnl
dnl Do the checks for SASL
dnl
AC_CHECK_FUNC(dlopen,,AC_CHECK_LIB(dl,dlopen))
CMU_SASL2_REQUIRED
LIBS="${LIB_SASL} ${LIBS}"
dnl
dnl Stuff that takes configure command-line arguments
dnl
AC_ARG_WITH(ldap,[ --with-ldap=LIBRARY use LDAP address book features
LIBRARY is the name of your LDAP library],
[if test "$with_ldap" = "yes"; then
AC_MSG_ERROR(Must provide a library name for --with-ldap)
fi
if test "$with_ldap" != "no"; then
AC_CHECK_LIB("$with_ldap", ldap_init,
[AC_DEFINE(HAVE_LDAP,[],[Do we have ldap support?])
HAVE_LDAP_OBJS="abook_ldap.o"
LIBS="-l$with_ldap -llber -lssl -lcrypto $LIBS"],
AC_MSG_ERROR(LDAP library does not provide ldap_init),
-llber -lssl -lcrypto)
fi],
AC_SEARCH_LIBS(ldap_init, [ldap10 ldap],
[AC_DEFINE(HAVE_LDAP)
HAVE_LDAP_OBJS="abook_ldap.o"],
-llber -lssl -lcrypto))
AC_SUBST(HAVE_LDAP_OBJS)
AC_ARG_WITH(lock,[ --with-lock=METHOD force use of METHOD for locking (flock or fcntl)],
WITH_LOCK="$withval", [
AC_CHECK_FUNC(fcntl,WITH_LOCK="fcntl",[
AC_CHECK_FUNC(flock,WITH_LOCK="flock",[
AC_ERROR(unable to detect locking method)
])
])
])
AC_SUBST(WITH_LOCK)
AC_ARG_WITH(login,,AC_ERROR([--with-login is no longer supported.
Configure SASL appropriately instead.]))
AC_ARG_WITH(auth,[ --with-auth=METHOD use authorization module METHOD
METHOD is unix, krb, or krb_pts],
WITH_AUTH="$withval",
if test -f /etc/krb.conf -o -f /etc/kerberosIV/krb.conf ; then
WITH_AUTH="krb"
else
WITH_AUTH="unix"
fi)
AC_SUBST(WITH_AUTH)
dnl this is the new simple check for kerberos; since the person had to
dnl compile SASL, we might as well use the same checks.
AC_ARG_WITH(krb,[ --with-krb=PATH use Kerberos from PATH],
with_krb="$withval", with_krb="yes")
if test "$WITH_AUTH" = "krb" -o "$WITH_AUTH" = "krb_pts" ; then
dnl In order to compile kerberos4, we need libkrb and libdes.
dnl we might need -lresolv for kerberos
AC_CHECK_LIB(resolv,res_search)
dnl Do we need DES for kerberos?
AC_ARG_WITH(krbdes,[ --with-krbdes use Kerberos DES implementation [[yes]]],
with_krbdes="$withval", with_krbdes="yes")
if test "$with_krbdes" = "yes"; then
AC_CHECK_LIB(des,des_ecb_encrypt, LIBS="${LIBS} -ldes",
AC_MSG_ERROR([The Kerberos DES library is required for Kerberos support.]))
fi
dnl if we were ambitious, we'd look more aggressively for the
dnl krb4 install
if test -d ${with_krb}; then
AC_CACHE_CHECK(for Kerberos includes, cyrus_krbinclude, [
for krbhloc in include/kerberosIV include
do
if test -f ${with_krb}/${krbhloc}/krb.h ; then
cyrus_krbinclude=${with_krb}/${krbhloc}
break
fi
done
])
if test -n "${cyrus_krbinclude}"; then
CPPFLAGS="$CPPFLAGS -I${cyrus_krbinclude}"
fi
LDFLAGS="$LDFLAGS -L${with_krb}/lib"
fi
AC_CHECK_HEADER(krb.h,
AC_CHECK_LIB(krb, krb_mk_priv,,
AC_WARN(No Kerberos V4 found); krb4=no),
AC_WARN(No Kerberos V4 found); krb4=no)
if test "${krb4}" != no; then
AC_DEFINE(HAVE_KRB, [], [Do we have kerberos support?])
else
AC_ERROR([Kerberos not found for authorization module])
fi
fi
AC_ARG_WITH(afs,[ --with-afs=PATH use AFS libraries from PATH],
[with_afs="${withval}"
CFLAGS="${CFLAGS} -I${withval}/include"],with_afs="/usr/local")
if test "$WITH_AUTH" = "krb_pts" ; then
EXTRA_SUBDIRS="${EXTRA_SUBDIRS} ptclient"
EXTRA_OUTPUT="${EXTRA_OUTPUT} ptclient/Makefile"
AFS_LIBS="${with_afs}/lib/afs/libkauth.a ${with_afs}/lib/afs/libprot.a ${with_afs}/lib/afs/libauth.a ${with_afs}/lib/afs/libsys.a ${with_afs}/lib/librxkad.a ${with_afs}/lib/librx.a ${with_afs}/lib/afs/libsys.a ${with_afs}/lib/libubik.a ${with_afs}/lib/liblwp.a ${with_afs}/lib/afs/util.a"
if test -f ${with_afs}/lib/afs/libaudit.a; then
AFS_LIBS="$AFS_LIBS ${with_afs}/lib/afs/libaudit.a"
fi
if test -f /usr/ucblib/libucb.a; then
CMU_ADD_LIBPATH_TO(/usr/ucblib, AFS_LDFLAGS)
AFS_LIBS="$AFS_LIBS -lc -lucb"
fi
AC_CACHE_VAL(cyrus_afs_pr_end,[
SAVE_LIBS="$LIBS"
LIBS="$AFS_LIBS"
AC_MSG_CHECKING(if AFS libraries have pr_End)
AC_TRY_LINK([pr_End();],
[pr_End()],
[
dnl it linked; have it
AC_MSG_RESULT(yes)
cyrus_afs_pr_end="yes"
], [
dnl didn't link; use old code
AC_MSG_RESULT(no)
cyrus_afs_pr_end="no"
])
])
LIBS="$SAVE_LIBS"
if test "$cyrus_afs_pr_end" = no; then
AC_DEFINE(HAVE_PR_END)
fi
AC_CACHE_VAL(cyrus_afs_sigvec,[
SAVE_LIBS="$LIBS"
LIBS="${with_afs}/lib/liblwp.a"
AC_MSG_CHECKING(if AFS libraries need sigvec)
dnl Does AFS need sigvec? We have to link against lwp and see
dnl if IOMGR_Initialize wants it
AC_TRY_LINK([IOMGR_Initialize();],
[IOMGR_Initialize()],
[
dnl it linked; don't need it
AC_MSG_RESULT(no)
cyrus_afs_sigvec="no"
], [
dnl didn't link; pick up sigvec
AC_MSG_RESULT(yes)
cyrus_afs_sigvec="yes"
])
])
if test "$cyrus_afs_sigvec" = yes; then
if test "$cant_find_sigvec" = yes; then
AC_MSG_WARN([Can't find a sigvec for AFS libraries which seem to])
AC_MSG_WARN([need one; ptloader may not build.])
else
AFS_LIBS="${AFS_LIBS} $cyrus_sigveclib"
fi
fi
LIBS="$SAVE_LIBS"
AC_SUBST(AFS_LIBS)
AC_SUBST(AFS_LDFLAGS)
AC_ARG_WITH(statedir,
[ --with-statedir=DIR use DIR as state directory for ptclient,
only needed when using krb_pts for authorization],
statedir="$withval",statedir="/var")
AC_DEFINE_UNQUOTED(STATEDIR,"$statedir",[ptclient state directory?])
fi
AC_SUBST(EXTRA_SUBDIRS)
AC_OUTPUT(Makefile ptclient/Makefile lib/Makefile imsp/Makefile)
cyrus-imspd-v1.8/aclocal.m4 0100644 0043101 0000012 00000043360 10170575164 015040 0 ustar shadow staff dnl aclocal.m4 generated automatically by aclocal 1.4-p6
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# isc-posix.m4 serial 2 (gettext-0.11.2)
dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX])
AC_DEFUN([AC_ISC_POSIX],
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
dnl
dnl Additional macros for configure.in packaged up for easier theft.
dnl $Id: cyrus.m4,v 1.4 2003/10/08 20:35:24 rjs3 Exp $
dnl tjs@andrew.cmu.edu 6-may-1998
dnl
dnl It would be good if ANDREW_ADD_LIBPATH could detect if something was
dnl already there and not redundantly add it if it is.
dnl add -L(arg), and possibly (runpath switch)(arg), to LDFLAGS
dnl (so the runpath for shared libraries is set).
AC_DEFUN([CMU_ADD_LIBPATH], [
# this is CMU ADD LIBPATH
if test "$andrew_runpath_switch" = "none" ; then
LDFLAGS="-L$1 ${LDFLAGS}"
else
LDFLAGS="-L$1 $andrew_runpath_switch$1 ${LDFLAGS}"
fi
])
dnl add -L(1st arg), and possibly (runpath switch)(1st arg), to (2nd arg)
dnl (so the runpath for shared libraries is set).
AC_DEFUN([CMU_ADD_LIBPATH_TO], [
# this is CMU ADD LIBPATH TO
if test "$andrew_runpath_switch" = "none" ; then
$2="-L$1 ${$2}"
else
$2="-L$1 ${$2} $andrew_runpath_switch$1"
fi
])
dnl runpath initialization
AC_DEFUN([CMU_GUESS_RUNPATH_SWITCH], [
# CMU GUESS RUNPATH SWITCH
AC_CACHE_CHECK(for runpath switch, andrew_runpath_switch, [
# first, try -R
SAVE_LDFLAGS="${LDFLAGS}"
LDFLAGS="-R /usr/lib"
AC_TRY_LINK([],[],[andrew_runpath_switch="-R"], [
LDFLAGS="-Wl,-rpath,/usr/lib"
AC_TRY_LINK([],[],[andrew_runpath_switch="-Wl,-rpath,"],
[andrew_runpath_switch="none"])
])
LDFLAGS="${SAVE_LDFLAGS}"
])])
dnl sasl2.m4--sasl2 libraries and includes
dnl Rob Siemborski
dnl $Id: sasl2.m4,v 1.48 2004/09/13 21:06:34 shadow Exp $
AC_DEFUN([SASL_GSSAPI_CHK],[
AC_ARG_ENABLE(gssapi, [ --enable-gssapi= enable GSSAPI authentication [yes] ],
gssapi=$enableval,
gssapi=yes)
AC_ARG_WITH(gss_impl, [ --with-gss_impl={heimdal|mit|cybersafe|seam|auto} choose specific GSSAPI implementation [[auto]] ],
gss_impl=$withval,
gss_impl=auto)
AC_REQUIRE([SASL2_CRYPT_CHK])
AC_REQUIRE([CMU_SOCKETS])
if test "$gssapi" != no; then
platform=
case "${host}" in
*-*-linux*)
platform=__linux
;;
*-*-hpux*)
platform=__hpux
;;
*-*-irix*)
platform=__irix
;;
*-*-solaris2*)
# When should we use __sunos?
platform=__solaris
;;
*-*-aix*)
platform=__aix
;;
*)
AC_WARN([The system type is not recognized. If you believe that CyberSafe GSSAPI works on this platform, please update the configure script])
if test "$gss_impl" = "cybersafe"; then
AC_ERROR([CyberSafe was forced, cannot continue as platform is not supported])
fi
;;
esac
cmu_saved_CPPFLAGS=$CPPFLAGS
if test -d ${gssapi}; then
CPPFLAGS="$CPPFLAGS -I$gssapi/include"
# We want to keep -I in our CPPFLAGS, but only if we succeed
cmu_saved_CPPFLAGS=$CPPFLAGS
LDFLAGS="$LDFLAGS -L$gssapi/lib"
if test -n "$platform"; then
if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
CPPFLAGS="$CPPFLAGS -D$platform"
if test -d "${gssapi}/appsec-sdk/include"; then
CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
fi
fi
fi
fi
AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H,,[Define if you have the gssapi.h header file]), [
AC_CHECK_HEADER(gssapi/gssapi.h,, AC_WARN(Disabling GSSAPI - no include files found); gssapi=no)])
CPPFLAGS=$cmu_saved_CPPFLAGS
fi
if test "$gssapi" != no; then
dnl We need to find out which gssapi implementation we are
dnl using. Supported alternatives are: MIT Kerberos 5,
dnl Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal),
dnl CyberSafe Kerberos 5 (http://www.cybersafe.com/)
dnl and Sun SEAM (http://wwws.sun.com/software/security/kerberos/)
dnl
dnl The choice is reflected in GSSAPIBASE_LIBS
AC_CHECK_LIB(resolv,res_search)
if test -d ${gssapi}; then
gssapi_dir="${gssapi}/lib"
GSSAPIBASE_LIBS="-L$gssapi_dir"
GSSAPIBASE_STATIC_LIBS="-L$gssapi_dir"
else
dnl FIXME: This is only used for building cyrus, and then only as
dnl a real hack. it needs to be fixed.
gssapi_dir="/usr/local/lib"
fi
# Check a full link against the Heimdal libraries.
# If this fails, check a full link against the MIT libraries.
# If this fails, check a full link against the CyberSafe libraries.
# If this fails, check a full link against the Solaris 8 and up libgss.
if test "$gss_impl" = "auto" -o "$gss_impl" = "heimdal"; then
gss_failed=0
AC_CHECK_LIB(gssapi,gss_unwrap,gss_impl="heimdal",gss_failed=1,$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET})
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
if test "$gss_impl" = "auto" -o "$gss_impl" = "mit"; then
gss_failed=0
AC_CHECK_LIB(gssapi_krb5,gss_unwrap,gss_impl="mit",gss_failed=1,$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${LIB_SOCKET})
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
# For Cybersafe one has to set a platform define in order to make compilation work
if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_GSSAPIBASE_LIBS=$GSSAPIBASE_LIBS
# FIX ME - Note that the libraries are in .../lib/64 for 64bit kernels
if test -d "${gssapi}/appsec-rt/lib"; then
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -L${gssapi}/appsec-rt/lib"
fi
CPPFLAGS="$CPPFLAGS -D$platform"
if test -d "${gssapi}/appsec-sdk/include"; then
CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
fi
gss_failed=0
# Check for CyberSafe with two libraries first, than fall back to a single
# library (older CyberSafe)
unset ac_cv_lib_gss_csf_gss_acq_user
AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe03",[
unset ac_cv_lib_gss_csf_gss_acq_user;AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe",gss_failed=1,$GSSAPIBASE_LIBS -lgss)],$GSSAPIBASE_LIBS -lgss -lcstbk5)
if test "$gss_failed" = "1"; then
# Restore variables
GSSAPIBASE_LIBS=$cmu_saved_GSSAPIBASE_LIBS
CPPFLAGS=$cmu_saved_CPPFLAGS
if test "$gss_impl" != "auto"; then
gss_impl="failed"
fi
fi
fi
if test "$gss_impl" = "auto" -o "$gss_impl" = "seam"; then
gss_failed=0
AC_CHECK_LIB(gss,gss_unwrap,gss_impl="seam",gss_failed=1,-lgss)
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
if test "$gss_impl" = "mit"; then
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a"
elif test "$gss_impl" = "heimdal"; then
CPPFLAGS="$CPPFLAGS -DKRB5_HEIMDAL"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err"
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}"
elif test "$gss_impl" = "cybersafe03"; then
# Version of CyberSafe with two libraries
CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss -lcstbk5"
# there is no static libgss for CyberSafe
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "cybersafe"; then
CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss"
# there is no static libgss for CyberSafe
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "seam"; then
GSSAPIBASE_LIBS=-lgss
# there is no static libgss on Solaris 8 and up
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "failed"; then
gssapi="no"
GSSAPIBASE_LIBS=
GSSAPIBASE_STATIC_LIBS=
AC_WARN(Disabling GSSAPI - specified library not found)
else
gssapi="no"
GSSAPIBASE_LIBS=
GSSAPIBASE_STATIC_LIBS=
AC_WARN(Disabling GSSAPI - no library)
fi
fi
#
# Cybersafe defines both GSS_C_NT_HOSTBASED_SERVICE and GSS_C_NT_USER_NAME in gssapi\rfckrb5.h
#
if test "$gssapi" != "no"; then
if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
AC_EGREP_CPP(hostbased_service_gss_nt_yes,
[#include
#ifdef GSS_C_NT_HOSTBASED_SERVICE
hostbased_service_gss_nt_yes
#endif
], AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE]), AC_WARN(Cybersafe define not found))
elif test "$ac_cv_header_gssapi_h" = "yes"; then
AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE]))
elif test "$ac_cv_header_gssapi_gssapi_h"; then
AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE]))
fi
if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
AC_EGREP_CPP(user_name_yes_gss_nt,
[#include
#ifdef GSS_C_NT_USER_NAME
user_name_yes_gss_nt
#endif
], AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME]), AC_WARN(Cybersafe define not found))
elif test "$ac_cv_header_gssapi_h" = "yes"; then
AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME]))
elif test "$ac_cv_header_gssapi_gssapi_h"; then
AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi/gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME]))
fi
fi
GSSAPI_LIBS=""
AC_MSG_CHECKING(GSSAPI)
if test "$gssapi" != no; then
AC_MSG_RESULT(with implementation ${gss_impl})
AC_CHECK_LIB(resolv,res_search,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv")
SASL_MECHS="$SASL_MECHS libgssapiv2.la"
SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/gssapi.o"
cmu_save_LIBS="$LIBS"
LIBS="$LIBS $GSSAPIBASE_LIBS"
AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity)
LIBS="$cmu_save_LIBS"
else
AC_MSG_RESULT(disabled)
fi
AC_SUBST(GSSAPI_LIBS)
AC_SUBST(GSSAPIBASE_LIBS)
])
AC_DEFUN([SASL_SET_GSSAPI_LIBS], [
SASL_GSSAPI_LIBS_SET="yes"
])
dnl What we want to do here is setup LIB_SASL with what one would
dnl generally want to have (e.g. if static is requested, make it that,
dnl otherwise make it dynamic.
dnl We also want to create LIB_DYN_SASL and DYNSASLFLAGS.
dnl Also sets using_static_sasl to "no" "static" or "staticonly"
AC_DEFUN([CMU_SASL2], [
AC_REQUIRE([SASL_GSSAPI_CHK])
AC_ARG_WITH(sasl,
[ --with-sasl=DIR Compile with libsasl2 in ],
with_sasl="$withval",
with_sasl="yes")
AC_ARG_WITH(staticsasl,
[ --with-staticsasl=DIR Compile with staticly linked libsasl2 in ],
with_staticsasl="$withval";
if test $with_staticsasl != "no"; then
using_static_sasl="static"
fi,
with_staticsasl="no"; using_static_sasl="no")
SASLFLAGS=""
LIB_SASL=""
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_LDFLAGS=$LDFLAGS
cmu_saved_LIBS=$LIBS
if test ${with_staticsasl} != "no"; then
if test -d ${with_staticsasl}; then
if test -d ${with_staticsasl}/lib64 ; then
ac_cv_sasl_where_lib=${with_staticsasl}/lib64
else
ac_cv_sasl_where_lib=${with_staticsasl}/lib
fi
ac_cv_sasl_where_lib=${with_staticsasl}/lib
ac_cv_sasl_where_inc=${with_staticsasl}/include
SASLFLAGS="-I$ac_cv_sasl_where_inc"
LIB_SASL="-L$ac_cv_sasl_where_lib"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
else
with_staticsasl="/usr"
fi
AC_CHECK_HEADER(sasl/sasl.h, [
AC_CHECK_HEADER(sasl/saslutil.h, [
for i42 in lib64 lib; do
if test -r ${with_staticsasl}/$i42/libsasl2.a; then
ac_cv_found_sasl=yes
AC_MSG_CHECKING(for static libsasl)
LIB_SASL="$LIB_SASL ${with_staticsasl}/$i42/libsasl2.a"
fi
done
if test ! "$ac_cv_found_sasl" = "yes"; then
AC_MSG_CHECKING(for static libsasl)
AC_ERROR([Could not find ${with_staticsasl}/lib*/libsasl2.a])
fi
])])
AC_MSG_RESULT(found)
if test "x$SASL_GSSAPI_LIBS_SET" = "x"; then
LIB_SASL="$LIB_SASL $GSSAPIBASE_STATIC_LIBS"
else
SASL_GSSAPI_LIBS_SET=""
cmu_saved_LIBS="$GSSAPIBASE_STATIC_LIBS $cmu_saved_LIBS"
fi
fi
if test -d ${with_sasl}; then
ac_cv_sasl_where_lib=${with_sasl}/lib
ac_cv_sasl_where_inc=${with_sasl}/include
DYNSASLFLAGS="-I$ac_cv_sasl_where_inc"
if test "$ac_cv_sasl_where_lib" != ""; then
CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, LIB_DYN_SASL)
fi
LIB_DYN_SASL="$LIB_DYN_SASL -lsasl2"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
fi
dnl be sure to check for a SASLv2 specific function
AC_CHECK_HEADER(sasl/sasl.h, [
AC_CHECK_HEADER(sasl/saslutil.h, [
AC_CHECK_LIB(sasl2, prop_get,
ac_cv_found_sasl=yes,
ac_cv_found_sasl=no)],
ac_cv_found_sasl=no)], ac_cv_found_sasl=no)
if test "$ac_cv_found_sasl" = "yes"; then
if test "$ac_cv_sasl_where_lib" != ""; then
CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, DYNLIB_SASL)
fi
DYNLIB_SASL="$DYNLIB_SASL -lsasl2"
if test "$using_static_sasl" != "static"; then
LIB_SASL=$DYNLIB_SASL
SASLFLAGS=$DYNSASLFLAGS
fi
else
DYNLIB_SASL=""
DYNSASLFLAGS=""
using_static_sasl="staticonly"
fi
if test "x$SASL_GSSAPI_LIBS_SET" != "x"; then
SASL_GSSAPI_LIBS_SET=""
cmu_saved_LIBS="$GSSAPIBASE_LIBS $cmu_saved_LIBS"
fi
LIBS="$cmu_saved_LIBS"
LDFLAGS="$cmu_saved_LDFLAGS"
CPPFLAGS="$cmu_saved_CPPFLAGS"
AC_SUBST(LIB_DYN_SASL)
AC_SUBST(DYNSASLFLAGS)
AC_SUBST(LIB_SASL)
AC_SUBST(SASLFLAGS)
])
AC_DEFUN([CMU_SASL2_REQUIRED],
[AC_REQUIRE([CMU_SASL2])
if test "$ac_cv_found_sasl" != "yes"; then
AC_ERROR([Cannot continue without libsasl2.
Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.])
fi])
AC_DEFUN([CMU_SASL2_REQUIRE_VER], [
AC_REQUIRE([CMU_SASL2_REQUIRED])
cmu_saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $SASLFLAGS"
AC_TRY_CPP([
#include
#ifndef SASL_VERSION_MAJOR
#error SASL_VERSION_MAJOR not defined
#endif
#ifndef SASL_VERSION_MINOR
#error SASL_VERSION_MINOR not defined
#endif
#ifndef SASL_VERSION_STEP
#error SASL_VERSION_STEP not defined
#endif
#if SASL_VERSION_MAJOR < $1 || SASL_VERSION_MINOR < $2 || SASL_VERSION_STEP < $3
#error SASL version is less than $1.$2.$3
#endif
],,AC_ERROR([Incorrect SASL headers found. This package requires SASL $1.$2.$3 or newer.]))
CPPFLAGS=$cmu_saved_CPPFLAGS
])
AC_DEFUN([CMU_SASL2_CHECKAPOP_REQUIRED], [
AC_REQUIRE([CMU_SASL2_REQUIRED])
cmu_saved_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $LIB_SASL"
AC_CHECK_LIB(sasl2, sasl_checkapop, AC_DEFINE(HAVE_APOP,[],[Does SASL support APOP?]),
AC_MSG_ERROR([libsasl2 without working sasl_checkapop. Cannot continue.]))
LDFLAGS=$cmu_saved_LDFLAGS
])
AC_DEFUN([SASL2_CRYPT_CHK],[
AC_CHECK_FUNC(crypt, cmu_have_crypt=yes, [
AC_CHECK_LIB(crypt, crypt,
LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes,
cmu_have_crypt=no)])
AC_SUBST(LIB_CRYPT)
])
dnl bsd_sockets.m4--which socket libraries do we need?
dnl Derrick Brashear
dnl from Zephyr
dnl $Id: bsd_sockets.m4,v 1.9 2003/10/08 20:35:24 rjs3 Exp $
dnl Hacked on by Rob Earhart to not just toss stuff in LIBS
dnl It now puts everything required for sockets into LIB_SOCKET
AC_DEFUN([CMU_SOCKETS], [
save_LIBS="$LIBS"
LIB_SOCKET=""
AC_CHECK_FUNC(connect, :,
AC_CHECK_LIB(nsl, gethostbyname,
LIB_SOCKET="-lnsl $LIB_SOCKET")
AC_CHECK_LIB(socket, connect,
LIB_SOCKET="-lsocket $LIB_SOCKET")
)
LIBS="$LIB_SOCKET $save_LIBS"
AC_CHECK_FUNC(res_search, :,
AC_CHECK_LIB(resolv, res_search,
LIB_SOCKET="-lresolv $LIB_SOCKET")
)
LIBS="$LIB_SOCKET $save_LIBS"
AC_CHECK_FUNCS(dn_expand dns_lookup)
LIBS="$save_LIBS"
AC_SUBST(LIB_SOCKET)
])
cyrus-imspd-v1.8/config.guess 0100644 0043101 0000012 00000074774 07754522070 015534 0 ustar shadow staff #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
# Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner .
# The master version of this file is at the FSF in /home/gd/gnu/lib.
# Please send patches to .
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# Use $HOST_CC if defined. $CC may point to a cross-compiler
if test x"$CC_FOR_BUILD" = x; then
if test x"$HOST_CC" != x; then
CC_FOR_BUILD="$HOST_CC"
else
if test x"$CC" != x; then
CC_FOR_BUILD="$CC"
else
CC_FOR_BUILD=cc
fi
fi
fi
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
cat <$dummy.s
.globl main
.ent main
main:
.frame \$30,0,\$26,0
.prologue 0
.long 0x47e03d80 # implver $0
lda \$2,259
.long 0x47e20c21 # amask $2,$1
srl \$1,8,\$2
sll \$2,2,\$2
sll \$0,3,\$0
addl \$1,\$0,\$0
addl \$2,\$0,\$0
ret \$31,(\$26),1
.end main
EOF
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
;;
15)
UNAME_MACHINE="alphaev5"
;;
14)
UNAME_MACHINE="alphaev56"
;;
10)
UNAME_MACHINE="alphapca56"
;;
16)
UNAME_MACHINE="alphaev6"
;;
esac
fi
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
arc64:OpenBSD:*:*)
echo mips64el-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hkmips:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
arm32:NetBSD:*:*)
echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit 0 ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit 0 ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
macppc:NetBSD:*:*)
echo powerpc-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >$dummy.c
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[34678]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
sed 's/^ //' << EOF >$dummy.c
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
rm -f $dummy.c $dummy
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >$dummy.c
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
*9??*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
hppa*:OpenBSD:*:*)
echo hppa-unknown-openbsd
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*T3E:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
if test -x /usr/bin/objformat; then
if test "elf" = "`/usr/bin/objformat`"; then
echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
exit 0
fi
fi
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit 0 ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
ld_help_string=`cd /; ld --help 2>&1`
ld_supported_emulations=`echo $ld_help_string \
| sed -ne '/supported emulations:/!d
s/[ ][ ]*/ /g
s/.*supported emulations: *//
s/ .*//
p'`
case "$ld_supported_emulations" in
*ia64)
echo "${UNAME_MACHINE}-unknown-linux"
exit 0
;;
i?86linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit 0
;;
i?86coff)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0
;;
sparclinux)
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
exit 0
;;
armlinux)
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
exit 0
;;
elf32arm*)
echo "${UNAME_MACHINE}-unknown-linux-gnu"
exit 0
;;
armelf_linux*)
echo "${UNAME_MACHINE}-unknown-linux-gnu"
exit 0
;;
m68klinux)
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
exit 0
;;
elf32ppc)
# Determine Lib Version
cat >$dummy.c <
#if defined(__GLIBC__)
extern char __libc_version[];
extern char __libc_release[];
#endif
main(argc, argv)
int argc;
char *argv[];
{
#if defined(__GLIBC__)
printf("%s %s\n", __libc_version, __libc_release);
#else
printf("unkown\n");
#endif
return 0;
}
EOF
LIBC=""
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./$dummy | grep 1\.99 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f $dummy.c $dummy
echo powerpc-unknown-linux-gnu${LIBC}
exit 0
;;
esac
if test "${UNAME_MACHINE}" = "alpha" ; then
sed 's/^ //' <$dummy.s
.globl main
.ent main
main:
.frame \$30,0,\$26,0
.prologue 0
.long 0x47e03d80 # implver $0
lda \$2,259
.long 0x47e20c21 # amask $2,$1
srl \$1,8,\$2
sll \$2,2,\$2
sll \$0,3,\$0
addl \$1,\$0,\$0
addl \$2,\$0,\$0
ret \$31,(\$26),1
.end main
EOF
LIBC=""
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
;;
15)
UNAME_MACHINE="alphaev5"
;;
14)
UNAME_MACHINE="alphaev56"
;;
10)
UNAME_MACHINE="alphapca56"
;;
16)
UNAME_MACHINE="alphaev6"
;;
esac
objdump --private-headers $dummy | \
grep ld.so.1 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
elif test "${UNAME_MACHINE}" = "mips" ; then
cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
else
# Either a pre-BFD a.out linker (linux-gnuoldld)
# or one that does not give us useful --help.
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
# If ld does not provide *any* "supported emulations:"
# that means it is gnuoldld.
echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
case "${UNAME_MACHINE}" in
i?86)
VENDOR=pc;
;;
*)
VENDOR=unknown;
;;
esac
# Determine whether the default compiler is a.out or elf
cat >$dummy.c <
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
# else
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
# endif
# else
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
# endif
#else
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i?86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit 0 ;;
i?86:*:5:7*)
# Fixed at (any) Pentium or better
UNAME_MACHINE=i586
if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
pc:*:*:*)
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
news*:NEWS-OS:*:6*)
echo mips-sony-newsos6
exit 0 ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit 0 ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit 0 ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit 0 ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit 0 ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:QNX:*:4*)
echo i386-qnx-qnx${UNAME_VERSION}
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >$dummy.c <
# include
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1
cyrus-imspd-v1.8/install-sh 0100755 0043101 0000012 00000011243 07057313173 015177 0 ustar shadow staff #!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
cyrus-imspd-v1.8/cmulocal/ 0040755 0043101 0000012 00000000000 10170575121 014765 5 ustar shadow staff cyrus-imspd-v1.8/cmulocal/COPYING 0100644 0043101 0000012 00000002024 06605243477 016031 0 ustar shadow staff Copyright 1998 by Carnegie Mellon University
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Carnegie Mellon University
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
cyrus-imspd-v1.8/cmulocal/README.andrew 0100644 0043101 0000012 00000005725 10014167216 017131 0 ustar shadow staff This is a collection of autoconf macros which've been written by
various people at CMU. To use it, use "aclocal -I cmulocal" (after
the first time, automake should automatically use the -I cmulocal, if
you've called CMU_INIT_AUTOMAKE in configure.in).
CMU_INIT_AUTOMAKE
If you use automake, you should call this after AM_INIT_AUTOMAKE.
It adds "-I cmulocal" to the aclocal command line, so that when
automake runs aclocal, aclocal'll continue to pick up these macros.
CMU_ADD_LIBPATH
Add -L(arg), and possibly -R(arg) (or whatever the runpath is) to
LDFLAGS.
CMU_ADD_LIBPATH_TO
Likewise to above, except adds it to the specified variable (arg 2).
CMU_GUESS_RUNPATH_SWITCH
Attempts to guess what the runpath switch is (-R or whatever).
CMU_COMERR
Requires that com_err exist in the collection (at CMU, do this by
running "cvs checkout com_err", and adding com_err to DIST_SUBDIRS
in your Makefile.am).
It sets the output variable COMPILE_ET to the compile_et program to
use, and adds the appropriate paths to LDFLAGS and CPPFLAGS.
It does *not* add -lcom_err to LIBS (this would cause later library
checks to fail if com_err needs to be built), so Makefiles need to
explicitly add -lcom_err (which, after all, should always exist as
long as the com_err compile doesn't blow up). Makefiles should do
this by using LIB_COMERR, which will substitute to the appropriate
magic to use to grab the library. (This may involve a libtool archive;
you should be using libtool to link your program if you distribute
libraries with it that the program may link against).
Note that com_err will only be compiled if the configure script
can't find compile_et or libcom_err; if the system already has them,
the configure script will use the system installation (although, due
to some autoconf wonkiness, com_err will still be configured; it just
won't show up in the @subdirs@ expansion).
CMU_NANA
Adds --with-nana, set by default; if set, attempts to link against
libnana. If not set, or if libnana is unavailable, or if we're not
using gcc, it defines WITHOUT_NANA.
CMU_PROG_LIBTOOL
Just like AM_PROG_LIBTOOL, except it performs a couple little hacks
to make sure that things don't break on picky vendor compilers
which whine about empty translation units. [DEPRECATED - DO NOT USE]
CMU_PTHREADS
This attempts to link against libpthread (failing if it can't be found),
and attempts to do any system-specific setup required for thread
support (for example, most things want _REENTRANT to be defined,
but Solaris wants _POSIX_PTHREAD_SEMANTICS and __EXTENSIONS__, IRIX
wants to see _SGI_REENTRANT_FUNCTIONS, etc).
CMU_SASL
This tries to find a SASL library, and calls AC_SUBST on LIB_SASL
if it finds one, or tells the user to go ftp it if it doesn't exist.
Provides --with-sasldir.
CMU_KRB4
This attempts to find Kerberos 4 libraries and set up CFLAGS and LIBS
appropriately. It also updates and substitutes RPATH for shared library
stuff.
cyrus-imspd-v1.8/cmulocal/afs.m4 0100644 0043101 0000012 00000030147 10044275347 016011 0 ustar shadow staff dnl afs.m4--AFS libraries, includes, and dependencies
dnl $Id: afs.m4,v 1.28 2004/04/29 22:00:07 cg2v Exp $
dnl Chaskiel Grundman
dnl based on kerberos_v4.m4
dnl Derrick Brashear
dnl from KTH krb and Arla
AC_DEFUN([CMU_AFS_INC_WHERE1], [
cmu_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$cmu_save_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[#ifndef SYS_NAME
choke me
#endif
int foo;],
ac_cv_found_afs_inc=yes,
ac_cv_found_afs_inc=no)
CPPFLAGS=$cmu_save_CPPFLAGS
])
AC_DEFUN([CMU_AFS_LIB_WHERE1], [
save_LIBS="$LIBS"
save_LDFLAGS="$LDFLAGS"
LIBS="-lauth $1/afs/util.a $LIB_SOCKET $LIBS"
LDFLAGS="-L$1 -L$1/afs $LDFLAGS"
dnl suppress caching
AC_TRY_LINK([],[afsconf_Open();], ac_cv_found_afs_lib=yes, ac_cv_found_afs_lib=no)
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"
])
AC_DEFUN([CMU_AFS_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for AFS in $i)
CMU_AFS_INC_WHERE1("$i/include")
ac_cv_found_lwp_inc=$ac_cv_found_afs_inc
CMU_TEST_INCPATH($i/include, lwp)
ac_cv_found_afs_inc=$ac_cv_found_lwp_inc
if test "$ac_cv_found_afs_inc" = "yes"; then
CMU_AFS_LIB_WHERE1("$i/lib")
if test "$ac_cv_found_afs_lib" = "yes"; then
ac_cv_afs_where=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_AFS], [
AC_REQUIRE([CMU_SOCKETS])
AC_REQUIRE([CMU_LIBSSL])
AC_ARG_WITH(AFS,
[ --with-afs=PREFIX Compile with AFS support],
[if test "X$with_AFS" = "X"; then
with_AFS=yes
fi])
if test "X$with_AFS" != "X"; then
ac_cv_afs_where=$with_AFS
fi
if test "X$ac_cv_afs_where" = "X"; then
CMU_AFS_WHERE(/usr/afsws /usr/local /usr/athena /Library/OpenAFS/Tools)
fi
AC_MSG_CHECKING(whether to include AFS)
if test "X$ac_cv_afs_where" = "Xno" -o "X$ac_cv_afs_where" = "X"; then
ac_cv_found_afs=no
AC_MSG_RESULT(no)
else
ac_cv_found_afs=yes
AC_MSG_RESULT(yes)
AFS_INC_DIR="$ac_cv_afs_where/include"
AFS_LIB_DIR="$ac_cv_afs_where/lib"
AFS_TOP_DIR="$ac_cv_afs_where"
AFS_INC_FLAGS="-I${AFS_INC_DIR}"
AFS_LIB_FLAGS="-L${AFS_LIB_DIR} -L${AFS_LIB_DIR}/afs"
cmu_save_LIBS="$LIBS"
cmu_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS ${AFS_INC_FLAGS}"
cmu_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$cmu_save_LDFLAGS ${AFS_LIB_FLAGS}"
AC_CHECK_HEADERS(afs/stds.h)
AC_MSG_CHECKING([if libdes is needed])
AC_TRY_LINK([],[des_quad_cksum();],AFS_DES_LIB="",AFS_DES_LIB="maybe")
if test "X$AFS_DES_LIB" != "X"; then
LIBS="$cmu_save_LIBS -ldes"
AC_TRY_LINK([], [des_quad_cksum();],AFS_DES_LIB="yes")
if test "X$AFS_DES_LIB" = "Xyes"; then
AC_MSG_RESULT([yes])
AFS_LIBDES="-ldes"
AFS_LIBDESA="${AFS_LIB_DIR}/libdes.a"
else
LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS"
AC_TRY_LINK([],
[des_quad_cksum();],AFS_DES_LIB="libcrypto")
if test "X$AFS_DES_LIB" = "Xlibcrypto"; then
AC_MSG_RESULT([libcrypto])
AFS_LIBDES="$LIBSSL_LIB_FLAGS"
AFS_LIBDESA="$LIBSSL_LIB_FLAGS"
else
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([Could not use -ldes])
fi
fi
else
AC_MSG_RESULT([no])
fi
AFS_CLIENT_LIBS_STATIC="${AFS_LIB_DIR}/afs/libvolser.a ${AFS_LIB_DIR}/afs/libvldb.a ${AFS_LIB_DIR}/afs/libkauth.a ${AFS_LIB_DIR}/afs/libprot.a ${AFS_LIB_DIR}/libubik.a ${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/librxkad.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcmd.a ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a"
AFS_KTC_LIBS_STATIC="${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a"
AFS_CLIENT_LIBS="-lvolser -lvldb -lkauth -lprot -lubik -lauth -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a"
AFS_RX_LIBS="-lauth -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a"
AFS_KTC_LIBS="-lauth ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcom_err ${AFS_LIB_DIR}/afs/util.a"
LIBS="$cmu_save_LIBS $AFS_CLIENT_LIBS ${LIB_SOCKET}"
AC_CHECK_FUNC(des_pcbc_init)
if test "X$ac_cv_func_des_pcbc_init" != "Xyes"; then
AC_CHECK_LIB(descompat, des_pcbc_init, AFS_DESCOMPAT_LIB="-ldescompat")
if test "X$AFS_DESCOMPAT_LIB" != "X" ; then
AFS_CLIENT_LIBS_STATIC="$AFS_CLIENT_LIBS_STATIC $AFS_DESCOMPAT_LIB"
AFS_KTC_LIBS_STATIC="$AFS_KTC_LIBS_STATIC $AFS_DESCOMPAT_LIB"
AFS_CLIENT_LIBS="$AFS_CLIENT_LIBS $AFS_DESCOMPAT_LIB"
AFS_KTC_LIBS="$AFS_KTC_LIBS $AFS_DESCOMPAT_LIB"
else
AC_MSG_CHECKING([if rxkad needs des_pcbc_init])
AC_TRY_LINK(,[tkt_DecodeTicket();],RXKAD_PROBLEM=no,RXKAD_PROBLEM=maybe)
if test "$RXKAD_PROBLEM" = "maybe"; then
AC_TRY_LINK([int des_pcbc_init() { return 0;}],
[tkt_DecodeTicket();],RXKAD_PROBLEM=yes,RXKAD_PROBLEM=error)
if test "$RXKAD_PROBLEM" = "yes"; then
AC_MSG_RESULT([yes])
AC_MSG_ERROR([cannot use rxkad])
else
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([Unknown error testing rxkad])
fi
else
AC_MSG_RESULT([no])
fi
fi
fi
LIBS="$cmu_save_LIBS"
AC_CHECK_FUNC(flock)
LIBS="$cmu_save_LIBS ${AFS_CLIENT_LIBS} ${LIB_SOCKET}"
if test "X$ac_cv_func_flock" != "Xyes"; then
AC_MSG_CHECKING([if AFS needs flock])
AC_TRY_LINK([#include
#ifdef HAVE_AFS_STDS_H
#include
#endif
#include
#include
#include
#include
struct ubik_client * cstruct;
int sigvec() {return 0;}
extern int UV_SetSecurity();],
[vsu_ClientInit(1,"","",0,
&cstruct,UV_SetSecurity)],
AFS_FLOCK=no,AFS_FLOCK=yes)
if test $AFS_FLOCK = "no"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
LDFLAGS="$LDFLAGS -L/usr/ucblib"
AC_CHECK_LIB(ucb, flock,:, [AC_CHECK_LIB(BSD, flock)])
fi
fi
LIBS="$cmu_save_LIBS"
AC_CHECK_FUNC(sigvec)
LIBS="$cmu_save_LIBS ${AFS_CLIENT_LIBS} ${LIB_SOCKET}"
if test "X$ac_cv_func_sigvec" != "Xyes"; then
AC_MSG_CHECKING([if AFS needs sigvec])
AC_TRY_LINK([#include
#ifdef HAVE_AFS_STDS_H
#include
#endif
#include
#include
#include
#include
struct ubik_client * cstruct;
int flock() {return 0;}
extern int UV_SetSecurity();],
[vsu_ClientInit(1,"","",0,
&cstruct,UV_SetSecurity)],
AFS_SIGVEC=no,AFS_SIGVEC=yes)
if test $AFS_SIGVEC = "no"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
LDFLAGS="$LDFLAGS -L/usr/ucblib"
AC_CHECK_LIB(ucb, sigvec,:,[AC_CHECK_LIB(BSD, sigvec)])
fi
fi
if test "$ac_cv_lib_ucb_flock" = "yes" -o "$ac_cv_lib_ucb_sigvec" = "yes"; then
AFS_LIB_FLAGS="${AFS_LIB_FLAGS} -L/usr/ucblib -R/usr/ucblib"
fi
if test "$ac_cv_lib_ucb_flock" = "yes" -o "$ac_cv_lib_ucb_sigvec" = "yes"; then
AFS_BSD_LIB="-lucb"
elif test "$ac_cv_lib_BSD_flock" = "yes" -o "$ac_cv_lib_BSD_sigvec" = "yes"; then
AFS_BSD_LIB="-lBSD"
fi
if test "X$AFS_BSD_LIB" != "X" ; then
AFS_CLIENT_LIBS_STATIC="$AFS_CLIENT_LIBS_STATIC $AFS_BSD_LIB"
AFS_KTC_LIBS_STATIC="$AFS_KTC_LIBS_STATIC $AFS_BSD_LIB"
AFS_CLIENT_LIBS="$AFS_CLIENT_LIBS $AFS_BSD_LIB"
AFS_RX_LIBS="$AFS_CLIENT_LIBS $AFS_BSD_LIB"
AFS_KTC_LIBS="$AFS_KTC_LIBS $AFS_BSD_LIB"
fi
AC_MSG_CHECKING([if libaudit is needed])
AFS_LIBAUDIT=""
LIBS="$cmu_save_LIBS $AFS_CLIENT_LIBS ${LIB_SOCKET}"
AC_TRY_LINK([#include
#ifdef HAVE_AFS_STDS_H
#include
#endif
#include
#include ],
[afsconf_SuperUser();],AFS_AUDIT_LIB="",AFS_AUDIT_LIB="maybe")
if test "X$AFS_AUDIT_LIB" != "X"; then
LIBS="$cmu_save_LIBS -lvolser -lvldb -lkauth -lprot -lubik -lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB $LIB_SOCKET"
AC_TRY_LINK([#include
#ifdef HAVE_AFS_STDS_H
#include
#endif
#include
#include ],
[afsconf_SuperUser();],AFS_AUDIT_LIB="yes")
if test "X$AFS_AUDIT_LIB" = "Xyes"; then
AC_MSG_RESULT([yes])
AFS_LIBAUDIT="-laudit"
AFS_CLIENT_LIBS_STATIC="${AFS_LIB_DIR}/afs/libvolser.a ${AFS_LIB_DIR}/afs/libvldb.a ${AFS_LIB_DIR}/afs/libkauth.a ${AFS_LIB_DIR}/afs/libprot.a ${AFS_LIB_DIR}/libubik.a ${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/afs/libaudit.a ${AFS_LIB_DIR}/librxkad.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcmd.a ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a"
AFS_CLIENT_LIBS="-lvolser -lvldb -lkauth -lprot -lubik -lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB"
AFS_RX_LIBS="-lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB"
else
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([Could not use -lauth while testing for -laudit])
fi
else
AC_MSG_RESULT([no])
fi
AC_CHECK_FUNCS(VL_ProbeServer)
AC_MSG_CHECKING([if new-style afs_ integer types are defined])
AC_CACHE_VAL(ac_cv_afs_int32,
dnl The next few lines contain a quoted argument to egrep
dnl It is critical that there be no leading or trailing whitespace
dnl or newlines
[AC_EGREP_CPP(dnl
changequote(<<,>>)dnl
<<(^|[^a-zA-Z_0-9])afs_int32[^a-zA-Z_0-9]>>dnl
changequote([,]), [#include
#ifdef HAVE_AFS_STDS_H
#include
#endif],
ac_cv_afs_int32=yes, ac_cv_afs_int32=no)])
AC_MSG_RESULT($ac_cv_afs_int32)
if test $ac_cv_afs_int32 = yes ; then
AC_DEFINE(HAVE_AFS_INT32,, [AFS provides new "unambiguous" type names])
else
AC_DEFINE(afs_int16, int16, [it's a type definition])
AC_DEFINE(afs_int32, int32, [it's a type definition])
AC_DEFINE(afs_uint16, u_int16, [it's a type definition])
AC_DEFINE(afs_uint32, u_int32, [it's a type definition])
fi
CPPFLAGS="${cmu_save_CPPFLAGS}"
LDFLAGS="${cmu_save_LDFLAGS}"
LIBS="${cmu_save_LIBS}"
AC_DEFINE(AFS_ENV,, [Use AFS. (find what needs this and nuke it)])
AC_DEFINE(AFS,, [Use AFS. (find what needs this and nuke it)])
AC_SUBST(AFS_CLIENT_LIBS_STATIC)
AC_SUBST(AFS_KTC_LIBS_STATIC)
AC_SUBST(AFS_CLIENT_LIBS)
AC_SUBST(AFS_RX_LIBS)
AC_SUBST(AFS_KTC_LIBS)
AC_SUBST(AFS_INC_FLAGS)
AC_SUBST(AFS_LIB_FLAGS)
AC_SUBST(AFS_TOP_DIR)
AC_SUBST(AFS_LIBAUDIT)
AC_SUBST(AFS_LIBDES)
AC_SUBST(AFS_LIBDESA)
fi
])
AC_DEFUN([CMU_NEEDS_AFS],
[AC_REQUIRE([CMU_AFS])
if test "$ac_cv_found_afs" != "yes"; then
AC_ERROR([Cannot continue without AFS])
fi])
cyrus-imspd-v1.8/cmulocal/agentx.m4 0100644 0043101 0000012 00000002421 07741072414 016520 0 ustar shadow staff dnl agentx.m4--detect agentx libraries
dnl copied from x-unixrc
dnl Tim Martin
dnl $Id: agentx.m4,v 1.5 2003/10/08 20:35:24 rjs3 Exp $
AC_DEFUN([CMU_AGENTX], [
dnl
dnl CMU AgentX
dnl
AC_MSG_CHECKING([for AgentX])
AC_ARG_WITH(agentx, [ --with-agentx CMU AgentX libraries located in (val)], AGENTX_DIR="$withval", AGENTX_DIR=no)
found_agentx="no"
if test "${AGENTX_DIR}" != "no" &&
test -f $AGENTX_DIR/lib${ABILIBDIR}/libagentx.a &&
test -f $AGENTX_DIR/include/agentx.h; then
AGENTX_DIR="$AGENTX_DIR"
found_agentx="yes"
elif test -d /usr/local &&
test -f /usr/local/lib${ABILIBDIR}/libagentx.a &&
test -f /usr/local/include/agentx.h; then
AGENTX_DIR="/usr/local"
found_agentx="yes"
elif test -d /usr/ng &&
test -f /usr/ng/lib${ABILIBDIR}/libagentx.a &&
test -f /usr/ng/include/agentx.h; then
AGENTX_DIR="/usr/ng"
found_agentx="yes"
fi
if test "$found_agentx" = "no"; then
AC_MSG_WARN([Could not locate AgentX Libraries! http://www.net.cmu.edu/groups/netdev/agentx/])
else
LIB_AGENTX="-L$AGENTX_DIR/lib${ABILIBDIR} -lagentx"
AC_SUBST(LIB_AGENTX)
AGENTXFLAGS="-I$AGENTX_DIR/include"
AC_SUBST(AGENTXFLAGS)
AC_MSG_RESULT([found $AGENTX_DIR/lib${ABILIBDIR}/libagentx.a])
fi
])
cyrus-imspd-v1.8/cmulocal/arx.m4 0100644 0043101 0000012 00000007421 07741072414 016031 0 ustar shadow staff dnl $Id: arx.m4,v 1.5 2003/10/08 20:35:24 rjs3 Exp $
AC_DEFUN([CMU_ARX_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[arx_context *foo;],
ac_cv_found_arx_inc=yes,
ac_cv_found_arx_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_ARX_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for arx headers in $i)
CMU_ARX_INC_WHERE1($i)
CMU_TEST_INCPATH($i, arx)
if test "$ac_cv_found_arx_inc" = "yes"; then
ac_cv_arx_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for lib files
#
AC_DEFUN([CMU_ARX_LIB_WHERE1], [
AC_REQUIRE([CMU_AFS])
AC_REQUIRE([CMU_KRB4])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -larx $AFS_LIB_FLAGS $AFS_CLIENT_LIBS $KRB_LIB_FLAGS $LIB_SOCKET"
AC_TRY_LINK(,
[arx_Init();],
[ac_cv_found_arx_lib=yes],
ac_cv_found_arx_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_ARX_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for arx libraries in $i)
CMU_ARX_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, arx)
if test "$ac_cv_found_arx_lib" = "yes" ; then
ac_cv_arx_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_USE_ARX], [
AC_ARG_WITH(arx,
[ --with-arx=PREFIX Compile with arx support],
[if test "X$with_arx" = "X"; then
with_arx=yes
fi])
AC_ARG_WITH(arx-lib,
[ --with-arx-lib=dir use arx libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-arx-lib])
fi])
AC_ARG_WITH(arx-include,
[ --with-arx-include=dir use arx headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-arx-include])
fi])
if test "X$with_arx" != "X"; then
if test "$with_arx" != "yes"; then
ac_cv_arx_where_lib=$with_arx/lib
ac_cv_arx_where_inc=$with_arx/include
fi
fi
if test "X$with_arx_lib" != "X"; then
ac_cv_arx_where_lib=$with_arx_lib
fi
if test "X$ac_cv_arx_where_lib" = "X"; then
CMU_ARX_LIB_WHERE(/usr/athena/lib /usr/local/lib /usr/lib)
fi
if test "X$with_arx_include" != "X"; then
ac_cv_arx_where_inc=$with_arx_include
fi
if test "X$ac_cv_arx_where_inc" = "X"; then
CMU_ARX_INC_WHERE(/usr/athena/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include arx)
if test "X$ac_cv_arx_where_lib" = "X" -o "X$ac_cv_arx_where_inc" = "X"; then
ac_cv_found_arx=no
AC_MSG_RESULT(no)
else
ac_cv_found_arx=yes
AC_MSG_RESULT(yes)
ARX_INC_DIR=$ac_cv_arx_where_inc
ARX_LIB_DIR=$ac_cv_arx_where_lib
ARX_INC_FLAGS="-I${ARX_INC_DIR}"
ARX_LIB_FLAGS="-L${ARX_LIB_DIR} -larx"
ARX_LD_FLAGS="-L${ARX_LIB_DIR}"
dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
dnl Allow makefile substitutions....
AC_SUBST(ARX_INC_FLAGS)
AC_SUBST(ARX_LIB_FLAGS)
AC_SUBST(ARX_LD_FLAGS)
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${ARX_LIB_DIR}"
else
RPATH="${RPATH}:${ARX_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${ARX_LIB_DIR}"
else
RPATH="${RPATH}:${ARX_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${ARX_LIB_DIR}"
else
RPATH="${RPATH}:${ARX_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${ARX_LIB_DIR}"
else
RPATH="${RPATH}:${ARX_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${ARX_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/berkdb.m4 0100644 0043101 0000012 00000016033 10167317224 016464 0 ustar shadow staff dnl $Id: berkdb.m4,v 1.19 2005/01/06 20:24:52 shadow Exp $
AC_DEFUN([CMU_DB_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[DB *db;
db_create(&db, NULL, 0);
db->open(db, "foo.db", NULL, DB_UNKNOWN, DB_RDONLY, 0644);],
ac_cv_found_db_inc=yes,
ac_cv_found_db_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_DB_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for db headers in $i)
CMU_DB_INC_WHERE1($i)
CMU_TEST_INCPATH($i, db)
if test "$ac_cv_found_db_inc" = "yes"; then
ac_cv_db_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for lib files
#
AC_DEFUN([CMU_DB3_LIB_WHERE1], [
AC_REQUIRE([CMU_AFS])
AC_REQUIRE([CMU_KRB4])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -ldb-3"
AC_TRY_LINK([#include ],
[db_env_create(NULL, 0);],
[ac_cv_found_db_3_lib=yes],
ac_cv_found_db_3_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_DB4_LIB_WHERE1], [
AC_REQUIRE([CMU_AFS])
AC_REQUIRE([CMU_KRB4])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -ldb-4"
AC_TRY_LINK([#include ],
[db_env_create(NULL, 0);],
[ac_cv_found_db_4_lib=yes],
ac_cv_found_db_4_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_DB_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for db libraries in $i)
if test "$enable_db4" = "yes"; then
CMU_DB4_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, [db-4])
ac_cv_found_db_lib=$ac_cv_found_db_4_lib
else
CMU_DB3_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, [db-3])
ac_cv_found_db_lib=$ac_cv_found_db_3_lib
fi
if test "$ac_cv_found_db_lib" = "yes" ; then
ac_cv_db_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_USE_DB], [
AC_ARG_WITH(db,
[ --with-db=PREFIX Compile with db support],
[if test "X$with_db" = "X"; then
with_db=yes
fi])
AC_ARG_WITH(db-lib,
[ --with-db-lib=dir use db libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-db-lib])
fi])
AC_ARG_WITH(db-include,
[ --with-db-include=dir use db headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-db-include])
fi])
AC_ARG_ENABLE(db4,
[ --enable-db4 use db 4.x libraries])
if test "X$with_db" != "X"; then
if test "$with_db" != "yes"; then
ac_cv_db_where_lib=$with_db/lib
ac_cv_db_where_inc=$with_db/include
fi
fi
if test "X$with_db_lib" != "X"; then
ac_cv_db_where_lib=$with_db_lib
fi
if test "X$ac_cv_db_where_lib" = "X"; then
CMU_DB_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib)
fi
if test "X$with_db_include" != "X"; then
ac_cv_db_where_inc=$with_db_include
fi
if test "X$ac_cv_db_where_inc" = "X"; then
CMU_DB_INC_WHERE(/usr/athena/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include db)
if test "X$ac_cv_db_where_lib" = "X" -o "X$ac_cv_db_where_inc" = "X"; then
ac_cv_found_db=no
AC_MSG_RESULT(no)
else
ac_cv_found_db=yes
AC_MSG_RESULT(yes)
DB_INC_DIR=$ac_cv_db_where_inc
DB_LIB_DIR=$ac_cv_db_where_lib
DB_INC_FLAGS="-I${DB_INC_DIR}"
if test "$enable_db4" = "yes"; then
DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-4"
else
DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-3"
fi
dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
dnl Allow makefile substitutions....
AC_SUBST(DB_INC_FLAGS)
AC_SUBST(DB_LIB_FLAGS)
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${DB_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
dnl ---- CUT HERE ---
dnl These are the Cyrus Berkeley DB macros. In an ideal world these would be
dnl identical to the above.
dnl They are here so that they can be shared between Cyrus IMAPd
dnl and Cyrus SASL with relative ease.
dnl The big difference between this and the ones above is that we don't assume
dnl that we know the name of the library, and we try a lot of permutations
dnl instead. We also assume that DB4 is acceptable.
dnl When we're done, there will be a BDB_LIBADD and a BDB_INCADD which should
dnl be used when necessary. We should probably be smarter about our RPATH
dnl handling.
dnl Call these with BERKELEY_DB_CHK.
dnl We will also set $dblib to "berkeley" if we are successful, "no" otherwise.
dnl this is unbelievably painful due to confusion over what db-3 should be
dnl named and where the db-3 header file is located. arg.
AC_DEFUN([CYRUS_BERKELEY_DB_CHK_LIB],
[
BDB_SAVE_LDFLAGS=$LDFLAGS
if test -d $with_bdb_lib; then
CMU_ADD_LIBPATH_TO($with_bdb_lib, LDFLAGS)
CMU_ADD_LIBPATH_TO($with_bdb_lib, BDB_LIBADD)
else
BDB_LIBADD=""
fi
saved_LIBS=$LIBS
for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
do
LIBS="$saved_LIBS -l$dbname"
AC_TRY_LINK([#include ],
[db_create(NULL, NULL, 0);],
BDB_LIBADD="$BDB_LIBADD -l$dbname"; dblib="berkeley"; dbname=db,
dblib="no")
if test "$dblib" = "berkeley"; then break; fi
done
if test "$dblib" = "no"; then
LIBS="$saved_LIBS -ldb"
AC_TRY_LINK([#include ],
[db_open(NULL, 0, 0, 0, NULL, NULL, NULL);],
BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db,
dblib="no")
fi
LIBS=$saved_LIBS
LDFLAGS=$BDB_SAVE_LDFLAGS
])
AC_DEFUN([CYRUS_BERKELEY_DB_OPTS],
[
AC_ARG_WITH(bdb-libdir,
[ --with-bdb-libdir=DIR Berkeley DB lib files are in DIR],
with_bdb_lib=$withval,
[ test "${with_bdb_lib+set}" = set || with_bdb_lib=none])
AC_ARG_WITH(bdb-incdir,
[ --with-bdb-incdir=DIR Berkeley DB include files are in DIR],
with_bdb_inc=$withval,
[ test "${with_bdb_inc+set}" = set || with_bdb_inc=none ])
])
AC_DEFUN([CYRUS_BERKELEY_DB_CHK],
[
AC_REQUIRE([CYRUS_BERKELEY_DB_OPTS])
cmu_save_CPPFLAGS=$CPPFLAGS
if test -d $with_bdb_inc; then
CPPFLAGS="$CPPFLAGS -I$with_bdb_inc"
BDB_INCADD="-I$with_bdb_inc"
else
BDB_INCADD=""
fi
dnl Note that FreeBSD puts it in a wierd place
dnl (but they should use with-bdb-incdir)
AC_CHECK_HEADER(db.h,
[CYRUS_BERKELEY_DB_CHK_LIB()],
dblib="no")
CPPFLAGS=$cmu_save_CPPFLAGS
])
cyrus-imspd-v1.8/cmulocal/bsd_sockets.m4 0100644 0043101 0000012 00000001464 07741072414 017543 0 ustar shadow staff dnl bsd_sockets.m4--which socket libraries do we need?
dnl Derrick Brashear
dnl from Zephyr
dnl $Id: bsd_sockets.m4,v 1.9 2003/10/08 20:35:24 rjs3 Exp $
dnl Hacked on by Rob Earhart to not just toss stuff in LIBS
dnl It now puts everything required for sockets into LIB_SOCKET
AC_DEFUN([CMU_SOCKETS], [
save_LIBS="$LIBS"
LIB_SOCKET=""
AC_CHECK_FUNC(connect, :,
AC_CHECK_LIB(nsl, gethostbyname,
LIB_SOCKET="-lnsl $LIB_SOCKET")
AC_CHECK_LIB(socket, connect,
LIB_SOCKET="-lsocket $LIB_SOCKET")
)
LIBS="$LIB_SOCKET $save_LIBS"
AC_CHECK_FUNC(res_search, :,
AC_CHECK_LIB(resolv, res_search,
LIB_SOCKET="-lresolv $LIB_SOCKET")
)
LIBS="$LIB_SOCKET $save_LIBS"
AC_CHECK_FUNCS(dn_expand dns_lookup)
LIBS="$save_LIBS"
AC_SUBST(LIB_SOCKET)
])
cyrus-imspd-v1.8/cmulocal/c-attribute.m4 0100644 0043101 0000012 00000001063 07741072414 017456 0 ustar shadow staff dnl
dnl $Id: c-attribute.m4,v 1.3 2003/10/08 20:35:24 rjs3 Exp $
dnl
dnl
dnl Test for __attribute__
dnl
AC_DEFUN([CMU_C___ATTRIBUTE__], [
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(ac_cv___attribute__, [
AC_TRY_COMPILE([
#include
],
[
static void foo(void) __attribute__ ((noreturn));
static void
foo(void)
{
exit(1);
}
],
ac_cv___attribute__=yes,
ac_cv___attribute__=no)])
if test "$ac_cv___attribute__" = "yes"; then
AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
fi
AC_MSG_RESULT($ac_cv___attribute__)
])
cyrus-imspd-v1.8/cmulocal/c-fpic.m4 0100644 0043101 0000012 00000000750 07741072414 016376 0 ustar shadow staff dnl
dnl $Id: c-fpic.m4,v 1.2 2003/10/08 20:35:24 rjs3 Exp $
dnl
dnl
dnl Test for -fPIC
dnl
AC_DEFUN([CMU_C_FPIC], [
AC_MSG_CHECKING(if compiler supports -fPIC)
AC_CACHE_VAL(ac_cv_fpic, [
save_CFLAGS=$CFLAGS
CFLAGS="${CFLAGS} -fPIC"
AC_TRY_COMPILE([
#include
],
[
static void
foo(void)
{
exit(1);
}
],
ac_cv_fpic=yes,
ac_cv_fpic=no)
CFLAGS=$save_CFLAGS
])
if test "$ac_cv_fpic" = "yes"; then
FPIC_CFLAGS="-fPIC"
else
FPIC_CFLAGS=""
fi
AC_MSG_RESULT($ac_cv_fpic)
])
cyrus-imspd-v1.8/cmulocal/com_err.m4 0100644 0043101 0000012 00000001573 07741072414 016667 0 ustar shadow staff dnl com_err.m4--com_err detection macro
dnl Rob Earhart
dnl $Id: com_err.m4,v 1.6 2003/10/08 20:35:24 rjs3 Exp $
AC_DEFUN([CMU_COMERR], [
cmu_need_compile_et=no
AC_CHECK_PROGS(COMPILE_ET, compile_et, no)
if test "$COMPILE_ET" = no; then
COMPILE_ET="\$(top_builddir)/com_err/compile_et"
cmu_need_to_compile_com_err=yes
fi
AC_CHECK_HEADER(com_err.h,,CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/com_err")
cmu_save_LIBS="$LIBS"
AC_CHECK_LIB(com_err, com_err,
LIB_COMERR="-lcom_err",
LDFLAGS="$LDFLAGS -L`pwd`/com_err"
LIB_COMERR="\$(top_builddir)/com_err/libcom_err.la"
cmu_need_to_compile_com_err=yes)
AC_SUBST(LIB_COMERR)
LIBS="$cmu_save_LIBS"
AC_MSG_CHECKING(whether we need to compile com_err)
if test "$cmu_need_to_compile_com_err" = yes; then
AC_MSG_RESULT(yes)
AC_CONFIG_SUBDIRS(com_err)
else
AC_MSG_RESULT(no)
fi
])
cyrus-imspd-v1.8/cmulocal/com_err_link.m4 0100644 0043101 0000012 00000010042 07741072414 017673 0 ustar shadow staff dnl damnit, i don't want to figure out if I need to build an integral com_err
dnl library with the collection, I just want to know where it's installed,
dnl so don't bitch, Rob...
dnl Derrick Brashear
dnl $Id: com_err_link.m4,v 1.7 2003/10/08 20:35:24 rjs3 Exp $
AC_DEFUN([CMU_COMERR_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[int foo;],
ac_cv_found_com_err_inc=yes,
ac_cv_found_com_err_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_COMERR_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for com_err headers in $i)
CMU_COMERR_INC_WHERE1($i)
CMU_TEST_INCPATH($i, com_err)
if test "$ac_cv_found_com_err_inc" = "yes"; then
ac_cv_comerr_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for lib files
#
AC_DEFUN([CMU_COMERR_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lcom_err"
AC_TRY_LINK(,
[com_err();],
[ac_cv_found_com_err_lib=yes],
ac_cv_found_com_err_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_COMERR_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for com_err libraries in $i)
CMU_COMERR_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, com_err)
if test "$ac_cv_found_com_err_lib" = "yes" ; then
ac_cv_comerr_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_USE_COMERR], [
AC_ARG_WITH(comerr,
[ --with-comerr=PREFIX Compile with com_err support],
[if test "X$with_comerr" = "X"; then
with_comerr=yes
fi])
AC_ARG_WITH(comerr-lib,
[ --with-comerr-lib=dir use com_err libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-comerr-lib])
fi])
AC_ARG_WITH(comerr-include,
[ --with-comerr-include=dir use com_err headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-comerr-include])
fi])
if test "X$with_comerr" != "X"; then
if test "$with_comerr" != "yes"; then
ac_cv_comerr_where_lib=$with_comerr/lib
ac_cv_comerr_where_inc=$with_comerr/include
fi
fi
if test "X$with_comerr_lib" != "X"; then
ac_cv_comerr_where_lib=$with_comerr_lib
fi
if test "X$ac_cv_comerr_where_lib" = "X"; then
CMU_COMERR_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib)
fi
if test "X$with_comerr_include" != "X"; then
ac_cv_comerr_where_inc=$with_comerr_include
fi
if test "X$ac_cv_comerr_where_inc" = "X"; then
CMU_COMERR_INC_WHERE(/usr/athena/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include com_err)
if test "X$ac_cv_comerr_where_lib" = "X" -a "X$ac_cv_comerr_where_inc" = "X"; then
ac_cv_found_com_err=no
AC_MSG_RESULT(no)
else
ac_cv_found_com_err=yes
AC_MSG_RESULT(yes)
COMERR_INC_DIR=$ac_cv_comerr_where_inc
COMERR_LIB_DIR=$ac_cv_comerr_where_lib
COMERR_INC_FLAGS="-I${COMERR_INC_DIR}"
COMERR_LIB_FLAGS="-L${COMERR_LIB_DIR} -lcom_err"
dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
dnl Allow makefile substitutions....
AC_SUBST(COMERR_INC_FLAGS)
AC_SUBST(COMERR_LIB_FLAGS)
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
else
RPATH="${RPATH}:${COMERR_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${COMERR_LIB_DIR}"
else
RPATH="${RPATH}:${COMERR_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${COMERR_LIB_DIR}"
else
RPATH="${RPATH}:${COMERR_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${COMERR_LIB_DIR}"
else
RPATH="${RPATH}:${COMERR_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${COMERR_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/common.m4 0100644 0043101 0000012 00000002156 07741072414 016527 0 ustar shadow staff dnl $Id: common.m4,v 1.11 2003/10/08 20:35:24 rjs3 Exp $
AC_DEFUN([CMU_TEST_LIBPATH], [
changequote(<<, >>)
define(<>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>))
changequote([, ])
if test "$CMU_AC_CV_FOUND" = "yes"; then
if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl"; then
CMU_AC_CV_FOUND=no
fi
fi
])
AC_DEFUN([CMU_TEST_INCPATH], [
changequote(<<, >>)
define(<>, translit(ac_cv_found_$2_inc, [ *], [_p]))
changequote([, ])
if test "$CMU_AC_CV_FOUND" = "yes"; then
if test \! -r "$1/$2.h"; then
CMU_AC_CV_FOUND=no
fi
fi
])
dnl CMU_CHECK_HEADER_NOCACHE(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN([CMU_CHECK_HEADER_NOCACHE],
[dnl Do the transliteration at runtime so arg 1 can be a shell variable.
ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
AC_MSG_CHECKING([for $1])
AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
eval "ac_cv_header_$ac_safe=no")
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
ifelse([$3], , , [$3
])dnl
fi
])
cyrus-imspd-v1.8/cmulocal/cyrus.m4 0100644 0043101 0000012 00000002554 07741072414 016406 0 ustar shadow staff dnl
dnl Additional macros for configure.in packaged up for easier theft.
dnl $Id: cyrus.m4,v 1.4 2003/10/08 20:35:24 rjs3 Exp $
dnl tjs@andrew.cmu.edu 6-may-1998
dnl
dnl It would be good if ANDREW_ADD_LIBPATH could detect if something was
dnl already there and not redundantly add it if it is.
dnl add -L(arg), and possibly (runpath switch)(arg), to LDFLAGS
dnl (so the runpath for shared libraries is set).
AC_DEFUN([CMU_ADD_LIBPATH], [
# this is CMU ADD LIBPATH
if test "$andrew_runpath_switch" = "none" ; then
LDFLAGS="-L$1 ${LDFLAGS}"
else
LDFLAGS="-L$1 $andrew_runpath_switch$1 ${LDFLAGS}"
fi
])
dnl add -L(1st arg), and possibly (runpath switch)(1st arg), to (2nd arg)
dnl (so the runpath for shared libraries is set).
AC_DEFUN([CMU_ADD_LIBPATH_TO], [
# this is CMU ADD LIBPATH TO
if test "$andrew_runpath_switch" = "none" ; then
$2="-L$1 ${$2}"
else
$2="-L$1 ${$2} $andrew_runpath_switch$1"
fi
])
dnl runpath initialization
AC_DEFUN([CMU_GUESS_RUNPATH_SWITCH], [
# CMU GUESS RUNPATH SWITCH
AC_CACHE_CHECK(for runpath switch, andrew_runpath_switch, [
# first, try -R
SAVE_LDFLAGS="${LDFLAGS}"
LDFLAGS="-R /usr/lib"
AC_TRY_LINK([],[],[andrew_runpath_switch="-R"], [
LDFLAGS="-Wl,-rpath,/usr/lib"
AC_TRY_LINK([],[],[andrew_runpath_switch="-Wl,-rpath,"],
[andrew_runpath_switch="none"])
])
LDFLAGS="${SAVE_LDFLAGS}"
])])
cyrus-imspd-v1.8/cmulocal/db.m4 0100644 0043101 0000012 00000001674 10013510042 015604 0 ustar shadow staff dnl $Id: db.m4,v 1.2 2004/02/14 21:16:18 cg2v Exp $
dnl
dnl tests for various db libraries
dnl
AC_DEFUN([rk_DB],[berkeley_db=db
AC_ARG_WITH(berkeley-db,
[ --without-berkeley-db if you don't want berkeley db],[
if test "$withval" = no; then
berkeley_db=""
fi
])
if test "$berkeley_db"; then
AC_CHECK_HEADERS([ \
db.h \
db_185.h \
])
fi
AC_FIND_FUNC_NO_LIBS2(dbopen, $berkeley_db, [
#include
#if defined(HAVE_DB_185_H)
#include
#elif defined(HAVE_DB_H)
#include
#endif
],[NULL, 0, 0, 0, NULL])
AC_FIND_FUNC_NO_LIBS(dbm_firstkey, $berkeley_db gdbm ndbm)
AC_FIND_FUNC_NO_LIBS2(db_create, $berkeley_db, [
#include
#if defined(HAVE_DB_H)
#include
#endif
],[NULL, NULL, 0])
DBLIB="$LIB_dbopen"
if test "$LIB_dbopen" != "$LIB_db_create"; then
DBLIB="$DBLIB $LIB_db_create"
fi
if test "$LIB_dbopen" != "$LIB_dbm_firstkey"; then
DBLIB="$DBLIB $LIB_dbm_firstkey"
fi
AC_SUBST(DBLIB)dnl
])
cyrus-imspd-v1.8/cmulocal/find-func-no-libs.m4 0100644 0043101 0000012 00000000501 07741072414 020441 0 ustar shadow staff dnl $Id: find-func-no-libs.m4,v 1.2 2003/10/08 20:35:24 rjs3 Exp $
dnl
dnl
dnl Look for function in any of the specified libraries
dnl
dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
AC_DEFUN([AC_FIND_FUNC_NO_LIBS], [
AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
cyrus-imspd-v1.8/cmulocal/find-func-no-libs2.m4 0100644 0043101 0000012 00000002721 07741072414 020531 0 ustar shadow staff dnl $Id: find-func-no-libs2.m4,v 1.2 2003/10/08 20:35:24 rjs3 Exp $
dnl
dnl
dnl Look for function in any of the specified libraries
dnl
dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
AC_DEFUN([AC_FIND_FUNC_NO_LIBS2], [
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_cv_funclib_$1,
[
if eval "test \"\$ac_cv_func_$1\" != yes" ; then
ac_save_LIBS="$LIBS"
for ac_lib in $2; do
if test -n "$ac_lib"; then
ac_lib="-l$ac_lib"
else
ac_lib=""
fi
LIBS="$6 $ac_lib $5 $ac_save_LIBS"
AC_TRY_LINK([$3],[$1($4)],eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break)
done
eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
LIBS="$ac_save_LIBS"
fi
])
eval "ac_res=\$ac_cv_funclib_$1"
if false; then
AC_CHECK_FUNCS($1)
dnl AC_CHECK_LIBS($2, foo)
fi
# $1
ac_tr_func=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
ac_tr_lib=HAVE_LIB_`echo $ac_res |sed 's/-l//' | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
eval "LIB_$1=$ac_res"
case "$ac_res" in
yes)
eval "ac_cv_func_$1=yes"
eval "LIB_$1="
AC_DEFINE_UNQUOTED($ac_tr_func)
AC_MSG_RESULT([yes])
;;
no)
eval "ac_cv_func_$1=no"
eval "LIB_$1="
AC_MSG_RESULT([no])
;;
*)
eval "ac_cv_func_$1=yes"
eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
AC_DEFINE_UNQUOTED($ac_tr_func)
AC_DEFINE_UNQUOTED($ac_tr_lib)
AC_MSG_RESULT([yes, in $ac_res])
;;
esac
AC_SUBST(LIB_$1)
])
cyrus-imspd-v1.8/cmulocal/find-func.m4 0100644 0043101 0000012 00000000365 07741072414 017110 0 ustar shadow staff dnl $Id: find-func.m4,v 1.2 2003/10/08 20:35:24 rjs3 Exp $
dnl
dnl AC_FIND_FUNC(func, libraries, includes, arguments)
AC_DEFUN([AC_FIND_FUNC], [
AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
if test -n "$LIB_$1"; then
LIBS="$LIB_$1 $LIBS"
fi
])
cyrus-imspd-v1.8/cmulocal/heimdal.m4 0100644 0043101 0000012 00000012563 10034720374 016637 0 ustar shadow staff dnl kerberos_v5.m4--Kerberos 5 libraries and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: heimdal.m4,v 1.8 2004/04/07 06:34:36 shadow Exp $
AC_DEFUN([CMU_LIBHEIMDAL_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[krb5_keyblock foo;],
ac_cv_found_libheimdal_inc=yes,
ac_cv_found_libheimdal_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_LIBHEIMDAL_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for heimdal headers in $i)
CMU_LIBHEIMDAL_INC_WHERE1($i)
CMU_TEST_INCPATH($i, krb5)
if test "$ac_cv_found_libheimdal_inc" = "yes"; then
ac_cv_libheimdal_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for kerberos lib files
#
AC_DEFUN([CMU_LIBHEIMDAL_LIB_WHERE1], [
AC_REQUIRE([CMU_SOCKETS])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lkadm5clnt -lkrb5 -lasn1 -lkadm5clnt -lroken $LIB_SOCKET"
AC_TRY_LINK(,
[krb5_get_in_tkt();],
[ac_cv_found_libheimdal_lib=yes],
ac_cv_found_libheimdal_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_LIBHEIMDAL_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for heimdal libraries in $i)
CMU_LIBHEIMDAL_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, krb5)
if test "$ac_cv_found_libheimdal_lib" = "yes" ; then
ac_cv_libheimdal_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBHEIMDAL_LIBDES], [
AC_REQUIRE([CMU_LIBSSL])
cmu_save_LIBS=$LIBS
AC_MSG_CHECKING([if libdes is needed])
AC_TRY_LINK([],[des_quad_cksum();],HEIM_DES_LIB="",HEIM_DES_LIB="maybe")
if test "X$HEIM_DES_LIB" != "X"; then
LIBS="$cmu_save_LIBS -L$1 -ldes"
AC_TRY_LINK([], [des_quad_cksum();],HEIM_DES_LIB="yes")
if test "X$HEIM_DES_LIB" = "Xyes"; then
AC_MSG_RESULT([yes])
HEIM_LIBDES="-ldes"
HEIM_LIBDESA="$1/libdes.a"
else
LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS"
AC_TRY_LINK([],
[des_quad_cksum();],HEIM_DES_LIB="libcrypto")
if test "X$HEIM_DES_LIB" = "Xlibcrypto"; then
AC_MSG_RESULT([libcrypto])
HEIM_LIBDES="$LIBSSL_LIB_FLAGS"
HEIM_LIBDESA="$LIBSSL_LIB_FLAGS"
else
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([Could not use -ldes])
fi
fi
else
AC_MSG_RESULT([no])
fi
])
AC_DEFUN([CMU_LIBHEIMDAL], [
AC_REQUIRE([CMU_SOCKETS])
AC_REQUIRE([CMU_USE_COMERR])
AC_ARG_WITH(LIBHEIMDAL,
[ --with-libheimdal=PREFIX Compile with Heimdal support],
[if test "X$with_libheimdal" = "X"; then
with_libheimdal=yes
fi])
AC_ARG_WITH(libheimdal-lib,
[ --with-libheimdal-lib=dir use heimdal libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libheimdal-lib])
fi])
AC_ARG_WITH(libheimdal-include,
[ --with-libheimdal-include=dir use heimdal headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libheimdal-include])
fi])
if test "X$with_libheimdal" != "X"; then
if test "$with_libheimdal" != "yes" -a "$with_libheimdal" != "no"; then
ac_cv_libheimdal_where_lib=$with_libheimdal/lib
ac_cv_libheimdal_where_inc=$with_libheimdal/include
fi
fi
if test "$with_libheimdal" != "no"; then
if test "X$with_libheimdal_lib" != "X"; then
ac_cv_libheimdal_where_lib=$with_libheimdal_lib
fi
if test "X$ac_cv_libheimdal_where_lib" = "X"; then
CMU_LIBHEIMDAL_LIB_WHERE(/usr/athena/lib /usr/lib /usr/heimdal/lib /usr/local/lib)
fi
if test "X$with_libheimdal_include" != "X"; then
ac_cv_libheimdal_where_inc=$with_libheimdal_include
fi
if test "X$ac_cv_libheimdal_where_inc" = "X"; then
CMU_LIBHEIMDAL_INC_WHERE(/usr/athena/include /usr/heimdal/include /usr/local/include)
fi
fi
AC_MSG_CHECKING(whether to include heimdal)
if test "X$ac_cv_libheimdal_where_lib" = "X" -a "X$ac_cv_libheimdal_where_inc" = "X"; then
ac_cv_found_libheimdal=no
AC_MSG_RESULT(no)
else
ac_cv_found_libheimdal=yes
AC_MSG_RESULT(yes)
LIBHEIMDAL_INC_DIR=$ac_cv_libheimdal_where_inc
LIBHEIMDAL_LIB_DIR=$ac_cv_libheimdal_where_lib
CMU_LIBHEIMDAL_LIBDES($LIBHEIMDAL_LIB_DIR)
LIBHEIMDAL_INC_FLAGS="-I${LIBHEIMDAL_INC_DIR}"
LIBHEIMDAL_LIB_FLAGS="-L${LIBHEIMDAL_LIB_DIR} -lkadm5clnt -lkrb5 -lasn1 ${HEIM_LIBDES} -lroken $LIB_SOCKET"
AC_SUBST(LIBHEIMDAL_INC_FLAGS)
AC_SUBST(LIBHEIMDAL_LIB_FLAGS)
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBHEIMDAL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${LIBHEIMDAL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBHEIMDAL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${LIBHEIMDAL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${LIBHEIMDAL_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/init_automake.m4 0100644 0043101 0000012 00000000367 07741072414 020072 0 ustar shadow staff dnl init_automake.m4--cmulocal automake setup macro
dnl Rob Earhart
dnl $Id: init_automake.m4,v 1.4 2003/10/08 20:35:24 rjs3 Exp $
AC_DEFUN([CMU_INIT_AUTOMAKE], [
AC_REQUIRE([AM_INIT_AUTOMAKE])
ACLOCAL="$ACLOCAL -I \$(top_srcdir)/cmulocal"
])
cyrus-imspd-v1.8/cmulocal/ipv6.m4 0100644 0043101 0000012 00000006170 07765657403 016140 0 ustar shadow staff dnl See whether we can use IPv6 related functions
dnl contributed by Hajimu UMEMOTO
AC_DEFUN([IPv6_CHECK_FUNC], [
AC_CHECK_FUNC($1, [dnl
ac_cv_lib_socket_$1=no
ac_cv_lib_inet6_$1=no
], [dnl
AC_CHECK_LIB(socket, $1, [dnl
LIBS="$LIBS -lsocket"
ac_cv_lib_inet6_$1=no
], [dnl
AC_MSG_CHECKING([whether your system has IPv6 directory])
AC_CACHE_VAL(ipv6_cv_dir, [dnl
for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
break
fi
done])dnl
AC_MSG_RESULT($ipv6_cv_dir)
if test $ipv6_cv_dir = no; then
ac_cv_lib_inet6_$1=no
else
if test x$ipv6_libinet6 = x; then
ipv6_libinet6=no
SAVELDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
fi
AC_CHECK_LIB(inet6, $1, [dnl
if test $ipv6_libinet6 = no; then
ipv6_libinet6=yes
LIBS="$LIBS -linet6"
fi],)dnl
if test $ipv6_libinet6 = no; then
LDFLAGS="$SAVELDFLAGS"
fi
fi])dnl
])dnl
ipv6_cv_$1=no
if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
-o $ac_cv_lib_inet6_$1 = yes
then
ipv6_cv_$1=yes
fi
if test $ipv6_cv_$1 = no; then
if test $1 = getaddrinfo; then
for ipv6_cv_pfx in o n; do
AC_EGREP_HEADER(${ipv6_cv_pfx}$1, netdb.h,
[AC_CHECK_FUNC(${ipv6_cv_pfx}$1)])
if eval test X\$ac_cv_func_${ipv6_cv_pfx}$1 = Xyes; then
AC_DEFINE(HAVE_GETADDRINFO,[],[Do we have a getaddrinfo?])
ipv6_cv_$1=yes
break
fi
done
fi
fi
if test $ipv6_cv_$1 = yes; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi])
dnl See whether we have ss_family in sockaddr_storage
AC_DEFUN([IPv6_CHECK_SS_FAMILY], [
AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage])
AC_CACHE_VAL(ipv6_cv_ss_family, [dnl
AC_TRY_COMPILE([#include
#include ],
[struct sockaddr_storage ss; int i = ss.ss_family;],
[ipv6_cv_ss_family=yes], [ipv6_cv_ss_family=no])])dnl
if test $ipv6_cv_ss_family = yes; then
ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY,[],[Is there an ss_family in sockaddr_storage?]), [$1])
else
ifelse([$2], , :, [$2])
fi
AC_MSG_RESULT($ipv6_cv_ss_family)])
dnl whether you have sa_len in struct sockaddr
AC_DEFUN([IPv6_CHECK_SA_LEN], [
AC_MSG_CHECKING([whether you have sa_len in struct sockaddr])
AC_CACHE_VAL(ipv6_cv_sa_len, [dnl
AC_TRY_COMPILE([#include
#include ],
[struct sockaddr sa; int i = sa.sa_len;],
[ipv6_cv_sa_len=yes], [ipv6_cv_sa_len=no])])dnl
if test $ipv6_cv_sa_len = yes; then
ifelse([$1], , AC_DEFINE(HAVE_SOCKADDR_SA_LEN,[],[Does sockaddr have an sa_len?]), [$1])
else
ifelse([$2], , :, [$2])
fi
AC_MSG_RESULT($ipv6_cv_sa_len)])
dnl See whether sys/socket.h has socklen_t
AC_DEFUN([IPv6_CHECK_SOCKLEN_T], [
AC_MSG_CHECKING(for socklen_t)
AC_CACHE_VAL(ipv6_cv_socklen_t, [dnl
AC_TRY_LINK([#include
#include ],
[socklen_t len = 0;],
[ipv6_cv_socklen_t=yes], [ipv6_cv_socklen_t=no])])dnl
if test $ipv6_cv_socklen_t = yes; then
ifelse([$1], , AC_DEFINE(HAVE_SOCKLEN_T,[],[Do we have a socklen_t?]), [$1])
else
ifelse([$2], , :, [$2])
fi
AC_MSG_RESULT($ipv6_cv_socklen_t)])
cyrus-imspd-v1.8/cmulocal/kafs.m4 0100644 0043101 0000012 00000010207 07741072414 016157 0 ustar shadow staff dnl kerberos_v4.m4--Kafs libraries and includes
dnl Derrick Brashear
dnl from KTH kafs and Arla
dnl $Id: kafs.m4,v 1.6 2003/10/08 20:35:24 rjs3 Exp $
AC_DEFUN([CMU_KAFS_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([
#include
#include
#include
],
[struct ClearToken foo;],
ac_cv_found_kafs_inc=yes,
ac_cv_found_kafs_inc=no)
if test "$ac_cv_found_kafs_inc" = "no"; then
CPPFLAGS="$saved_CPPFLAGS -I$1 -I$1/kerberosIV"
AC_TRY_COMPILE([
#include
#include
#include
],
[struct ClearToken foo;],
[ac_cv_found_kafs_inc=yes],
ac_cv_found_kafs_inc=no)
fi
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_KAFS_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for kafs headers in $i)
CMU_KAFS_INC_WHERE1($i)
CMU_TEST_INCPATH($i, kafs)
if test "$ac_cv_found_kafs_inc" = "yes"; then
ac_cv_kafs_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_KAFS_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lkafs $KRB_LIB_FLAGS $KRB5_LIB_FLAGS"
AC_TRY_LINK(,
[krb_afslog();],
[ac_cv_found_kafs_lib=yes],
ac_cv_found_kafs_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_KAFS_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for kafs libraries in $i)
CMU_KAFS_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, kafs)
if test "$ac_cv_found_kafs_lib" = "yes" ; then
ac_cv_kafs_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_KAFS], [
AC_REQUIRE([CMU_SOCKETS])
AC_REQUIRE([CMU_KRB4])
AC_REQUIRE([CMU_KRB5])
AC_ARG_WITH(kafs,
[ --with-kafs=PREFIX Compile with Kafs support],
[if test "X$with_kafs" = "X"; then
with_kafs=yes
fi])
AC_ARG_WITH(kafs-lib,
[ --with-kafs-lib=dir use kafs libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-kafs-lib])
fi])
AC_ARG_WITH(kafs-include,
[ --with-kafs-include=dir use kafs headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-kafs-include])
fi])
if test "X$with_kafs" != "X"; then
if test "$with_kafs" != "yes" -a "$with_kafs" != no; then
ac_cv_kafs_where_lib=$with_kafs/lib
ac_cv_kafs_where_inc=$with_kafs/include
fi
fi
if test "$with_kafs" != "no"; then
if test "X$with_kafs_lib" != "X"; then
ac_cv_kafs_where_lib=$with_kafs_lib
fi
if test "X$ac_cv_kafs_where_lib" = "X"; then
CMU_KAFS_LIB_WHERE(/usr/athena/lib /usr/local/lib /usr/lib)
fi
if test "X$with_kafs_include" != "X"; then
ac_cv_kafs_where_inc=$with_kafs_include
fi
if test "X$ac_cv_kafs_where_inc" = "X"; then
CMU_KAFS_INC_WHERE(/usr/athena/include /usr/include/kerberosIV /usr/local/include /usr/include/kerberos)
fi
fi
AC_MSG_CHECKING(whether to include kafs)
if test "X$ac_cv_kafs_where_lib" = "X" -a "X$ac_cv_kafs_where_inc" = "X"; then
ac_cv_found_kafs=no
AC_MSG_RESULT(no)
else
ac_cv_found_kafs=yes
AC_MSG_RESULT(yes)
KAFS_INC_DIR=$ac_cv_kafs_where_inc
KAFS_LIB_DIR=$ac_cv_kafs_where_lib
KAFS_INC_FLAGS="-I${KAFS_INC_DIR}"
KAFS_LIB_FLAGS="-L${KAFS_LIB_DIR} -lkafs"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${KAFS_LIB_DIR}"
else
RPATH="${RPATH}:${KAFS_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${KAFS_LIB_DIR}"
else
RPATH="${RPATH}:${KAFS_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${KAFS_LIB_DIR}"
else
RPATH="${RPATH}:${KAFS_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${KAFS_LIB_DIR}"
else
RPATH="${RPATH}:${KAFS_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${KAFS_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/kerberos_v4.m4 0100644 0043101 0000012 00000017602 10010505537 017454 0 ustar shadow staff dnl kerberos_v4.m4--Kerberos 4 libraries and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: kerberos_v4.m4,v 1.27 2004/02/05 18:28:47 cg2v Exp $
AC_DEFUN([CMU_KRB_SENDAUTH_PROTO], [
AC_MSG_CHECKING(for krb_sendauth prototype)
AC_TRY_COMPILE(
[#include
int krb_sendauth (long options, int fd, KTEXT ktext, char *service,
char *inst, char *realm, u_long checksum,
MSG_DAT *msg_data, CREDENTIALS *cred,
Key_schedule schedule, struct sockaddr_in *laddr,
struct sockaddr_in *faddr, char *version);],
[int foo = krb_sendauth(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); ],
ac_cv_krb_sendauth_proto=no,
ac_cv_krb_sendauth_proto=yes)
AC_MSG_RESULT($ac_cv_krb_sendauth_proto)
if test "$ac_cv_krb_sendauth_proto" = yes; then
AC_DEFINE(HAVE_KRB_SENDAUTH_PROTO)dnl
fi
AC_MSG_RESULT($ac_cv_krb_sendauth_proto)
])
AC_DEFUN([CMU_KRB_SET_KEY_PROTO], [
AC_MSG_CHECKING(for krb_set_key prototype)
AC_CACHE_VAL(ac_cv_krb_set_key_proto, [
cmu_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}"
AC_TRY_COMPILE(
[#include
int krb_set_key(char *key, int cvt);],
[int foo = krb_set_key(0, 0);],
ac_cv_krb_set_key_proto=no,
ac_cv_krb_set_key_proto=yes)
])
CPPFLAGS="${cmu_save_CPPFLAGS}"
if test "$ac_cv_krb_set_key_proto" = yes; then
AC_DEFINE(HAVE_KRB_SET_KEY_PROTO)dnl
fi
AC_MSG_RESULT($ac_cv_krb_set_key_proto)
])
AC_DEFUN([CMU_KRB4_32_DEFN], [
AC_MSG_CHECKING(for KRB4_32 definition)
AC_CACHE_VAL(ac_cv_krb4_32_defn, [
cmu_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}"
AC_TRY_COMPILE(
[#include
],
[KRB4_32 foo = 1;],
ac_cv_krb4_32_defn=yes,
ac_cv_krb4_32_defn=no)
])
CPPFLAGS="${cmu_save_CPPFLAGS}"
if test "$ac_cv_krb4_32_defn" = yes; then
AC_DEFINE(HAVE_KRB4_32_DEFINE)dnl
fi
AC_MSG_RESULT($ac_cv_krb4_32_defn)
])
AC_DEFUN([CMU_KRB_RD_REQ_PROTO], [
AC_MSG_CHECKING(for krb_rd_req prototype)
AC_CACHE_VAL(ac_cv_krb_rd_req_proto, [
cmu_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}"
AC_TRY_COMPILE(
[#include
int krb_rd_req(KTEXT authent, char *service, char *instance,
unsigned KRB_INT32 from_addr, AUTH_DAT *ad, char *fn);],
[int foo = krb_rd_req(0,0,0,0,0,0);],
ac_cv_krb_rd_req_proto=no,
ac_cv_krb_rd_req_proto=yes)
])
CPPFLAGS="${cmu_save_CPPFLAGS}"
if test "$ac_cv_krb_rd_req_proto" = yes; then
AC_DEFINE(HAVE_KRB_RD_REQ_PROTO)dnl
fi
AC_MSG_RESULT($ac_cv_krb_rd_req_proto)
])
AC_DEFUN([CMU_KRB_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[struct ktext foo;],
ac_cv_found_krb_inc=yes,
ac_cv_found_krb_inc=no)
if test "$ac_cv_found_krb_inc" = "no"; then
CPPFLAGS="$saved_CPPFLAGS -I$1 -I$1/kerberosIV"
AC_TRY_COMPILE([#include ],
[struct ktext foo;],
[ac_cv_found_krb_inc=yes],
ac_cv_found_krb_inc=no)
fi
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_KRB_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for kerberos headers in $i)
CMU_KRB_INC_WHERE1($i)
CMU_TEST_INCPATH($i, krb)
if test "$ac_cv_found_krb_inc" = "yes"; then
ac_cv_krb_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for kerberos lib files
#
AC_DEFUN([CMU_KRB_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lkrb ${KRB_LIBDES}"
AC_TRY_LINK(,
[dest_tkt();],
[ac_cv_found_krb_lib=yes],
ac_cv_found_krb_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_KRB_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for kerberos libraries in $i)
CMU_KRB_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, krb)
if test "$ac_cv_found_krb_lib" = "yes" ; then
ac_cv_krb_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_KRB4], [
AC_REQUIRE([CMU_SOCKETS])
AC_REQUIRE([CMU_LIBSSL])
AC_ARG_WITH(krb4,
[ --with-krb4=PREFIX Compile with Kerberos 4 support],
[if test "X$with_krb4" = "X"; then
with_krb4=yes
fi])
AC_ARG_WITH(krb4-lib,
[ --with-krb4-lib=dir use kerberos 4 libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-krb4-lib])
fi])
AC_ARG_WITH(krb4-include,
[ --with-krb4-include=dir use kerberos 4 headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-krb4-include])
fi])
if test "X$with_krb4" != "X"; then
if test "$with_krb4" != "yes" -a "$with_krb4" != "no"; then
ac_cv_krb_where_lib=$with_krb4/lib
ac_cv_krb_where_inc=$with_krb4/include
fi
fi
if test "$with_krb4" != "no"; then
if test "X$with_krb4_lib" != "X"; then
ac_cv_krb_where_lib=$with_krb4_lib
fi
if test "X$with_krb4_include" != "X"; then
ac_cv_krb_where_inc=$with_krb4_include
fi
if test "X$ac_cv_krb_where_inc" = "X"; then
CMU_KRB_INC_WHERE(/usr/athena/include /usr/include/kerberosIV /usr/local/include /usr/include/kerberos)
fi
AC_MSG_CHECKING([if libdes is needed])
AC_TRY_LINK([],[des_quad_cksum();],KRB_DES_LIB="",KRB_DES_LIB="maybe")
if test "X$KRB_DES_LIB" != "X"; then
LIBS="$cmu_save_LIBS -ldes"
AC_TRY_LINK([], [des_quad_cksum();],KRB_DES_LIB="yes")
if test "X$KRB_DES_LIB" = "Xyes"; then
AC_MSG_RESULT([yes])
KRB_LIBDES="-ldes"
KRB_LIBDESA='$(KRB_LIB_DIR)/libdes.a'
else
LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS"
AC_TRY_LINK([],
[des_quad_cksum();],KRB_DES_LIB="libcrypto")
if test "X$KRB_DES_LIB" = "Xlibcrypto"; then
AC_MSG_RESULT([libcrypto])
KRB_LIBDES="$LIBSSL_LIB_FLAGS"
KRB_LIBDESA="$LIBSSL_LIB_FLAGS"
else
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([Could not use -ldes])
fi
fi
else
AC_MSG_RESULT([no])
fi
if test "X$ac_cv_krb_where_lib" = "X"; then
CMU_KRB_LIB_WHERE(/usr/athena/lib /usr/local/lib /usr/lib)
fi
fi
LIBS="${cmu_save_LIBS}"
AC_MSG_CHECKING([whether to include kerberos 4])
if test "X$ac_cv_krb_where_lib" = "X" -o "X$ac_cv_krb_where_inc" = "X"; then
ac_cv_found_krb=no
AC_MSG_RESULT(no)
else
ac_cv_found_krb=yes
AC_MSG_RESULT(yes)
KRB_INC_DIR=$ac_cv_krb_where_inc
KRB_LIB_DIR=$ac_cv_krb_where_lib
KRB_INC_FLAGS="-I${KRB_INC_DIR}"
KRB_LIB_FLAGS="-L${KRB_LIB_DIR} -lkrb ${KRB_LIBDES}"
LIBS="${cmu_save_LIBS} ${KRB_LIB_FLAGS}"
AC_CHECK_LIB(resolv, dns_lookup, KRB_LIB_FLAGS="${KRB_LIB_FLAGS} -lresolv",,"${KRB_LIB_FLAGS}")
AC_CHECK_LIB(crypt, crypt, KRB_LIB_FLAGS="${KRB_LIB_FLAGS} -lcrypt",,"${KRB_LIB_FLAGS}")
LIBS="${LIBS} ${KRB_LIB_FLAGS}"
AC_CHECK_FUNCS(krb_get_int krb_life_to_time)
AC_SUBST(KRB_INC_FLAGS)
AC_SUBST(KRB_LIB_FLAGS)
LIBS="${cmu_save_LIBS}"
AC_DEFINE(KERBEROS,,[Use kerberos 4. find out what needs this symbol])
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${KRB_LIB_DIR}"
else
RPATH="${RPATH}:${KRB_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${KRB_LIB_DIR}"
else
RPATH="${RPATH}:${KRB_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${KRB_LIB_DIR}"
else
RPATH="${RPATH}:${KRB_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${KRB_LIB_DIR}"
else
RPATH="${RPATH}:${KRB_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${KRB_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/kerberos_v5.m4 0100644 0043101 0000012 00000012065 10034720374 017457 0 ustar shadow staff dnl kerberos_v5.m4--Kerberos 5 libraries and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: kerberos_v5.m4,v 1.8 2004/04/07 06:34:36 shadow Exp $
AC_DEFUN([CMU_KRB5_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[krb5_keyblock foo;],
ac_cv_found_krb5_inc=yes,
ac_cv_found_krb5_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_KRB5_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for krb5 headers in $i)
CMU_KRB5_INC_WHERE1($i)
CMU_TEST_INCPATH($i, krb5)
if test "$ac_cv_found_krb5_inc" = "yes"; then
ac_cv_krb5_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for kerberos lib files
#
AC_DEFUN([CMU_KRB5_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lkrb5 -lk5crypto"
AC_TRY_LINK(,
[krb5_get_in_tkt();],
[ac_cv_found_krb5_lib=yes],
ac_cv_found_krb5_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_KRB5_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for krb5 libraries in $i)
CMU_KRB5_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, krb5)
if test "$ac_cv_found_krb5_lib" = "yes" ; then
ac_cv_krb5_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_KRB5], [
AC_REQUIRE([CMU_SOCKETS])
AC_REQUIRE([CMU_USE_COMERR])
AC_ARG_WITH(krb5,
[ --with-krb5=PREFIX Compile with Kerberos 5 support],
[if test "X$with_krb5" = "X"; then
with_krb5=yes
fi])
AC_ARG_WITH(krb5-lib,
[ --with-krb5-lib=dir use kerberos 5 libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-krb5-lib])
fi])
AC_ARG_WITH(krb5-include,
[ --with-krb5-include=dir use kerberos 5 headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-krb5-include])
fi])
AC_ARG_WITH(krb5-impl,
[ --with-krb5-impl=heimdal use heimdal kerberos 5 libraries
--with-krb5-impl=mit use MIT kerberos 5 libraries],
[if test "$withval" != "heimdal" -a "$withval" != "mit"; then
AC_MSG_ERROR([Invalid argument for --with-krb5-impl])
fi])
if test "X$with_krb5" != "X"; then
if test "$with_krb5" != "yes" -a "$with_krb5" != "no"; then
ac_cv_krb5_where_lib=$with_krb5/lib
ac_cv_krb5_where_inc=$with_krb5/include
ac_cv_krb5_impl=mit
fi
fi
if test "$with_krb5" != "no"; then
if test "X$with_krb5_lib" != "X"; then
ac_cv_krb5_where_lib=$with_krb5_lib
ac_cv_krb5_impl=mit
fi
if test "X$with_krb5_impl" != "X"; then
ac_cv_krb5_impl=$with_krb5_impl
fi
if test "X$ac_cv_krb5_where_lib" = "X" -a "X$with_krb5_impl" != "Xheimdal"; then
CMU_KRB5_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib)
if test "X$ac_cv_krb5_where_lib" != "X"; then
ac_cv_krb5_impl=mit
fi
fi
if test "X$ac_cv_krb5_where_lib" = "X" -a "X$with_krb5_impl" != "Xmit"; then
CMU_LIBHEIMDAL_LIB_WHERE(/usr/athena/lib /usr/lib /usr/heimdal/lib /usr/local/lib)
if test "X$ac_cv_libheimdal_where_lib" != "X"; then
ac_cv_krb5_where_lib=$ac_cv_libheimdal_where_lib
ac_cv_krb5_impl=heimdal
fi
fi
if test "X$with_krb5_include" != "X"; then
ac_cv_krb5_where_inc=$with_krb5_include
fi
if test "X$ac_cv_krb5_where_inc" = "X"; then
CMU_KRB5_INC_WHERE(/usr/athena/include /usr/include/kerberos /usr/local/include /usr/include)
fi
fi
AC_MSG_CHECKING(whether to include kerberos 5)
if test "X$ac_cv_krb5_where_lib" = "X" -o "X$ac_cv_krb5_where_inc" = "X"; then
ac_cv_found_krb5=no
AC_MSG_RESULT(no)
else
ac_cv_found_krb5=yes
AC_MSG_RESULT(yes)
KRB5_INC_DIR=$ac_cv_krb5_where_inc
KRB5_LIB_DIR=$ac_cv_krb5_where_lib
if test "X$ac_cv_krb5_impl" != "Xheimdal"; then
KRB5_LIB_FLAGS="-L${KRB5_LIB_DIR} -lkrb5 -lk5crypto"
else
CMU_LIBHEIMDAL_LIBDES($KRB5_LIB_DIR)
KRB5_LIB_FLAGS="-L${KRB5_LIB_DIR} -lkadm5clnt -lkrb5 -lasn1 ${HEIM_LIBDES} -lroken $LIB_SOCKET"
AC_DEFINE(HEIMDAL,,[we found heimdal krb5 and not MIT krb5])
fi
KRB5_INC_FLAGS="-I${KRB5_INC_DIR}"
AC_SUBST(KRB5_INC_FLAGS)
AC_SUBST(KRB5_LIB_FLAGS)
AC_DEFINE(KRB5,,[Use Kerberos 5. (maybe find what needs this and nuke it)])
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${KRB5_LIB_DIR}"
else
RPATH="${RPATH}:${KRB5_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${KRB5_LIB_DIR}"
else
RPATH="${RPATH}:${KRB5_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${KRB5_LIB_DIR}"
else
RPATH="${RPATH}:${KRB5_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${KRB5_LIB_DIR}"
else
RPATH="${RPATH}:${KRB5_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${KRB5_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/libXau.m4 0100644 0043101 0000012 00000007012 07741072415 016460 0 ustar shadow staff dnl $Id: libXau.m4,v 1.4 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_XAU_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([
#include
],
[Xauth foo;],
ac_cv_found_Xau_inc=yes,
ac_cv_found_Xau_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_XAU_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for Xau headers in $i)
CMU_XAU_INC_WHERE1($i)
CMU_TEST_INCPATH($i, X11/Xauth)
if test "$ac_cv_found_Xau_inc" = "yes"; then
ac_cv_Xau_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_XAU_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lXau $LIB_SOCKET"
AC_TRY_LINK(,
[XauDisposeAuth();],
[ac_cv_found_Xau_lib=yes],
ac_cv_found_Xau_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_XAU_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for Xau libraries in $i)
CMU_XAU_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, Xau)
if test "$ac_cv_found_Xau_lib" = "yes" ; then
ac_cv_Xau_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_XAU], [
AC_REQUIRE([CMU_SOCKETS])
AC_ARG_WITH(Xau,
[ --with-Xau=PREFIX Compile with Xau support],
[if test "X$with_Xau" = "X"; then
with_Xau=yes
fi])
AC_ARG_WITH(Xau-lib,
[ --with-Xau-lib=dir use Xau libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-Xau-lib])
fi])
AC_ARG_WITH(Xau-include,
[ --with-Xau-include=dir use Xau headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-Xau-include])
fi])
if test "X$with_Xau" != "X"; then
if test "$with_Xau" != "yes"; then
ac_cv_Xau_where_lib=$with_Xau/lib
ac_cv_Xau_where_inc=$with_Xau/include
fi
fi
if test "X$with_Xau_lib" != "X"; then
ac_cv_Xau_where_lib=$with_Xau_lib
fi
if test "X$ac_cv_Xau_where_lib" = "X"; then
CMU_XAU_LIB_WHERE(/usr/X11R6/lib /usr/local/lib /usr/openwin/lib)
fi
if test "X$with_Xau_include" != "X"; then
ac_cv_Xau_where_inc=$with_Xau_include
fi
if test "X$ac_cv_Xau_where_inc" = "X"; then
CMU_XAU_INC_WHERE(/usr/X11R6/include /usr/local/include /usr/openwin/include)
fi
AC_MSG_CHECKING(whether to include Xau)
if test "X$ac_cv_Xau_where_lib" = "X" -a "X$ac_cv_Xau_where_inc" = "X"; then
ac_cv_found_Xau=no
AC_MSG_RESULT(no)
else
ac_cv_found_Xau=yes
AC_MSG_RESULT(yes)
XAU_INC_DIR=$ac_cv_Xau_where_inc
XAU_LIB_DIR=$ac_cv_Xau_where_lib
XAU_INC_FLAGS="-I${XAU_INC_DIR}"
XAU_LIB_FLAGS="-L${XAU_LIB_DIR} -lXau"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${XAU_LIB_DIR}"
else
RPATH="${RPATH}:${XAU_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${XAU_LIB_DIR}"
else
RPATH="${RPATH}:${XAU_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${XAU_LIB_DIR}"
else
RPATH="${RPATH}:${XAU_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${XAU_LIB_DIR}"
else
RPATH="${RPATH}:${XAU_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${XAU_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/libcyrus.m4 0100644 0043101 0000012 00000010321 07741072415 017065 0 ustar shadow staff dnl libcyrus.m4--Cyrus libraries and includes
dnl Derrick Brashear
dnl from KTH kafs and Arla
dnl $Id: libcyrus.m4,v 1.19 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_LIBCYRUS_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1 $SASLFLAGS"
CMU_CHECK_HEADER_NOCACHE(cyrus/imclient.h,
ac_cv_found_cyrus_inc=yes,
ac_cv_found_cyrus_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_LIBCYRUS_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for libcyrus headers in $i)
CMU_LIBCYRUS_INC_WHERE1($i)
CMU_TEST_INCPATH($i, imclient)
if test "$ac_cv_found_cyrus_inc" = "yes"; then
ac_cv_cyrus_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBCYRUS_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lcyrus ${LIB_SASL} ${LIBSSL_LIB_FLAGS} ${LIB_SOCKET}"
AC_TRY_LINK([void fatal(){}],
[imclient_authenticate();],
[ac_cv_found_cyrus_lib=yes],
ac_cv_found_cyrus_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_LIBCYRUS_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for libcyrus libraries in $i)
CMU_LIBCYRUS_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, cyrus)
if test "$ac_cv_found_cyrus_lib" = "yes" ; then
ac_cv_cyrus_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBCYRUS], [
AC_REQUIRE([CMU_SOCKETS])
AC_REQUIRE([CMU_SASL2])
AC_REQUIRE([CMU_LIBSSL])
AC_ARG_WITH(libcyrus,
[ --with-libcyrus=PREFIX Compile with Libcyrus support],
[if test "X$with_libcyrus" = "X"; then
with_libcyrus=yes
fi])
AC_ARG_WITH(libcyrus-lib,
[ --with-libcyrus-lib=dir use libcyrus libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libcyrus-lib])
fi])
AC_ARG_WITH(libcyrus-include,
[ --with-libcyrus-include=dir use libcyrus headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libcyrus-include])
fi])
if test "X$with_libcyrus" != "X"; then
if test "$with_libcyrus" != "yes" -a "$with_libcyrus" != no; then
ac_cv_cyrus_where_lib=$with_libcyrus/lib
ac_cv_cyrus_where_inc=$with_libcyrus/include
fi
fi
if test "$with_libcyrus" != "no"; then
if test "X$with_libcyrus_lib" != "X"; then
ac_cv_cyrus_where_lib=$with_libcyrus_lib
fi
if test "X$ac_cv_cyrus_where_lib" = "X"; then
CMU_LIBCYRUS_LIB_WHERE(/usr/cyrus/lib /usr/local/lib /usr/lib)
fi
if test "X$with_libcyrus_include" != "X"; then
ac_cv_cyrus_where_inc=$with_libcyrus_include
fi
if test "X$ac_cv_cyrus_where_inc" = "X"; then
CMU_LIBCYRUS_INC_WHERE(/usr/cyrus/include /usr/local/include /usr/local/include/cyrus /usr/include/cyrus)
fi
fi
AC_MSG_CHECKING(whether to include libcyrus)
if test "X$ac_cv_cyrus_where_lib" = "X" -o "X$ac_cv_cyrus_where_inc" = "X"; then
ac_cv_found_cyrus=no
AC_MSG_RESULT(no)
else
ac_cv_found_cyrus=yes
AC_MSG_RESULT(yes)
LIBCYRUS_INC_DIR=$ac_cv_cyrus_where_inc
LIBCYRUS_LIB_DIR=$ac_cv_cyrus_where_lib
LIBCYRUS_INC_FLAGS="-I${LIBCYRUS_INC_DIR}"
LIBCYRUS_LIB_FLAGS="-L${LIBCYRUS_LIB_DIR} -lcyrus"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBCYRUS_LIB_DIR}"
else
RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${LIBCYRUS_LIB_DIR}"
else
RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBCYRUS_LIB_DIR}"
else
RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${LIBCYRUS_LIB_DIR}"
else
RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${LIBCYRUS_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
AC_SUBST(LIBCYRUS_INC_DIR)
AC_SUBST(LIBCYRUS_LIB_DIR)
AC_SUBST(LIBCYRUS_INC_FLAGS)
AC_SUBST(LIBCYRUS_LIB_FLAGS)
])
cyrus-imspd-v1.8/cmulocal/libloguse.m4 0100644 0043101 0000012 00000004570 07741072415 017227 0 ustar shadow staff dnl libloguse.m4--LOGUSE libraries and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: libloguse.m4,v 1.5 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_LOGUSE_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lloguse"
AC_TRY_LINK(,
[loguse("","","");],
[ac_cv_found_loguse_lib=yes],
ac_cv_found_loguse_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_LOGUSE_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for loguse library in $i)
CMU_LOGUSE_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, loguse)
if test "$ac_cv_found_loguse_lib" = "yes" ; then
ac_cv_loguse_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(no found)
fi
done
])
AC_DEFUN([CMU_LOGUSE], [
AC_REQUIRE([CMU_SOCKETS])
AC_ARG_WITH(loguse,
[ --with-loguse=PREFIX Compile with LOGUSE support],
[if test "X$with_loguse" = "X"; then
with_loguse=yes
fi])
if test "X$with_loguse" != "X"; then
if test "$with_loguse" != "yes"; then
ac_cv_loguse_where_lib=$with_loguse/lib
fi
fi
if test "X$with_loguse_lib" != "X"; then
ac_cv_loguse_where_lib=$with_loguse_lib
fi
if test "X$ac_cv_loguse_where_lib" = "X"; then
CMU_LOGUSE_LIB_WHERE(/usr/lib /usr/local/lib)
fi
AC_MSG_CHECKING(whether to include loguse)
if test "X$ac_cv_loguse_where_lib" = "X"; then
ac_cv_found_loguse=no
AC_MSG_RESULT(no)
else
ac_cv_found_loguse=yes
AC_DEFINE(HAVE_LOGUSE)
AC_MSG_RESULT(yes)
LOGUSE_LIB_DIR=$ac_cv_loguse_where_lib
LOGUSE_LIB_FLAGS="-L${LOGUSE_LIB_DIR} -lloguse"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LOGUSE_LIB_DIR}"
else
RPATH="${RPATH}:${LOGUSE_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${LOGUSE_LIB_DIR}"
else
RPATH="${RPATH}:${LOGUSE_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LOGUSE_LIB_DIR}"
else
RPATH="${RPATH}:${LOGUSE_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${LOGUSE_LIB_DIR}"
else
RPATH="${RPATH}:${LOGUSE_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${LOGUSE_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/libnet.m4 0100644 0043101 0000012 00000011666 07741072415 016523 0 ustar shadow staff dnl libnet.m4--libnet and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: libnet.m4,v 1.7 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_LIBNET_CFG_WHERE1], [
ac_cv_found_libnet_bin=no
if test -f "$1/libnet-config" ; then
ac_cv_found_libnet_cfg=yes
fi
])
AC_DEFUN([CMU_LIBNET_CFG_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for libnet config in $i)
CMU_LIBNET_CFG_WHERE1($i)
if test "$ac_cv_found_libnet_cfg" = "yes"; then
ac_cv_libnet_where_cfg=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBNET_INC_WHERE1], [
ac_cv_found_libnet_inc=no
if test -f "$1/libnet.h" ; then
ac_cv_found_libnet_inc=yes
fi
])
AC_DEFUN([CMU_LIBNET_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for libnet header in $i)
CMU_LIBNET_INC_WHERE1($i)
if test "$ac_cv_found_libnet_inc" = "yes"; then
ac_cv_libnet_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBNET_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lnet"
AC_TRY_LINK(,
[open_link_interface("","");],
[ac_cv_found_libnet_lib=yes],
AC_TRY_LINK(,
[libnet_open_link_interface("","");],
[
CMU_LIBNET_CFLAGS_ADD="-DNEW_LIBNET_INTERFACE"
ac_cv_found_libnet_lib=yes
],
ac_cv_found_libnet_lib=no)
)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_LIBNET_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for libnet library in $i)
CMU_LIBNET_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, net)
if test "$ac_cv_found_libnet_lib" = "yes" ; then
ac_cv_libnet_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBNET], [
AC_ARG_WITH(libnet,
[ --with-libnet=PREFIX Compile with LIBNET support],
[if test "X$with_libnet" = "X"; then
with_libnet=yes
fi])
AC_ARG_WITH(libnet-config,
[ --with-libnet-config=dir use libnet config program in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libnet-config])
fi])
AC_ARG_WITH(libnet-lib,
[ --with-libnet-lib=dir use libnet libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libnet-lib])
fi])
AC_ARG_WITH(libnet-include,
[ --with-libnet-include=dir use libnet headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libnet-include])
fi])
if test "X$with_libnet" != "X"; then
if test "$with_libnet" != "yes"; then
if test -f "$with_libnet/libnet-config"; then
ac_cv_libnet_where_cfg=$with_libnet
else
ac_cv_libnet_where_cfg=$with_libnet/bin
fi
ac_cv_libnet_where_lib=$with_libnet/lib
ac_cv_libnet_where_inc=$with_libnet/include
fi
fi
if test "X$with_libnet_cfg" != "X"; then
ac_cv_libnet_where_cfg=$with_libnet_cfg
fi
if test "X$ac_cv_libnet_where_cfg" = "X"; then
CMU_LIBNET_CFG_WHERE(/usr/ng/bin /usr/bin /usr/local/bin)
fi
if test "X$with_libnet_lib" != "X"; then
ac_cv_libnet_where_lib=$with_libnet_lib
fi
if test "X$ac_cv_libnet_where_lib" = "X"; then
CMU_LIBNET_LIB_WHERE(/usr/ng/lib /usr/lib /usr/local/lib)
fi
if test "X$with_libnet_include" != "X"; then
ac_cv_libnet_where_inc=$with_libnet_include
fi
if test "X$ac_cv_libnet_where_inc" = "X"; then
CMU_LIBNET_INC_WHERE(/usr/ng/include /usr/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include libnet)
if test "X$ac_cv_libnet_where_lib" = "X" -o "X$ac_cv_libnet_where_inc" = "X" -o "X$ac_cv_libnet_where_cfg" = "X"; then
ac_cv_found_libnet=no
AC_MSG_RESULT(no)
else
ac_cv_found_libnet=yes
AC_MSG_RESULT(yes)
LIBNET_CONFIG=$ac_cv_libnet_where_cfg/libnet-config
LIBNET_INC_DIR=$ac_cv_libnet_where_inc
LIBNET_LIB_DIR=$ac_cv_libnet_where_lib
LIBNET_CFLAGS="`$LIBNET_CONFIG --cflags` ${CMU_LIBNET_CFLAGS_ADD}"
LIBNET_DEF_FLAGS="`$LIBNET_CONFIG --defines`"
LIBNET_INC_FLAGS="-I${LIBNET_INC_DIR}"
LIBNET_LIB_FLAGS="-L${LIBNET_LIB_DIR} `${LIBNET_CONFIG} --libs`"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBNET_LIB_DIR}"
else
RPATH="${RPATH}:${LIBNET_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${LIBNET_LIB_DIR}"
else
RPATH="${RPATH}:${LIBNET_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBNET_LIB_DIR}"
else
RPATH="${RPATH}:${LIBNET_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${LIBNET_LIB_DIR}"
else
RPATH="${RPATH}:${LIBNET_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${LIBNET_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/libpcap.m4 0100644 0043101 0000012 00000006641 07741072415 016655 0 ustar shadow staff dnl libpcap.m4--PCAP libraries and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: libpcap.m4,v 1.8 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_PCAP_INC_WHERE1], [
ac_cv_found_pcap_inc=no
if test -f "$1/pcap.h" ; then
ac_cv_found_pcap_inc=yes
fi
])
AC_DEFUN([CMU_PCAP_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for pcap header in $i)
CMU_PCAP_INC_WHERE1($i)
if test "$ac_cv_found_pcap_inc" = "yes"; then
ac_cv_pcap_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(no found)
fi
done
])
AC_DEFUN([CMU_PCAP_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lpcap"
AC_TRY_LINK(,
[pcap_lookupdev("");],
[ac_cv_found_pcap_lib=yes],
ac_cv_found_pcap_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_PCAP_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for pcap library in $i)
CMU_PCAP_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, pcap)
if test "$ac_cv_found_pcap_lib" = "yes" ; then
ac_cv_pcap_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(no found)
fi
done
])
AC_DEFUN([CMU_PCAP], [
AC_ARG_WITH(pcap,
[ --with-pcap=PREFIX Compile with PCAP support],
[if test "X$with_pcap" = "X"; then
with_pcap=yes
fi])
AC_ARG_WITH(pcap-lib,
[ --with-pcap-lib=dir use pcap libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-pcap-lib])
fi])
AC_ARG_WITH(pcap-include,
[ --with-pcap-include=dir use pcap headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-pcap-include])
fi])
if test "X$with_pcap" != "X"; then
if test "$with_pcap" != "yes"; then
ac_cv_pcap_where_lib=$with_pcap/lib
ac_cv_pcap_where_inc=$with_pcap/include
fi
fi
if test "X$with_pcap_lib" != "X"; then
ac_cv_pcap_where_lib=$with_pcap_lib
fi
if test "X$ac_cv_pcap_where_lib" = "X"; then
CMU_PCAP_LIB_WHERE(/usr/ng/lib /usr/lib /usr/local/lib)
fi
if test "X$with_pcap_include" != "X"; then
ac_cv_pcap_where_inc=$with_pcap_include
fi
if test "X$ac_cv_pcap_where_inc" = "X"; then
CMU_PCAP_INC_WHERE(/usr/ng/include /usr/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include pcap)
if test "X$ac_cv_pcap_where_lib" = "X" -a "X$ac_cv_pcap_where_inc" = "X"; then
ac_cv_found_pcap=no
AC_MSG_RESULT(no)
else
ac_cv_found_pcap=yes
AC_MSG_RESULT(yes)
PCAP_INC_DIR=$ac_cv_pcap_where_inc
PCAP_LIB_DIR=$ac_cv_pcap_where_lib
PCAP_INC_FLAGS="-I${PCAP_INC_DIR}"
PCAP_LIB_FLAGS="-L${PCAP_LIB_DIR} -lpcap"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${PCAP_LIB_DIR}"
else
RPATH="${RPATH}:${PCAP_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${PCAP_LIB_DIR}"
else
RPATH="${RPATH}:${PCAP_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${PCAP_LIB_DIR}"
else
RPATH="${RPATH}:${PCAP_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${PCAP_LIB_DIR}"
else
RPATH="${RPATH}:${PCAP_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${PCAP_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/librestrict.m4 0100644 0043101 0000012 00000004672 07741072415 017573 0 ustar shadow staff dnl librestrict.m4--restrict libraries and includes
dnl Derrick Brashear
dnl from KTH krb and Arla
dnl $Id: librestrict.m4,v 1.4 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_RESTRICT_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lrestrict"
AC_TRY_LINK(,
[ConsoleInUse();],
[ac_cv_found_restrict_lib=yes],
ac_cv_found_restrict_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_RESTRICT_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for restrict library in $i)
CMU_RESTRICT_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, restrict)
if test "$ac_cv_found_restrict_lib" = "yes" ; then
ac_cv_restrict_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(no found)
fi
done
])
AC_DEFUN([CMU_RESTRICT], [
AC_ARG_WITH(restrict,
[ --with-restrict=PREFIX Compile with RESTRICT support],
[if test "X$with_restrict" = "X"; then
with_restrict=yes
fi])
if test "X$with_restrict" != "X"; then
if test "$with_restrict" != "yes"; then
ac_cv_restrict_where_lib=$with_restrict/lib
fi
fi
if test "X$with_restrict_lib" != "X"; then
ac_cv_restrict_where_lib=$with_restrict_lib
fi
if test "X$ac_cv_restrict_where_lib" = "X"; then
CMU_RESTRICT_LIB_WHERE(/usr/lib /usr/local/lib)
fi
AC_MSG_CHECKING(whether to include restrict)
if test "X$ac_cv_restrict_where_lib" = "X"; then
ac_cv_found_restrict=no
AC_MSG_RESULT(no)
else
ac_cv_found_restrict=yes
AC_DEFINE(HAVE_RESTRICT)
AC_MSG_RESULT(yes)
RESTRICT_LIB_DIR=$ac_cv_restrict_where_lib
RESTRICT_LIB_FLAGS="-L${RESTRICT_LIB_DIR} -lrestrict"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}"
else
RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${RESTRICT_LIB_DIR}"
else
RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}"
else
RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${RESTRICT_LIB_DIR}"
else
RPATH="${RPATH}:${RESTRICT_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${RESTRICT_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/libssl.m4 0100644 0043101 0000012 00000007733 07741072415 016536 0 ustar shadow staff dnl libssl.m4--Ssl libraries and includes
dnl Derrick Brashear
dnl from KTH kafs and Arla
dnl $Id: libssl.m4,v 1.9 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_LIBSSL_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
CMU_CHECK_HEADER_NOCACHE(openssl/ssl.h,
ac_cv_found_libssl_inc=yes,
ac_cv_found_libssl_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_LIBSSL_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for libssl headers in $i)
CMU_LIBSSL_INC_WHERE1($i)
CMU_TEST_INCPATH($i, ssl)
if test "$ac_cv_found_libssl_inc" = "yes"; then
ac_cv_libssl_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBSSL_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lssl -lcrypto $LIB_SOCKET"
AC_TRY_LINK(,
[SSL_write();],
[ac_cv_found_ssl_lib=yes],
ac_cv_found_ssl_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_LIBSSL_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for libssl libraries in $i)
CMU_LIBSSL_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, ssl)
if test "$ac_cv_found_ssl_lib" = "yes" ; then
ac_cv_libssl_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_LIBSSL], [
AC_REQUIRE([CMU_SOCKETS])
AC_ARG_WITH(libssl,
[ --with-libssl=PREFIX Compile with Libssl support],
[if test "X$with_libssl" = "X"; then
with_libssl=yes
fi])
AC_ARG_WITH(libssl-lib,
[ --with-libssl-lib=dir use libssl libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libssl-lib])
fi])
AC_ARG_WITH(libssl-include,
[ --with-libssl-include=dir use libssl headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-libssl-include])
fi])
if test "X$with_libssl" != "X"; then
if test "$with_libssl" != "yes" -a "$with_libssl" != no; then
ac_cv_libssl_where_lib=$with_libssl/lib
ac_cv_libssl_where_inc=$with_libssl/include
fi
fi
if test "$with_libssl" != "no"; then
if test "X$with_libssl_lib" != "X"; then
ac_cv_libssl_where_lib=$with_libssl_lib
fi
if test "X$ac_cv_libssl_where_lib" = "X"; then
CMU_LIBSSL_LIB_WHERE(/usr/local/lib/openssl /usr/lib/openssl /usr/local/lib /usr/lib)
fi
if test "X$with_libssl_include" != "X"; then
ac_cv_libssl_where_inc=$with_libssl_include
fi
if test "X$ac_cv_libssl_where_inc" = "X"; then
CMU_LIBSSL_INC_WHERE(/usr/local/include /usr/include)
fi
fi
AC_MSG_CHECKING(whether to include libssl)
if test "X$ac_cv_libssl_where_lib" = "X" -a "X$ac_cv_libssl_where_inc" = "X"; then
ac_cv_found_libssl=no
AC_MSG_RESULT(no)
else
ac_cv_found_libssl=yes
AC_MSG_RESULT(yes)
LIBSSL_INC_DIR=$ac_cv_libssl_where_inc
LIBSSL_LIB_DIR=$ac_cv_libssl_where_lib
LIBSSL_INC_FLAGS="-I${LIBSSL_INC_DIR}"
LIBSSL_LIB_FLAGS="-L${LIBSSL_LIB_DIR} -lssl -lcrypto"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${LIBSSL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${LIBSSL_LIB_DIR}"
else
RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${LIBSSL_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
AC_SUBST(LIBSSL_INC_DIR)
AC_SUBST(LIBSSL_LIB_DIR)
AC_SUBST(LIBSSL_INC_FLAGS)
AC_SUBST(LIBSSL_LIB_FLAGS)
])
cyrus-imspd-v1.8/cmulocal/libtoolhack.m4 0100644 0043101 0000012 00000001464 07741072415 017534 0 ustar shadow staff dnl libtoolhack.m4--hack to make libtool behave better
dnl Rob Earhart
dnl $Id: libtoolhack.m4,v 1.4 2003/10/08 20:35:25 rjs3 Exp $
dnl Libtool tries to compile an empty file to see whether it can build
dnl shared libraries, and treats *any* warning as a problem.
dnl Solaris's and HP's cc complains about the empty file. So we hack
dnl the CFLAGS to make cc not complain.
AC_DEFUN([CMU_PROG_LIBTOOL], [
AC_REQUIRE([AC_PROG_CC])
if test "$ac_cv_prog_gcc" = no; then
case "$host_os" in
solaris2*)
save_cflags="${CFLAGS}"
CFLAGS="-erroff=E_EMPTY_TRANSLATION_UNIT ${CFLAGS}"
;;
hpux*)
save_cflags="${CFLAGS}"
CFLAGS="-w"
;;
esac
fi
AC_PROG_LIBTOOL
if test "$ac_cv_prog_gcc" = no; then
case "$host_os" in
solaris2*|hpux*)
CFLAGS="${save_cflags}"
esac
fi
])
cyrus-imspd-v1.8/cmulocal/libwrap.m4 0100644 0043101 0000012 00000001746 07745550532 016711 0 ustar shadow staff dnl libwrap.m4 --- do we have libwrap, the access control library?
dnl $Id: libwrap.m4,v 1.9 2003/10/22 18:50:02 rjs3 Exp $
AC_DEFUN([CMU_LIBWRAP], [
AC_REQUIRE([CMU_SOCKETS])
AC_ARG_WITH(libwrap,
[ --with-libwrap=DIR use libwrap (rooted in DIR) [yes] ],
with_libwrap=$withval, with_libwrap=yes)
if test "$with_libwrap" != no; then
if test -d "$with_libwrap"; then
CPPFLAGS="$CPPFLAGS -I${with_libwrap}/include"
LDFLAGS="$LDFLAGS -L${with_libwrap}/lib"
fi
cmu_save_LIBS="$LIBS"
AC_CHECK_LIB(wrap, request_init, [
AC_CHECK_HEADER(tcpd.h,, with_libwrap=no)],
with_libwrap=no, ${LIB_SOCKET})
LIBS="$cmu_save_LIBS"
fi
AC_MSG_CHECKING(libwrap support)
AC_MSG_RESULT($with_libwrap)
LIB_WRAP=""
if test "$with_libwrap" != no; then
AC_DEFINE(HAVE_LIBWRAP,[],[Do we have TCP wrappers?])
LIB_WRAP="-lwrap"
AC_CHECK_LIB(nsl, yp_get_default_domain, LIB_WRAP="${LIB_WRAP} -lnsl")
fi
AC_SUBST(LIB_WRAP)
])
cyrus-imspd-v1.8/cmulocal/mips-abi.m4 0100644 0043101 0000012 00000005175 07741072415 016745 0 ustar shadow staff dnl mips-abi.m4--Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext
dnl to some value
dnl Derrick Brashear
dnl from KTH krb (from CMU)
dnl $Id: mips-abi.m4,v 1.5 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([AC_MIPS_ABI], [
AC_ARG_WITH(mips_abi,
[ --with-mips-abi=abi ABI to use for IRIX (32, n32, or 64)])
case "$host_os" in
irix*)
with_mips_abi="${with_mips_abi:-yes}"
if test -n "$GCC"; then
# GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
# which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
#
# Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
# GCC and revert back to O32. The same goes if O32 is asked for - old
# GCCs doesn't like the -mabi option, and new GCCs can't output O32.
#
# Don't you just love *all* the different SGI ABIs?
case "${with_mips_abi}" in
32|o32) abi='-mabi=32'; abilibdirext='' ;;
n32|yes) abi='-mabi=n32'; abilibdirext='32' ;;
64) abi='-mabi=64'; abilibdirext='64' ;;
no) abi=''; abilibdirext='';;
*) AC_ERROR("Invalid ABI specified") ;;
esac
if test -n "$abi" ; then
ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
dnl
dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
dnl AC_MSG_RESULT
dnl
AC_MSG_CHECKING([if $CC supports the $abi option])
AC_CACHE_VAL($ac_foo, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $abi"
AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
CFLAGS="$save_CFLAGS"
])
ac_res=`eval echo \\\$$ac_foo`
AC_MSG_RESULT($ac_res)
if test $ac_res = no; then
# Try to figure out why that failed...
case $abi in
-mabi=32)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mabi=n32"
AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
CLAGS="$save_CFLAGS"
if test $ac_res = yes; then
# New GCC
AC_ERROR([$CC does not support the $with_mips_abi ABI])
fi
# Old GCC
abi=''
abilibdirext=''
;;
-mabi=n32|-mabi=64)
if test $with_mips_abi = yes; then
# Old GCC, default to O32
abi=''
abilibdirext=''
else
# Some broken GCC
AC_ERROR([$CC does not support the $with_mips_abi ABI])
fi
;;
esac
fi #if test $ac_res = no; then
fi #if test -n "$abi" ; then
else
case "${with_mips_abi}" in
32|o32) abi='-32'; abilibdirext='' ;;
n32|yes) abi='-n32'; abilibdirext='32' ;;
64) abi='-64'; abilibdirext='64' ;;
no) abi=''; abilibdirext='';;
*) AC_ERROR("Invalid ABI specified") ;;
esac
fi #if test -n "$GCC"; then
;;
esac
dnl And then we munge variables to make things work
CFLAGS="${CFLAGS} $abi"
libdir=`echo $libdir | sed 's,/*$,$abilibdirext,'`
LDFLAGS=`echo $LDFLAGS | sed -e "s,/lib$,/lib$abilibdirext," -e "s,\\\(/lib[^a-zA-Z]\\\),\\\1$abilibdirext,g"`
])
cyrus-imspd-v1.8/cmulocal/nadine.m4 0100644 0043101 0000012 00000010571 07741072415 016476 0 ustar shadow staff dnl nadine.m4--The nadine event library
dnl Derrick Brashear
dnl from KTH kafs and Arla
dnl $Id: nadine.m4,v 1.6 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_NADINE_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
CMU_CHECK_HEADER_NOCACHE(libevent/libevent.h,
ac_cv_found_event_inc=yes,
ac_cv_found_event_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_NADINE_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for nadine headers in $i)
CMU_NADINE_INC_WHERE1($i)
dnl CMU_TEST_INCPATH($i, ssl)
dnl CMU_TEST_INCPATH isn't very versatile
if test "$ac_cv_found_event_inc" = "yes"; then
if test \! -f $i/libevent/libevent.h ; then
ac_cv_found_event_inc=no
fi
fi
if test "$ac_cv_found_event_inc" = "yes"; then
ac_cv_event_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_NADINE_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -levent"
AC_TRY_LINK(,
[libevent_Initialize();],
[ac_cv_found_event_lib=yes],
ac_cv_found_event_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_NADINE_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for event libraries in $i)
CMU_NADINE_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, event)
if test "$ac_cv_found_event_lib" = "yes" ; then
ac_cv_event_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_NADINE], [
AC_REQUIRE([CMU_SOCKETS])
AC_ARG_WITH(nadine,
[ --with-nadine=PREFIX Compile with nadine libevent support],
[if test "X$with_nadine" = "X"; then
with_nadine=yes
fi])
AC_ARG_WITH(nadine-lib,
[ --with-nadine-lib=dir use nadine libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-nadine-lib])
fi])
AC_ARG_WITH(nadine-include,
[ --with-nadine-include=dir use nadine headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-nadine-include])
fi])
if test "$with_ucdsnmp" = "no" ; then
AC_MSG_WARN([Nadine requires UCD SNMP. Disabling Nadine support])
with_nadine=no
with_nadine_lib=no
with_nadine_include=no
fi
if test "X$with_nadine" != "X"; then
if test "$with_nadine" != "yes" -a "$with_nadine" != no; then
ac_cv_event_where_lib=$with_nadine/lib
ac_cv_event_where_inc=$with_nadine/include
fi
fi
if test "$with_nadine" != "no"; then
if test "X$with_nadine_lib" != "X"; then
ac_cv_event_where_lib=$with_nadine_lib
fi
if test "X$ac_cv_event_where_lib" = "X"; then
CMU_NADINE_LIB_WHERE(/usr/local/lib /usr/ng/lib /usr/lib)
fi
if test "X$with_nadine_include" != "X"; then
ac_cv_event_where_inc=$with_nadine_include
fi
if test "X$ac_cv_event_where_inc" = "X"; then
CMU_NADINE_INC_WHERE(/usr/local/include /usr/ng/include /usr/include)
fi
fi
AC_MSG_CHECKING(whether to include nadine)
if test "X$ac_cv_event_where_lib" = "X" -a "X$ac_cv_event_where_inc" = "X"; then
ac_cv_found_event=no
AC_MSG_RESULT(no)
else
ac_cv_found_event=yes
AC_MSG_RESULT(yes)
NADINE_INC_DIR=$ac_cv_event_where_inc
NADINE_LIB_DIR=$ac_cv_event_where_lib
NADINE_INC_FLAGS="-I${NADINE_INC_DIR}"
NADINE_LIB_FLAGS="-L${NADINE_LIB_DIR} -levent"
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${NADINE_LIB_DIR}"
else
RPATH="${RPATH}:${NADINE_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${NADINE_LIB_DIR}"
else
RPATH="${RPATH}:${NADINE_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${NADINE_LIB_DIR}"
else
RPATH="${RPATH}:${NADINE_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${NADINE_LIB_DIR}"
else
RPATH="${RPATH}:${NADINE_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${NADINE_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
AC_SUBST(NADINE_INC_DIR)
AC_SUBST(NADINE_LIB_DIR)
AC_SUBST(NADINE_INC_FLAGS)
AC_SUBST(NADINE_LIB_FLAGS)
])
cyrus-imspd-v1.8/cmulocal/nana.m4 0100644 0043101 0000012 00000001260 07741072415 016150 0 ustar shadow staff dnl nana.m4--nana macro
dnl Rob Earhart
dnl $Id: nana.m4,v 1.5 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_NANA], [
AC_REQUIRE([AC_PROG_CC])
AC_ARG_WITH(nana, [[ --with-nana use NANA [yes] ]],,with_nana=yes)
if test "$GCC" != yes; then
with_nana=no
elif test "$with_nana" = yes; then
AC_CHECK_PROGS(NANA, nana, :)
if test "$NANA" = ":"; then
with_nana=no
else
AC_CHECK_HEADER(nana.h,
AC_CHECK_LIB(nana, nana_error,,with_nana=no),
with_nana=no)
fi
else
with_nana=no
fi
AC_MSG_CHECKING([whether to use NANA])
AC_MSG_RESULT($with_nana)
if test "$with_nana" != yes; then
AC_DEFINE(WITHOUT_NANA)
fi
])
cyrus-imspd-v1.8/cmulocal/openssl.m4 0100644 0043101 0000012 00000002137 07774306776 016742 0 ustar shadow staff dnl
dnl macros for configure.in to detect openssl
dnl $Id: openssl.m4,v 1.9 2003/12/30 14:38:54 rjs3 Exp $
dnl
AC_DEFUN([CMU_HAVE_OPENSSL], [
AC_ARG_WITH(openssl,[ --with-openssl=PATH use OpenSSL from PATH],
with_openssl=$withval, with_openssl="yes")
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
if test -d $with_openssl; then
CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include"
CMU_ADD_LIBPATH(${with_openssl}/lib)
fi
case "$with_openssl" in
no)
with_openssl="no";;
*)
dnl if openssl has been compiled with the rsaref2 libraries,
dnl we need to include the rsaref libraries in the crypto check
LIB_RSAREF=""
AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes,
cmu_have_rsaref=no)
AC_CHECK_HEADER(openssl/evp.h, [
AC_CHECK_LIB(crypto, EVP_DigestInit,
with_openssl="yes",
with_openssl="no", $LIB_RSAREF)],
with_openssl=no)
;;
esac
if test "$with_openssl" != "no"; then
AC_DEFINE(HAVE_OPENSSL,[],[Do we have OpenSSL?])
else
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
fi
])
cyrus-imspd-v1.8/cmulocal/pthreads.m4 0100644 0043101 0000012 00000001157 07741072415 017052 0 ustar shadow staff dnl pthreads.m4--pthreads setup macro
dnl Rob Earhart
dnl $Id: pthreads.m4,v 1.11 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_PTHREADS], [
AC_REQUIRE([AC_CANONICAL_HOST])
cmu_save_LIBS="$LIBS"
AC_CHECK_LIB(pthread, pthread_create,LIB_PTHREAD="-lpthread",
AC_CHECK_LIB(c_r, pthread_create,LIB_PTHREAD="-lc_r",
AC_ERROR([Can't compile without pthreads])))
LIBS="$cmu_save_LIBS"
AC_SUBST(LIB_PTHREAD)
AC_DEFINE(_REENTRANT)
case "$host_os" in
solaris2*)
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
AC_DEFINE(__EXTENSIONS__)
;;
irix6*)
AC_DEFINE(_SGI_REENTRANT_FUNCTIONS)
;;
esac
])
cyrus-imspd-v1.8/cmulocal/sasl.m4 0100644 0043101 0000012 00000004370 07741072415 016202 0 ustar shadow staff dnl sasl.m4--sasl libraries and includes
dnl Derrick Brashear
dnl from KTH sasl and Arla
dnl $Id: sasl.m4,v 1.22 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_SASL_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
CMU_CHECK_HEADER_NOCACHE(sasl.h,
ac_cv_found_sasl_inc=yes,
ac_cv_found_sasl_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_SASL_INC_WHERE], [
for i in $1; do
CMU_SASL_INC_WHERE1($i)
CMU_TEST_INCPATH($i, sasl)
if test "$ac_cv_found_sasl_inc" = "yes"; then
ac_cv_sasl_where_inc=$i
break
fi
done
])
AC_DEFUN([CMU_SASL_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lsasl"
AC_TRY_LINK(,
[sasl_getprop();],
[ac_cv_found_sasl_lib=yes],
ac_cv_found_sasl_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_SASL_LIB_WHERE], [
for i in $1; do
CMU_SASL_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, sasl)
if test "$ac_cv_found_sasl_lib" = "yes" ; then
ac_cv_sasl_where_lib=$i
break
fi
done
])
AC_DEFUN([CMU_SASL], [
AC_ARG_WITH(sasl,
[ --with-sasl=DIR Compile with libsasl in ],
with_sasl="$withval",
with_sasl="yes")
SASLFLAGS=""
LIB_SASL=""
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_LDFLAGS=$LDFLAGS
cmu_saved_LIBS=$LIBS
if test -d ${with_sasl}; then
ac_cv_sasl_where_lib=${with_sasl}/lib
ac_cv_sasl_where_inc=${with_sasl}/include
SASLFLAGS="-I$ac_cv_sasl_where_inc"
LIB_SASL="-L$ac_cv_sasl_where_lib"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
fi
AC_CHECK_HEADER(sasl.h,
AC_CHECK_LIB(sasl, sasl_getprop,
ac_cv_found_sasl=yes,
ac_cv_found_sasl=no), ac_cv_found_sasl=no)
LIBS="$cmu_saved_LIBS"
LDFLAGS="$cmu_saved_LDFLAGS"
CPPFLAGS="$cmu_saved_CPPFLAGS"
if test "$ac_cv_found_sasl" = yes; then
LIB_SASL="$LIB_SASL -lsasl"
else
LIB_SASL=""
SASLFLAGS=""
fi
AC_SUBST(LIB_SASL)
AC_SUBST(SASLFLAGS)
])
AC_DEFUN([CMU_SASL_REQUIRED],
[AC_REQUIRE([CMU_SASL])
if test "$ac_cv_found_sasl" != "yes"; then
AC_ERROR([Cannot continue without libsasl.
Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.])
fi])
cyrus-imspd-v1.8/cmulocal/sasl2.m4 0100644 0043101 0000012 00000034135 10121405732 016252 0 ustar shadow staff dnl sasl2.m4--sasl2 libraries and includes
dnl Rob Siemborski
dnl $Id: sasl2.m4,v 1.48 2004/09/13 21:06:34 shadow Exp $
AC_DEFUN([SASL_GSSAPI_CHK],[
AC_ARG_ENABLE(gssapi, [ --enable-gssapi= enable GSSAPI authentication [yes] ],
gssapi=$enableval,
gssapi=yes)
AC_ARG_WITH(gss_impl, [ --with-gss_impl={heimdal|mit|cybersafe|seam|auto} choose specific GSSAPI implementation [[auto]] ],
gss_impl=$withval,
gss_impl=auto)
AC_REQUIRE([SASL2_CRYPT_CHK])
AC_REQUIRE([CMU_SOCKETS])
if test "$gssapi" != no; then
platform=
case "${host}" in
*-*-linux*)
platform=__linux
;;
*-*-hpux*)
platform=__hpux
;;
*-*-irix*)
platform=__irix
;;
*-*-solaris2*)
# When should we use __sunos?
platform=__solaris
;;
*-*-aix*)
###_AIX
platform=__aix
;;
*)
AC_WARN([The system type is not recognized. If you believe that CyberSafe GSSAPI works on this platform, please update the configure script])
if test "$gss_impl" = "cybersafe"; then
AC_ERROR([CyberSafe was forced, cannot continue as platform is not supported])
fi
;;
esac
cmu_saved_CPPFLAGS=$CPPFLAGS
if test -d ${gssapi}; then
CPPFLAGS="$CPPFLAGS -I$gssapi/include"
# We want to keep -I in our CPPFLAGS, but only if we succeed
cmu_saved_CPPFLAGS=$CPPFLAGS
### I am not sure how useful is this (and whether this is required at all
### especially when we have to provide two -L flags for new CyberSafe
LDFLAGS="$LDFLAGS -L$gssapi/lib"
if test -n "$platform"; then
if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
CPPFLAGS="$CPPFLAGS -D$platform"
if test -d "${gssapi}/appsec-sdk/include"; then
CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
fi
fi
fi
fi
AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H,,[Define if you have the gssapi.h header file]), [
AC_CHECK_HEADER(gssapi/gssapi.h,, AC_WARN(Disabling GSSAPI - no include files found); gssapi=no)])
CPPFLAGS=$cmu_saved_CPPFLAGS
fi
if test "$gssapi" != no; then
dnl We need to find out which gssapi implementation we are
dnl using. Supported alternatives are: MIT Kerberos 5,
dnl Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal),
dnl CyberSafe Kerberos 5 (http://www.cybersafe.com/)
dnl and Sun SEAM (http://wwws.sun.com/software/security/kerberos/)
dnl
dnl The choice is reflected in GSSAPIBASE_LIBS
AC_CHECK_LIB(resolv,res_search)
if test -d ${gssapi}; then
gssapi_dir="${gssapi}/lib"
GSSAPIBASE_LIBS="-L$gssapi_dir"
GSSAPIBASE_STATIC_LIBS="-L$gssapi_dir"
else
dnl FIXME: This is only used for building cyrus, and then only as
dnl a real hack. it needs to be fixed.
gssapi_dir="/usr/local/lib"
fi
# Check a full link against the Heimdal libraries.
# If this fails, check a full link against the MIT libraries.
# If this fails, check a full link against the CyberSafe libraries.
# If this fails, check a full link against the Solaris 8 and up libgss.
if test "$gss_impl" = "auto" -o "$gss_impl" = "heimdal"; then
gss_failed=0
AC_CHECK_LIB(gssapi,gss_unwrap,gss_impl="heimdal",gss_failed=1,$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET})
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
if test "$gss_impl" = "auto" -o "$gss_impl" = "mit"; then
gss_failed=0
AC_CHECK_LIB(gssapi_krb5,gss_unwrap,gss_impl="mit",gss_failed=1,$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err ${LIB_SOCKET})
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
# For Cybersafe one has to set a platform define in order to make compilation work
if test "$gss_impl" = "auto" -o "$gss_impl" = "cybersafe"; then
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_GSSAPIBASE_LIBS=$GSSAPIBASE_LIBS
# FIX ME - Note that the libraries are in .../lib/64 for 64bit kernels
if test -d "${gssapi}/appsec-rt/lib"; then
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -L${gssapi}/appsec-rt/lib"
fi
CPPFLAGS="$CPPFLAGS -D$platform"
if test -d "${gssapi}/appsec-sdk/include"; then
CPPFLAGS="$CPPFLAGS -I${gssapi}/appsec-sdk/include"
fi
gss_failed=0
# Check for CyberSafe with two libraries first, than fall back to a single
# library (older CyberSafe)
unset ac_cv_lib_gss_csf_gss_acq_user
AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe03",[
unset ac_cv_lib_gss_csf_gss_acq_user;AC_CHECK_LIB(gss,csf_gss_acq_user,gss_impl="cybersafe",gss_failed=1,$GSSAPIBASE_LIBS -lgss)],$GSSAPIBASE_LIBS -lgss -lcstbk5)
if test "$gss_failed" = "1"; then
# Restore variables
GSSAPIBASE_LIBS=$cmu_saved_GSSAPIBASE_LIBS
CPPFLAGS=$cmu_saved_CPPFLAGS
if test "$gss_impl" != "auto"; then
gss_impl="failed"
fi
fi
fi
if test "$gss_impl" = "auto" -o "$gss_impl" = "seam"; then
gss_failed=0
AC_CHECK_LIB(gss,gss_unwrap,gss_impl="seam",gss_failed=1,-lgss)
if test "$gss_impl" != "auto" -a "$gss_failed" = "1"; then
gss_impl="failed"
fi
fi
if test "$gss_impl" = "mit"; then
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a"
elif test "$gss_impl" = "heimdal"; then
CPPFLAGS="$CPPFLAGS -DKRB5_HEIMDAL"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err"
GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}"
elif test "$gss_impl" = "cybersafe03"; then
# Version of CyberSafe with two libraries
CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss -lcstbk5"
# there is no static libgss for CyberSafe
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "cybersafe"; then
CPPFLAGS="$CPPFLAGS -D$platform -I${gssapi}/appsec-sdk/include"
GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgss"
# there is no static libgss for CyberSafe
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "seam"; then
GSSAPIBASE_LIBS=-lgss
# there is no static libgss on Solaris 8 and up
GSSAPIBASE_STATIC_LIBS=none
elif test "$gss_impl" = "failed"; then
gssapi="no"
GSSAPIBASE_LIBS=
GSSAPIBASE_STATIC_LIBS=
AC_WARN(Disabling GSSAPI - specified library not found)
else
gssapi="no"
GSSAPIBASE_LIBS=
GSSAPIBASE_STATIC_LIBS=
AC_WARN(Disabling GSSAPI - no library)
fi
fi
#
# Cybersafe defines both GSS_C_NT_HOSTBASED_SERVICE and GSS_C_NT_USER_NAME in gssapi\rfckrb5.h
#
if test "$gssapi" != "no"; then
if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
AC_EGREP_CPP(hostbased_service_gss_nt_yes,
[#include
#ifdef GSS_C_NT_HOSTBASED_SERVICE
hostbased_service_gss_nt_yes
#endif
], AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE]), AC_WARN(Cybersafe define not found))
elif test "$ac_cv_header_gssapi_h" = "yes"; then
AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE]))
elif test "$ac_cv_header_gssapi_gssapi_h"; then
AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE]))
fi
if test "$gss_impl" = "cybersafe" -o "$gss_impl" = "cybersafe03"; then
AC_EGREP_CPP(user_name_yes_gss_nt,
[#include
#ifdef GSS_C_NT_USER_NAME
user_name_yes_gss_nt
#endif
], AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME]), AC_WARN(Cybersafe define not found))
elif test "$ac_cv_header_gssapi_h" = "yes"; then
AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME]))
elif test "$ac_cv_header_gssapi_gssapi_h"; then
AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi/gssapi.h,
AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME]))
fi
fi
GSSAPI_LIBS=""
AC_MSG_CHECKING(GSSAPI)
if test "$gssapi" != no; then
AC_MSG_RESULT(with implementation ${gss_impl})
AC_CHECK_LIB(resolv,res_search,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv")
SASL_MECHS="$SASL_MECHS libgssapiv2.la"
SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/gssapi.o"
cmu_save_LIBS="$LIBS"
LIBS="$LIBS $GSSAPIBASE_LIBS"
AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity)
LIBS="$cmu_save_LIBS"
else
AC_MSG_RESULT(disabled)
fi
AC_SUBST(GSSAPI_LIBS)
AC_SUBST(GSSAPIBASE_LIBS)
])
AC_DEFUN([SASL_SET_GSSAPI_LIBS], [
SASL_GSSAPI_LIBS_SET="yes"
])
dnl What we want to do here is setup LIB_SASL with what one would
dnl generally want to have (e.g. if static is requested, make it that,
dnl otherwise make it dynamic.
dnl We also want to create LIB_DYN_SASL and DYNSASLFLAGS.
dnl Also sets using_static_sasl to "no" "static" or "staticonly"
AC_DEFUN([CMU_SASL2], [
AC_REQUIRE([SASL_GSSAPI_CHK])
AC_ARG_WITH(sasl,
[ --with-sasl=DIR Compile with libsasl2 in ],
with_sasl="$withval",
with_sasl="yes")
AC_ARG_WITH(staticsasl,
[ --with-staticsasl=DIR Compile with staticly linked libsasl2 in ],
with_staticsasl="$withval";
if test $with_staticsasl != "no"; then
using_static_sasl="static"
fi,
with_staticsasl="no"; using_static_sasl="no")
SASLFLAGS=""
LIB_SASL=""
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_LDFLAGS=$LDFLAGS
cmu_saved_LIBS=$LIBS
if test ${with_staticsasl} != "no"; then
if test -d ${with_staticsasl}; then
if test -d ${with_staticsasl}/lib64 ; then
ac_cv_sasl_where_lib=${with_staticsasl}/lib64
else
ac_cv_sasl_where_lib=${with_staticsasl}/lib
fi
ac_cv_sasl_where_lib=${with_staticsasl}/lib
ac_cv_sasl_where_inc=${with_staticsasl}/include
SASLFLAGS="-I$ac_cv_sasl_where_inc"
LIB_SASL="-L$ac_cv_sasl_where_lib"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
else
with_staticsasl="/usr"
fi
AC_CHECK_HEADER(sasl/sasl.h, [
AC_CHECK_HEADER(sasl/saslutil.h, [
for i42 in lib64 lib; do
if test -r ${with_staticsasl}/$i42/libsasl2.a; then
ac_cv_found_sasl=yes
AC_MSG_CHECKING(for static libsasl)
LIB_SASL="$LIB_SASL ${with_staticsasl}/$i42/libsasl2.a"
fi
done
if test ! "$ac_cv_found_sasl" = "yes"; then
AC_MSG_CHECKING(for static libsasl)
AC_ERROR([Could not find ${with_staticsasl}/lib*/libsasl2.a])
fi
])])
AC_MSG_RESULT(found)
if test "x$SASL_GSSAPI_LIBS_SET" = "x"; then
LIB_SASL="$LIB_SASL $GSSAPIBASE_STATIC_LIBS"
else
SASL_GSSAPI_LIBS_SET=""
cmu_saved_LIBS="$GSSAPIBASE_STATIC_LIBS $cmu_saved_LIBS"
fi
fi
if test -d ${with_sasl}; then
ac_cv_sasl_where_lib=${with_sasl}/lib
ac_cv_sasl_where_inc=${with_sasl}/include
DYNSASLFLAGS="-I$ac_cv_sasl_where_inc"
if test "$ac_cv_sasl_where_lib" != ""; then
CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, LIB_DYN_SASL)
fi
LIB_DYN_SASL="$LIB_DYN_SASL -lsasl2"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
fi
dnl be sure to check for a SASLv2 specific function
AC_CHECK_HEADER(sasl/sasl.h, [
AC_CHECK_HEADER(sasl/saslutil.h, [
AC_CHECK_LIB(sasl2, prop_get,
ac_cv_found_sasl=yes,
ac_cv_found_sasl=no)],
ac_cv_found_sasl=no)], ac_cv_found_sasl=no)
if test "$ac_cv_found_sasl" = "yes"; then
if test "$ac_cv_sasl_where_lib" != ""; then
CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, DYNLIB_SASL)
fi
DYNLIB_SASL="$DYNLIB_SASL -lsasl2"
if test "$using_static_sasl" != "static"; then
LIB_SASL=$DYNLIB_SASL
SASLFLAGS=$DYNSASLFLAGS
fi
else
DYNLIB_SASL=""
DYNSASLFLAGS=""
using_static_sasl="staticonly"
fi
if test "x$SASL_GSSAPI_LIBS_SET" != "x"; then
SASL_GSSAPI_LIBS_SET=""
cmu_saved_LIBS="$GSSAPIBASE_LIBS $cmu_saved_LIBS"
fi
LIBS="$cmu_saved_LIBS"
LDFLAGS="$cmu_saved_LDFLAGS"
CPPFLAGS="$cmu_saved_CPPFLAGS"
AC_SUBST(LIB_DYN_SASL)
AC_SUBST(DYNSASLFLAGS)
AC_SUBST(LIB_SASL)
AC_SUBST(SASLFLAGS)
])
AC_DEFUN([CMU_SASL2_REQUIRED],
[AC_REQUIRE([CMU_SASL2])
if test "$ac_cv_found_sasl" != "yes"; then
AC_ERROR([Cannot continue without libsasl2.
Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.])
fi])
AC_DEFUN([CMU_SASL2_REQUIRE_VER], [
AC_REQUIRE([CMU_SASL2_REQUIRED])
cmu_saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $SASLFLAGS"
AC_TRY_CPP([
#include
#ifndef SASL_VERSION_MAJOR
#error SASL_VERSION_MAJOR not defined
#endif
#ifndef SASL_VERSION_MINOR
#error SASL_VERSION_MINOR not defined
#endif
#ifndef SASL_VERSION_STEP
#error SASL_VERSION_STEP not defined
#endif
#if SASL_VERSION_MAJOR < $1 || SASL_VERSION_MINOR < $2 || SASL_VERSION_STEP < $3
#error SASL version is less than $1.$2.$3
#endif
],,AC_ERROR([Incorrect SASL headers found. This package requires SASL $1.$2.$3 or newer.]))
CPPFLAGS=$cmu_saved_CPPFLAGS
])
AC_DEFUN([CMU_SASL2_CHECKAPOP_REQUIRED], [
AC_REQUIRE([CMU_SASL2_REQUIRED])
cmu_saved_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $LIB_SASL"
AC_CHECK_LIB(sasl2, sasl_checkapop, AC_DEFINE(HAVE_APOP,[],[Does SASL support APOP?]),
AC_MSG_ERROR([libsasl2 without working sasl_checkapop. Cannot continue.]))
LDFLAGS=$cmu_saved_LDFLAGS
])
AC_DEFUN([SASL2_CRYPT_CHK],[
AC_CHECK_FUNC(crypt, cmu_have_crypt=yes, [
AC_CHECK_LIB(crypt, crypt,
LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes,
cmu_have_crypt=no)])
AC_SUBST(LIB_CRYPT)
])
cyrus-imspd-v1.8/cmulocal/tcl.m4 0100644 0043101 0000012 00000013474 07741072415 016027 0 ustar shadow staff dnl FIRST PASS AFTER STEALING THIS FROM CYRUS!
dnl USE AT YOUR OWN PERIL!
dnl I MEAN IT!
dnl
dnl tcl.m4: an autoconf Tcl locator
dnl $Id: tcl.m4,v 1.4 2003/10/08 20:35:25 rjs3 Exp $
dnl
dnl This is rob's Tcl macro, fixed by tjs. It may need occasional tweaking,
dnl but until the next impediment to compilation, it's fill-in-the-blank,
dnl and it should be able to do reasonable things with user input.
dnl
dnl This will probably just work on Andrew systems, but given the variety
dnl and apparent creativity of people who compile Tcl elsewhere, I don't know
dnl what it will do. I have yet to see an autoconf Tcl test that users were
dnl happy with.
dnl
dnl BUGS
dnl The command-line arguments are overcomplicated.
dnl There are doubtlessly others...
dnl To use this macro, just do CMU_TCL. It outputs
dnl TCL_LIBS, TCL_CPPFLAGS, and TCL_DEFS and SUBSTs them.
dnl If successful, these have stuff in them. If not, they're empty.
dnl If not successful, with_tcl has the value "no".
AC_DEFUN([CMU_TCL], [
# --- BEGIN CMU_TCL ---
dnl To link against Tcl, configure does several things to make my life
dnl "easier".
dnl
dnl * maybe ask the user where they think Tcl lives, and try to find it
dnl * maybe ask the user what "tclsh" is called this week (i.e., "tclsh8.0")
dnl * run tclsh, ask it for a path, then run that path through sed
dnl * sanity check its result (many installs are a little broken)
dnl * try to figure out where Tcl is based on this result
dnl * try to guess where the Tcl include files are
dnl
dnl Notes from previous incarnations:
dnl > XXX MUST CHECK FOR TCL BEFORE KERBEROS V4 XXX
dnl > This is because some genius at MIT named one of the Kerberos v4
dnl > library functions log(). This of course conflicts with the
dnl > logarithm function in the standard math library, used by Tcl.
dnl
dnl > Checking for Tcl first puts -lm before -lkrb on the library list.
dnl
dnl Check for some information from the user on what the world looks like
AC_ARG_WITH(tclconfig,[ --with-tclconfig=PATH use tclConfig.sh from PATH
(configure gets Tcl configuration from here)],
dnl trim tclConfig.sh off the end so we can add it back on later.
TclLibBase=`echo ${withval} | sed s/tclConfig.sh\$//`)
AC_ARG_WITH(tcl, [ --with-tcl=PATH use Tcl from PATH],
TclLibBase="${withval}/lib")
AC_ARG_WITH(tclsh, [ --with-tclsh=TCLSH use TCLSH as the tclsh program
(let configure find Tcl using this program)],
TCLSH="${withval}")
if test "$TCLSH" = "no" -o "$with_tclconfig" = "no" ; then
AC_MSG_WARN([Tcl disabled because tclsh or tclconfig specified as "no"])
with_tcl=no
fi
if test "$with_tcl" != "no"; then
if test \! -z "$with_tclconfig" -a \! -d "$with_tclconfig" ; then
AC_MSG_ERROR([--with-tclconfig requires a directory argument.])
fi
if test \! -z "$TCLSH" -a \! -x "$TCLSH" ; then
AC_MSG_ERROR([--with-tclsh must specify an executable file.])
fi
if test -z "$TclLibBase"; then # do we already know?
# No? Run tclsh and ask it where it lives.
# Do we know where a tclsh lives?
if test -z "$TCLSH"; then
# Try and find tclsh. Any tclsh.
# If a new version of tcl comes out and unfortunately adds another
# filename, it should be safe to add it (to the front of the line --
# somef vendors have older, badly installed tclshs that we want to avoid
# if we can)
AC_PATH_PROGS(TCLSH, [tclsh8.1 tclsh8.0 tclsh], "unknown")
fi
# Do we know where to get a tclsh?
if test "${TCLSH}" != "unknown"; then
AC_MSG_CHECKING([where Tcl says it lives])
TclLibBase=`echo puts \\\$tcl_library | ${TCLSH} | sed -e 's,[^/]*$,,'`
AC_MSG_RESULT($TclLibBase)
fi
fi
if test -z "$TclLibBase" ; then
AC_MSG_RESULT([can't find tclsh])
AC_MSG_WARN([can't find Tcl installtion; use of Tcl disabled.])
with_tcl=no
else
AC_MSG_CHECKING([for tclConfig.sh])
# Check a list of places where the tclConfig.sh file might be.
for tcldir in "${TclLibBase}" \
"${TclLibBase}/.." \
"${TclLibBase}"`echo ${TCLSH} | sed s/sh//` ; do
if test -f "${tcldir}/tclConfig.sh"; then
TclLibBase="${tcldir}"
break
fi
done
if test -z "${TclLibBase}" ; then
AC_MSG_RESULT("unknown")
AC_MSG_WARN([can't find Tcl configuration; use of Tcl disabled.])
with_tcl=no
else
AC_MSG_RESULT(${TclLibBase}/)
fi
if test "${with_tcl}" != no ; then
AC_MSG_CHECKING([Tcl configuration on what Tcl needs to compile])
. ${TclLibBase}/tclConfig.sh
AC_MSG_RESULT(ok)
dnl no TK stuff for us.
dnl . ${TclLibBase}/tkConfig.sh
fi
if test "${with_tcl}" != no ; then
dnl Now, hunt for the Tcl include files, since we don't strictly
dnl know where they are; some folks put them (properly) in the
dnl default include path, or maybe in /usr/local; the *BSD folks
dnl put them in other places.
AC_MSG_CHECKING([where Tcl includes are])
for tclinclude in "${TCL_PREFIX}/include/tcl${TCL_VERSION}" \
"${TCL_PREFIX}/include/tcl" \
"${TCL_PREFIX}/include" ; do
if test -r "${tclinclude}/tcl.h" ; then
TCL_CPPFLAGS="-I${tclinclude}"
break
fi
done
if test -z "${TCL_CPPFLAGS}" ; then
AC_MSG_WARN(can't find Tcl includes; use of Tcl disabled.)
with_tcl=no
fi
AC_MSG_RESULT(${TCL_CPPFLAGS})
fi
# Finally, pick up the Tcl configuration if we haven't found an
# excuse not to.
if test "${with_tcl}" != no; then
dnl TCL_LIBS="${TK_LIB_SPEC} ${TK_XLIBSW} ${TCL_LD_SEARCH_FLAGS} ${TCL_LIB_SPEC}"
TCL_LIBS="${TCL_LD_SEARCH_FLAGS} ${TCL_LIB_SPEC} ${TCL_LIBS}"
fi
fi
fi
AC_SUBST(TCL_DEFS)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_CPPFLAGS)
# --- END CMU_TCL ---
]) dnl CMU_TCL
cyrus-imspd-v1.8/cmulocal/telnet.m4 0100644 0043101 0000012 00000012522 07741072415 016531 0 ustar shadow staff dnl telnet.m4--telnet special macros
dnl Derrick Brashear
dnl $Id: telnet.m4,v 1.12 2003/10/08 20:35:25 rjs3 Exp $
AC_DEFUN([CMU_TELNET_WHICH_TERM], [
AC_CHECK_LIB(termlib, setupterm, [
AC_DEFINE(HAVE_SETUPTERM)
AC_CHECK_LIB(c, setupterm, TCLIB="/usr/ccs/lib/libtermlib.a",TCLIB="-ltermlib","/usr/ccs/lib/libtermlib.a")
], TCLIB="-ltermcap")
])
AC_DEFUN([CMU_TELNET_CC_T],
[
AC_MSG_CHECKING(for cc_t definition)
AC_CACHE_VAL(cmu_cv_cc_t_definition, [
AC_TRY_COMPILE(
[
#ifdef HAVE_SYS_TERMIOS_H
#include
#else
#ifdef HAVE_SYS_TERMIO_H
#include
#endif
#endif
],
[cc_t ffoo;],
cmu_cv_cc_t_definition=yes,
cmu_cv_cc_t_definition=no)
])
if test "$cmu_cv_cc_t_definition" = "no"; then
AC_DEFINE(NO_CC_T)
fi
AC_MSG_RESULT($cmu_cv_cc_t_definition)
])
AC_DEFUN([CMU_STREAMS], [
if test "$ac_cv_header_sys_stropts_h" = "yes" -o "$ac_cv_header_stropts_h" = "yes"; then
AC_DEFINE(HAVE_STREAMS)dnl
fi
])
AC_DEFUN([CMU_TERMIO_MODEL], [
if test "$ac_cv_header_sys_termio_h" = "yes" -o "$ac_cv_header_sys_termios_h" = "yes"; then
AC_DEFINE(USE_TERMIO)dnl
if test "$ac_cv_header_sys_termios_h" = "no"; then
AC_DEFINE(SYSV_TERMIO)dnl
fi
fi
])
AC_DEFUN([CMU_TELNET_DES_STRING_TO_KEY_PROTO], [
AC_MSG_CHECKING(for des_string_to_key prototype)
AC_CACHE_VAL(cmu_cv_des_string_to_key_proto, [
AC_TRY_COMPILE(
[#include
typedef unsigned char Block[8];
int des_string_to_key(char *, Block);],
[int foo = des_string_to_key(NULL, NULL);],
cmu_cv_des_string_to_key_proto=no,
cmu_cv_des_string_to_key_proto=yes)
])
if test "$cmu_cv_des_string_to_key_proto" = yes; then
AC_DEFINE(HAVE_DES_STRING_TO_KEY_PROTO)dnl
fi
AC_MSG_RESULT($cmu_cv_des_string_to_key_proto)
])
AC_DEFUN([CMU_TELNET_DES_KEY_SCHED_PROTO], [
AC_MSG_CHECKING(for des_key_sched prototype)
AC_CACHE_VAL(cmu_cv_des_key_sched_proto, [
AC_TRY_COMPILE(
[
#include
char des_key_sched(int foo, int bar, int baz);
],
[des_key_sched(NULL, NULL);],
cmu_cv_des_key_sched_proto=no,
cmu_cv_des_key_sched_proto=yes)
])
if test "$cmu_cv_des_key_sched_proto" = yes; then
AC_DEFINE(HAVE_DES_KEY_SCHED_PROTO)dnl
fi
AC_MSG_RESULT($cmu_cv_des_key_sched_proto)
])
AC_DEFUN([CMU_TELNET_DES_SET_RANDOM_GENERATOR_SEED_PROTO], [
AC_MSG_CHECKING(for des_set_random_generator_seed prototype)
AC_CACHE_VAL(cmu_cv_des_set_random_generator_seed_proto, [
AC_TRY_COMPILE(
[
#include
char des_set_random_generator_seed(int foo, int bar, int baz);
],
[des_set_random_generator_seed(NULL, NULL);],
cmu_cv_des_set_random_generator_seed_proto=no,
cmu_cv_des_set_random_generator_seed_proto=yes)
])
if test "$cmu_cv_des_set_random_generator_seed_proto" = yes; then
AC_DEFINE(HAVE_DES_SET_RANDOM_GENERATOR_SEED_PROTO)dnl
fi
AC_MSG_RESULT($cmu_cv_des_set_random_generator_seed_proto)
])
AC_DEFUN([CMU_TELNET_DES_NEW_RANDOM_KEY_PROTO], [
AC_MSG_CHECKING(for des_new_random_key prototype)
AC_CACHE_VAL(cmu_cv_des_new_random_key_proto, [
AC_TRY_COMPILE(
[
#include
char des_new_random_key(int foo, int bar, int baz);
],
[des_new_random_key(NULL, NULL);],
cmu_cv_des_new_random_key_proto=no,
cmu_cv_des_new_random_key_proto=yes)
])
if test "$cmu_cv_des_new_random_key_proto" = yes; then
AC_DEFINE(HAVE_DES_NEW_RANDOM_KEY_PROTO)dnl
fi
AC_MSG_RESULT($cmu_cv_des_new_random_key_proto)
])
AC_DEFUN([CMU_TELNET_DES_ECB_ENCRYPT_PROTO], [
AC_MSG_CHECKING(for des_ecb_encrypt prototype)
AC_CACHE_VAL(cmu_cv_des_ecb_encrypt_proto, [
AC_TRY_COMPILE(
[#include
typedef unsigned char Block[8];
typedef struct { Block _; } Schedule[16];
void des_ecb_encrypt(Block, Block, Schedule, int);],
[int foo = des_ecb_encrypt(NULL, NULL, NULL, 0);],
cmu_cv_des_ecb_encrypt_proto=no,
cmu_cv_des_ecb_encrypt_proto=yes)
])
if test "$cmu_cv_des_ecb_encrypt_proto" = yes; then
AC_DEFINE(HAVE_DES_ECB_ENCRYPT_PROTO)dnl
fi
AC_MSG_RESULT($cmu_cv_des_ecb_encrypt_proto)
])
AC_DEFUN([CMU_TELNET_NEWDES], [
AC_REQUIRE([CMU_KRB4])
AC_REQUIRE([CMU_KRB5])
AC_MSG_CHECKING(for des_new_random_key prototype)
AC_CACHE_VAL(ac_cv_func_des_new_random_key_proto, [
AC_TRY_COMPILE(
[#include
des_cblock key;],
[des_new_random_key(&key);],
ac_cv_func_des_new_random_key=yes,
ac_cv_func_des_new_random_key=no)
])
if test "$ac_cv_func_des_new_random_key" = yes; then
AC_DEFINE(NEWDESLIB)dnl
fi
AC_MSG_RESULT($ac_cv_func_des_new_random_key)
])
AC_DEFUN([CMU_TELNET_OLDNEWDES], [
AC_REQUIRE([CMU_KRB4])
AC_REQUIRE([CMU_KRB5])
saved_LIBS=$LIBS
LIBS="$KRB_LIB_FLAGS $KRB5_LIB_FLAGS"
if test "$with_des" = yes; then
AC_CHECK_FUNCS(des_new_random_key)
if test "$ac_cv_func_des_new_random_key" = yes; then
AC_DEFINE(NEWDESLIB)
fi
fi
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_TELNET_GETTYTAB], [
if test -f "/etc/gettytab"; then
AC_CHECK_FUNCS(getent getstr)
if test "X$ac_cv_func_getent" != "Xyes"; then
AC_DEFINE(HAVE_GETTYTAB)
if test "X$ac_cv_func_getstr" = "Xyes"; then
CFLAGS="$CFLAGS -Dgetstr=ggetstr"
fi
fi
else
AC_CHECK_FUNCS(cgetent)
fi
])
AC_DEFUN([CMU_TELNET_ISSUE], [
if test -f "/etc/issue.net"; then
AC_DEFINE(ISSUE_FILE, "/etc/issue.net")
else
if test -f "/etc/issue"; then
AC_DEFINE(ISSUE_FILE, "/etc/issue")
fi
fi
])
AC_DEFUN([CMU_TELNET_PTYDIR], [
if test -d /dev/pts -o -d /dev/pty; then
case "${host}" in
*-*-irix*)
;;
*-*-linux*)
AC_DEFINE(PTYDIR)
;;
*)
AC_DEFINE(PTYDIR)
AC_DEFINE(STREAMSPTY)
;;
esac
fi
])
cyrus-imspd-v1.8/cmulocal/ucdsnmp.m4 0100644 0043101 0000012 00000003775 10054446065 016716 0 ustar shadow staff dnl look for the (ucd|net)snmp libraries
dnl $Id: ucdsnmp.m4,v 1.10 2004/05/24 19:25:41 ken3 Exp $
AC_DEFUN([CMU_UCDSNMP], [
AC_REQUIRE([CMU_SOCKETS])
AC_ARG_WITH(snmp,
[ --with-snmp=DIR use ucd|net snmp (rooted in DIR) [yes] ],
with_snmp=$withval, with_snmp=yes)
dnl
dnl Maintain backwards compatibility with old --with-ucdsnmp option
dnl
AC_ARG_WITH(ucdsnmp,, with_snmp=$withval,)
if test "$with_snmp" != "no"; then
dnl
dnl Try net-snmp first
dnl
if test "$with_snmp" = "yes"; then
AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
else
SNMP_CONFIG="$with_snmp/bin/net-snmp-config"
fi
if test -x "$SNMP_CONFIG"; then
AC_MSG_CHECKING(NET SNMP libraries)
SNMP_LIBS=`$SNMP_CONFIG --agent-libs`
SNMP_PREFIX=`$SNMP_CONFIG --prefix`
if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
CPPFLAGS="$CPPFLAGS -I${SNMP_PREFIX}/include"
LIB_UCDSNMP=$SNMP_LIBS
AC_DEFINE(HAVE_NETSNMP,1,[Do we have Net-SNMP support?])
AC_SUBST(LIB_UCDSNMP)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([Could not find the required paths. Please check your net-snmp installation.])
fi
else
dnl
dnl Try ucd-snmp if net-snmp test failed
dnl
if test "$with_snmp" != no; then
if test -d "$with_snmp"; then
CPPFLAGS="$CPPFLAGS -I${with_snmp}/include"
LDFLAGS="$LDFLAGS -L${with_snmp}/lib"
fi
cmu_save_LIBS="$LIBS"
AC_CHECK_LIB(snmp, sprint_objid, [
AC_CHECK_HEADER(ucd-snmp/version.h,, with_snmp=no)],
with_snmp=no, ${LIB_SOCKET})
LIBS="$cmu_save_LIBS"
fi
AC_MSG_CHECKING(UCD SNMP libraries)
AC_MSG_RESULT($with_snmp)
LIB_UCDSNMP=""
if test "$with_snmp" != no; then
AC_DEFINE(HAVE_UCDSNMP,1,[Do we have UCD-SNMP support?])
LIB_UCDSNMP="-lucdagent -lucdmibs -lsnmp"
AC_CHECK_LIB(rpm, rpmdbOpen,
LIB_UCDSNMP="${LIB_UCDSNMP} -lrpm -lpopt",,-lpopt)
fi
AC_SUBST(LIB_UCDSNMP)
fi
fi
])
cyrus-imspd-v1.8/cmulocal/util.m4 0100644 0043101 0000012 00000004260 07741072416 016214 0 ustar shadow staff dnl util.m4--robutil macro
dnl Rob Earhart
dnl $Id: util.m4,v 1.10 2003/10/08 20:35:26 rjs3 Exp $
dnl robutil is a collection of stuff I (Rob Earhart) have found useful
dnl to have around when writing code; it's the stuff I wind up rewriting
dnl every time I start a project. This does the autoconf setup
dnl necessary for it.
dnl This is a helper macro, here because there're times when I
dnl want to know if a type exists or not, but don't want to define
dnl it to something else (the way AC_CHECK_TYPE does).
AC_DEFUN([CMU_CHECK_TYPE_EXISTS], [
changequote(<<, >>)
define(<>, translit(CMU_HAVE_$1, [a-z *], [A-Z_P]))
define(<>, translit(cmu_cv_type_$1, [ *], [_p]))
changequote([, ])
AC_REQUIRE([AC_HEADER_STDC])
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(CMU_CV_NAME, [
AC_EGREP_CPP([$1[[^a-zA-Z_0-9]]], [
#include
#if STDC_HEADERS
#include
#include
#endif
], CMU_CV_NAME=yes, CMU_CV_NAME=no)])
AC_MSG_RESULT($CMU_CV_NAME)
if test $CMU_CV_NAME = yes; then
AC_DEFINE(CMU_TYPE_NAME)
fi
])
AC_DEFUN([CMU_UTIL], [
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AM_PROG_CC_STDC])
AC_REQUIRE([AC_PROG_RANLIB])
AC_REQUIRE([CMU_NANA])
AC_REQUIRE([CMU_COMERR])
AC_REQUIRE([AC_HEADER_STDC])
AC_REQUIRE([AC_TYPE_MODE_T])
AC_REQUIRE([AC_C_CONST])
AC_CHECK_HEADERS(sys/sysmacros.h)
AC_CHECK_HEADER(inttypes.h, AC_DEFINE(HAVE_INTTYPES_H),
CMU_CHECK_TYPE_EXISTS(int8_t)
CMU_CHECK_TYPE_EXISTS(uint8_t)
CMU_CHECK_TYPE_EXISTS(u_int8_t)
CMU_CHECK_TYPE_EXISTS(int16_t)
CMU_CHECK_TYPE_EXISTS(uint16_t)
CMU_CHECK_TYPE_EXISTS(u_int16_t)
CMU_CHECK_TYPE_EXISTS(int32_t)
CMU_CHECK_TYPE_EXISTS(uint32_t)
CMU_CHECK_TYPE_EXISTS(u_int32_t)
)
dnl I'm not sure why autoconf gets so annoyed when these
dnl are embedded as part of the inttypes check, but, whatever,
dnl this works.
if test "$ac_cv_header_inttypes_h" = no; then
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
fi
AC_CHECK_TYPE(ssize_t, signed)
THREADED_UTIL_OBJECTS=""
AC_SUBST(THREADED_UTIL_OBJECTS)
])
AC_DEFUN([CMU_THREAD_UTIL], [
AC_REQUIRE([CMU_UTIL])
THREADED_UTIL_OBJECTS="refcache.o rselock.o"
])
cyrus-imspd-v1.8/cmulocal/zephyr.m4 0100644 0043101 0000012 00000011231 10013507333 016537 0 ustar shadow staff dnl zephyr.m4--Zephyr libraries and includes
dnl based on kafs.m4, by
dnl Derrick Brashear
dnl from KTH kafs and Arla
dnl $Id: zephyr.m4,v 1.1 2004/02/14 21:10:51 cg2v Exp $
AC_DEFUN([CMU_ZEPHYR_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE(
[#include ],
[ZNotice_t foo;],
ac_cv_found_zephyr_inc=yes,
ac_cv_found_zephyr_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_ZEPHYR_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for zephyr headers in $i)
CMU_ZEPHYR_INC_WHERE1($i)
CMU_TEST_INCPATH($i, zephyr/zephyr)
if test "$ac_cv_found_zephyr_inc" = "yes"; then
ac_cv_zephyr_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_ZEPHYR_LIB_WHERE1], [
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lzephyr $KRB_LIB_FLAGS"
AC_TRY_LINK(,
[ZInitialize();],
[ac_cv_found_zephyr_lib=yes],
ac_cv_found_zephyr_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_ZEPHYR_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for zephyr libraries in $i)
CMU_ZEPHYR_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, zephyr)
if test "$ac_cv_found_zephyr_lib" = "yes" ; then
ac_cv_zephyr_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_ZEPHYR], [
AC_REQUIRE([CMU_SOCKETS])
AC_REQUIRE([CMU_KRB4])
AC_ARG_WITH(zephyr,
[ --with-zephyr=PREFIX Compile with Zephyr support],
[if test "X$with_zephyr" = "X"; then
with_zephyr=yes
fi])
AC_ARG_WITH(zephyr-lib,
[ --with-zephyr-lib=dir use zephyr libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-zephyr-lib])
fi])
AC_ARG_WITH(zephyr-include,
[ --with-zephyr-include=dir use zephyr headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-zephyr-include])
fi])
if test "X$with_zephyr" != "X"; then
if test "$with_zephyr" != "yes" -a "$with_zephyr" != no; then
ac_cv_zephyr_where_lib=$with_zephyr/lib
ac_cv_zephyr_where_inc=$with_zephyr/include
fi
fi
if test "$with_zephyr" != "no"; then
if test "X$with_zephyr_lib" != "X"; then
ac_cv_zephyr_where_lib=$with_zephyr_lib
fi
if test "X$ac_cv_zephyr_where_lib" = "X"; then
CMU_ZEPHYR_LIB_WHERE(/usr/athena/lib /usr/local/lib /usr/lib)
fi
if test "X$with_zephyr_include" != "X"; then
ac_cv_zephyr_where_inc=$with_zephyr_include
fi
if test "X$ac_cv_zephyr_where_inc" = "X"; then
CMU_ZEPHYR_INC_WHERE(/usr/athena/include /usr/local/include /usr/include)
fi
fi
AC_MSG_CHECKING(whether to include zephyr)
if test "X$ac_cv_zephyr_where_lib" = "X" -a "X$ac_cv_zephyr_where_inc" = "X"; then
ac_cv_found_zephyr=no
AC_MSG_RESULT(no)
else
ac_cv_found_zephyr=yes
AC_MSG_RESULT(yes)
ZEPHYR_INC_DIR=$ac_cv_zephyr_where_inc
ZEPHYR_LIB_DIR=$ac_cv_zephyr_where_lib
ZEPHYR_INC_FLAGS="-I${ZEPHYR_INC_DIR}"
ZEPHYR_LIB_FLAGS="-L${ZEPHYR_LIB_DIR} -lzephyr"
AC_SUBST(ZEPHYT_INC_FLAGS)
AC_SUBST(ZEPHYR_LIB_FLAGS)
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${ZEPHYR_LIB_DIR}"
else
RPATH="${RPATH}:${ZEPHYR_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${ZEPHYR_LIB_DIR}"
else
RPATH="${RPATH}:${ZEPHYR_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${ZEPHYR_LIB_DIR}"
else
RPATH="${RPATH}:${ZEPHYR_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${ZEPHYR_LIB_DIR}"
else
RPATH="${RPATH}:${ZEPHYR_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${ZEPHYR_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
cyrus-imspd-v1.8/cmulocal/ax_path_bdb.m4 0100644 0043101 0000012 00000050014 10167317224 017463 0 ustar shadow staff dnl @synopsis AX_PATH_BDB([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl
dnl This macro finds the latest version of Berkeley DB on the system,
dnl and ensures that the header file and library versions match. If
dnl MINIMUM-VERSION is specified, it will ensure that the library
dnl found is at least that version.
dnl
dnl It determines the name of the library as well as the path to the
dnl header file and library. It will check both the default environment
dnl as well as the default Berkeley DB install location. When found, it
dnl sets BDB_LIBS, BDB_CPPFLAGS, and BDB_LDFLAGS to the necessary values
dnl to add to LIBS, CPPFLAGS, and LDFLAGS, as well as setting BDB_VERSION
dnl to the version found. HAVE_DB_H is defined also.
dnl
dnl The option --with-bdb-dir=DIR can be used to specify a specific
dnl Berkeley DB installation to use.
dnl
dnl An example of it's use is:
dnl AX_PATH_BDB([3],[
dnl LIBS="$BDB_LIBS $LIBS"
dnl LDFLAGS="$BDB_LDFLAGS $LDFLAGS"
dnl CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS"
dnl ])
dnl which will locate the latest version of Berkeley DB on the system,
dnl and ensure that it is version 3.0 or higher.
dnl
dnl Details: This macro does not use either AC_CHECK_HEADERS or
dnl AC_CHECK_LIB because, first, the functions inside the library are
dnl sometimes renamed to contain a version code that is only available
dnl from the db.h on the system, and second, because it is common to
dnl have multiple db.h and libdb files on a system it is important to
dnl make sure the ones being used correspond to the same version.
dnl Additionally, there are many different possible names for libdb
dnl when installed by an OS distribution, and these need to be checked
dnl if db.h does not correspond to libdb.
dnl
dnl When cross compiling, only header versions are verified since it
dnl would be difficult to check the library version. Additionally
dnl the default Berkeley DB installation locations /usr/local/BerkeleyDB*
dnl are not searched for higher versions of the library.
dnl
dnl The format for the list of library names to search came from the
dnl Cyrus IMAP distribution, although they are generated dynamically
dnl here, and only for the version found in db.h.
dnl
dnl The macro AX_COMPARE_VERSION is required to use this macro, and
dnl should be available from the Autoconf Macro Archive.
dnl
dnl The author would like to acknowledge the generous and valuable feedback
dnl from Guido Draheim, without which this macro would be far less robust,
dnl and have poor and inconsistent cross compilation support.
dnl
dnl @version $Id: ax_path_bdb.m4,v 1.1 2005/01/06 20:24:52 shadow Exp $
dnl @author Tim Toolan
dnl
dnl #########################################################################
AC_DEFUN([AX_PATH_BDB], [
dnl # Used to indicate success or failure of this function.
ax_path_bdb_ok=no
# Add --with-bdb-dir option to configure.
AC_ARG_WITH([bdb-dir],
[AC_HELP_STRING([--with-bdb-dir=DIR],
[Berkeley DB installation directory])])
# Check if --with-bdb-dir was specified.
if test "x$with_bdb_dir" = "x" ; then
# No option specified, so just search the system.
AX_PATH_BDB_NO_OPTIONS([$1], [HIGHEST], [
ax_path_bdb_ok=yes
])
else
# Set --with-bdb-dir option.
ax_path_bdb_INC="$with_bdb_dir/include"
ax_path_bdb_LIB="$with_bdb_dir/lib"
dnl # Save previous environment, and modify with new stuff.
ax_path_bdb_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I$ax_path_bdb_INC $CPPFLAGS"
ax_path_bdb_save_LDFLAGS=$LDFLAGS
LDFLAGS="-L$ax_path_bdb_LIB $LDFLAGS"
# Check for specific header file db.h
AC_MSG_CHECKING([db.h presence in $ax_path_bdb_INC])
if test -f "$ax_path_bdb_INC/db.h" ; then
AC_MSG_RESULT([yes])
# Check for library
AX_PATH_BDB_NO_OPTIONS([$1], [ENVONLY], [
ax_path_bdb_ok=yes
BDB_CPPFLAGS="-I$ax_path_bdb_INC"
BDB_LDFLAGS="-L$ax_path_bdb_LIB"
])
else
AC_MSG_RESULT([no])
AC_MSG_NOTICE([no usable Berkeley DB not found])
fi
dnl # Restore the environment.
CPPFLAGS="$ax_path_bdb_save_CPPFLAGS"
LDFLAGS="$ax_path_bdb_save_LDFLAGS"
fi
dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND.
if test "$ax_path_bdb_ok" = "yes" ; then
m4_ifvaln([$2],[$2],[:])dnl
m4_ifvaln([$3],[else $3])dnl
fi
]) dnl AX_PATH_BDB
dnl #########################################################################
dnl Check for berkeley DB of at least MINIMUM-VERSION on system.
dnl
dnl The OPTION argument determines how the checks occur, and can be one of:
dnl
dnl HIGHEST - Check both the environment and the default installation
dnl directories for Berkeley DB and choose the version that
dnl is highest. (default)
dnl ENVFIRST - Check the environment first, and if no satisfactory
dnl library is found there check the default installation
dnl directories for Berkeley DB which is /usr/local/BerkeleyDB*
dnl ENVONLY - Check the current environment only.
dnl
dnl Requires AX_PATH_BDB_PATH_GET_VERSION, AX_PATH_BDB_PATH_FIND_HIGHEST,
dnl AX_PATH_BDB_ENV_CONFIRM_LIB, AX_PATH_BDB_ENV_GET_VERSION, and
dnl AX_COMPARE_VERSION macros.
dnl
dnl Result: sets ax_path_bdb_no_options_ok to yes or no
dnl sets BDB_LIBS, BDB_CPPFLAGS, BDB_LDFLAGS, BDB_VERSION
dnl
dnl AX_PATH_BDB_NO_OPTIONS([MINIMUM-VERSION], [OPTION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([AX_PATH_BDB_NO_OPTIONS], [
dnl # Used to indicate success or failure of this function.
ax_path_bdb_no_options_ok=no
# Values to add to environment to use Berkeley DB.
BDB_VERSION=''
BDB_LIBS=''
BDB_CPPFLAGS=''
BDB_LDFLAGS=''
# Check cross compilation here.
if test "x$cross_compiling" = "xyes" ; then
# If cross compiling, can't use AC_RUN_IFELSE so do these tests.
# The AC_PREPROC_IFELSE confirms that db.h is preprocessable,
# and extracts the version number from it.
AC_MSG_CHECKING([for db.h])
AS_VAR_PUSHDEF([HEADER_VERSION],[ax_path_bdb_no_options_HEADER_VERSION])dnl
HEADER_VERSION=''
AC_PREPROC_IFELSE([
AC_LANG_SOURCE([[
#include
AX_PATH_BDB_STUFF DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH
]])
],[
# Extract version from preprocessor output.
HEADER_VERSION=`eval "$ac_cpp conftest.$ac_ext" 2> /dev/null \
| grep AX_PATH_BDB_STUFF | sed 's/[[^0-9,]]//g;s/,/./g;1q'`
],[])
if test "x$HEADER_VERSION" = "x" ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([$HEADER_VERSION])
# Check that version is high enough.
AX_COMPARE_VERSION([$HEADER_VERSION],[ge],[$1],[
# get major and minor version numbers
AS_VAR_PUSHDEF([MAJ],[ax_path_bdb_no_options_MAJOR])dnl
MAJ=`echo $HEADER_VERSION | sed 's,\..*,,'`
AS_VAR_PUSHDEF([MIN],[ax_path_bdb_no_options_MINOR])dnl
MIN=`echo $HEADER_VERSION | sed 's,^[[0-9]]*\.,,;s,\.[[0-9]]*$,,'`
dnl # Save LIBS.
ax_path_bdb_no_options_save_LIBS="$LIBS"
# Check that we can link with the library.
AC_SEARCH_LIBS([db_version],
[db db-$MAJ.$MIN db$MAJ.$MIN db$MAJ$MIN db-$MAJ db$MAJ],[
# Sucessfully found library.
ax_path_bdb_no_options_ok=yes
BDB_VERSION=$HEADER_VERSION
# Extract library from LIBS
ax_path_bdb_no_options_LEN=` \
echo "x$ax_path_bdb_no_options_save_LIBS" \
| awk '{print(length)}'`
BDB_LIBS=`echo "x$LIBS " \
| sed "s/.\{$ax_path_bdb_no_options_LEN\}\$//;s/^x//;s/ //g"`
],[])
dnl # Restore LIBS
LIBS="$ax_path_bdb_no_options_save_LIBS"
AS_VAR_POPDEF([MAJ])dnl
AS_VAR_POPDEF([MIN])dnl
])
fi
AS_VAR_POPDEF([HEADER_VERSION])dnl
else
# Not cross compiling.
# Check version of Berkeley DB in the current environment.
AX_PATH_BDB_ENV_GET_VERSION([
AX_COMPARE_VERSION([$ax_path_bdb_env_get_version_VERSION],[ge],[$1],[
# Found acceptable version in current environment.
ax_path_bdb_no_options_ok=yes
BDB_VERSION="$ax_path_bdb_env_get_version_VERSION"
BDB_LIBS="$ax_path_bdb_env_get_version_LIBS"
])
])
# Determine if we need to search /usr/local/BerkeleyDB*
ax_path_bdb_no_options_DONE=no
if test "x$2" = "xENVONLY" ; then
ax_path_bdb_no_options_DONE=yes
elif test "x$2" = "xENVFIRST" ; then
ax_path_bdb_no_options_DONE=$ax_path_bdb_no_options_ok
fi
if test "$ax_path_bdb_no_options_DONE" = "no" ; then
# Check for highest in /usr/local/BerkeleyDB*
AX_PATH_BDB_PATH_FIND_HIGHEST([
if test "$ax_path_bdb_no_options_ok" = "yes" ; then
# If we already have an acceptable version use this if higher.
AX_COMPARE_VERSION(
[$ax_path_bdb_path_find_highest_VERSION],[gt],[$BDB_VERSION])
else
# Since we didn't have an acceptable version check if this one is.
AX_COMPARE_VERSION(
[$ax_path_bdb_path_find_highest_VERSION],[ge],[$1])
fi
])
dnl # If result from _AX_COMPARE_VERSION is true we want this version.
if test "$ax_compare_version" = "true" ; then
ax_path_bdb_no_options_ok=yes
BDB_LIBS="-ldb"
BDB_CPPFLAGS="-I$ax_path_bdb_path_find_highest_DIR/include"
BDB_LDFLAGS="-L$ax_path_bdb_path_find_highest_DIR/lib"
BDB_VERSION="$ax_path_bdb_path_find_highest_VERSION"
fi
fi
fi
dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND.
if test "$ax_path_bdb_no_options_ok" = "yes" ; then
AC_MSG_NOTICE([using Berkeley DB version $BDB_VERSION])
AC_DEFINE([HAVE_DB_H],[1],
[Define to 1 if you have the header file.])
m4_ifvaln([$3],[$3])dnl
else
AC_MSG_NOTICE([no Berkeley DB version $1 or higher found])
m4_ifvaln([$4],[$4])dnl
fi
]) dnl AX_PATH_BDB_NO_OPTIONS
dnl #########################################################################
dnl Check the default installation directory for Berkeley DB which is
dnl of the form /usr/local/BerkeleyDB* for the highest version.
dnl
dnl Result: sets ax_path_bdb_path_find_highest_ok to yes or no,
dnl sets ax_path_bdb_path_find_highest_VERSION to version,
dnl sets ax_path_bdb_path_find_highest_DIR to directory.
dnl
dnl AX_PATH_BDB_PATH_FIND_HIGHEST([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([AX_PATH_BDB_PATH_FIND_HIGHEST], [
dnl # Used to indicate success or failure of this function.
ax_path_bdb_path_find_highest_ok=no
AS_VAR_PUSHDEF([VERSION],[ax_path_bdb_path_find_highest_VERSION])dnl
VERSION=''
ax_path_bdb_path_find_highest_DIR=''
# find highest verison in default install directory for Berkeley DB
AS_VAR_PUSHDEF([CURDIR],[ax_path_bdb_path_find_highest_CURDIR])dnl
AS_VAR_PUSHDEF([CUR_VERSION],[ax_path_bdb_path_get_version_VERSION])dnl
for CURDIR in `ls -d /usr/local/BerkeleyDB* 2> /dev/null`
do
AX_PATH_BDB_PATH_GET_VERSION([$CURDIR],[
AX_COMPARE_VERSION([$CUR_VERSION],[gt],[$VERSION],[
ax_path_bdb_path_find_highest_ok=yes
ax_path_bdb_path_find_highest_DIR="$CURDIR"
VERSION="$CUR_VERSION"
])
])
done
AS_VAR_POPDEF([VERSION])dnl
AS_VAR_POPDEF([CUR_VERSION])dnl
AS_VAR_POPDEF([CURDIR])dnl
dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND.
if test "$ax_path_bdb_path_find_highest_ok" = "yes" ; then
m4_ifvaln([$1],[$1],[:])dnl
m4_ifvaln([$2],[else $2])dnl
fi
]) dnl AX_PATH_BDB_PATH_FIND_HIGHEST
dnl #########################################################################
dnl Checks for Berkeley DB in specified directory's lib and include
dnl subdirectories.
dnl
dnl Result: sets ax_path_bdb_path_get_version_ok to yes or no,
dnl sets ax_path_bdb_path_get_version_VERSION to version.
dnl
dnl AX_PATH_BDB_PATH_GET_VERSION(BDB-DIR, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([AX_PATH_BDB_PATH_GET_VERSION], [
dnl # Used to indicate success or failure of this function.
ax_path_bdb_path_get_version_ok=no
# Indicate status of checking for Berkeley DB header.
AC_MSG_CHECKING([in $1/include for db.h])
ax_path_bdb_path_get_version_got_header=no
test -f "$1/include/db.h" && ax_path_bdb_path_get_version_got_header=yes
AC_MSG_RESULT([$ax_path_bdb_path_get_version_got_header])
# Indicate status of checking for Berkeley DB library.
AC_MSG_CHECKING([in $1/lib for library -ldb])
ax_path_bdb_path_get_version_VERSION=''
if test -d "$1/include" && test -d "$1/lib" &&
test "$ax_path_bdb_path_get_version_got_header" = "yes" ; then
dnl # save and modify environment
ax_path_bdb_path_get_version_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I$1/include $CPPFLAGS"
ax_path_bdb_path_get_version_save_LIBS="$LIBS"
LIBS="$LIBS -ldb"
ax_path_bdb_path_get_version_save_LDFLAGS="$LDFLAGS"
LDFLAGS="-L$1/lib $LDFLAGS"
# Compile and run a program that compares the version defined in
# the header file with a version defined in the library function
# db_version.
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include
#include
int main(int argc,char **argv)
{
int major,minor,patch;
db_version(&major,&minor,&patch);
if (argc > 1)
printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH);
if (DB_VERSION_MAJOR == major && DB_VERSION_MINOR == minor &&
DB_VERSION_PATCH == patch)
return 0;
else
return 1;
}
]])
],[
# Program compiled and ran, so get version by adding argument.
ax_path_bdb_path_get_version_VERSION=`./conftest$ac_exeext x`
ax_path_bdb_path_get_version_ok=yes
],[],[])
dnl # restore environment
CPPFLAGS="$ax_path_bdb_path_get_version_save_CPPFLAGS"
LIBS="$ax_path_bdb_path_get_version_save_LIBS"
LDFLAGS="$ax_path_bdb_path_get_version_save_LDFLAGS"
fi
dnl # Finally, execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND.
if test "$ax_path_bdb_path_get_version_ok" = "yes" ; then
AC_MSG_RESULT([$ax_path_bdb_path_get_version_VERSION])
m4_ifvaln([$2],[$2])dnl
else
AC_MSG_RESULT([no])
m4_ifvaln([$3],[$3])dnl
fi
]) dnl AX_PATH_BDB_PATH_GET_VERSION
#############################################################################
dnl Checks if version of library and header match specified version.
dnl Only meant to be used by AX_PATH_BDB_ENV_GET_VERSION macro.
dnl
dnl Requires AX_COMPARE_VERSION macro.
dnl
dnl Result: sets ax_path_bdb_env_confirm_lib_ok to yes or no.
dnl
dnl AX_PATH_BDB_ENV_CONFIRM_LIB(VERSION, [LIBNAME])
AC_DEFUN([AX_PATH_BDB_ENV_CONFIRM_LIB], [
dnl # Used to indicate success or failure of this function.
ax_path_bdb_env_confirm_lib_ok=no
dnl # save and modify environment to link with library LIBNAME
ax_path_bdb_env_confirm_lib_save_LIBS="$LIBS"
LIBS="$LIBS $2"
# Compile and run a program that compares the version defined in
# the header file with a version defined in the library function
# db_version.
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include
#include
int main(int argc,char **argv)
{
int major,minor,patch;
db_version(&major,&minor,&patch);
if (argc > 1)
printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH);
if (DB_VERSION_MAJOR == major && DB_VERSION_MINOR == minor &&
DB_VERSION_PATCH == patch)
return 0;
else
return 1;
}
]])
],[
# Program compiled and ran, so get version by giving an argument,
# which will tell the program to print the output.
ax_path_bdb_env_confirm_lib_VERSION=`./conftest$ac_exeext x`
# If the versions all match up, indicate success.
AX_COMPARE_VERSION([$ax_path_bdb_env_confirm_lib_VERSION],[eq],[$1],[
ax_path_bdb_env_confirm_lib_ok=yes
])
],[],[])
dnl # restore environment
LIBS="$ax_path_bdb_env_confirm_lib_save_LIBS"
]) dnl AX_PATH_BDB_ENV_CONFIRM_LIB
#############################################################################
dnl Finds the version and library name for Berkeley DB in the
dnl current environment. Tries many different names for library.
dnl
dnl Requires AX_PATH_BDB_ENV_CONFIRM_LIB macro.
dnl
dnl Result: set ax_path_bdb_env_get_version_ok to yes or no,
dnl set ax_path_bdb_env_get_version_VERSION to the version found,
dnl and ax_path_bdb_env_get_version_LIBNAME to the library name.
dnl
dnl AX_PATH_BDB_ENV_GET_VERSION([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
AC_DEFUN([AX_PATH_BDB_ENV_GET_VERSION], [
dnl # Used to indicate success or failure of this function.
ax_path_bdb_env_get_version_ok=no
ax_path_bdb_env_get_version_VERSION=''
ax_path_bdb_env_get_version_LIBS=''
AS_VAR_PUSHDEF([HEADER_VERSION],[ax_path_bdb_env_get_version_HEADER_VERSION])dnl
AS_VAR_PUSHDEF([TEST_LIBNAME],[ax_path_bdb_env_get_version_TEST_LIBNAME])dnl
# Indicate status of checking for Berkeley DB library.
AC_MSG_CHECKING([for db.h])
# Compile and run a program that determines the Berkeley DB version
# in the header file db.h.
HEADER_VERSION=''
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include
#include
int main(int argc,char **argv)
{
if (argc > 1)
printf("%d.%d.%d\n",DB_VERSION_MAJOR,DB_VERSION_MINOR,DB_VERSION_PATCH);
return 0;
}
]])
],[
# Program compiled and ran, so get version by adding an argument.
HEADER_VERSION=`./conftest$ac_exeext x`
AC_MSG_RESULT([$HEADER_VERSION])
],[AC_MSG_RESULT([no])],[AC_MSG_RESULT([no])])
# Have header version, so try to find corresponding library.
# Looks for library names in the order:
# nothing, db, db-X.Y, dbX.Y, dbXY, db-X, dbX
# and stops when it finds the first one that matches the version
# of the header file.
if test "x$HEADER_VERSION" != "x" ; then
AC_MSG_CHECKING([for library containing Berkeley DB $HEADER_VERSION])
AS_VAR_PUSHDEF([MAJOR],[ax_path_bdb_env_get_version_MAJOR])dnl
AS_VAR_PUSHDEF([MINOR],[ax_path_bdb_env_get_version_MINOR])dnl
# get major and minor version numbers
MAJOR=`echo $HEADER_VERSION | sed 's,\..*,,'`
MINOR=`echo $HEADER_VERSION | sed 's,^[[0-9]]*\.,,;s,\.[[0-9]]*$,,'`
# see if it is already specified in LIBS
TEST_LIBNAME=''
AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME])
if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then
# try format "db"
TEST_LIBNAME='-ldb'
AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME])
fi
if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then
# try format "db-X.Y"
TEST_LIBNAME="-ldb-${MAJOR}.$MINOR"
AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME])
fi
if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then
# try format "dbX.Y"
TEST_LIBNAME="-ldb${MAJOR}.$MINOR"
AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME])
fi
if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then
# try format "dbXY"
TEST_LIBNAME="-ldb$MAJOR$MINOR"
AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME])
fi
if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then
# try format "db-X"
TEST_LIBNAME="-ldb-$MAJOR"
AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME])
fi
if test "$ax_path_bdb_env_confirm_lib_ok" = "no" ; then
# try format "dbX"
TEST_LIBNAME="-ldb$MAJOR"
AX_PATH_BDB_ENV_CONFIRM_LIB([$HEADER_VERSION], [$TEST_LIBNAME])
fi
dnl # Found a valid library.
if test "$ax_path_bdb_env_confirm_lib_ok" = "yes" ; then
if test "x$TEST_LIBNAME" = "x" ; then
AC_MSG_RESULT([none required])
else
AC_MSG_RESULT([$TEST_LIBNAME])
fi
ax_path_bdb_env_get_version_VERSION="$HEADER_VERSION"
ax_path_bdb_env_get_version_LIBS="$TEST_LIBNAME"
ax_path_bdb_env_get_version_ok=yes
else
AC_MSG_RESULT([no])
fi
AS_VAR_POPDEF([MAJOR])dnl
AS_VAR_POPDEF([MINOR])dnl
fi
AS_VAR_POPDEF([HEADER_VERSION])dnl
AS_VAR_POPDEF([TEST_LIBNAME])dnl
dnl # Execute ACTION-IF-FOUND / ACTION-IF-NOT-FOUND.
if test "$ax_path_bdb_env_confirm_lib_ok" = "yes" ; then
m4_ifvaln([$1],[$1],[:])dnl
m4_ifvaln([$2],[else $2])dnl
fi
]) dnl BDB_ENV_GET_VERSION
#############################################################################
cyrus-imspd-v1.8/cmulocal/berkdb.m4~ 0100644 0043101 0000012 00000015767 10150703405 016667 0 ustar shadow staff dnl $Id: berkdb.m4,v 1.18 2004/11/23 18:52:53 shadow Exp $
AC_DEFUN([CMU_DB_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[DB *db;
db_create(&db, NULL, 0);
db->open(db, "foo.db", NULL, DB_UNKNOWN, DB_RDONLY, 0644);],
ac_cv_found_db_inc=yes,
ac_cv_found_db_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_DB_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for db headers in $i)
CMU_DB_INC_WHERE1($i)
CMU_TEST_INCPATH($i, db)
if test "$ac_cv_found_db_inc" = "yes"; then
ac_cv_db_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for lib files
#
AC_DEFUN([CMU_DB3_LIB_WHERE1], [
AC_REQUIRE([CMU_AFS])
AC_REQUIRE([CMU_KRB4])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -ldb-3"
AC_TRY_LINK([#include ],
[db_env_create(NULL, 0);],
[ac_cv_found_db_3_lib=yes],
ac_cv_found_db_3_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_DB4_LIB_WHERE1], [
AC_REQUIRE([CMU_AFS])
AC_REQUIRE([CMU_KRB4])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -ldb-4"
AC_TRY_LINK([#include ],
[db_env_create(NULL, 0);],
[ac_cv_found_db_4_lib=yes],
ac_cv_found_db_4_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_DB_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for db libraries in $i)
if test "$enable_db4" = "yes"; then
CMU_DB4_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, [db-4])
ac_cv_found_db_lib=$ac_cv_found_db_4_lib
else
CMU_DB3_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, [db-3])
ac_cv_found_db_lib=$ac_cv_found_db_3_lib
fi
if test "$ac_cv_found_db_lib" = "yes" ; then
ac_cv_db_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_USE_DB], [
AC_ARG_WITH(db,
[ --with-db=PREFIX Compile with db support],
[if test "X$with_db" = "X"; then
with_db=yes
fi])
AC_ARG_WITH(db-lib,
[ --with-db-lib=dir use db libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-db-lib])
fi])
AC_ARG_WITH(db-include,
[ --with-db-include=dir use db headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-db-include])
fi])
AC_ARG_ENABLE(db4,
[ --enable-db4 use db 4.x libraries])
if test "X$with_db" != "X"; then
if test "$with_db" != "yes"; then
ac_cv_db_where_lib=$with_db/lib
ac_cv_db_where_inc=$with_db/include
fi
fi
if test "X$with_db_lib" != "X"; then
ac_cv_db_where_lib=$with_db_lib
fi
if test "X$ac_cv_db_where_lib" = "X"; then
CMU_DB_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib)
fi
if test "X$with_db_include" != "X"; then
ac_cv_db_where_inc=$with_db_include
fi
if test "X$ac_cv_db_where_inc" = "X"; then
CMU_DB_INC_WHERE(/usr/athena/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include db)
if test "X$ac_cv_db_where_lib" = "X" -o "X$ac_cv_db_where_inc" = "X"; then
ac_cv_found_db=no
AC_MSG_RESULT(no)
else
ac_cv_found_db=yes
AC_MSG_RESULT(yes)
DB_INC_DIR=$ac_cv_db_where_inc
DB_LIB_DIR=$ac_cv_db_where_lib
DB_INC_FLAGS="-I${DB_INC_DIR}"
if test "$enable_db4" = "yes"; then
DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-4"
else
DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-3"
fi
dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
dnl Allow makefile substitutions....
AC_SUBST(DB_INC_FLAGS)
AC_SUBST(DB_LIB_FLAGS)
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${DB_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
dnl ---- CUT HERE ---
dnl These are the Cyrus Berkeley DB macros. In an ideal world these would be
dnl identical to the above.
dnl They are here so that they can be shared between Cyrus IMAPd
dnl and Cyrus SASL with relative ease.
dnl The big difference between this and the ones above is that we don't assume
dnl that we know the name of the library, and we try a lot of permutations
dnl instead. We also assume that DB4 is acceptable.
dnl When we're done, there will be a BDB_LIBADD and a BDB_INCADD which should
dnl be used when necessary. We should probably be smarter about our RPATH
dnl handling.
dnl Call these with BERKELEY_DB_CHK.
dnl We will also set $dblib to "berkeley" if we are successful, "no" otherwise.
dnl this is unbelievably painful due to confusion over what db-3 should be
dnl named and where the db-3 header file is located. arg.
AC_DEFUN([CYRUS_BERKELEY_DB_CHK_LIB],
[
BDB_SAVE_LDFLAGS=$LDFLAGS
if test -d $with_bdb_lib; then
CMU_ADD_LIBPATH_TO($with_bdb_lib, LDFLAGS)
CMU_ADD_LIBPATH_TO($with_bdb_lib, BDB_LIBADD)
else
BDB_LIBADD=""
fi
saved_LIBS=$LIBS
for dbname in db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
do
LIBS="$saved_LIBS -l$dbname"
AC_TRY_LINK([#include ],
[db_create(NULL, NULL, 0);],
BDB_LIBADD="$BDB_LIBADD -l$dbname"; dblib="berkeley"; dbname=db,
dblib="no")
if test "$dblib" = "berkeley"; then break; fi
done
if test "$dblib" = "no"; then
LIBS="$saved_LIBS -ldb"
AC_TRY_LINK([#include ],
[db_open(NULL, 0, 0, 0, NULL, NULL, NULL);],
BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db,
dblib="no")
fi
LIBS=$saved_LIBS
LDFLAGS=$BDB_SAVE_LDFLAGS
])
AC_DEFUN([CYRUS_BERKELEY_DB_OPTS],
[
AC_ARG_WITH(bdb-libdir,
[ --with-bdb-libdir=DIR Berkeley DB lib files are in DIR],
with_bdb_lib=$withval,
[ test "${with_bdb_lib+set}" = set || with_bdb_lib=none])
AC_ARG_WITH(bdb-incdir,
[ --with-bdb-incdir=DIR Berkeley DB include files are in DIR],
with_bdb_inc=$withval,
[ test "${with_bdb_inc+set}" = set || with_bdb_inc=none ])
])
AC_DEFUN([CYRUS_BERKELEY_DB_CHK],
[
AC_REQUIRE([CYRUS_BERKELEY_DB_OPTS])
cmu_save_CPPFLAGS=$CPPFLAGS
if test -d $with_bdb_inc; then
CPPFLAGS="$CPPFLAGS -I$with_bdb_inc"
BDB_INCADD="-I$with_bdb_inc"
else
BDB_INCADD=""
fi
dnl Note that FreeBSD puts it in a wierd place
dnl (but they should use with-bdb-incdir)
AC_CHECK_HEADER(db.h,
[CYRUS_BERKELEY_DB_CHK_LIB()],
dblib="no")
CPPFLAGS=$cmu_save_CPPFLAGS
])
cyrus-imspd-v1.8/cmulocal/.#berkdb.m4.1.16 0100644 0043101 0000012 00000015542 10121410377 017166 0 ustar shadow staff dnl $Id: berkdb.m4,v 1.16 2004/08/22 19:41:47 shadow Exp $
AC_DEFUN([CMU_DB_INC_WHERE1], [
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
AC_TRY_COMPILE([#include ],
[DB *db;
db_create(&db, NULL, 0);
db->open(db, "foo.db", NULL, DB_UNKNOWN, DB_RDONLY, 0644);],
ac_cv_found_db_inc=yes,
ac_cv_found_db_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN([CMU_DB_INC_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for db headers in $i)
CMU_DB_INC_WHERE1($i)
CMU_TEST_INCPATH($i, db)
if test "$ac_cv_found_db_inc" = "yes"; then
ac_cv_db_where_inc=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
#
# Test for lib files
#
AC_DEFUN([CMU_DB3_LIB_WHERE1], [
AC_REQUIRE([CMU_AFS])
AC_REQUIRE([CMU_KRB4])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -ldb-3"
AC_TRY_LINK([#include ],
[db_env_create(NULL, 0);],
[ac_cv_found_db_3_lib=yes],
ac_cv_found_db_3_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_DB4_LIB_WHERE1], [
AC_REQUIRE([CMU_AFS])
AC_REQUIRE([CMU_KRB4])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -ldb-4"
AC_TRY_LINK([#include ],
[db_env_create(NULL, 0);],
[ac_cv_found_db_4_lib=yes],
ac_cv_found_db_4_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN([CMU_DB_LIB_WHERE], [
for i in $1; do
AC_MSG_CHECKING(for db libraries in $i)
if test "$enable_db4" = "yes"; then
CMU_DB4_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, [db-4])
ac_cv_found_db_lib=$ac_cv_found_db_4_lib
else
CMU_DB3_LIB_WHERE1($i)
CMU_TEST_LIBPATH($i, [db-3])
ac_cv_found_db_lib=$ac_cv_found_db_3_lib
fi
if test "$ac_cv_found_db_lib" = "yes" ; then
ac_cv_db_where_lib=$i
AC_MSG_RESULT(found)
break
else
AC_MSG_RESULT(not found)
fi
done
])
AC_DEFUN([CMU_USE_DB], [
AC_ARG_WITH(db,
[ --with-db=PREFIX Compile with db support],
[if test "X$with_db" = "X"; then
with_db=yes
fi])
AC_ARG_WITH(db-lib,
[ --with-db-lib=dir use db libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-db-lib])
fi])
AC_ARG_WITH(db-include,
[ --with-db-include=dir use db headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-db-include])
fi])
AC_ARG_ENABLE(db4,
[ --enable-db4 use db 4.x libraries])
if test "X$with_db" != "X"; then
if test "$with_db" != "yes"; then
ac_cv_db_where_lib=$with_db/lib
ac_cv_db_where_inc=$with_db/include
fi
fi
if test "X$with_db_lib" != "X"; then
ac_cv_db_where_lib=$with_db_lib
fi
if test "X$ac_cv_db_where_lib" = "X"; then
CMU_DB_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib)
fi
if test "X$with_db_include" != "X"; then
ac_cv_db_where_inc=$with_db_include
fi
if test "X$ac_cv_db_where_inc" = "X"; then
CMU_DB_INC_WHERE(/usr/athena/include /usr/local/include)
fi
AC_MSG_CHECKING(whether to include db)
if test "X$ac_cv_db_where_lib" = "X" -o "X$ac_cv_db_where_inc" = "X"; then
ac_cv_found_db=no
AC_MSG_RESULT(no)
else
ac_cv_found_db=yes
AC_MSG_RESULT(yes)
DB_INC_DIR=$ac_cv_db_where_inc
DB_LIB_DIR=$ac_cv_db_where_lib
DB_INC_FLAGS="-I${DB_INC_DIR}"
if test "$enable_db4" = "yes"; then
DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-4"
else
DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-3"
fi
dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally
dnl Allow makefile substitutions....
AC_SUBST(DB_INC_FLAGS)
AC_SUBST(DB_LIB_FLAGS)
if test "X$RPATH" = "X"; then
RPATH=""
fi
case "${host}" in
*-*-linux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-hpux*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,+b${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-irix*)
if test "X$RPATH" = "X"; then
RPATH="-Wl,-rpath,${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
;;
*-*-solaris2*)
if test "$ac_cv_prog_gcc" = yes; then
if test "X$RPATH" = "X"; then
RPATH="-Wl,-R${DB_LIB_DIR}"
else
RPATH="${RPATH}:${DB_LIB_DIR}"
fi
else
RPATH="${RPATH} -R${DB_LIB_DIR}"
fi
;;
esac
AC_SUBST(RPATH)
fi
])
dnl ---- CUT HERE ---
dnl These are the Cyrus Berkeley DB macros. In an ideal world these would be
dnl identical to the above.
dnl They are here so that they can be shared between Cyrus IMAPd
dnl and Cyrus SASL with relative ease.
dnl The big difference between this and the ones above is that we don't assume
dnl that we know the name of the library, and we try a lot of permutations
dnl instead. We also assume that DB4 is acceptable.
dnl When we're done, there will be a BDB_LIBADD and a BDB_INCADD which should
dnl be used when necessary. We should probably be smarter about our RPATH
dnl handling.
dnl Call these with BERKELEY_DB_CHK.
dnl We will also set $dblib to "berkeley" if we are successful, "no" otherwise.
dnl this is unbelievably painful due to confusion over what db-3 should be
dnl named and where the db-3 header file is located. arg.
AC_DEFUN([CYRUS_BERKELEY_DB_CHK_LIB],
[
BDB_SAVE_LDFLAGS=$LDFLAGS
if test -d $with_bdb_lib; then
CMU_ADD_LIBPATH_TO($with_bdb_lib, LDFLAGS)
CMU_ADD_LIBPATH_TO($with_bdb_lib, BDB_LIBADD)
else
BDB_LIBADD=""
fi
for dbname in db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db
do
AC_TRY_COMPILE([#include ],
[db_create(NULL, NULL, 0);],
BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db,
dblib="no")
done
if test "$dblib" = "no"; then
AC_TRY_COMPILE([#include ],
[db_open(NULL, 0, 0, 0, NULL, NULL, NULL);],
BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db,
dblib="no")
fi
LDFLAGS=$BDB_SAVE_LDFLAGS
])
AC_DEFUN([CYRUS_BERKELEY_DB_OPTS],
[
AC_ARG_WITH(bdb-libdir,
[ --with-bdb-libdir=DIR Berkeley DB lib files are in DIR],
with_bdb_lib=$withval,
[ test "${with_bdb_lib+set}" = set || with_bdb_lib=none])
AC_ARG_WITH(bdb-incdir,
[ --with-bdb-incdir=DIR Berkeley DB include files are in DIR],
with_bdb_inc=$withval,
[ test "${with_bdb_inc+set}" = set || with_bdb_inc=none ])
])
AC_DEFUN([CYRUS_BERKELEY_DB_CHK],
[
AC_REQUIRE([CYRUS_BERKELEY_DB_OPTS])
cmu_save_CPPFLAGS=$CPPFLAGS
if test -d $with_bdb_inc; then
CPPFLAGS="$CPPFLAGS -I$with_bdb_inc"
BDB_INCADD="-I$with_bdb_inc"
else
BDB_INCADD=""
fi
dnl Note that FreeBSD puts it in a wierd place
dnl (but they should use with-bdb-incdir)
AC_CHECK_HEADER(db.h,
[CYRUS_BERKELEY_DB_CHK_LIB()],
dblib="no")
CPPFLAGS=$cmu_save_CPPFLAGS
])
cyrus-imspd-v1.8/imsp/ 0040755 0043101 0000012 00000000000 10170575121 014136 5 ustar shadow staff cyrus-imspd-v1.8/imsp/Makefile.in 0100644 0043101 0000012 00000006205 07217303221 016201 0 ustar shadow staff # Makefile for Cyrus IMSP server and associated programs
#
# Copyright (c) 1998-2000 Carnegie Mellon University. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The name "Carnegie Mellon University" must not be used to
# endorse or promote products derived from this software without
# prior written permission. For permission or any other legal
# details, please contact
# Office of Technology Transfer
# Carnegie Mellon University
# 5000 Forbes Avenue
# Pittsburgh, PA 15213-3890
# (412) 268-4387, fax: (412) 268-7395
# tech-transfer@andrew.cmu.edu
#
# 4. Redistributions of any form whatsoever must retain the following
# acknowledgment:
# "This product includes software developed by Computing Services
# at Carnegie Mellon University (http://www.cmu.edu/computing/)."
#
# CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
DEFINES=-DSETPROCTITLE
srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
INSTALL = @INSTALL@
DEFS = @DEFS@ $(DEFINES)
CPPFLAGS = -I.. -I. -I$(srcdir) -I$(srcdir)/../lib @CPPFLAGS@
LIBS = @LIBS@
DEPLIBS = ../lib/libcyrus.a @DEPLIBS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
IMSPDOBJS= main.o dispatch.o imsp_server.o option.o syncdb.o adate.o \
im_util.o abook.o authize.o alock.o sasl_support.o @HAVE_LDAP_OBJS@
PROGS = cyrus-imspd
PUREPROGS = cyrus-imspd.pure
PURIFY = purify
PUREARGS = -follow-child-processes=yes -threads=yes
QUANTIFY = quantify
QUANTARGS = -record-child-process-data
all: $(PROGS)
purify: cyrus-imspd.pure
quantify: cyrus-imspd.quant
.c.o:
$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) \
$<
install: cyrus-imspd
$(INSTALL) -s cyrus-imspd $(DESTDIR)/cyrus/usr/cyrus/bin/imspd
cyrus-imspd: $(IMSPDOBJS) $(DEPLIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o cyrus-imspd $(IMSPDOBJS) $(DEPLIBS) $(LIBS)
cyrus-imspd.pure: $(IMSPDOBJS) $(DEPLIBS)
$(PURIFY) $(PUREARGS) $(CC) $(CFLAGS) $(LDFLAGS) -o imspd.purify $(IMSPDOBJS) $(DEPLIBS) $(LIBS)
cyrus-imspd.quant: $(IMSPDOBJS) $(DEPLIBS)
$(QUANTIFY) $(QUANTARGS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(IMSPDOBJS) $(DEPLIBS) $(LIBS)
clean:
rm -f *.o *.a Makefile.bak $(PROGS)
distclean: clean
rm -f Makefile
depend:
makedepend $(CPPFLAGS) $(DEFS) $(CFLAGS) *.c $(srcdir)/*.c
# DO NOT DELETE THIS LINE -- make depend depends on it.
cyrus-imspd-v1.8/imsp/abook.c 0100644 0043101 0000012 00000071012 07765430215 015405 0 ustar shadow staff /* abook.c -- address book routines
*
* Copyright (c) 1993-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Newman
* Start Date: 6/28/93
*/
#include
#include
#include
#include "xmalloc.h"
#include "util.h"
#include "syncdb.h"
#include "authize.h"
#include "abook.h"
#ifdef HAVE_LDAP
#include "abook_ldap.h"
#endif
#include "acl.h"
#include "option.h" /* for option_doquota() */
/* import from OS: */
extern char *malloc();
/* database names */
static char abooks[] = "abooks";
static char abooksdb[] = "user/%s/abooks";
static char abooksudb[] = "user/%.*s/abooks";
static char abookdb[] = "user/%.*s/abook.%s";
/* generate the database name for an address book
* returns -1 for invalid name, otherwise returns length of owner name
*/
static int abook_dbname(char *dbname, int maxout, const char *name)
{
char *split;
int len = strlen(name), ownerlen;
/* catch empty name */
if (len == 0) return (-1);
/* disallow trailing "." */
if (name[len - 1] == '.') return (-1);
/* look for split to determine ownerlen */
ownerlen = len;
if ((split = strchr(name, '.'))) {
ownerlen = split - name;
}
snprintf(dbname, maxout, abookdb, ownerlen, name, name);
return (ownerlen);
}
/* check an access control list on an address book
* returns masked acl bits
*/
static long abook_rights(id, name, acl)
auth_id *id;
char *name, *acl;
{
char dbname[256];
char *uname;
int len;
long mask = 0;
/* look up the database */
len = abook_dbname(dbname, sizeof(dbname), name);
if (len < 0) return (0);
/* get the ACL */
if (!acl && sdb_get(abooks, name, SDB_ICASE, &acl) < 0) return (0);
if (acl) mask = acl_myrights(auth_get_state(id), acl);
/* check for administrator */
if (auth_level(id) == AUTH_ADMIN) mask |= ACL_ALL;
/* check ownership */
uname = auth_username(id);
if (strlen(uname) == len && !strncasecmp(uname, name, len)) {
mask |= (ACL_LOOKUP | ACL_ADMIN);
if (!acl) mask = ACL_ALL;
}
#ifdef HAVE_LDAP
/* If this abook is implemented via LDAP lookups,
turn off all access but READ, LOOKUP and ADMIN.
Not even admins are allowed any further rights.
Be sure to leave all the USER bits alone.
*/
if (mask & ACL_USER1) {
mask = mask & ((ACL_FULL & ~ACL_ALL) |
ACL_READ | ACL_LOOKUP | ACL_ADMIN);
}
#endif
return (mask);
}
/* get ACL for parent db
*/
static long abook_parentacl(id, name, pacl)
auth_id *id;
char *name, **pacl;
{
char dbname[256];
char *dot, *cname;
int exists = -1, nlen = 0;
long mask = 0;
nlen = strlen(name);
if ((cname = malloc(nlen+1)) == NULL) {
/* bummer, can't return a failure condition... */
return 0;
}
(void)strcpy(cname, name);
dot = cname + nlen - 1;
*pacl = NULL;
while (dot >= cname && exists < 0) {
while (dot >= cname && *dot != '.') --dot;
if (dot >= cname) *dot = '\0';
sdb_get(abooks, cname, SDB_ICASE, pacl);
abook_dbname(dbname, sizeof(dbname), cname);
exists = sdb_check(dbname);
if (exists == 0) mask = abook_rights(id, cname, *pacl);
if (dot >= cname) --dot;
}
free(cname);
return (mask);
}
#ifdef HAVE_LDAP
static int abook_usesldap(id, name)
auth_id *id;
char *name;
{
return (abook_rights(id, name, NULL) & ACL_USER1 ? 1 : 0);
}
#endif
/* fetch an address book entry
*
* Look up an entry in an address book, returning all of its contents.
* The address book name is given in "name".
* "Alias" has the name of the entry being sought.
* It sends back an array of (field, data) pairs via the return value pointer.
* Also sets "count" to indicate how many fields were found in the entry.
*
* The "state" pointer is used by the internal database routines. When
* using the sdb routines (instead of LDAP), the field/data array is actually
* a series of pointers into "state".
*
* On error, returns the NULL pointer, resulting in a "No such entry" reply.
*
* Otherwise, the caller must call abook_fetchdone() to let it free the memory
* associated with the returned pointer and the state variable.
*/
abook_fielddata *abook_fetch(state, id, name, alias, count, freedata)
abook_state *state;
auth_id *id;
char *name, *alias;
int *count;
int *freedata;
{
sdb_keyvalue *kv;
char *pat;
int kvcount, i, len;
abook_fielddata *fdata = NULL, *fptr;
char dbname[256];
state->kv = NULL;
*count = 0;
*freedata = 0;
if (abook_dbname(dbname, sizeof(dbname), name) < 0) return (NULL);
#ifdef HAVE_LDAP
if (abook_usesldap(id, name)) {
/* Lookup using an LDAP server */
fdata = abook_ldap_fetch(alias, count);
*freedata = 1;
} else
#endif
{
/* Lookup in an IMSP database file */
len = strlen(alias) + 1;
pat = malloc(len + 2);
if (!pat) return (NULL);
snprintf(pat, len + 2, "%s\"*", alias);
if (sdb_match(dbname, pat, SDB_ICASE, NULL, 0, &kv, &kvcount) >= 0
&& kvcount) {
state->kv = kv;
state->kvcount = kvcount;
fdata = (abook_fielddata *) malloc(sizeof (abook_fielddata) *
kvcount);
if (fdata) {
fptr = fdata;
for (i = 0; i < kvcount; ++i) {
if (!strncasecmp(pat, kv[i].key, len)
&& kv[i].key[len] != '\0') {
fptr->field = kv[i].key + len;
fptr->data = kv[i].value;
++fptr;
}
}
*count = fptr - fdata;
}
}
free(pat);
}
return (fdata);
}
/* free storage used by fetch
*/
void abook_fetchdone(state, data, count, freedata)
abook_state *state;
abook_fielddata *data;
int count;
int freedata;
{
int i;
if (data) {
if (freedata) {
for (i = 0; i < count; i++) {
free(data[i].field);
free(data[i].data);
}
}
free(data);
}
if (state->kv)
sdb_freematch(state->kv, state->kvcount, 0);
state->kv = NULL;
}
/* check if user has permission to fetch entries for a given address book
* returns non-zero if permitted, 0 otherwise
*/
int abook_canfetch(id, name)
auth_id *id;
char *name;
{
return (abook_rights(id, name, NULL) & ACL_READ ? 1 : 0);
}
/* check if user has permission to lock entries for a given address book
* returns non-zero if permitted, 0 otherwise
*/
int abook_canlock(id, name)
auth_id *id;
char *name;
{
return (abook_rights(id, name, NULL) & ACL_WRITE ? 1 : 0);
}
/* begin a search in address book
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_PERM_LIST
*/
int abook_searchstart(state, ldap_state, id, name, flist, fcount)
abook_state *state;
void **ldap_state;
auth_id *id;
char *name;
abook_fielddata *flist;
int fcount;
{
char dbname[256];
char *pat, *key;
sdb_keyvalue *nkv;
int i, j, result, ncount, cmp, len, kcount;
*ldap_state = NULL;
/* check permissions */
if (!(abook_rights(id, name, NULL) & ACL_READ)) {
return (AB_PERM);
}
/* Impose Joe's permission check for the "All Andrew Users" addr book:
* If the '0' bit is set, don't allow unqualified searches.
* This keeps users from "opening" the addr book in Mulberry and Simeon
* while still letting them "search" for entries and "resolve nicknames".
*/
if ((abook_rights(id, name, NULL) & ACL_USER0) &&
(fcount == 0 || ((fcount == 1)
&& (strcasecmp(flist[0].field, "name") == 0)
&& (strcmp(flist[0].data, "*") == 0))
)) {
return (AB_PERM_LIST);
}
#ifdef HAVE_LDAP
if (abook_usesldap(id, name)) {
state->kv = NULL;
/* Compiler warning here because
* ldap_state is void **, not the private type used internally by the
* abook_ldap module
*/
if (abook_ldap_searchstart(ldap_state, flist, fcount) < 0)
return (AB_FAIL);
else
return (AB_SUCCESS);
}
#endif
if (abook_dbname(dbname, sizeof(dbname), name) < 0) return (AB_FAIL);
/* start match */
if (!fcount) {
if (sdb_match(dbname, "*", SDB_ICASE, NULL, 1,
&state->kv, &state->kvcount) < 0) {
return (AB_FAIL);
}
} else {
state->kv = nkv = NULL;
/* first look for the "name" field */
for (i = 0; i < fcount; ++i) {
if (!strcasecmp(flist[i].field, "name")) {
int patlen = strlen(flist[i].data) + 3;
pat = malloc(patlen);
if (!pat) return (AB_FAIL);
snprintf(pat, patlen, "%s\"*", flist[i].data);
result = sdb_match(dbname, pat, SDB_ICASE, NULL, 1,
&state->kv, &state->kvcount);
free(pat);
if (result < 0) return (AB_FAIL);
if (!state->kvcount) return (AB_SUCCESS);
break;
}
}
/* then do other fields */
while (fcount) {
if (strcasecmp(flist->field, "name")) {
int patlen = strlen(flist->field) + 3;
pat = malloc(patlen);
if (!pat) {
if (state->kv) sdb_freematch(state->kv, state->kvcount, 1);
state->kv = NULL;
return (AB_FAIL);
}
snprintf(pat, patlen, "*\"%s", flist->field);
if (!state->kv) {
result = sdb_match(dbname, pat, SDB_ICASE, flist->data, 1,
&state->kv, &state->kvcount);
} else {
result = sdb_match(dbname, pat, SDB_ICASE, flist->data, 0,
&nkv, &ncount);
}
free(pat);
if (result < 0) {
if (state->kv) sdb_freematch(state->kv, state->kvcount, 1);
state->kv = NULL;
return (AB_FAIL);
}
if (!state->kvcount) break;
if (nkv) {
j = 0;
kcount = 0;
for (i = 0; i < state->kvcount; ++i) {
if (j == ncount) {
*state->kv[i].key = '\0';
} else if (*(key = state->kv[i].key)) {
len = strchr(key, '"') - key + 1;
cmp = strncasecmp(key, nkv[j].key, len);
while (cmp > 0 && ++j < ncount) {
cmp = strncasecmp(key, nkv[j].key, len);
}
if (cmp) *state->kv[i].key = '\0';
else ++kcount;
}
}
sdb_freematch(nkv, ncount, 0);
if (!kcount) break;
}
}
--fcount;
++flist;
}
}
state->kvpos = state->kv;
state->kvlast = NULL;
return (AB_SUCCESS);
}
/* get next search element, or NULL
*/
char *abook_search(state, ldap_state)
abook_state *state;
void *ldap_state;
{
#ifdef HAVE_LDAP
if (ldap_state) {
return (abook_ldap_search(ldap_state));
} else
#endif
if (state->kvcount) {
while (state->kvpos - state->kv < state->kvcount) {
if (*state->kvpos->key) {
*strchr(state->kvpos->key, '"') = '\0';
if (!state->kvlast
|| strcasecmp(state->kvpos->key, state->kvlast)) {
return (state->kvlast = state->kvpos++->key);
}
}
++state->kvpos;
}
}
return (NULL);
}
/* finish search: free storage used
*/
void abook_searchdone(state, ldap_state)
abook_state *state;
void *ldap_state;
{
if (state->kv) sdb_freematch(state->kv, state->kvcount, 1);
#ifdef HAVE_LDAP
if (ldap_state)
abook_ldap_searchdone(ldap_state);
#endif
state->kv = NULL;
}
/* create an address book
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_EXIST
*/
int abook_create(id, name)
auth_id *id;
char *name;
{
char dbname[256], acldb[256];
char *acl = NULL;
int ownerlen, result = 0;
/* find abook, and make sure it doesn't exist */
if ((ownerlen = abook_dbname(dbname, sizeof(dbname), name)) < 0) return (AB_FAIL);
if (sdb_check(dbname) == 0) return (AB_EXIST);
#if 0
/* The default address book for the current user always exists */
/* 10/97 - Well, the addressbook doesn't always exist so someone
* may need to create the sucker. So, this section of the code is
* ifdef'd out. It could be 'bad' protocol wise if this returns an
* error but it is probably better than giving a non-intuitive error.
*/
if (!strcasecmp(auth_username(id), name)) {
return (AB_EXIST);
}
#endif /* 0 */
if (auth_level(id) == AUTH_ADMIN)
goto skip_acl_check;
#ifndef DISABLE_AUTO_CREATE_AB
if (!strcasecmp(auth_username(id), name)) {
goto skip_acl_check;
}
#endif /* DISABLE_AUTO_CREATE_AB */
/* check create access */
if (!(abook_parentacl(id, name, &acl) & ACL_CREATE)) {
return (AB_PERM);
}
skip_acl_check:
/* create database */
if (sdb_create(dbname) < 0) {
return (AB_FAIL);
}
/* add addressbook to global abooks list, if appropriate */
if (acl && (result = sdb_writelock(abooks, name, SDB_ICASE)) >= 0) {
result = sdb_set(abooks, name, SDB_ICASE, acl);
if (sdb_unlock(abooks, name, SDB_ICASE) < 0) result = AB_FAIL;
}
/* add addressbook name to personal abooks list */
snprintf(acldb, sizeof(acldb), abooksudb, ownerlen, name);
if (sdb_check(acldb) < 0 && sdb_create(acldb) < 0) {
result = AB_FAIL;
} else if (!result) {
if (!(result = sdb_writelock(acldb, name, SDB_ICASE))) {
result = sdb_set(acldb, name, SDB_ICASE, "");
if (sdb_unlock(acldb, name, SDB_ICASE) < 0) result = AB_FAIL;
}
/* clean up on error */
if (result < 0) {
if (sdb_writelock(acldb, name, SDB_ICASE) >= 0) {
sdb_remove(acldb, name, SDB_ICASE);
sdb_unlock(acldb, name, SDB_ICASE);
}
}
}
if (result < 0) {
sdb_delete(dbname);
}
return (result);
}
/* delete an address book
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_NOEXIST
*/
int abook_delete(id, name)
auth_id *id;
char *name;
{
char dbname[256], uname[256];
int result, ownerlen;
int delta, kvcount;
sdb_keyvalue *kv, *kvpos;
char *sep, *value;
/* find abook, and make sure it exists */
if ((ownerlen = abook_dbname(dbname, sizeof(dbname), name)) < 0) {
return (AB_FAIL);
}
if (ownerlen == strlen(name) && auth_level(id) != AUTH_ADMIN) {
return (AB_FAIL);
}
if (sdb_check(dbname) < 0) return (AB_NOEXIST);
/* check delete access */
if (!(abook_rights(id, name, NULL) & ACL_DELETE)) {
return (AB_PERM);
}
/* if we need to adjust the quota, compute the delta */
delta = 0;
if (sdb_match(dbname, "*", SDB_ICASE, NULL, 0, &kv, &kvcount) >= 0
&& kvcount > 0) {
for (kvpos = kv; kvcount--; ++kvpos) {
if (kvpos->value) delta += strlen(kvpos->value);
if ((sep = strchr(kvpos->key, '"'))) delta += strlen(sep + 1);
}
sdb_freematch(kv, kvcount, 0);
snprintf(uname, sizeof(uname), "%.*s", ownerlen, name);
}
/* remove address book database */
result = sdb_delete(dbname);
if (result == AB_SUCCESS) {
if (delta) option_doquota(uname, -delta);
/* remove database name from abooks list */
snprintf(dbname, sizeof(dbname), abooksudb, ownerlen, name);
if (sdb_writelock(dbname, name, SDB_ICASE) >= 0) {
sdb_remove(dbname, name, SDB_ICASE);
sdb_unlock(dbname, name, SDB_ICASE);
if (sdb_count(dbname, SDB_ICASE) == 0) {
sdb_delete(dbname);
}
}
/* if set, remove name from global abooks list */
if (sdb_get(abooks, name, SDB_ICASE, &value) >= 0 && value != NULL) {
if (sdb_writelock(abooks, name, SDB_ICASE) >= 0) {
sdb_remove(abooks, name, SDB_ICASE);
sdb_unlock(abooks, name, SDB_ICASE);
}
}
}
return (result);
}
/* rename an address book
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_QUOTA, AB_NOEXIST, AB_EXIST
*/
int abook_rename(id, name, newname)
auth_id *id;
char *name, *newname;
{
char dbsrc[256], dbdst[256], uname[256];
int osrclen, odstlen, default_abook, new_name;
int delta, kvcount, result;
sdb_keyvalue *kv, *kvpos;
char *sep, *value, *tmpacl = NULL;
char tmpc;
/* make sure names are valid */
if (!strcasecmp(name, newname) ||
(osrclen = abook_dbname(dbsrc, sizeof(dbsrc), name)) < 0 ||
(odstlen = abook_dbname(dbdst, sizeof(dbdst), newname)) < 0) {
return (AB_FAIL);
}
if (sdb_check(dbsrc) < 0) return (AB_NOEXIST);
if (sdb_check(dbdst) == 0) return (AB_EXIST);
default_abook = osrclen == strlen(name);
new_name = osrclen != odstlen || strncasecmp(name, newname, osrclen);
/* check permission */
if (!(abook_rights(id, name, NULL) & ACL_DELETE)
|| !(abook_rights(id, newname, NULL) & ACL_CREATE)) {
return (AB_PERM);
}
/* if we need to adjust the quota, compute the delta */
delta = 0;
if (new_name) {
if (sdb_match(dbsrc, "*", SDB_ICASE, NULL, 0, &kv, &kvcount) >= 0
&& kvcount > 0) {
for (kvpos = kv; kvcount--; ++kvpos) {
if (kvpos->value) delta += strlen(kvpos->value);
if ((sep = strchr(kvpos->key, '"'))) delta += strlen(sep + 1);
}
sdb_freematch(kv, kvcount, 0);
}
snprintf(uname, sizeof(uname), "%.*s", odstlen, newname);
if ((result = option_doquota(uname, delta)) < 0) {
return (result);
}
}
/* copy to new location & delete old location */
if (sdb_copy(dbsrc, dbdst, SDB_ICASE) < 0) {
if (delta) option_doquota(uname, -delta);
return (AB_FAIL);
}
if (sdb_delete(dbsrc) == 0 && delta) {
/* if necessary, adjust down quota for old location */
snprintf(uname, sizeof(uname), "%.*s", osrclen, name);
option_doquota(uname, -delta);
}
if (default_abook) sdb_create(dbsrc);
/* update user abooks file */
if (!default_abook) {
snprintf(dbsrc, sizeof(dbsrc), abooksudb, osrclen, name);
if (sdb_writelock(dbsrc, name, SDB_ICASE) >= 0) {
sdb_remove(dbsrc, name, SDB_ICASE);
sdb_unlock(dbsrc, name, SDB_ICASE);
}
}
snprintf(dbdst, sizeof(dbdst), abooksudb, odstlen, newname);
if (sdb_check(dbdst) >= 0 || sdb_create(dbdst) >= 0) {
if (sdb_writelock(dbdst, newname, SDB_ICASE) >= 0) {
sdb_set(dbdst, newname, SDB_ICASE, "");
sdb_unlock(dbdst, newname, SDB_ICASE);
}
}
/* update global abooks file (ACL) */
if (sdb_writelock(abooks, newname, SDB_ICASE) >= 0) {
if (sdb_get(abooks, name, SDB_ICASE, &value) >= 0) {
if (value == NULL && new_name) {
tmpacl = malloc(2);
if (tmpacl) {
strcpy(tmpacl, "\t");
tmpc = name[osrclen];
name[osrclen] = '\0';
acl_set(&tmpacl, name, ACL_MODE_SET, ACL_ALL, NULL, NULL);
name[osrclen] = tmpc;
}
value = tmpacl;
}
if (value) {
sdb_set(abooks, newname, SDB_ICASE, value);
if (!default_abook
&& sdb_writelock(abooks, name, SDB_ICASE) >= 0) {
sdb_remove(abooks, name, SDB_ICASE);
sdb_unlock(abooks, name, SDB_ICASE);
}
}
if (tmpacl) free(tmpacl);
}
sdb_unlock(abooks, newname, SDB_ICASE);
}
return (AB_SUCCESS);
}
/* store a set of fields
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_QUOTA, AB_NOEXIST
*/
int abook_store(id, name, alias, flist, fcount)
auth_id *id;
char *name, *alias;
abook_fielddata *flist;
int fcount;
{
char dbname[256], acldb[256], uname[256];
char *key, *scan, *value;
int i, result, ownerlen, maxfieldlen, len, keylen;
long delta;
if ((ownerlen = abook_dbname(dbname, sizeof(dbname), name)) < 0) return (AB_FAIL);
snprintf(uname, sizeof(uname), "%.*s", ownerlen, name);
/* check for invalid characters in alias or field */
for (scan = alias; *scan && *scan != '*'
&& *scan != '%' && *scan != '"'; ++scan);
if (*scan) return (AB_FAIL);
for (i = 0; i < fcount; ++i) {
for (scan = flist[i].field;
*scan && *scan != '*' && *scan != '?' && *scan != '%'; ++scan);
if (*scan) return (AB_FAIL);
}
/* make sure database exists */
if (sdb_check(dbname) < 0) {
if (ownerlen == strlen(name)) {
/* create primary address book */
if (sdb_create(dbname) < 0) return (AB_FAIL);
} else {
return (AB_NOEXIST);
}
/* add addressbook name to personal abooks list */
snprintf(acldb, sizeof(acldb), abooksudb, ownerlen, name);
if (sdb_check(acldb) < 0 && sdb_create(acldb) < 0) {
result = AB_FAIL;
} else if (!(result = sdb_writelock(acldb, name, SDB_ICASE))) {
result = sdb_set(acldb, name, SDB_ICASE, "");
if (sdb_unlock(acldb, name, SDB_ICASE) < 0) result = AB_FAIL;
}
if (result < 0) {
sdb_delete(dbname);
return (AB_FAIL);
}
}
/* check permissions */
if (!(abook_rights(id, name, NULL) & ACL_WRITE)) {
return (AB_PERM);
}
/* lock database */
if (sdb_writelock(dbname, NULL, SDB_ICASE) < 0) return (AB_FAIL);
/* quota & max field length calculation */
delta = 0;
maxfieldlen = 0;
for (i = 0; i < fcount; ++i) {
if ((len = strlen(flist[i].field)) > maxfieldlen) {
maxfieldlen = len;
}
if (*flist[i].data) {
delta += len + strlen(flist[i].data);
}
}
keylen = maxfieldlen + strlen(alias) + 2;
if ((key = malloc(keylen)) == NULL) {
sdb_unlock(dbname, NULL, SDB_ICASE);
return (AB_FAIL);
}
for (i = 0; i < fcount; ++i) {
snprintf(key, keylen, "%s\"%s", alias, flist[i].field);
if (sdb_get(dbname, key, SDB_ICASE, &value) == 0 && value != NULL) {
delta -= strlen(value) + strlen(flist[i].field);
}
}
if ((result = option_doquota(uname, delta)) < 0) {
free(key);
sdb_unlock(dbname, NULL, SDB_ICASE);
return (result);
}
/* make changes to database */
snprintf(key, keylen, "%s\"", alias);
if (sdb_get(dbname, key, SDB_ICASE, &value) < 0 || value == NULL) {
sdb_set(dbname, key, SDB_ICASE, "");
}
for (i = 0; i < fcount; ++i) {
snprintf(key, keylen, "%s\"%s", alias, flist[i].field);
if (*flist[i].data) {
sdb_set(dbname, key, SDB_ICASE, flist[i].data);
} else {
sdb_remove(dbname, key, SDB_ICASE);
}
}
free(key);
/* if changes failed, back out quota change */
if ((result = sdb_unlock(dbname, NULL, SDB_ICASE)) < 0) {
option_doquota(uname, -delta);
}
return (result);
}
/* delete an entry
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_NOEXIST
*/
int abook_deleteent(id, name, alias)
auth_id *id;
char *name, *alias;
{
char *key, *scan;
sdb_keyvalue *kv;
int i, result, kvcount, ownerlen, keylen;
long delta;
char dbname[256];
/* check permissions */
if (!(abook_rights(id, name, NULL) & ACL_DELETE)) {
return (AB_PERM);
}
if ((ownerlen = abook_dbname(dbname, sizeof(dbname), name)) < 0) return (AB_FAIL);
/* check for invalid characters in alias */
for (scan = alias; *scan && *scan != '*' && *scan != '%'; ++scan);
if (*scan) return (AB_FAIL);
/* lock database */
if (sdb_writelock(dbname, NULL, SDB_ICASE) < 0) return (AB_FAIL);
/* find entries for key */
keylen = strlen(alias) + 3;
key = malloc(keylen);
if (!key) {
sdb_unlock(dbname, NULL, SDB_ICASE);
return (AB_FAIL);
}
snprintf(key, keylen, "%s\"*", alias);
result = sdb_match(dbname, key, SDB_ICASE, NULL, 1, &kv, &kvcount);
free(key);
if (result < 0 || !kvcount) {
sdb_unlock(dbname, NULL, SDB_ICASE);
return (result < 0 ? AB_FAIL : AB_NOEXIST);
}
/* quota check */
delta = (strlen(alias) + 1) * kvcount;
for (i = 0; i < kvcount; ++i) {
delta -= strlen(kv[i].key) + strlen(kv[i].value);
}
if ((result = option_doquota(auth_username(id), delta)) < 0) {
sdb_unlock(dbname, NULL, SDB_ICASE);
return (result);
}
/* nuke the entries */
for (i = 0; i < kvcount; ++i) {
sdb_remove(dbname, kv[i].key, SDB_ICASE);
}
sdb_freematch(kv, kvcount, 0);
/* unlock */
if (sdb_unlock(dbname, NULL, SDB_ICASE) < 0) {
option_doquota(auth_username(id), -delta);
return (AB_FAIL);
}
return (AB_SUCCESS);
}
/* set an access control list
* rights is NULL to delete an entry: returns 1 if entry doesn't exist
* AB_FAIL, AB_NOEXIST, AB_PERM
*/
int abook_setacl(id, name, ident, rights)
auth_id *id;
char *name, *ident, *rights;
{
char dbname[256];
char *value, *acl, tmpc;
int ownerlen, result = AB_FAIL;
/* check permissions */
if (!(abook_rights(id, name, NULL) & ACL_ADMIN)) {
return (AB_PERM);
}
/* make sure db exists */
if ((ownerlen = abook_dbname(dbname, sizeof(dbname), name)) < 0) return (AB_FAIL);
if (sdb_check(dbname) < 0) return (AB_NOEXIST);
/* lock acl db */
if (sdb_writelock(abooks, name, SDB_ICASE) < 0) {
return (AB_FAIL);
}
/* check for acl */
if (sdb_get(abooks, name, SDB_ICASE, &value) >= 0) {
/* if no ACL, create one */
if (value == NULL) {
/* create default acl */
acl = malloc(2);
if (acl) {
strcpy(acl, "\t");
tmpc = name[ownerlen];
name[ownerlen] = '\0';
acl_set(&acl, name, ACL_MODE_SET, ACL_ALL, NULL, NULL);
name[ownerlen] = tmpc;
}
} else {
/* copy acl */
acl = strdup(value);
}
/* update acl */
if (acl
&& acl_set(&acl, ident, ACL_MODE_SET,
rights ? acl_strtomask(rights) : 0L,
NULL, NULL) == 0) {
if (sdb_set(abooks, name, SDB_ICASE, acl) == 0) {
result = AB_SUCCESS;
}
}
}
/* unlock db */
if (sdb_unlock(abooks, name, SDB_ICASE) < 0) result = AB_FAIL;
if (acl) free(acl);
return (result);
}
/* return myrights for address book
* rights must be ACL_MAXSTR
* returns 0 for success
*/
int abook_myrights(id, name, rights)
auth_id *id;
char *name, *rights;
{
/* some more error checking might be in order... */
acl_masktostr(abook_rights(id, name, NULL), rights);
return (AB_SUCCESS);
}
/* return acl string
*/
char *abook_getacl(id, name)
auth_id *id;
char *name;
{
char dbname[256];
char *acl;
/* look up the database */
if (abook_dbname(dbname, sizeof(dbname), name) < 0) return (NULL);
/* make sure db exists */
if (sdb_check(dbname) < 0) return (NULL);
/* check rights */
if (!(abook_rights(id, name, NULL) & ACL_LOOKUP)) return (NULL);
/* check acl */
if (sdb_get(abooks, name, SDB_ICASE, &acl) < 0) return (NULL);
if (acl == NULL) acl = "";
return (acl);
}
/* start finding address books
*/
int abook_findstart(state, id, pat)
abook_state *state;
auth_id *id;
char *pat;
{
char dbname[256];
int pkvcount;
state->kv = state->pkv = NULL;
if (sdb_match(abooks, pat, 0, NULL, 0, &state->kv, &state->kvcount) < 0) {
return (AB_FAIL);
}
state->kvend = state->kv + state->kvcount;
state->kvpos = state->kv;
snprintf(dbname, sizeof(dbname), abooksdb, auth_username(id));
sdb_match(dbname, pat, 0, NULL, 0, &state->pkv, &pkvcount);
if (state->pkv) {
state->kvend = state->pkv + pkvcount;
state->kvpos = state->pkv;
}
return (AB_SUCCESS);
}
/* return next address book found
* abook is set to address book name
* attrs is set to address book attributes
* returns NULL or address book name
*/
char *abook_find(state, id, abook, attrs)
abook_state *state;
auth_id *id;
char **abook;
int *attrs;
{
char *user, *key;
int result = 0, ulen;
user = auth_username(id);
ulen = strlen(user);
do {
if (!state->kvpos) return (NULL);
if (state->kvpos < state->kvend) {
key = state->kvpos->key;
if (state->pkv || strncmp(user, key, ulen)
|| (key[ulen] != '.' && key[ulen] != '\0')) {
result = abook_rights(id, state->kvpos->key, NULL)&ACL_LOOKUP;
*abook = state->kvpos->key;
*attrs = 0;
}
}
if (++state->kvpos >= state->kvend) {
state->kvpos = NULL;
if (state->pkv) {
sdb_freematch(state->pkv, state->kvend - state->pkv, 0);
state->pkv = NULL;
state->kvpos = state->kv;
state->kvend = state->kv + state->kvcount;
}
}
} while (!result);
return (*abook);
}
/* finish finding address books
*/
void abook_finddone(state)
abook_state *state;
{
if (state->pkv) {
sdb_freematch(state->pkv, state->kvend - state->pkv, 0);
}
if (state->kv) {
sdb_freematch(state->kv, state->kvcount, 0);
}
state->kvpos = state->kv = state->pkv = NULL;
}
cyrus-imspd-v1.8/imsp/abook.h 0100644 0043101 0000012 00000015077 07732657011 015422 0 ustar shadow staff #ifndef __abook_h
#define __abook_h
/* abook.h -- definitions for address book routines
*
* Copyright (c) 1993-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Newman
* Start Date: 6/28/93
*/
#include "authize.h"
#include "syncdb.h"
/* return values */
#define AB_SUCCESS 0 /* general success */
#define AB_FAIL -1 /* general failure */
#define AB_PERM -2 /* permission failure */
#define AB_QUOTA -3 /* quota overflow */
#define AB_NOEXIST -4 /* object doesn't exist */
#define AB_EXIST -5 /* item already exists on create */
#define AB_PERM_LIST -6 /* not allowed to list all entries */
/* field/data pairs for an address book entry */
typedef struct abook_fielddata {
char *field;
char *data;
} abook_fielddata;
/* address book state holder */
typedef struct abook_state {
/* all fields are private to abook module: */
sdb_keyvalue *kv, *kvpos, *kvend, *pkv;
char *kvlast, *kvrights, *kvowner;
int kvcount;
} abook_state;
#ifdef __STDC__
/* abook_fetch(state, id, name, alias, count, freedata)
* fetch an address book entry
* state: pointer to existing abook_state structure
*/
abook_fielddata *abook_fetch(abook_state *, auth_id *, char *, char *,
int *, int*);
/* abook_fetchdone(state, data, count, freedata)
* free storage used by fetch
*/
void abook_fetchdone(abook_state *, abook_fielddata *, int, int);
/* abook_canfetch(id, name)
* check if user can fetch entries for a given name
* returns 1 if permitted, 0 otherwise
*/
int abook_canfetch(auth_id *, char *);
/* abook_canlock(id, name)
* check if user has permission to lock entries for a given address book
* returns non-zero if permitted, 0 otherwise
*/
int abook_canlock(auth_id *, char *);
/* abook_searchstart(state, ldap_state, id, name, flist, fcount)
* begin a search in address book
* state must point to a valid abook_state variable
* ldap_state if non-NULL, stores an LDAP context for the LDAP search
* id indicates the authorization
* name address book name
* flist list of fields and patterns to look for in that field
* fcount number of fields of interest (may be 0)
* returns: AB_SUCCESS, AB_FAIL, AB_PERM
*/
int abook_searchstart(abook_state *, void **, auth_id *, char *,
abook_fielddata *, int);
/* abook_search(state, ldap_state)
* get next search element, or NULL
* abook_searchstart must have been called on "state" already
*/
char *abook_search(abook_state *, void *);
/* abook_searchdone(state, ldap_state);
* finish search: free storage used
*/
void abook_searchdone(abook_state *, void *);
/* abook_create(id, name);
* create an address book
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_EXIST
*/
int abook_create(auth_id *, char *);
/* abook_delete(id, name)
* delete an address book
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_NOEXIST
*/
int abook_delete(auth_id *, char *);
/* abook_rename(id, oldname, newname)
* rename an address book
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_NOEXIST, AB_EXIST
*/
int abook_rename(auth_id *, char *, char *);
/* abook_store(id, name, alias, flist, fcount);
* store a set of fields
* returns: AB_SUCCESS, AB_FAIL, AB_PERM, AB_QUOTA, AB_NOEXIST
*/
int abook_store(auth_id *, char *, char *,
abook_fielddata *, int);
/* abook_deleteent(id, name, alias)
* delete an entry
* -1 for failure, -2 for permission denied, 1 for key doesn't exist
*/
int abook_deleteent(auth_id *, char *, char *);
/* abook_setacl(id, name, ident, rights)
* set an access control list
* rights is NULL to delete an entry: returns 1 if entry doesn't exist
* -1 for failure, -2 for permission denied, 0 for success
*/
int abook_setacl(auth_id *, char *, char *, char *);
/* abook_myrights(id, name, rights)
* return myrights for address book
* rights must have minimum length of ACL_MAXSTR
* returns -2 for permission denied, -1 for failure, 0 for success
*/
int abook_myrights(auth_id *, char *, char *);
/* abook_getacl(id, name)
* return acl for address book
* NULL = error
* "" = default ACL
*/
char *abook_getacl(auth_id *, char *);
/* abook_findstart(state, id, pat)
* start finding address books
*/
int abook_findstart(abook_state *, auth_id *, char *);
/* abook_find(state, id, abook, attrs)
* return next address book found
* abook is set to address book name
* attrs is set to address book attributes
* returns NULL or address book name
*/
char *abook_find(abook_state *, auth_id *, char **, int *);
/* finish finding address books
*/
void abook_finddone(abook_state *);
#else
abook_fielddata *abook_fetch();
void abook_fetchdone(), abook_searchdone(), abook_finddone();
int abook_canfetch(), abook_canlock(), abook_searchstart(), abook_create();
int abook_delete(), abook_rename(), abook_store(), abook_deleteent();
int abook_setacl(), abook_myrights(), abook_findstart();
char *abook_search(), *abook_getacl(), *abook_find();
#endif
#endif /* __abook_h */
cyrus-imspd-v1.8/imsp/abook_ldap.c 0100644 0043101 0000012 00000074147 07776354174 016434 0 ustar shadow staff /* abook_ldap.c -- address books implemented via LDAP lookups
*
* Copyright (c) 1998-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include
#include
#include
#include
#include
#include
#include "xmalloc.h"
#include "util.h"
#include "syncdb.h"
#include "option.h"
#include "authize.h"
#include "exitcodes.h"
#include "abook.h"
#include "abook_ldap.h"
#define ATTRMAPSIZE 20
struct map_pair {
char *field;
char *attr;
char *append;
};
struct ldap_config {
int configured;
char *searchbase;
int scope;
char *ldaphost;
int ldapport;
char *fullnameattr;
char *uniqueattr;
char *defaultfilter;
struct map_pair map[ATTRMAPSIZE];
};
static struct ldap_config config = {0};
static struct ldap_config secondaryconfig = {0};
static char opt_ldap_searchbase[] = "imsp.ldap.searchbase";
static char opt_ldap_scope[] = "imsp.ldap.scope";
static char opt_ldap_ldaphost[] = "imsp.ldap.host";
static char opt_ldap_ldapport[] = "imsp.ldap.port";
static char opt_ldap_fullnameattr[] = "imsp.ldap.fullnameattr";
static char opt_ldap_uniqueattr[] = "imsp.ldap.uniqueattr";
static char opt_ldap_defaultfilter[] = "imsp.ldap.defaultfilter";
static char opt_ldap_attrmap[] = "imsp.ldap.attrmap";
/*
* appendmap is used to append a string onto the end of an
* attribute before returning it to the client. useful for
* fully qualifing an email address. turn foo into foo@bar.baz
* by doing something like:
* imsp.ldap.appendmap N (email "@bar.baz")
* in your options file.
*/
static char opt_ldap_appendmap[] = "imsp.ldap.appendmap";
/*
* If imsp.ldap.secondary.searchbase is defined in the options file,
* then use these settings as a backup search if and only if the search
* using the primary LDAP settings returns no entries.
*
* If the scope, host, and port options are undefined, they
* will be inherited from the primary settings.
*
* 9-Nov-2001 jeaton@andrew.cmu.edu
*/
static char opt_ldap_secondary_searchbase[] = "imsp.ldap.secondary.searchbase";
static char opt_ldap_secondary_scope[] = "imsp.ldap.secondary.scope";
static char opt_ldap_secondary_ldaphost[] = "imsp.ldap.secondary.host";
static char opt_ldap_secondary_ldapport[] = "imsp.ldap.secondary.port";
static char opt_ldap_secondary_fullnameattr[] = "imsp.ldap.secondary.fullnameattr";
static char opt_ldap_secondary_uniqueattr[] = "imsp.ldap.secondary.uniqueattr";
static char opt_ldap_secondary_defaultfilter[] = "imsp.ldap.secondary.defaultfilter";
static char opt_ldap_secondary_attrmap[] = "imsp.ldap.secondary.attrmap";
static char opt_ldap_secondary_appendmap[] = "imsp.ldap.secondary.appendmap";
static char err_ldap_missing[] =
"Missing LDAP setting in global options file: %s";
static char err_ldap_badvalue[] =
"Illegal value for LDAP option in global options file: %s";
static void
config_error(char *reason, char *optname)
{
syslog(LOG_ERR, reason, optname);
}
static int
config_ldap(void)
{
int i = 0, j = 0;
char *value;
option_list *mapping;
if (!config.configured) {
/*
syslog(LOG_NOTICE, "Configuring the LDAP settings for the first time");
*/
/* Search Base */
value = option_get("", opt_ldap_searchbase, 1, NULL);
if (value) {
config.searchbase = strdup(value);
} else {
config_error(err_ldap_missing, opt_ldap_searchbase);
return -1;
}
/* Scope */
value = option_get("", opt_ldap_scope, 1, NULL);
if (value) {
if (strcasecmp(value, "subtree") == 0) {
config.scope = LDAP_SCOPE_SUBTREE;
} else if (strcasecmp(value, "base") == 0) {
config.scope = LDAP_SCOPE_BASE;
} else if (strcasecmp(value, "onelevel") == 0) {
config.scope = LDAP_SCOPE_ONELEVEL;
} else {
config_error(err_ldap_badvalue, opt_ldap_scope);
return -1;
}
} else {
config_error(err_ldap_missing, opt_ldap_scope);
return -1;
}
/* LDAP Server Hostname */
value = option_get("", opt_ldap_ldaphost, 1, NULL);
if (value) {
config.ldaphost = strdup(value);
} else {
config_error(err_ldap_missing, opt_ldap_ldaphost);
return -1;
}
/* LDAP Server Port Number */
value = option_get("", opt_ldap_ldapport, 1);
if (value) {
config.ldapport = atoi(value);
} else {
config.ldapport = LDAP_PORT;
}
/* Fullname Attribute */
value = option_get("", opt_ldap_fullnameattr, 1, NULL);
if (value) {
config.fullnameattr = strdup(value);
} else {
config_error(err_ldap_missing, opt_ldap_fullnameattr);
return -1;
}
/* Unique Attribute */
value = option_get("", opt_ldap_uniqueattr, 1, NULL);
if (value) {
config.uniqueattr = strdup(value);
} else {
config_error(err_ldap_missing, opt_ldap_uniqueattr);
return -1;
}
/* Default Search Filter */
value = option_get("", opt_ldap_defaultfilter, 1, NULL);
if (value) {
config.defaultfilter = strdup(value);
} else {
config_error(err_ldap_missing, opt_ldap_defaultfilter);
return -1;
}
/* Mapping from IMSP fields to LDAP attributes */
mapping = option_getlist("", opt_ldap_attrmap, 1);
if (mapping == NULL) {
config_error(err_ldap_missing, opt_ldap_attrmap);
return -1;
}
/* there must be an even number of items to form pairs */
if (mapping->count == 0 ||
(mapping->count % 2) != 0 ||
(mapping->count / 2) > ATTRMAPSIZE) {
config_error(err_ldap_badvalue, opt_ldap_attrmap);
return -1;
}
/* step through the items in the map option,
assigning them alternatively to the "field" and "value"
halfs of the map structure.
*/
for (i = 0; i < mapping->count; i++) {
if (strcasecmp(mapping->item[i], "null") == 0)
value = NULL;
else
value = strdup(mapping->item[i]);
if (i % 2 == 0)
config.map[i / 2].field = value;
else
config.map[i / 2].attr = value;
config.map[i / 2].append = NULL;
}
/* add a null terminator pair at the end */
config.map[i / 2].field = NULL;
config.map[i / 2].attr = NULL;
/* appendmap */
mapping = option_getlist("", opt_ldap_appendmap, 1);
if (mapping != NULL) {
if (mapping->count == 0 ||
(mapping->count % 2) != 0 ||
(mapping->count / 2) > ATTRMAPSIZE) {
config_error(err_ldap_badvalue, opt_ldap_appendmap);
return -1;
}
/*
* step through the items in the appendmap,
* assigning them to the "append" field of the
* map structure, where necessary
*/
for (i = 0; i < mapping->count; i++) {
for (j = 0; config.map[j].field != NULL ; j++) {
if (strcmp(mapping->item[i], config.map[j].field) == 0) {
i++;
config.map[j].append = strdup(mapping->item[i]);
}
}
}
}
/* Secondary search settings, if applicable */
value = option_get("", opt_ldap_secondary_searchbase, 1, NULL);
if (value) {
secondaryconfig.searchbase = strdup(value);
/* Scope */
value = option_get("", opt_ldap_secondary_scope, 1, NULL);
if (value) {
if (strcasecmp(value, "subtree") == 0) {
secondaryconfig.scope = LDAP_SCOPE_SUBTREE;
} else if (strcasecmp(value, "base") == 0) {
secondaryconfig.scope = LDAP_SCOPE_BASE;
} else if (strcasecmp(value, "onelevel") == 0) {
secondaryconfig.scope = LDAP_SCOPE_ONELEVEL;
} else {
config_error(err_ldap_badvalue, opt_ldap_secondary_scope);
return -1;
}
} else {
secondaryconfig.scope = config.scope;
}
/* LDAP Server Hostname */
value = option_get("", opt_ldap_secondary_ldaphost, 1, NULL);
if (value) {
secondaryconfig.ldaphost = strdup(value);
} else {
secondaryconfig.ldaphost = strdup(config.ldaphost);
}
/* LDAP Server Port Number */
value = option_get("", opt_ldap_secondary_ldapport, 1);
if (value) {
secondaryconfig.ldapport = atoi(value);
} else {
secondaryconfig.ldapport = config.ldapport;
}
/* Fullname Attribute */
value = option_get("", opt_ldap_secondary_fullnameattr, 1, NULL);
if (value) {
secondaryconfig.fullnameattr = strdup(value);
} else {
secondaryconfig.fullnameattr = strdup(config.fullnameattr);
}
/* Unique Attribute */
value = option_get("", opt_ldap_secondary_uniqueattr, 1, NULL);
if (value) {
secondaryconfig.uniqueattr = strdup(value);
} else {
secondaryconfig.uniqueattr = strdup(config.uniqueattr);
}
/* Default Search Filter */
value = option_get("", opt_ldap_secondary_defaultfilter, 1, NULL);
if (value) {
secondaryconfig.defaultfilter = strdup(value);
} else {
secondaryconfig.defaultfilter = strdup(config.defaultfilter);
}
/* Mapping from IMSP fields to LDAP attributes */
mapping = option_getlist("", opt_ldap_secondary_attrmap, 1);
if (mapping == NULL) {
mapping = mapping;
}
/* there must be an even number of items to form pairs */
if (mapping->count == 0 ||
(mapping->count % 2) != 0 ||
(mapping->count / 2) > ATTRMAPSIZE) {
config_error(err_ldap_badvalue, opt_ldap_secondary_attrmap);
return -1;
}
/* step through the items in the map option,
assigning them alternatively to the "field" and "value"
halfs of the map structure.
*/
for (i = 0; i < mapping->count; i++) {
if (strcasecmp(mapping->item[i], "null") == 0)
value = NULL;
else
value = strdup(mapping->item[i]);
if (i % 2 == 0)
secondaryconfig.map[i / 2].field = value;
else
secondaryconfig.map[i / 2].attr = value;
secondaryconfig.map[i / 2].append = NULL;
}
/* add a null terminator pair at the end */
secondaryconfig.map[i / 2].field = NULL;
secondaryconfig.map[i / 2].attr = NULL;
/* appendmap */
mapping = option_getlist("", opt_ldap_secondary_appendmap, 1);
if (mapping != NULL) {
if (mapping->count == 0 ||
(mapping->count % 2) != 0 ||
(mapping->count / 2) > ATTRMAPSIZE) {
config_error(err_ldap_badvalue, opt_ldap_secondary_appendmap);
return -1;
}
/*
* step through the items in the appendmap,
* assigning them to the "append" field of the
* map structure, where necessary
*/
for (i = 0; i < mapping->count; i++) {
for (j = 0; secondaryconfig.map[j].field != NULL ; j++) {
if (strcmp(mapping->item[i], secondaryconfig.map[j].field) == 0) {
i++;
secondaryconfig.map[j].append = strdup(mapping->item[i]);
}
}
}
}
secondaryconfig.configured = 1;
} else {
/* no secondary search defined */
}
config.configured = 1;
}
return 0;
}
/* Convert an IMSP search specification to an LDAP search filter.
* Returns 0 on success, setting "filter" to the resulting filter.
* Returns -1 if none of the IMSP fields could be converted to an
* LDAP attribute.
*/
static int
imsp_to_ldap_filter(abook_fielddata *flist, int fcount, char **filter,
struct ldap_config ldapconfig)
{
int i, j;
static char filt[2048];
int filter_is_empty = 1;
strlcpy(filt, "(&", sizeof(filt));
strlcat(filt, ldapconfig.defaultfilter, sizeof(filt));
for (i = 0; i < fcount; i++) {
for (j = 0; ldapconfig.map[j].field != NULL; j++) {
if ((strcasecmp(flist[i].field, ldapconfig.map[j].field) == 0)) {
if (ldapconfig.map[j].attr == NULL) {
syslog(LOG_ERR, "imsp_to_ldap_filter: skipping unmapped"
" field '%s'", flist[i].field);
} else {
filter_is_empty = 0;
strlcat(filt, "(", sizeof(filt));
strlcat(filt, ldapconfig.map[j].attr, sizeof(filt));
strlcat(filt, "=", sizeof(filt));
strlcat(filt, flist[i].data, sizeof(filt));
strlcat(filt, ")", sizeof(filt));
}
break;
}
}
if (ldapconfig.map[j].field == NULL) {
syslog(LOG_ERR, "imsp_to_ldap_filter: skipping unknown"
" field '%s'", flist[i].field);
}
}
strlcat(filt, ")", sizeof(filt));
/* syslog(LOG_NOTICE, "Filter: %s", filt); */
if (filter_is_empty) {
return -1;
} else {
*filter = filt;
return 0;
}
}
int
abook_ldap_searchstart(abook_ldap_state **ldap_state,
abook_fielddata *flist, int fcount)
{
abook_ldap_state *mystate;
int msgid, rc;
int sizelimit;
char *msg;
char *attrs[20];
LDAP *ld;
LDAPMessage *result;
char *filter, *secondaryfilter;
int searching_secondary = 0;
if (config_ldap() < 0) {
syslog(LOG_ERR, "abook_ldap_searchstart: failed to configure LDAP");
return -1;
}
if (imsp_to_ldap_filter(flist, fcount, &filter, config) < 0) {
syslog(LOG_ERR, "abook_ldap_searchstart: failed to convert filter");
return -1;
}
ld = ldap_init(config.ldaphost, config.ldapport);
if (ld == NULL) {
syslog(LOG_ERR, "abook_ldap_searchstart: LDAP init failed: %s",
strerror(errno));
return -1;
}
rc = ldap_simple_bind_s(ld, NULL, NULL);
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR, "abook_ldap_searchstart: simple bind failed: %s",
ldap_err2string(rc));
return -1;
}
/* For testing the error handlers...
sizelimit = 4;
ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &sizelimit);
*/
attrs[0] = config.fullnameattr;
attrs[1] = config.uniqueattr;
attrs[2] = NULL;
msgid = ldap_search(ld, config.searchbase, config.scope,
filter, attrs, 0/*attrs-only*/);
if (msgid == -1) {
syslog(LOG_ERR, "abook_ldap_searchstart: LDAP search failed");
ldap_unbind(ld);
return -1;
}
rc = ldap_result(ld, msgid, 0, NULL, &result);
switch (rc) {
case LDAP_RES_SEARCH_ENTRY:
/* Do nothing here. The abook_search function will pull out this
* entry and send it back for display to the user.
* The result is freed later.
*/
break;
case LDAP_RES_SEARCH_RESULT:
rc = ldap_result2error(ld, result, 1 /* free result */);
if (rc == LDAP_SUCCESS) {
/*
* Search returned successfully, but with no matching entries.
*
* Try to do the secondary search, if configured to do so.
* fails, then set the prevresult to NULL.
*/
if (secondaryconfig.ldaphost) {
searching_secondary = 1;
/* close the connection to the primary ldap server */
ldap_unbind(ld);
if (imsp_to_ldap_filter(flist, fcount, &secondaryfilter,
secondaryconfig) < 0) {
syslog(LOG_ERR, "abook_ldap_searchstart: failed to convert filter");
return -1;
}
/* open connection to the secondary server */
ld = ldap_init(secondaryconfig.ldaphost, secondaryconfig.ldapport);
if (ld == NULL) {
syslog(LOG_ERR, "abook_ldap_searchstart: LDAP init failed: %s",
strerror(errno));
return -1;
}
rc = ldap_simple_bind_s(ld, NULL, NULL);
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR, "abook_ldap_searchstart: simple bind failed: %s",
ldap_err2string(rc));
return -1;
}
attrs[0] = secondaryconfig.fullnameattr;
attrs[1] = secondaryconfig.uniqueattr;
attrs[2] = NULL;
msgid = ldap_search(ld, secondaryconfig.searchbase,
secondaryconfig.scope, secondaryfilter,
attrs, 0 /*attrs-only*/);
if (msgid == -1) {
syslog(LOG_ERR, "abook_ldap_searchstart: LDAP search failed");
ldap_unbind(ld);
return -1;
}
rc = ldap_result(ld, msgid, 0, NULL, &result);
switch (rc) {
case LDAP_RES_SEARCH_ENTRY:
/* Do nothing here. The abook_search function will pull out this
* entry and send it back for display to the user.
* The result is freed later.
*/
break;
case LDAP_RES_SEARCH_RESULT:
/* Still didn't get any data. Send a null "prevresult" to the
* abook_search function.
*/
result = NULL;
break;
default:
syslog(LOG_ERR, "abook_ldap_searchstart: ldap_result failed: %s (%d)",
ldap_err2string(rc), rc);
(void) ldap_msgfree(result); /* ignore message type return value */
ldap_unbind(ld);
return -1;
}
} /* if (secondaryconfig.ldaphost) */
} else {
syslog(LOG_ERR,"abook_ldap_searchstart: search returned error: %s",
ldap_err2string(rc));
ldap_unbind(ld);
return -1;
}
break;
default:
syslog(LOG_ERR, "abook_ldap_searchstart: ldap_result failed: A1 SEARCHADDRESS %s",
ldap_err2string(rc));
(void) ldap_msgfree(result); /* ignore message type return value */
ldap_unbind(ld);
return -1;
}
mystate = (abook_ldap_state *) malloc (sizeof (abook_ldap_state));
*ldap_state = mystate;
if (mystate == NULL) {
syslog(LOG_ERR, "abook_ldap_searchstart: Out of memory");
(void) ldap_msgfree(result); /* ignore message type return value */
ldap_unbind(ld);
return -1;
}
mystate->ld = ld;
mystate->msgid = msgid;
mystate->prevresult = result;
if (searching_secondary == 0) {
mystate->ldapconfig = &config;
} else {
mystate->ldapconfig = &secondaryconfig;
}
return 0;
}
static int
count_identical_fullnames(abook_ldap_state *ldap_state, char *alias)
{
int rc, count = 0;
char filter[1024];
LDAPMessage *results;
/*
* To limit the work done for this search, look for some bogus attribute
* that's probably not in the entry and don't return any values.
*/
char *attrs[] = {"c", NULL};
snprintf(filter, sizeof(filter), "(&%s(%s=%s))", config.defaultfilter,
config.fullnameattr, alias);
rc = ldap_search_s(ldap_state->ld, config.searchbase, config.scope,
filter, attrs, 1 /*attrs-only*/, &results);
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR, "count_identical_fullnames: search failed: %s",
ldap_err2string(rc));
count = -1;
} else {
count = ldap_count_entries(ldap_state->ld, results);
/* Returns -1 on error, so just pass that back to the caller */
(void) ldap_msgfree(results); /* ignore message type return value */
}
return count;
}
char *
abook_ldap_search(abook_ldap_state *ldap_state)
{
int rc, count;
LDAP *ld;
int msgid;
LDAPMessage *result, *entry;
char *dn;
static char alias[1024];
char **values;
struct ldap_config* ldapconfig;
if (ldap_state->prevresult == NULL) {
/* prevresult is set to NULL when the prior call to ldap_result
* indicated that the search ended successfully.
*/
return NULL;
} else {
ld = ldap_state->ld;
msgid = ldap_state->msgid;
result = ldap_state->prevresult;
ldapconfig = ldap_state->ldapconfig;
/* Find the full name associated with this matching entry so we
* can return a pointer to it.
*/
entry = ldap_first_entry(ld, result);
if (entry == NULL) {
syslog(LOG_ERR, "abook_ldap_search: ldap_first_entry failed");
return NULL;
}
values = ldap_get_values(ld, entry, ldapconfig->fullnameattr);
if (values == NULL || values[0] == NULL) {
syslog(LOG_ERR, "abook_ldap_search: ldap_get_values (%s) failed", ldapconfig->fullnameattr);
return NULL;
}
strlcpy(alias, values[0], sizeof(alias));
ldap_value_free(values);
values = ldap_get_values(ld, entry, ldapconfig->uniqueattr);
if (values == NULL || values[0] == NULL) {
syslog(LOG_ERR, "abook_ldap_search: ldap_get_values (%s) failed", ldapconfig->uniqueattr);
syslog(LOG_ERR, "abook_ldap_search: previous value (%s) was %s", ldapconfig->fullnameattr, alias);
return NULL;
}
/* always uniqify the fullname, even if we don't have to */
strlcat(alias, "[", sizeof(alias));
strlcat(alias, ldapconfig->uniqueattr, sizeof(alias));
strlcat(alias, ":", sizeof(alias));
strlcat(alias, values[0], sizeof(alias));
strlcat(alias, "]", sizeof(alias));
ldap_value_free(values);
#if 0
count = count_identical_fullnames(ldap_state, alias);
if (count > 1) {
/* Find the uid for this entry */
values = ldap_get_values(ld, entry, ldapconfig->uniqueattr);
if (values == NULL || values[0] == NULL) {
syslog(LOG_ERR, "abook_ldap_search: ldap_get_values failed for attr '%s'", ldapconfig->uniqueattr);
return NULL;
}
strlcat(alias, "[", sizeof(alias));
strlcat(alias, ldapconfig->uniqueattr, sizeof(alias));
strlcat(alias, ":", sizeof(alias));
strlcat(alias, values[0], sizeof(alias));
strlcat(alias, "]", sizeof(alias));
ldap_value_free(values);
}
#endif
ldap_msgfree(result);
/* Now fetch the next result to get ready for the next iteration
* of this function.
*/
rc = ldap_result(ld, msgid, 0, NULL, &result);
switch (rc) {
case LDAP_RES_SEARCH_ENTRY:
ldap_state->prevresult = result;
break;
case LDAP_RES_SEARCH_RESULT:
rc = ldap_result2error(ld, result, 1 /* free result */);
/* This result had no entries, but indicated success or failure.
* Return the alias corresponding to the previous entry,
* but set "prevresult" to NULL to indicate to the next
* iteration that searching is completed.
*/
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR,"abook_ldap_search: search completed with"
" error: %s", ldap_err2string(rc));
}
ldap_state->prevresult = NULL;
break;
default:
syslog(LOG_ERR, "abook_ldap_search: ldap_result failed: 3: %s",
ldap_err2string(rc));
(void) ldap_msgfree(result); /* ignore message type return value */
ldap_state->prevresult = NULL;
}
return alias;
}
}
void
abook_ldap_searchdone(abook_ldap_state *ldap_state)
{
ldap_unbind(ldap_state->ld);
free(ldap_state);
}
abook_fielddata *
abook_ldap_fetch(char *alias, int *count)
{
int i, rc, ldapcount, mappedfieldcount;
char *ptr;
char prefix[1024];
char filter[1024];
abook_fielddata *fdata, *fptr;
char *searchattr;
char *searchkey;
LDAP *ld;
LDAPMessage *results, *entry;
char **values;
if (config_ldap() < 0) {
syslog(LOG_ERR, "abook_ldap_fetch: failed to configure LDAP");
return NULL;
}
/*
* Decide how to search for the user.
*/
snprintf(prefix, sizeof(prefix), "[%s:", config.uniqueattr);
ptr = strstr(alias, prefix);
if (ptr != NULL) {
*ptr = '\0';
ptr += 1 /*[*/ + strlen(config.uniqueattr) + 1 /*:*/;
searchkey = ptr;
ptr += strlen(ptr) - 1 /*]*/;
*ptr = '\0';
searchattr = config.uniqueattr;
} else {
searchkey = alias;
searchattr = config.fullnameattr;
}
snprintf(filter, sizeof(filter), "(&%s(%s=%s))", config.defaultfilter,
searchattr, searchkey);
ld = ldap_init(config.ldaphost, config.ldapport);
if (ld == NULL) {
syslog(LOG_ERR, "abook_ldap_fetch: LDAP init failed: %s",
strerror(errno));
return NULL;
}
rc = ldap_simple_bind_s(ld, NULL, NULL);
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR, "abook_ldap_fetch: simple bind failed: %s",
ldap_err2string(rc));
return NULL;
}
rc = ldap_search_s(ld, config.searchbase, config.scope, filter,
NULL/*get all attrs*/, 0/*attrs-only*/, &results);
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR, "abook_ldap_fetch: LDAP search failed: %s",
ldap_err2string(rc));
ldap_unbind(ld);
return NULL;
}
ldapcount = ldap_count_entries(ld, results);
if (ldapcount == 0) {
/* no matches on primary search, try secondary search if configured */
if (secondaryconfig.ldaphost) {
/* close the connection to the primary server */
ldap_unbind(ld);
snprintf(prefix, sizeof(prefix), "[%s:", secondaryconfig.uniqueattr);
ptr = strstr(alias, prefix);
if (ptr != NULL) {
*ptr = '\0';
ptr += 1 /*[*/ + strlen(secondaryconfig.uniqueattr) + 1 /*:*/;
searchkey = ptr;
ptr += strlen(ptr) - 1 /*]*/;
*ptr = '\0';
searchattr = secondaryconfig.uniqueattr;
} else {
searchkey = alias;
searchattr = secondaryconfig.fullnameattr;
}
snprintf(filter, sizeof(filter), "(&%s(%s=%s))", secondaryconfig.defaultfilter,
searchattr, searchkey);
ld=ldap_init(secondaryconfig.ldaphost, secondaryconfig.ldapport);
if (ld == NULL){
syslog(LOG_ERR, "abook_ldap_fetch: LDAP secondary init failed: %s",
strerror(errno));
return NULL;
}
rc = ldap_simple_bind_s(ld, NULL, NULL);
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR, "abook_ldap_fetch: simple secondary bind failed: %s",
ldap_err2string(rc));
return NULL;
}
rc = ldap_search_s(ld, secondaryconfig.searchbase, secondaryconfig.scope, filter,
NULL/*get all attrs*/, 0/*attrs-only*/, &results);
if (rc != LDAP_SUCCESS) {
syslog(LOG_ERR, "abook_ldap_fetch: LDAP secondary search failed: %s",
ldap_err2string(rc));
ldap_unbind(ld);
return NULL;
}
ldapcount = ldap_count_entries(ld, results);
if (ldapcount != 1) {
syslog(LOG_ERR, "abook_ldap_fetch: unexpected count of secondary search"
" hits: %d", ldapcount);
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return NULL;
}
entry = ldap_first_entry(ld, results);
if (entry == NULL) {
syslog(LOG_ERR, "abook_ldap_fetch: ldap_first_entry failed");
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return NULL;
}
/* This memory is freed by abook_fetchdone() which is called by
* show_address() after it's finished sending the field/data pairs
* back to the IMSP client
*/
mappedfieldcount = 0;
for (i = 0; secondaryconfig.map[i].field != NULL; i++) {
if (secondaryconfig.map[i].attr != NULL)
mappedfieldcount++;
}
fdata = (abook_fielddata *)
malloc(sizeof (abook_fielddata) * mappedfieldcount);
if (fdata == NULL) {
syslog(LOG_ERR, "abook_ldap_fetch: Out of memory");
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return NULL;
}
*count = 0;
fptr = fdata;
for (i = 0; secondaryconfig.map[i].field != NULL; i++) {
if ((secondaryconfig.map[i].attr != NULL) &&
(strcmp(secondaryconfig.map[i].attr, secondaryconfig.fullnameattr) != 0)) {
values = ldap_get_values(ld, entry, secondaryconfig.map[i].attr);
if (values != NULL && values[0] != NULL) {
fptr->field = strdup(secondaryconfig.map[i].field);
if (secondaryconfig.map[i].append != NULL) {
int fptrdatalen = strlen(values[0])+strlen(secondaryconfig.map[i].append)+1;
fptr->data=malloc(fptrdatalen);
if(!fptr->data) fatal("out of memory", EC_TEMPFAIL);
strlcpy(fptr->data, values[0], fptrdatalen);
strlcat(fptr->data, secondaryconfig.map[i].append, fptrdatalen);
} else {
fptr->data = strdup(values[0]);
if(!fptr->data) fatal("out of memory", EC_TEMPFAIL);
}
(*count)++;
fptr++;
}
if (values != NULL)
ldap_value_free(values);
}
}
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return (fdata);
}
}
if (ldapcount != 1) {
syslog(LOG_ERR, "abook_ldap_fetch: unexpected count of search"
" hits: %d", ldapcount);
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return NULL;
}
entry = ldap_first_entry(ld, results);
if (entry == NULL) {
syslog(LOG_ERR, "abook_ldap_fetch: ldap_first_entry failed");
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return NULL;
}
/* This memory is freed by abook_fetchdone() which is called by
* show_address() after it's finished sending the field/data pairs
* back to the IMSP client
*/
mappedfieldcount = 0;
for (i = 0; config.map[i].field != NULL; i++) {
if (config.map[i].attr != NULL)
mappedfieldcount++;
}
fdata = (abook_fielddata *)
malloc(sizeof (abook_fielddata) * mappedfieldcount);
if (fdata == NULL) {
syslog(LOG_ERR, "abook_ldap_fetch: Out of memory");
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return NULL;
}
*count = 0;
fptr = fdata;
for (i = 0; config.map[i].field != NULL; i++) {
if ((config.map[i].attr != NULL) &&
(strcmp(config.map[i].attr, config.fullnameattr) != 0)) {
values = ldap_get_values(ld, entry, config.map[i].attr);
if (values != NULL && values[0] != NULL) {
fptr->field = strdup(config.map[i].field);
if (config.map[i].append != NULL) {
printf("appending %s to field: %s value: %s\n", config.map[i].append, config.map[i].field,values[0]);
fptr->data=malloc(strlen(values[0])+strlen(config.map[i].append)+1);
fptr->data=strcat(fptr->data, values[0]);
fptr->data=strcat(fptr->data, config.map[i].append);
} else {
fptr->data = strdup(values[0]);
}
(*count)++;
fptr++;
}
if (values != NULL)
ldap_value_free(values);
}
}
(void) ldap_msgfree(results); /* ignore message type return value */
ldap_unbind(ld);
return (fdata);
}
cyrus-imspd-v1.8/imsp/abook_ldap.h 0100644 0043101 0000012 00000004465 07714510260 016413 0 ustar shadow staff /* abook_ldap.c -- address books implemented via LDAP lookups
*
* Copyright (c) 1998-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include
#include "abook.h"
typedef struct abook_ldap_state {
LDAP *ld;
int msgid;
LDAPMessage *prevresult;
struct ldap_config *ldapconfig;
} abook_ldap_state;
extern abook_fielddata *
abook_ldap_fetch(char *alias, int *count);
extern int
abook_ldap_searchstart(abook_ldap_state **ldap_state,
abook_fielddata *flist, int fcount);
extern char *
abook_ldap_search(abook_ldap_state *ldap_state);
extern void
abook_ldap_searchdone(abook_ldap_state *ldap_state);
cyrus-imspd-v1.8/imsp/adate.c 0100644 0043101 0000012 00000006111 07765430215 015366 0 ustar shadow staff /* adate.c -- generate an Internet standard date string for a mail header
*
* (C) Copyright 1991-1996 Christopher J. Newman
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Christopher J. Newman not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Christopher J. Newman makes no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
* SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
* Author: Christopher J. Newman
* Message: This is a nifty program.
*/
#include
#include
#include
#include
static char *dayofweek[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
static char *month[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
#define TIMESIZE 64
#define ZONESIZE 7
/* generate an Internet (historically Arpanet) standard date
*/
char *n_arpadate()
{
time_t now;
struct tm local, *gmt;
static char buf[TIMESIZE];
char tzbuf[ZONESIZE];
long zminutes;
char zsign, zdst;
/* get time */
now = time(NULL);
local = *localtime(&now);
gmt = gmtime(&now);
/* get GMT offset */
zminutes = local.tm_yday - gmt->tm_yday;
if (zminutes > 1) {
zminutes = -24;
} else if (zminutes < -1) {
zminutes = 24;
} else {
zminutes *= 24;
}
zminutes = (zminutes + local.tm_hour - gmt->tm_hour) * 60
+ local.tm_min - gmt->tm_min;
/* create timezone */
*tzbuf = '\0';
zsign = '+';
zdst = 'S';
if (local.tm_isdst) {
zdst = 'D';
}
if (zminutes < 0) {
zsign = '-';
zminutes = -zminutes;
if (zminutes >= 240 && zminutes <= 660 && zminutes % 60 == 0) {
snprintf(tzbuf, sizeof(tzbuf), " (%c%cT)", "AECMPYHB"
[(zminutes / 60) - (zdst == 'D' ? 3 : 4)], zdst);
}
}
/* create Internet date */
snprintf(buf, sizeof(buf), "%s, %d %s %d %02d:%02d:%02d %c%02ld%02ld%s",
dayofweek[local.tm_wday],
local.tm_mday,
month[local.tm_mon],
local.tm_year + 1900,
local.tm_hour, local.tm_min, local.tm_sec,
zsign, (unsigned long) (zminutes / 60),
(unsigned long) (zminutes % 60), tzbuf);
return (buf);
}
#ifdef TESTADATE
main()
{
printf("%s\n", n_arpadate());
}
#endif
cyrus-imspd-v1.8/imsp/alock.c 0100644 0043101 0000012 00000012033 07765430215 015401 0 ustar shadow staff /* alock.c -- advisory locking routines
*
* Copyright (c) 1993-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Newman
* Start Date: 8/18/93
*/
#include
#include
#include
#include "util.h"
#include "syncdb.h"
#include "alock.h"
/* database name */
static char alockdb[] = "user/%.*s/alock";
/* list of locks held by server */
typedef struct locklist_t {
struct locklist_t *next;
char dbname[256];
char key[1];
} locklist_t;
/* global list of locked items */
static locklist_t *locklist = NULL;
/* lock/unlock an option or address book entry
* for option, item1 is option name and item2 is NULL
* for address book, item1 is address book and item2 is name
* lockflag is 0 for unlock, 1 for lock
* host is set to hostname on input and returns user@host if already locked
* returns -1 on failure, 0 on success, 1 on already locked/unlocked
*/
int alock_dolock(user, item1, item2, lockflag, host)
char *user, *item1, *item2, **host;
int lockflag;
{
locklist_t *key, *lkey;
char *s, *value;
int result, result1, keylenplus;
/* create the key */
keylenplus = strlen(item1)
+ (item2 ? strlen(item2) + 1 : 0)
+ strlen(user) + strlen(*host) + 2;
key = (locklist_t *)
malloc(sizeof (locklist_t) + keylenplus);
if (!key) return (-1);
if (item2) {
snprintf(key->dbname, sizeof(key->dbname), alockdb,
(s = strchr(item1, '.')) ? s - item1 : strlen(item1), item1);
snprintf(key->key, keylenplus, "%s\"%s", item1, item2);
} else {
snprintf(key->dbname, sizeof(key->dbname), alockdb, strlen(user), user);
strcpy(key->key, item1);
}
/* look for lock to release */
if (!lockflag) {
for (lkey = locklist;
lkey && strcasecmp(lkey->key, key->key); lkey = locklist->next);
if (!lkey) {
free((char *) key);
return (1);
}
}
/* write-lock database, creating if necessary */
if ((result = sdb_writelock(key->dbname, key->key, 1)) < 0) {
/* create db & retry */
sdb_create(key->dbname);
result = sdb_writelock(key->dbname, key->key, 1);
}
/* change database */
if (!result) {
if (lockflag) {
if (sdb_get(key->dbname, key->key, 1, &value) == 0 && value) {
result = 1;
*host = value;
} else {
value = key->key + strlen(key->key) + 1;
snprintf(value, keylenplus - strlen(key->key) - 1, "%s@%s", user, *host);
result = sdb_set(key->dbname, key->key, 1, value);
}
} else {
result = sdb_remove(key->dbname, key->key, 1);
}
}
/* unlock it */
result1 = sdb_unlock(key->dbname, key->key, 1);
if (!result) result = result1;
/* remove entries from linked list */
if (!lockflag || result) free((char *) key);
if (!result && !lockflag) {
if (lkey == locklist) {
locklist = locklist->next;
} else {
for (key = locklist; key->next != lkey; key = key->next);
key->next = lkey->next;
}
free((char *)lkey);
}
/* add entry to linked list */
if (lockflag && !result) {
key->next = locklist;
locklist = key;
}
return (result);
}
/* unlock all active locks
*/
void alock_unlock()
{
locklist_t *key;
while (locklist) {
key = locklist;
locklist = locklist->next;
if (sdb_writelock(key->dbname, key->key, 1) == 0) {
sdb_remove(key->dbname, key->key, 1);
sdb_unlock(key->dbname, key->key, 1);
}
free((char *) key);
}
}
cyrus-imspd-v1.8/imsp/alock.h 0100644 0043101 0000012 00000004670 07217270230 015405 0 ustar shadow staff /* alock.h -- advisory locking routine definitions
*
* Copyright (c) 1993-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Newman
* Start Date: 8/18/93
*/
/* lock/unlock an option or address book entry
* for option, item1 is option name and item2 is NULL
* for address book, item1 is address book and item2 is name
* lockflag is 0 for unlock, 1 for lock
* lockstr is set to user who has option locked
* host is set to hostname on input and returns user@host if already locked
* returns -1 on failure, 0 on success, 1 on already locked/unlocked
*/
int alock_dolock( /* char *user, char *item1, char *item2,
int lockflag, char **host */ );
/* unlock all active locks
*/
void alock_unlock( /* void */ );
cyrus-imspd-v1.8/imsp/authize.c 0100644 0043101 0000012 00000014170 07714231525 015762 0 ustar shadow staff /* authize.c -- authorization module for IMSP
*
* Copyright (c) 1993-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Newman
* Start Date: 6/28/93
*/
#include
#include
#include
#include "util.h"
#include "acl.h"
#include "syncdb.h"
#include "option.h"
#include "auth.h"
#include "authize.h"
/* from OS: */
extern char *malloc(), *realloc();
extern char *crypt();
/* name of anonymous user */
static char anonymous[] = "anonymous";
/* standard options for setting authentication levels */
char opt_alladmin[] = "imsp.admin.all"; /* needed by sasl_support.c */
/* standard error messages */
static char err_nomem[] = "Not enough memory to log in";
/* Generate an auth_id from a user name
* This routine no longer does password validation, so the caller must
* only use this routine after a successful authentication.
* "idptr" is set to the new IMSP authentication structure
* "user" is the IMSP login name, and points to a dynamically allocated
* string which may be freed by the caller.
* "reply" is set to a success or failure message to be sent to the user
* (may not contain CR or LF characters)
* Returns -1 for malloc failures, otherwise 0 for success
*/
int
auth_login(auth_id **idptr, const char *user,
char *olduser, const char **reply)
{
auth_id *id = *idptr;
char *rptr;
static char replybuf[256];
/* Make space for auth_id if this is the first authentication
* of the session */
if (!id) {
*idptr = id = (auth_id *) malloc(sizeof (auth_id));
if (!id) {
*reply = err_nomem;
return -1;
}
id->level = AUTH_NONE;
strncpy(id->user, anonymous, sizeof(id->user));
id->state = NULL;
}
/* copy in the user-id */
strcpy(id->user, user);
/* construct the reply to be sent back to the user */
if (olduser) {
/* Write a reply that mentions the switch-user operation */
strcpy(replybuf, "Administrator switch from user `");
rptr = beautify_copy(replybuf + strlen(replybuf), olduser);
strcpy(rptr, "' to user `");
rptr = beautify_copy(replybuf + strlen(replybuf), user);
strcpy(rptr, "' successful.");
} else {
strcpy(replybuf, "User `");
rptr = beautify_copy(replybuf + strlen(replybuf), user);
strcpy(rptr, "' Logged in");
}
*reply = replybuf;
/* determine the authorization level */
id->level = AUTH_USER;
if (option_lookup("", opt_alladmin, 1, id->user)) {
id->level = AUTH_ADMIN;
}
/* Get an authentication state from the libcyrus "auth" module
* (not to be confused the the IMSP authize module in this file).
* This is needed for acl_myrights().
* Free id->state in case this isn't the first authentication this session.
*/
if (id->state)
auth_freestate(id->state);
id->state = auth_newstate(user, NULL);
return 0;
}
/*
* Decide whether the current user (as set in "id") is allowed to
* "switch-user" to become an alternate user (specified in "user").
*
* If the current id is an administrator,
* "id" is untouched,
* "reply" is set to a success message
* 1 is returned.
* Otherwise,
* "id" and "reply" is left alone
* 0 is returned.
*/
int
auth_switchuser(auth_id *id, char *user, char **olduser)
{
int retval = 0;
*olduser = NULL;
/* Have we authenticated yet and are we an administrator? */
if(id && (id->level == AUTH_ADMIN))
{
*olduser = strdup(auth_username(id));
retval = 1;
}
return retval;
}
/* this frees any resources used by an auth_id, it must zero out passwords
* and will be called before the program exits. If the argument is NULL,
* no action should be taken.
*/
void
auth_free(auth_id *id)
{
if (id) {
if (id->state)
auth_freestate(id->state);
free((char *)id);
}
}
/*
* Return the libcyrus authentication state from the given authorization state
*/
struct auth_state *
auth_get_state(id)
auth_id *id;
{
return (id ? id->state : NULL);
}
/* Return the user name of an identity. The user name is used to identify
* the appropriate mailboxes/bb-subscriptions/options/address-book/etc to
* use. It is also used for error messages. The string may not be longer
* than AUTH_USERMAX.
* If "id" is NULL, this should return a string representing an anonymous user.
*/
char *
auth_username(auth_id *id)
{
return (id ? id->user : anonymous);
}
/* return the access level for a given id
*/
int
auth_level(auth_id *id)
{
return (id ? id->level : AUTH_NONE);
}
cyrus-imspd-v1.8/imsp/authize.h 0100644 0043101 0000012 00000011431 07732657011 015766 0 ustar shadow staff #ifndef __authize_h
#define __authize_h
/* authize.h -- definitions for authorization API
*
* Copyright (c) 1993-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Newman
* Start Date: 6/28/93
*/
#include "auth.h" /* for struct auth_state */
/* maximum length for a user name */
#define AUTH_USERMAX 63
/* the option we keep administrators in */
extern char opt_alladmin[];
/* levels of authentication
* AUTH_NONE
* This is for an anonymous user, who is permitted to locate bboards, and
* view the values of global options.
* AUTH_SUBS
* This is for a user who may switch to any user to view their
* subscriptions, but may not change anything.
* AUTH_USER
* This is standard authentication, giving user access to their own
* options, subscriptions, address book, etc.
* AUTH_BB
* This allows the user to freely manipulate bboards.
* AUTH_ADMIN
* This allows the user full access to everything.
*/
#define AUTH_NONE 0
#define AUTH_SUBS 1
#define AUTH_USER 2
#define AUTH_BB 3
#define AUTH_ADMIN 4
/* The contents of this structure must not be accessed outside of the
* auth_ module. It may be variable sized.
*/
typedef struct auth_id {
int level;
char user[AUTH_USERMAX];
struct auth_state *state;
} auth_id;
/* Generate an auth_id from a user name
* This routine no longer does password validation, so the caller must
* only use this routine after a successful authentication.
* "idptr" is set to the new IMSP authentication structure
* "user" is the IMSP login name, and points to a dynamically allocated
* string which may be freed by the caller.
* "reply" is set to a success or failure message to be sent to the user
* (may not contain CR or LF characters)
* Returns -1 for malloc failures, otherwise 0 for success
*/
int auth_login(auth_id **idptr, const char *user,
char *olduser, const char **reply);
/*
* Decide whether the current user (as set in "id") is allowed to
* "switch-user" to become an alternate user (specified in "user").
*
* If the current id is an administrator,
* "id" is untouched,
* "reply" is set to a success message
* 1 is returned.
* Otherwise,
* "id" and "reply" is left alone
* 0 is returned.
*/
int auth_switchuser (auth_id *id, char *user, char **olduser);
/* this frees any resources used by an auth_id, it must zero out passwords
* and will be called before the program exits. If the argument is NULL,
* no action should be taken.
*/
void auth_free(auth_id *id);
/*
* Return the libcyrus authentication state from the given authorization state
*/
struct auth_state *auth_get_state(auth_id *id);
/* Return the user name of an identity. The user name is used to identify
* the appropriate mailboxes/bb-subscriptions/options/address-book/etc to
* use. It is also used for error messages. The string may not be longer
* than AUTH_USERMAX.
* If "id" is NULL, this should return a string representing an anonymous user.
*/
char *auth_username(auth_id *id);
/* return the access level for a given id
*/
int auth_level(auth_id *id);
#endif
cyrus-imspd-v1.8/imsp/bb.c 0100644 0043101 0000012 00000113711 07765430215 014700 0 ustar shadow staff /* bb.c -- bboard subscriptions/update/location databases
*
* (C) Copyright 1993-1994 by Carnegie Mellon University
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Chris Newman
* Start Date: 5/4/93
*/
#include
#include
#include
#include "glob.h"
#include "util.h"
#include "syncdb.h"
#include "option.h"
#include "dispatch.h"
#include "im_util.h"
#include "authize.h"
#include "imap_client.h"
#include "bb.h"
#include "acl.h"
/* import from OS: */
extern char *malloc(), *realloc();
/* name of mailboxes database */
static char mboxdb[] = "mailboxes";
static char newdb[] = "new";
static char changedb[] = "changed";
/* name of user's inbox */
static char inbox[] = "INBOX";
/* options used */
static char opt_hostlist[] = "imsp.imap.servers";
static char opt_newhost[] = "imsp.new.mailbox.servers";
/* proxy protocol */
static char proxy_list[] = "LIST";
static char proxy_acl[] = "ACL";
static char proxy_dolist[] = "%a LIST \"\" *\r\n";
static char proxy_getacl[] = "%a GETACL MAILBOX %s\r\n";
static char proxy_create[] = "%a CREATE %s%a%a\r\n";
static char proxy_delete[] = "%a DELETE %s\r\n";
static char proxy_rename[] = "%a RENAME %s %s\r\n";
static char proxy_setacl[] = "%a SETACL MAILBOX %s %s %s\r\n";
static char proxy_delacl[] = "%a DELETEACL MAILBOX %s %s\r\n";
/* value for an unspecified update string */
static char noinfosub[] = "1 0";
/* proxy replies */
static char rpl_noimap[] = "NO no available IMAP server to create";
static char rpl_dbfailure[] = "NO failed to modify mailbox list";
static char rpl_exists[] = "%a NO mailbox `%p' already exists\r\n";
static char rpl_inval[] = "NO invalid mailbox name";
static char rpl_notexists[] = "%a NO mailbox `%p' not found\r\n";
static char rpl_norename[] = "%a NO can't rename mailbox `%p' since mailbox `%p' already exists\r\n";
static char rpl_noreplace[] = "%a NO can't replace mailbox `%p' since mailbox `%p' doesn't exist\r\n";
static char rpl_wronghost[] = "%a NO mailbox `%p' is not located on that IMAP server\r\n";
static char rpl_badhost[] = "NO can't create mailbox on that host";
static char rpl_imapconn[] = "NO connection to IMAP server failed";
static char rpl_notsupported[] = "NO command not suppported at this site";
static char rpl_nomem[] = "NO IMSP server out of memory";
static char rpl_norep[] = "NO IMSP server does not support replicated mailboxes";
static char rpl_nocauth[] = "%a NO not authorized to create mailbox `%p'\r\n";
static char rpl_nodauth[] = "%a NO not authorized to delete mailbox `%p'\r\n";
static char rpl_norauth[] = "%a NO not authorized to rename mailbox `%p' to `%p'\r\n";
static char rpl_noaauth[] = "%a NO not authorized to change rights on mailbox `%p'\r\n";
static char rpl_okcreate[] = "OK Create of non-terminal names is unnecessary";
/* handler for getacl */
typedef struct getacl_handler {
im_handler hand;
char *entry, *mbox;
int used, size, num, mlen;
} getacl_handler;
/* handler procedure to add an ACL entry to a mailbox entry
*/
static void add_acl(hand, val, con)
getacl_handler *hand;
int val;
im_conn *con;
{
char *value, *bits;
int len, result;
/* make sure it's a "MAILBOX" acl for the right mailbox: */
if (strncasecmp(con->buf.upos, "MAILBOX ", 8) || !hand->entry) return;
con->buf.upos += 8;
value = copy_astring(&con->buf, 0);
if (!value) return;
result = strncasecmp(value, hand->mbox, hand->mlen);
free(value);
if (result) return;
/* get the ACL */
value = copy_astring(&con->buf, 0);
if (!value) return;
bits = get_atom(&con->buf);
if (!bits) {
free(value);
return;
}
len = strlen(value) + strlen(bits) + 2;
while (hand->size - hand->used < len) {
hand->entry = realloc(hand->entry, hand->size += 256);
if (!hand->entry) {
free(value);
return;
}
}
sprintf(hand->entry + hand->used, "%s\t%s\t", value, bits);
++hand->num;
free(value);
hand->used += len;
}
/* do a proxy GETACL command
*/
static char *bb_addacl(db, con, mbox, base, size)
char *db;
im_conn *con;
char *mbox, **base;
long *size;
{
getacl_handler h;
char *reply;
int result;
imap_inithandler(&h.hand, proxy_acl, add_acl);
h.entry = *base;
h.mbox = mbox;
h.mlen = strlen(mbox);
h.num = 0;
h.used = strlen(h.entry);
h.size = *size;
imap_addhandler(con, &h.hand);
result = im_send(&con->buf, con->lit, proxy_getacl, con->tag, mbox);
if (result == 0) reply = imap_wait(con);
if (con->lit[0].ptr) free(con->lit[0].ptr);
imap_removehandler(con, proxy_acl);
if (result != 0 || !reply) {
reply = rpl_imapconn;
} else {
if (reply[0] == 'B') {
reply = rpl_notsupported;
} else if (reply[0] == 'O' && reply[1] == 'K') {
reply = h.entry ? NULL : rpl_nomem;
if (sdb_set(db, mbox, SDB_ICASE, h.entry) < 0) {
reply = rpl_dbfailure;
}
}
}
*base = h.entry;
*size = h.size;
return (reply);
}
/* storage for new mailbox list used by bb_init/add_mailbox */
typedef struct list_handler {
im_handler hand;
char *mlist;
int mused, msize, hostnum;
} list_handler;
#define MLIST_START_SIZE 1024
/* handler procedure to add an entry to the mailbox list
*/
static void add_mailbox(hand, val, con)
list_handler *hand;
int val;
im_conn *con;
{
char *mbox = con->buf.upos;
int len, sep_char = '\r';
/* for now, we ignore attributes */
while (*mbox && *mbox != ')') ++mbox;
if (!*mbox || mbox[1] != ' ') return;
mbox += 2;
/* grab the sep_char */
if (*mbox == '"') {
++mbox;
if (*mbox == '\\') ++mbox;
sep_char = *mbox++;
} else if (*mbox != 'N' && *mbox != 'n') {
return;
}
while (*mbox && *mbox != ' ') ++mbox;
/* grab the mailbox name */
if (*mbox != ' ') return;
con->buf.upos = mbox + 1;
mbox = copy_astring(&con->buf, 0);
if (!mbox) return;
len = strlen(mbox);
/* add it to list */
if (len && hand->mlist && strcasecmp(mbox, inbox)) {
while (hand->mlist && hand->msize - hand->mused <= len + 3) {
hand->mlist = realloc(hand->mlist, hand->msize *= 2);
}
if (hand->mlist) {
sprintf(hand->mlist + hand->mused, "%c%c%s",
'0' + hand->hostnum, sep_char, mbox);
hand->mused += len + 3;
}
}
free(mbox);
}
/* initialize the toplevel mailbox list
*/
int bb_init()
{
option_list *hostlist = NULL;
char *client, *response, *mbox, *value, *newval, *host;
long size;
im_conn **con;
int result, hnum, len;
list_handler hand;
/* find IMAP hosts */
hostlist = option_getlist("", opt_hostlist, 1);
if (!hostlist || !hostlist->count) {
if (hostlist) option_freelist(hostlist);
return (-1);
}
con = (im_conn **) malloc(sizeof (im_conn *) * hostlist->count);
if (!con) {
option_freelist(hostlist);
return (-1);
}
/* set up mailbox list handler */
imap_inithandler(&hand.hand, proxy_list, add_mailbox);
hand.mlist = malloc(hand.msize = MLIST_START_SIZE);
if (!hand.mlist) {
free((char *) con);
option_freelist(hostlist);
return (-1);
}
hand.mused = 0;
/* loop through hosts, doing LIST */
hand.hostnum = -1;
while (++hand.hostnum < hostlist->count) {
/* check for IMAP client descriptor on hostname */
client = strchr(hostlist->item[hand.hostnum], '/');
if (client) *client++ = '\0';
/* connect to imap host */
con[hand.hostnum] =
imap_connect(hostlist->item[hand.hostnum], NULL, 1);
if (con[hand.hostnum] == NULL) break;
/* add "LIST" handler */
imap_addhandler(con[hand.hostnum], &hand.hand);
/* do a "LIST "" *" */
result = im_send(&con[hand.hostnum]->buf, NULL,
proxy_dolist, con[hand.hostnum]->tag);
if (result == 0) response = imap_wait(con[hand.hostnum]);
/* clean up & exit on error */
imap_removehandler(con[hand.hostnum], proxy_list);
if (result < 0 || !response
|| response[0] != 'O' || response[1] != 'K') {
break;
}
}
sdb_delete(newdb);
if (hand.hostnum < hostlist->count) {
result = -1;
} else if (sdb_create(newdb) != 0
|| sdb_writelock(newdb, NULL, SDB_ICASE) != 0) {
hand.hostnum = 0;
result = -1;
} else {
/* loop through mailboxes doing GETACL */
mbox = hand.mlist;
newval = NULL;
size = 0;
while (mbox - hand.mlist < hand.mused) {
mbox += 2;
if (sdb_get(newdb, mbox, SDB_ICASE, &value) >= 0 && value != NULL) {
/*XXX: replication: modify entry to add new host */
} else {
/* add new entry */
hnum = mbox[-2] - '0';
host = hostlist->item[hnum];
len = 8 + strlen(host);
if (size < len) {
if (newval) free(newval);
newval = malloc(size = len + 256);
if (!newval) break;
}
snprintf(newval, size, "* %c (%s) ", mbox[-1], host);
response = bb_addacl(newdb, con[hnum], mbox, &newval, &size);
if (response) break;
}
while (*mbox++);
}
result = 0;
if (response || !newval) result = -1;
if (newval) free(newval);
}
/* clean up everything */
for (hnum = 0; hnum < hostlist->count; ++hnum) {
if (con[hnum]) imap_close(con[hnum]);
}
if (hand.mlist) free(hand.mlist);
free((char *) con);
if (!result) {
/* copy over new mailboxes database */
sdb_create(mboxdb);
sdb_unlock(newdb, NULL, SDB_ICASE);
sdb_copy(newdb, mboxdb, SDB_ICASE);
sdb_delete(newdb);
}
if (hand.hostnum >= hostlist->count) {
sdb_unlock(newdb, NULL, SDB_ICASE);
sdb_delete(newdb);
}
option_freelist(hostlist);
return (result);
}
/* get/parse info about a bboard
*/
int bb_get(name, uid, loc, acl, sep_char)
char *name;
char **uid, **loc, **acl;
char *sep_char;
{
char *value = NULL;
if (name) {
sdb_get(mboxdb, name, SDB_ICASE, &value);
} else {
value = *uid;
}
if (value) {
if (uid) *uid = value;
while (*value && *value++ != ' '); /* skip last-uid */
if (*value && sep_char) *sep_char = *value++;
while (*value && *value++ != ' '); /* skip sep-char/flags */
if (loc) *loc = value;
value = strchr(value, ')'); /* skip to end of location list */
if (value && acl) {
*acl = value + 2;
}
}
return (value ? 0 : -1);
}
/* get the rights to a bboard
*/
long bb_rights(id, name, acl)
struct auth_state *id;
char *name, *acl;
{
long rights = acl_myrights(id, acl);
char *user = auth_username(id);
int len = strlen(user);
if (auth_level(id) >= AUTH_BB) {
rights |= ACL_ALL;
} else if (!strcasecmp(inbox, name)
|| (!strncasecmp("user.", name, 5)
&& !strncasecmp(user, name + 5, len)
&& (name[5+len] == '.' || name[5+len] == '\0'))) {
rights |= ACL_LOOKUP | ACL_ADMIN;
}
return (rights);
}
/* check if we have create rights in parent
* returns 0 if we do, -1 otherwise
*/
static int bb_parentcreate(id, name, ploc)
struct auth_state *id;
char *name;
char **ploc;
{
int result = -1;
char *dot;
char *loc, *acl;
if (auth_level(id) >= AUTH_BB) result = 0;
if (ploc) *ploc = NULL;
dot = strrchr(name, '.');
while (dot) {
*dot = '\0';
if (bb_get(name, NULL, &loc, &acl, NULL) == 0) {
*dot = '.';
if (bb_rights(id, name, acl) & ACL_CREATE) result = 0;
if (ploc) *ploc = loc;
break;
}
*dot = '.';
while (--dot >= name && *dot != '.');
if (dot < name) dot = NULL;
}
return (result);
}
/* check if any child of has lookup rights
* returns -1 on failure, 0 on success
*/
static int bb_childlookup(id, name, end, len)
struct auth_state *id;
sdb_keyvalue *name, *end;
int len;
{
char *key = name->key, *acl;
while (name < end && !strncasecmp(key, name->key, len)) {
if (name->key[len] == '.') {
bb_get(NULL, &name->value, NULL, &acl, NULL);
if (bb_rights(id, name->key, acl) & ACL_LOOKUP) {
return (0);
}
}
++name;
}
return (-1);
}
/* returns 0 if we already did a given partial match
*/
static int bb_didpartial(base, name, len)
sdb_keyvalue *base, *name;
int len;
{
char *key = name->key;
int result = -1;
if (len >= 0) {
while (--name >= base && strncasecmp(key, name->key, len) == 0) {
if (name->key[len] == '.' || name->key[len] == '\0') {
result = 0;
break;
}
}
}
return (result);
}
/* convert uid string to number
*/
static unsigned long uidval(uid)
char *uid;
{
unsigned long result = 0;
while (isspace(*uid)) ++uid;
while (isdigit(*uid)) result = result * 10 + (*uid++ - '0');
return (result);
}
/* initialize bboard subscriptions
*/
int bb_subsinit(user)
char *user;
{
char dbname[256];
/* check if it already exists */
snprintf(dbname, sizeof(dbname), "user/%s/subs", user);
return (sdb_check(dbname) == 0 || sdb_create(dbname) == 0 ? 0 : -1);
}
/* subscribe/unsubscribe to a bboard
* returns -1 on failure, 0 on success, 1 if already subscribed/unsubscribed
*/
#ifdef __STDC__
int bb_subscribe(struct auth_state *id, char *name, int subscribe)
#else
int bb_subscribe(id, name, subscribe)
struct auth_state *id;
char *name;
int subscribe;
#endif
{
char *user, *value, *bbvalue, *newval, *acl;
int result, result1;
char dbname[256], iboxname[256];
/* get old value / verify bboard name / verify proper rights */
user = auth_username(id);
if (!strcasecmp(inbox, name)) {
snprintf(iboxname, sizeof(iboxname), "user.%s", user);
name = iboxname;
}
snprintf(dbname, sizeof(dbname), "user/%s/subs", user);
if (sdb_writelock(dbname, name, SDB_ICASE) < 0) return (-1);
if (sdb_get(dbname, name, SDB_ICASE, &value) < 0
|| bb_get(name, &bbvalue, NULL, &acl, NULL) < 0
|| (!value && !(bb_rights(id, name, acl) & (ACL_LOOKUP|ACL_READ)))) {
sdb_unlock(dbname, name, SDB_ICASE);
return (-1);
}
/* check for silly requests */
if (((!value || *value == '0') && !subscribe)
|| (value && *value == '1' && subscribe)) {
sdb_unlock(dbname, name, SDB_ICASE);
return (1);
}
/* create new value & change it */
newval = malloc(value ? strlen(value) + 1 : sizeof (noinfosub));
if (newval == NULL) {
sdb_unlock(dbname, name, SDB_ICASE);
return (-1);
}
strcpy(newval, value ? value : noinfosub);
*newval = subscribe ? '1' : '0';
result = sdb_set(dbname, name, SDB_ICASE, newval);
result1 = sdb_unlock(dbname, name, SDB_ICASE);
free(newval);
if (!result) result = result1;
return (result);
}
/* finish mailbox matching
*/
void bb_matchdone(state)
bb_state *state;
{
if (state->pglob) glob_free(&state->pglob);
if (state->bbsub) free((char *) state->bbsub);
if (state->subs) {
sdb_freematch(state->subs, state->subend - state->subs, 1);
}
if (state->bb) sdb_freematch(state->bb, state->bbend - state->bb, 0);
memset((char *) state, 0, sizeof (bb_state));
}
/* begin a match
* returns -1 on failure
*/
int bb_matchstart(state, user, pat)
bb_state *state;
char *user, *pat;
{
char *end;
int bbcount, subcount;
char dbname[256];
/* initialize match state */
memset((char *) state, 0, sizeof (bb_state));
snprintf(state->inboxname, sizeof(state->inboxname), "user.%s", user);
state->inboxlen = strlen(state->inboxname);
state->lastmin = -1;
end = pat + strlen(pat) - 1;
/* check if inbox matches */
state->pglob = glob_init(pat, GLOB_ICASE | GLOB_HIERARCHY);
if (glob_test(state->pglob, inbox, 5, NULL) < 0) {
state->inboxdone = 1;
}
/* do the match */
if (*end == '%') {
/* for partial matches, we save the glob pattern and pass a '*'
* down to the db level, since the db level doesn't do partial
* matches.
*/
*end = '*';
} else {
glob_free(&state->pglob);
}
if (sdb_match(mboxdb, pat, GLOB_ICASE | GLOB_HIERARCHY, NULL, 0,
&state->bb, &bbcount) >= 0) {
state->bbend = state->bb + bbcount;
state->bbpos = state->bb;
snprintf(dbname, sizeof(dbname), "user/%s/subs", user);
if (sdb_match(dbname, pat, GLOB_ICASE | GLOB_HIERARCHY, NULL,
1, &state->subs, &subcount) >= 0) {
state->subend = state->subs + subcount;
state->subpos = state->subs;
state->bbsub = (sdb_keyvalue **)
malloc(sizeof (sdb_keyvalue *) * (subcount + 1));
}
}
/* done -- check for success */
if (state->pglob) *end = '%';
if (state->bbsub != NULL) {
state->bbsubpos = state->bbsub;
return (0);
}
bb_matchdone(state);
return (-1);
}
/* check if any matching subscriptions have been renamed or deleted
* (will call bb_subscribe to change entries as necessary)
* must be called after bb_matchstart and before bb_match
* *newname will be set to NULL in case *oldname was deleted.
* *autosub will be set to 1 if the user's subscription status to *newname
* was changed. Otherwise *autosub will be set to 0.
* returns -1 on fatal error (no need to call bb_matchdone)
* returns 0 if matching subscriptions are fully verified.
* returns 1 if a rename/delete is being returned. Call must call
* bb_matchverify again.
*/
int bb_matchverify(state, id, pat, oldname, newname, autosub)
bb_state *state;
struct auth_state *id;
char *pat, **oldname, **newname;
int *autosub;
{
char dbname[256];
char *key, *end, *user, *value;
int cmp, result, wassub, subcount;
/* set database name so we have it if needed */
user = auth_username(id);
snprintf(dbname, sizeof(dbname), "user/%s/subs", user);
/* build bbsubpos array & check for deleted/renamed bboards */
while (state->subpos < state->subend) {
key = state->subpos->key;
cmp = -1;
while (state->bbpos < state->bbend
&& (cmp = strcmp(key, state->bbpos->key)) > 0) {
++state->bbpos;
}
/* we have a deleted/renamed bboard */
if (cmp) {
state->subchgflag = 1;
wassub = *state->subpos->value == '1';
*oldname = key;
*newname = NULL;
*autosub = 0;
if (sdb_writelock(dbname, key, SDB_ICASE) >= 0) {
sdb_remove(dbname, key, SDB_ICASE);
sdb_unlock(dbname, key, SDB_ICASE);
}
++state->subpos;
if (!wassub) continue;
sdb_get(changedb, *oldname, SDB_ICASE, newname);
if (*newname) {
if (sdb_get(mboxdb, *newname, SDB_ICASE, &value) >= 0
&& value == NULL) {
/* bboard renamed and deleted */
*newname = NULL;
if (sdb_writelock(changedb, *oldname, SDB_ICASE) >= 0) {
sdb_remove(changedb, *oldname, SDB_ICASE);
sdb_unlock(changedb, *oldname, SDB_ICASE);
}
} else if (bb_subscribe(id, *newname, 1) == 0) {
*autosub = 1;
}
}
return (1);
}
*state->bbsubpos++ = state->bbpos++;
++state->subpos;
}
*state->bbsubpos = state->bbend;
/* if things changed, we need to rebuild subs & state->bbsub */
if (state->subchgflag) {
state->bbpos = state->bb;
end = pat + strlen(pat) - 1;
if (state->pglob) *end = '*'; /* assume user hasn't changed pat */
sdb_freematch(state->subs, state->subend - state->subs, 1);
if (sdb_match(dbname, pat, SDB_ICASE, NULL, 0,
&state->subs, &subcount) < 0) {
if (state->pglob) *end = '%';
bb_matchdone(state);
return (-1);
}
if (state->pglob) *end = '%';
state->subend = state->subs + subcount;
state->subpos = state->subs;
free((char *) state->bbsub);
state->bbsub = (sdb_keyvalue **)
malloc(sizeof (sdb_keyvalue *) * (subcount + 1));
if (!state->bbsub) {
bb_matchdone(state);
return (-1);
}
state->bbsubpos = state->bbsub;
state->subchgflag = 0;
result = bb_matchverify(state, id, pat, oldname, newname, autosub);
if (result < 0) return (result);
/* we fixed it, but it's still broken. Give up. */
if (result || state->subchgflag) {
bb_matchdone(state);
return (-1);
}
}
/* things are groovy! Reset and get ready to go */
state->bbpos = state->bb;
state->subpos = state->subs;
state->bbsubpos = state->bbsub;
return (0);
}
/* get the next match
* returns *name, or NULL
* *name and *loc could vanish if any other db calls are made
* if subonly is set, only subscribed bboards will be returned.
*/
#ifdef __STDC__
char *bb_match(bb_state *state, struct auth_state *id, char **name, char **loc,
char *sep_char, int *flags, int subonly)
#else
char *bb_match(state, id, name, loc, sep_char, flags, subonly)
bb_state *state;
struct auth_state *id;
char **name, **loc;
char *sep_char;
int *flags;
int subonly;
#endif
{
char *uid, *acl, *key, *value;
int len, mlen = -1, cmp;
char dbname[256];
/* turn '\0' back into '.' from partial matches */
if (state->part) {
*state->part = '.';
state->part = NULL;
}
/* check for inbox */
*flags = 0;
if (!state->inboxdone) {
snprintf(dbname, sizeof(dbname), "user/%s/subs", auth_username(id));
if (sdb_get(mboxdb, state->inboxname,
SDB_ICASE | SDB_QUICK, &uid) >= 0
&& bb_get(NULL, &uid, loc, &acl, sep_char) == 0
&& (!subonly ||
sdb_get(dbname, state->inboxname,
SDB_ICASE | SDB_QUICK, &value) < 0
|| value == NULL || *value == '1')) {
key = inbox;
} else {
state->inboxdone = 1;
}
}
/* keep looking until we find a bboard we have lookup rights to */
while (state->inboxdone) {
if (subonly) state->bbpos = *state->bbsubpos;
/* loop through uninteresting bboards */
while (state->bbpos < state->bbend) {
if (!subonly || *state->subpos->value == '1') {
key = state->bbpos->key;
if (!state->pglob) break;
if (state->lastmin < 0) state->lastmin = 0;
len = strlen(key);
if ((mlen = glob_test(state->pglob, key, len,
&state->lastmin)) >= 0
&& bb_didpartial(state->bb, state->bbpos, mlen) < 0) {
if (mlen == len) mlen = state->lastmin = -1;
break;
}
}
if (state->lastmin < 0) {
if (subonly) {
++state->subpos;
state->bbpos = *++state->bbsubpos;
} else if (++state->bbpos > *state->bbsubpos) {
++state->subpos, ++state->bbsubpos;
}
}
}
if (state->bbpos == state->bbend) return (NULL);
/* make sure it's not inbox & check LOOKUP right */
cmp = strncasecmp(state->inboxname, key, state->inboxlen);
if (mlen >= 0 || cmp != 0 || key[state->inboxlen] != '\0') {
uid = state->bbpos->value;
bb_get(NULL, &uid, loc, &acl, sep_char);
if ((cmp == 0 && key[state->inboxlen] == '.')
|| (mlen < 0 && (bb_rights(id, key, acl) & ACL_LOOKUP))
|| (mlen >= 0 && bb_childlookup(id, state->bbpos, state->bbend,
mlen) == 0)) {
break;
}
}
if (state->lastmin < 0) {
if (subonly) {
++state->subpos;
state->bbpos = *++state->bbsubpos;
} else if (++state->bbpos > *state->bbsubpos) {
++state->subpos, ++state->bbsubpos;
}
}
}
/* set flags */
*name = key;
/* if no messages on bboard, we're not interested */
if (uid[0] == '0' && uid[1] == ' ') *flags |= BB_UNMARKED;
/* check for NOINFERIOR:
* if it's the INBOX or
* the user doesn't have create rights,
* and there are no inferiors to which the user has lookup rights,
* then we set the NOINFERIOR flag
*/
if (!state->inboxdone ||
(!(bb_rights(id, key, acl) & ACL_CREATE)
&& bb_childlookup(id, state->bbpos, state->bbend,
mlen ? mlen : strlen(key)) < 0)) {
*flags |= BB_NOINFERIOR;
}
/* check against subscription list */
if (state->inboxdone && *state->bbsubpos == state->bbpos) {
if (*state->subpos->value == '1') {
*flags |= BB_SUBSCRIBED;
}
/* if we have info about a non-empty bboard, check uids */
if (!(*flags & BB_UNMARKED) && (uid[0] != '*' || uid[1] != ' ')) {
if (uidval(state->subpos->value + 2) >= uidval(uid)) {
*flags |= BB_UNMARKED;
} else {
*flags |= BB_MARKED;
}
}
if (state->lastmin < 0) {
++state->subpos, ++state->bbsubpos;
}
}
/* if a partial match, don't allow select, dump all other flags,
* and truncate name appropriately
*/
if (mlen >= 0) {
/* truncate name for partial match */
*flags = BB_NOSELECT;
key[mlen] = '\0';
state->part = key + mlen;
}
/* flag as done, and advance to next */
if (!state->inboxdone) {
state->inboxdone = 1;
} else if (state->lastmin < 0) {
++state->bbpos;
}
return (key);
}
/* do a create command, return IMSP reply string
*/
#ifdef __STDC__
char *bb_create(struct auth_state *id, char *mbox, int count, char *hostlist)
#else
char *bb_create(id, mbox, count, hostlist)
struct auth_state *id;
char *mbox;
int count;
char *hostlist;
#endif
{
char *reply = NULL, *host = NULL, *part = NULL;
char *value, *loc;
option_list *olist = NULL;
int result, created = 0;
long size;
im_conn *con;
/* don't allow create INBOX */
if (!strcasecmp(mbox, inbox)) return (rpl_inval);
/*XXX: eventually need to add replication support */
if (count > 1) return (rpl_norep);
if (mbox[strlen(mbox) - 1] == '.') return (rpl_okcreate);
/* check if mailbox already exists */
if (sdb_writelock(mboxdb, mbox, SDB_ICASE) < 0) return (rpl_dbfailure);
value = NULL;
sdb_get(mboxdb, mbox, SDB_ICASE, &value);
if (value != NULL) {
reply = rpl_exists;
} else if (bb_parentcreate(id, mbox, &loc) < 0) {
reply = rpl_nocauth;
} else if (!count) {
hostlist = loc;
}
/* get the host to use */
if (!reply) {
if (hostlist) {
/* get first host from hostlist */
host = copy_get_partition(hostlist, &part);
if (hostlist != loc
&& option_lookup("", opt_hostlist, 0, host) < 1) {
reply = rpl_badhost;
}
} else if ((olist = option_getlist("", opt_newhost, 1))
&& olist->count > 0) {
host = olist->item[0];
}
if (!host) reply = rpl_noimap;
}
/* connect to IMAP server */
if (!reply && !(con = imap_connect(host, id, 0))) {
reply = rpl_imapconn;
}
/* send CREATE command */
if (!reply) {
result = im_send(&con->buf, con->lit, proxy_create,
con->tag, mbox, part ? " " : "",
part ? part : "");
if (result < 0 || !(reply = imap_wait(con))) {
reply = rpl_imapconn;
} else if (reply[0] == 'B') {
reply = rpl_notsupported;
} else if (reply[0] == 'O' && reply[1] == 'K') {
reply = NULL;
created = 1;
}
if (con->lit[0].ptr) free(con->lit[0].ptr);
}
/* send GETACL command */
value = NULL;
if (!reply) {
size = strlen(host) + 256;
value = malloc(size);
if (!value) {
reply = rpl_nomem;
} else {
snprintf(value, size, "* . (%s) ", host);
reply = bb_addacl(mboxdb, con, mbox, &value, &size);
}
}
/* cleanup */
if (sdb_unlock(mboxdb, mbox, SDB_ICASE) < 0 && !reply) {
reply = rpl_dbfailure;
}
if (created && reply) {
/* if we created the mailbox, but something later failed, try to
* delete it
*/
if (im_send(&con->buf, con->lit, proxy_delete, con->tag, mbox) == 0) {
imap_wait(con);
}
if (con->lit[0].ptr) free(con->lit[0].ptr);
}
if (value) free(value);
if (olist) {
option_freelist(olist);
} else if (host) {
free(host);
}
return (reply);
}
/* do a proxy delete command
* host is usually NULL
* returns a status reply string
*/
char *bb_delete(id, mbox, host)
struct auth_state *id;
char *mbox, *host;
{
char *reply = NULL, *value = NULL, *myhost = host;
char *scan, *uid, *loc, *acl;
int dbdeleted = 0, len;
im_conn *con;
/* don't allow delete of inbox */
if (!strcasecmp(inbox, mbox)) return (rpl_inval);
/* check if mailbox exists */
if (sdb_writelock(mboxdb, mbox, SDB_ICASE) < 0) return (rpl_dbfailure);
if (bb_get(mbox, &uid, &loc, &acl, NULL) < 0) {
reply = rpl_notexists;
} else {
/* check delete rights */
/*XXX: need to add support for replication here */
if (!(bb_rights(id, mbox, acl) & ACL_DELETE)) {
reply = rpl_nodauth;
}
}
/* get hostname & connect to IMAP server */
if (!reply) {
if (myhost) {
len = strlen(myhost);
scan = loc;
do {
while (*scan == '(' || *scan == ' ') ++scan;
if (!strncasecmp(myhost, scan, len)) break;
while (*scan && *scan != ')' && *scan != ' ') ++scan;
} while (*scan && *scan != ')');
if (!*scan || *scan == ')') reply = rpl_wronghost;
} else {
myhost = copy_get_partition(loc, NULL);
}
if (!myhost) {
reply = rpl_nomem;
} else if (!(con = imap_connect(myhost, id, 0))) {
reply = rpl_imapconn;
}
}
/* remove mailbox from local db, keeping a record in case of error */
if (!reply) {
if ((value = malloc(strlen(uid) + 1)) == NULL) {
reply = rpl_nomem;
} else {
strcpy(value, uid);
if (sdb_remove(mboxdb, mbox, SDB_ICASE) < 0) {
reply = rpl_dbfailure;
} else {
if (sdb_unlock(mboxdb, mbox, SDB_ICASE) < 0) {
reply = rpl_dbfailure;
} else {
dbdeleted = 1;
}
}
}
}
/* send DELETE command */
if (!reply) {
if (im_send(&con->buf, con->lit, proxy_delete, con->tag, mbox) < 0
|| !(reply = imap_wait(con))) {
reply = rpl_imapconn;
} else if (reply[0] == 'B') {
reply = rpl_notsupported;
}
}
/* if we failed to delete the mailbox, but we removed it from our db,
* try to put it back
*/
if ((reply[0] != 'O' || reply[1] != 'K') && dbdeleted
&& sdb_writelock(mboxdb, mbox, SDB_ICASE) == 0) {
dbdeleted = 0;
sdb_set(mboxdb, mbox, SDB_ICASE, value);
}
/* clean up */
if (!dbdeleted) sdb_unlock(mboxdb, mbox, SDB_ICASE);
if (value) free(value);
if (myhost != host) free(myhost);
return (reply);
}
/* do a proxy rename or replace command
* returns reply string
*/
char *bb_rename(id, oldname, newname, rflag)
struct auth_state *id;
char *oldname;
char *newname;
int rflag;
{
char *reply = NULL, *host = NULL, *iname = NULL;
char *value, *uid, *loc, *acl;
int didrename = 0, result, count, i;
im_conn *con;
sdb_keyvalue *kv = NULL;
char dbname[256];
/* deal with inbox */
if (!strcasecmp(newname, inbox)) return (rpl_inval);
if (!strcasecmp(oldname, inbox)) {
int inamelen = strlen(auth_username(id)) + 6;
iname = malloc(inamelen);
if (!iname) return (rpl_nomem);
snprintf(iname, inamelen, "user.%s", auth_username(id));
oldname = iname;
}
/* lock db entries */
if (sdb_writelock(mboxdb, oldname, SDB_ICASE) < 0) return (rpl_dbfailure);
if (sdb_writelock(mboxdb, newname, SDB_ICASE) < 0) {
sdb_unlock(mboxdb, oldname, SDB_ICASE);
return (rpl_dbfailure);
}
/* make sure newname doesn't exist and check access rights */
value = NULL;
sdb_get(mboxdb, newname, SDB_ICASE, &value);
if (rflag) {
if (value == NULL) {
reply = rpl_noreplace;
}
} else if (value != NULL) {
reply = rpl_norename;
} else if (bb_parentcreate(id, newname, 0) < 0) {
reply = rpl_norauth;
}
/* make sure oldname exists and check access rights */
if (!reply) {
if (bb_get(oldname, &uid, &loc, &acl, NULL) < 0) {
reply = rpl_notexists;
} else if (!(bb_rights(id, oldname, acl) & ACL_DELETE)) {
reply = rpl_norauth;
}
}
/* get host and connect to server */
if (!reply) {
host = copy_get_partition(loc, NULL);
if (!(con = imap_connect(host, id, 0))) {
reply = rpl_imapconn;
}
}
/* send RENAME command (or DELETE command if replacing) */
if (!reply) {
result = im_send(&con->buf, con->lit,
rflag ? proxy_delete : proxy_rename,
con->tag, oldname, newname);
if (result < 0 || !(reply = imap_wait(con))) {
reply = rpl_imapconn;
} else if (reply[0] == 'B') {
reply = rpl_notsupported;
} else if (reply[0] == 'O' && reply[1] == 'K') {
didrename = 1;
}
if (con->lit[0].ptr) free(con->lit[0].ptr);
}
/* attempt to update the database */
if (didrename) {
if (rflag == 0 && sdb_set(mboxdb, newname, SDB_ICASE, uid) < 0) {
reply = rpl_dbfailure;
} else if (iname) {
if (bb_last(oldname, 0, NULL) < 0) {
reply = rpl_dbfailure;
}
} else if (sdb_remove(mboxdb, oldname, SDB_ICASE) < 0) {
reply = rpl_dbfailure;
sdb_remove(mboxdb, newname, SDB_ICASE);
}
}
/* unlock mbox db */
if (sdb_unlock(mboxdb, newname, SDB_ICASE) < 0 && didrename) {
reply = rpl_dbfailure;
}
if (sdb_unlock(mboxdb, oldname, SDB_ICASE) < 0 && didrename) {
reply = rpl_dbfailure;
}
if (didrename && reply != rpl_dbfailure && !iname) {
/* update changed file on success */
sdb_create(changedb);
if (sdb_writelock(changedb, NULL, SDB_ICASE) >= 0) {
if (sdb_match(changedb, "*", SDB_ICASE | GLOB_SUBSTRING,
oldname, 1, &kv, &count)==0) {
/* we have some old entries to update */
for (i = count; i--; ) {
if (!strcasecmp(kv[count].key, newname)) {
sdb_remove(changedb, kv[count].key, SDB_ICASE);
} else {
sdb_set(changedb, kv[count].key, SDB_ICASE, newname);
}
}
}
sdb_set(changedb, oldname, SDB_ICASE, newname);
sdb_unlock(changedb, NULL, SDB_ICASE);
if (kv) sdb_freematch(kv, count, 1);
}
/* update user's subscriptions file */
snprintf(dbname, sizeof(dbname), "user/%s/subs", auth_username(id));
if (sdb_get(dbname, oldname, SDB_ICASE, &value) >= 0 && value != NULL) {
bb_subscribe(id, newname, 1);
bb_subscribe(id, oldname, 0);
}
}
/* cleanup */
if (didrename && reply == rpl_dbfailure && !rflag) {
/* if we did the rename, but the db update failed, try to undo */
result = im_send(&con->buf, con->lit, proxy_rename,
con->tag, newname, oldname);
if (result == 0) imap_wait(con);
if (con->lit[0].ptr) free(con->lit[0].ptr);
}
if (host) free(host);
if (iname) free(iname);
return (reply);
}
/* set access control list
*/
char *bb_setacl(id, mbox, ident, rights)
struct auth_state *id;
char *mbox, *ident, *rights;
{
char *uid, *loc, *acl;
char *reply = NULL, *host = NULL, *value = NULL;
long size;
im_conn *con;
/* lock entry */
if (sdb_writelock(mboxdb, mbox, SDB_ICASE) < 0) {
return (rpl_dbfailure);
}
if (bb_get(mbox, &uid, &loc, &acl, NULL) < 0) {
/* bboard lookup failed */
reply = rpl_notexists;
} else if (!(bb_rights(id, mbox, acl) & ACL_ADMIN)) {
/* verify administer rights failed */
reply = rpl_noaauth;
} else if ((host = copy_get_partition(loc, NULL)) == NULL) {
/* get hostname failed */
reply = rpl_nomem;
} else if (!(con = imap_connect(host, id, 0))) {
/* connect to imap server failed */
reply = rpl_imapconn;
} else if (im_send(&con->buf, con->lit,
rights ? proxy_setacl : proxy_delacl,
con->tag, mbox, ident, rights) < 0) {
/* send proxy command failed */
reply = rpl_imapconn;
} else if (!(reply = imap_wait(con))) {
/* server response failed */
reply = rpl_imapconn;
} else if (reply[0] == 'B') {
/* BAD -- IMAP server doesn't support SETACL */
reply = rpl_notsupported;
} else if (reply[0] == 'O' && reply[1] == 'K') {
/* setacl successful -- now we need to GETACL to update localdb */
size = acl - uid + 256;
value = malloc(size);
if (!value) {
reply = rpl_nomem;
} else {
strncpy(value, uid, acl - uid);
value[acl - uid] = '\0';
reply = bb_addacl(mboxdb, con, mbox, &value, &size);
}
}
/* cleanup */
if (sdb_unlock(mboxdb, mbox, SDB_ICASE) < 0) {
reply = rpl_dbfailure;
}
if (value) free(value);
if (host) free(host);
return (reply);
}
/* set the last read mark for a mailbox. May add mailbox to local db.
* returns -1 on failure, 0 on success
*/
int bb_last(mbox, uid, host)
char *mbox, *uid, *host;
{
char *old = NULL, *new = NULL, *scan;
int ulen, result = -1, result1;
long size;
im_conn *con;
/* lock entry */
if (sdb_writelock(mboxdb, mbox, SDB_ICASE) < 0) {
return (-1);
}
/* check if entry exists */
if (sdb_get(mboxdb, mbox, SDB_ICASE, &old) >= 0) {
if (old == NULL) {
/* if entry doesn't exist, connect to server, get ACL,
* and add to database
*/
size = strlen(uid) + strlen(host) + 256;
if ((con = imap_connect(host, NULL, 1)) != NULL
&& (new = malloc(size)) != NULL) {
snprintf(new, size, "%s . (%s) ", uid, host);
if (bb_addacl(mboxdb, con, mbox, &new, &size) == NULL) {
result = 0;
}
}
} else {
/* see if we can do it in place */
for (scan = old; *scan && *scan != ' '; ++scan);
ulen = strlen(uid);
if (scan - old == ulen) {
new = old;
strncpy(new, uid, ulen);
} else {
new = malloc(strlen(old) - (scan - old) + ulen + 1);
if (new) {
strcpy(new, uid);
strcat(new, scan);
}
}
/* update db if we have a new entry, and cleanup */
if (new) result = sdb_set(mboxdb, mbox, SDB_ICASE, new);
}
}
/* cleanup */
result1 = sdb_unlock(mboxdb, mbox, SDB_ICASE);
if (!result) result = result1;
if (new && new != old) free(new);
return (result);
}
/* set the seen mark for a mailbox. May add to subscription list, but
* won't change subscription status.
* returns -1 on failure, 0 on success
*/
int bb_seen(mbox, uid, user)
char *mbox, *uid, *user;
{
char *value, *new = NULL;
char dbname[256];
int result = -1, result1, newlen;
/* set the db name */
snprintf(dbname, sizeof(dbname), "user/%s/subs", user);
/* sanity check for existance of mbox & subscription list */
if (sdb_get(mboxdb, mbox, SDB_ICASE, &value) < 0 || !value
|| sdb_writelock(dbname, mbox, SDB_ICASE) < 0) {
return (-1);
}
/* get old subscription status */
sdb_get(dbname, mbox, SDB_ICASE, &value);
if (!value) value = "0";
/* set new value */
newlen = strlen(uid) + 3;
new = malloc(newlen);
if (new) {
snprintf(new, newlen, "%c %s", *value, uid);
result = sdb_set(dbname, mbox, SDB_ICASE, new);
}
/* clean up */
result1 = sdb_unlock(dbname, mbox, SDB_ICASE);
if (!result) result = result1;
if (new) free(new);
return (result);
}
cyrus-imspd-v1.8/imsp/bb.h 0100644 0043101 0000012 00000013356 07050633536 014707 0 ustar shadow staff /* bb.h -- bboard subscriptions/update/location databases
*
* (C) Copyright 1993-1994 by Carnegie Mellon University
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Chris Newman
* Start Date: 5/3/93
*/
#include "auth.h" /* for struct auth_state */
/* structure to hold state for bb searches */
typedef struct bb_state {
/* all fields are private to bb module */
sdb_keyvalue *bb, *bbpos, *bbend; /* start, position, end of bboard list */
sdb_keyvalue *subs, *subpos, *subend; /* ditto for subscription list */
/* The next two fields are a cool efficiency hack -- they keep a list
* of pointers into the bb list for each subscription entry
*/
sdb_keyvalue **bbsub, **bbsubpos;
int subchgflag; /* if a bboard was deleted/renamed */
int inboxdone; /* flag if inbox has been done */
/* this is only non-NULL when the LIST pattern ends in a %. It is used
* to find partial matches
*/
glob *pglob;
int lastmin; /* last minimum partial match */
char *part; /* pointer to partial match '.' set to '\0' */
int inboxlen;
char inboxname[AUTH_USERMAX + 6];
} bb_state;
/* status flags */
#define BB_SUBSCRIBED 0x01 /* user is subscribed to bboard */
#define BB_MARKED 0x02 /* bboard does contain unseen messages */
#define BB_UNMARKED 0x04 /* bboard doesn't contain unseen messages */
#define BB_NOSELECT 0x08 /* prefix to bboard */
#define BB_NOINFERIOR 0x10 /* can't have children appear */
/* shortcuts -- these pairs are mutually exclusive in this implementation: */
#define BB_STATE (BB_NOSELECT | BB_NOINFERIOR)
#define BB_MARK (BB_MARKED | BB_UNMARKED)
#ifdef __STDC__
/* bb_subsinit(user)
* initialize bboard subscriptions for user
*/
int bb_subsinit(char *);
/* bb_subscribe(id, name, subscribe)
* subscribe/unsubscribe to a bboard
* returns -1 on failure, 0 on success, 1 if already subscribed/unsubscribed
*/
int bb_subscribe(struct auth_state *, char *, int);
/* bb_matchstart(state, user, pattern)
* begin a match
* returns -1 on failure
*/
int bb_matchstart(bb_state *, char *, char *);
/* bb_matchverify(state, id, pattern, oldname, newname, autosub);
* check if any matching subscriptions have been renamed or deleted
* (will call bb_subscribe to change entries as necessary)
* must be called after bb_matchstart and before bb_match
* *newname will be set to NULL in case *oldname was deleted.
* *autosub will be set to 1 if the user's subscription status to *newname
* was changed. Otherwise *autosub will be set to 0.
* returns -1 on fatal error (no need to call bb_matchdone)
* returns 0 if matching subscriptions are fully verified.
* returns 1 if a rename/delete is being returned. Call must call
* bb_matchverify again.
*/
int bb_matchverify(bb_state *, struct auth_state *, char *, char **, char **, int *);
/* bb_match(state, id, name, loc, flags, sep_char, subonly);
* get the next match
* returns *name, or NULL
* *name and *loc could vanish if any other db calls are made
* if subonly is set, only subscribed bboards will be returned.
*/
char *bb_match(bb_state *, struct auth_state *, char **, char **, char *, int *, int);
/* finish mailbox matching
*/
void bb_matchdone(bb_state *);
/* bb_create(id, mbox, hostcount, hostlist)
* do proxy IMAP to create a new bboard
* returns NULL on success, error message on failure
*/
char *bb_create(struct auth_state *, char *, int, char *);
/* bb_delete(id, mbox, host)
* do a proxy delete command
* host is usually NULL
* returns a status reply string
*/
char *bb_delete(struct auth_state *, char *, char *);
/* bb_rename(id, oldname, newname, replace_flag)
* do a proxy rename or a replace
* returns a status reply string
*/
char *bb_rename(struct auth_state *, char *, char *, int);
/* bb_setacl(id, mbox, ident, rights)
* do a proxy SETACL/DELETEACL command
* rights = NULL for DELETEACL
*/
char *bb_setacl(struct auth_state *, char *, char *, char *);
/* bb_get(name, uid, hostlist, acl, sep_char)
* get info about a bboard
* returns -1 on failure, 0 on success
*/
int bb_get(char *, char **, char **, char **, char *);
/* bb_last(mailbox, uid, host)
* set the last read mark for a mailbox. May add mailbox to local db.
* returns -1 on failure, 0 on success
*/
int bb_last(char *, char *, char *);
/* bb_seen(mailbox, uid, user)
* set the seen mark for a mailbox. May add to subscription list, but
* won't change subscription status.
* returns -1 on failure, 0 on success
*/
int bb_seen(char *, char *, char *);
/* bb_rights(id, mailbox, acl)
* returns the rights bitmask for the acl list
*/
long bb_rights(struct auth_state *, char *, char *);
#else
int bb_subscribe(), bb_matchstart(), bb_matchverify(), bb_get();
char *bb_match(), *bb_create(), *bb_delete(), *bb_rename(), *bb_setacl();
int bb_last(), bb_seen(), bb_subsinit();
long bb_rights();
#endif
cyrus-imspd-v1.8/imsp/dispatch.c 0100644 0043101 0000012 00000033066 07765430215 016120 0 ustar shadow staff /* dispatch.c -- dispatch routines
*
* Copyright (c) 1993-2000 Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The name "Carnegie Mellon University" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For permission or any other legal
* details, please contact
* Office of Technology Transfer
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213-3890
* (412) 268-4387, fax: (412) 268-7395
* tech-transfer@andrew.cmu.edu
*
* 4. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Computing Services
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris Newman
* SASL foo: Tim Martin