summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 05003d1805c9dafc8ccb626f296e657de07a7b34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
AC_INIT(slapi-nis,0.0)
AM_INIT_AUTOMAKE(foreign)
AC_PROG_LIBTOOL
AM_CONDITIONAL(GCC,[test x$GCC = xyes])
AM_MAINTAINER_MODE

AC_ARG_WITH(tcp-wrappers,
	    AS_HELP_STRING([--with-tcp-wrappers=AUTO]
	    		   [use tcp-wrappers]),
	    tcp_wrappers=$withval,tcp_wrappers=AUTO)
AC_CHECK_HEADERS(tcpd.h)
if test x$ac_cv_header_tcpd_h != xyes ; then
	if test x$tcp_wrappers = xyes ; then
		AC_MSG_ERROR([tcp-wrappers enabled but tcpd.h not found])
	elif test x$tcp_wrappers != xno ; then
		AC_MSG_WARN([tcp-wrappers enabled but tcpd.h not found])
	fi
else
	saved_LIBS="$LIBS"
	LIBS=
	AC_CHECK_FUNC(hosts_access,,AC_CHECK_LIB(wrap,hosts_access))
	LIBWRAP="$LIBS"
	LIBS="$saved_LIBS"
fi
AC_SUBST(LIBWRAP)

AC_ARG_WITH(domain,
	    AS_HELP_STRING([--with-domain=[[example.com]]],
	    		   [select a default domain name]),
	    mydomain=$withval,
	    mydomain=example.com)
mysuffix=`echo "$mydomain" | sed -e 's:^:dc=:g' -e 's:\.:, dc=:g'`
AC_ARG_WITH(server,
	    AS_HELP_STRING([--with-server=[[dirsrv]]],
	    		   [select a specific server implementation (dirsrv)]),
	    server=$withval,
	    server=dirsrv)

case "$server" in
dirsrv)
	PKG_CHECK_MODULES(RUNTIME,nss nspr)
	saved_CFLAGS="$CFLAGS"
	saved_LIBS="$LIBS"
	CFLAGS="$CFLAGS $RUNTIME_CFLAGS"
	LIBS="$LIBS $RUNTIME_LIBS"
	AC_CHECK_HEADER(dirsrv/slapi-plugin.h,
			AC_DEFINE(HAVE_DIRSRV_SLAPI_PLUGIN_H,1,
				[Define if you have <dirsrv/slapi-plugin.h>]),,[
			#include <nspr.h>
			#include <nss.h>
			])
	if test x$ac_cv_header_dirsrv_slapi_plugin_h = xno ; then
		AC_ERROR([<dirsrv/slapi-plugin.h> not found])
	fi
	CFLAGS="$saved_CFLAGS"
	LIBS="$saved_LIBS"
	AC_DEFINE(USE_NSPR_THREADS,1,[Define to use NSPR's threading functions.])
	;;
*)
	RUNTIME_CFLAGS=
	RUNTIME_LIBS=
	AC_CHECK_HEADERS(slapi-plugin.h)
	if test x$ac_cv_header_slapi_plugin_h = xno ; then
		AC_ERROR([<slapi-plugin.h> not found])
	fi
	AC_DEFINE(USE_PTHREADS,1,[Define to use POSIX threading functions.])
	saved_LIBS="$LIBS"
	LIBS=
	AC_CHECK_FUNC(pthread_create,,AC_CHECK_LIB(pthread,pthread_create))
	LIBPTHREAD="$LIBS"
	LIBS="$saved_LIBS"
esac
AC_SUBST(LIBPTHREAD)

mylibdir=`eval echo "$libdir" | sed "s,NONE,${ac_default_prefix},g"`
mylibdir=`eval echo "$mylibdir" | sed "s,NONE,${ac_prefix},g"`
case "$server" in
dirsrv)
	myplugindir="$mylibdir/dirsrv/plugins"
	;;
openldap)
	myplugindir="$mylibdir/openldap"
	;;
*)
	myplugindir="$mylibdir/$PACKAGE"
	;;
esac

AC_SUBST(myplugindir)
AC_SUBST(mydomain)
AC_SUBST(mysuffix)

AC_DEFINE(DEFAULT_MAX_DGRAM_SIZE,YPMAXRECORD,[Define to the default maximum datagram reply size.])
AC_DEFINE(DEFAULT_MAX_VALUE_SIZE,(256 * 1024),[Define to the default maximum map entry key and value size.])
AC_DEFINE(DEFAULT_TARGET_REPLY_SIZE,(4 * 1024),[Define to the default target size for a connected reply fragment.])

AC_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile src/Makefile plugin.ldif)