Skip to content
Snippets Groups Projects
configure.in 34.2 KiB
Newer Older
	AC_CHECK_HEADERS(dmalloc.h)
	AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
fi

# ud needs termcap (should insert check here)
ol_link_termcap=no
AC_CHECK_HEADERS(termcap.h ncurses.h)

if test $ol_link_termcap = no ; then
	AC_CHECK_LIB(termcap, tputs, [have_termcap=yes], [have_termcap=no])
	if test $have_termcap = yes ; then
		AC_DEFINE(HAVE_TERMCAP)
		ol_link_termcap=yes
		TERMCAP_LIBS=-ltermcap
	fi
fi

if test $ol_link_termcap = no ; then
	AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
	if test $have_ncurses = yes ; then
		AC_DEFINE(HAVE_NCURSES)
		ol_link_termcap=yes
		TERMCAP_LIBS=-lncurses
	fi
fi

if test $ol_link_termcap = no ; then
	AC_DEFINE(NO_TERMCAP,1)
	TERMCAP_LIBS=
fi

# FreeBSD (and others) have crypt(3) in -lcrypt
if test $ol_enable_crypt != no ; then
	AC_CHECK_FUNC(crypt, [have_crypt=yes], [
		AC_CHECK_LIB(crypt, crypt, [LUTIL_LIBS="$LUTIL_LIBS -lcrypt"
			have_crypt=yes], [have_crypt=no])])

	if test $have_crypt = yes ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
		AC_DEFINE(HAVE_CRYPT,1)
	else
		AC_MSG_WARN(could not find crypt)
		if test $ol_enable_crypt = yes ; then
			AC_MSG_ERROR(could not find crypt, select appropriate options or disable)
		fi

		AC_MSG_WARN(disabling crypt support)
		ol_enable_crypt=no
	fi
fi

Kurt Zeilenga's avatar
Kurt Zeilenga committed
# FreeBSD (and others) have setproctitle(3) in -lutil
if test $ol_enable_proctitle != no ; then
	AC_CHECK_FUNC(setproctitle,	[have_setproctitle=yes], [
		AC_CHECK_LIB(util, setproctitle,
			[have_setproctitle=yes
			LUTIL_LIBS="$LUTIL_LIBS -lutil"],
			[have_setproctitle=no
			LIBOBJS="$LIBOBJS setproctitle.o"])])

	if test $have_setproctitle = yes ; then
		AC_DEFINE(HAVE_SETPROCTITLE,1)
	fi
fi

dnl ----------------------------------------------------------------
dnl Checks for header files.
AC_HEADER_STDC

if test $ac_cv_header_stdc != yes; then
	AC_MSG_WARN([could not Standard C compliant headers])
fi

AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
if test $am_cv_sys_posix_termios = yes ; then
	AC_DEFINE(HAVE_POSIX_TERMIOS,1)
fi

AC_CHECK_HEADERS(	\
	crypt.h			\
	errno.h			\
	fcntl.h			\
	filio.h			\
	getopt.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
	libutil.h		\
	limits.h		\
	malloc.h		\
	memory.h		\
	regex.h			\
	sgtty.h			\
	stdarg.h		\
	stddef.h		\
	string.h		\
	strings.h		\
	sys/file.h		\
Kurt Zeilenga's avatar
Kurt Zeilenga committed
	sys/filio.h		\
	sys/errno.h		\
	sys/ioctl.h		\
	sys/param.h		\
	sys/socket.h	\
	sys/syslog.h	\
	sys/types.h		\
	syslog.h		\
	termios.h		\
)

dnl ----------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_GETGROUPS dnl requires AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
AC_HEADER_TIME
AC_STRUCT_TM

OL_C_UPPER_LOWER
AC_C_CONST
if test $cross_compiling = yes ; then
	AC_DEFINE(CROSS_COMPILING, 1)
	AC_CHECK_SIZEOF(short) 
	AC_CHECK_SIZEOF(int) 
	AC_CHECK_SIZEOF(long)
dnl ----------------------------------------------------------------
dnl Checks for library functions.
AC_FUNC_MEMCMP
dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF

if test $ac_cv_func_vprintf = yes ; then
	dnl check for vsnprintf
	AC_CHECK_FUNCS(vsnprintf vsprintf)
AC_FUNC_WAIT3

AC_CHECK_FUNCS(		\
	bcopy			\
	flock			\
	getdtablesize	\
	gethostname		\
	gettimeofday	\
	lockf			\
	memcpy			\
	memmove			\
	mkstemp			\
	res_search		\
	select			\
	setpwfile		\
	setsid			\
	signal			\
	sigset			\
	socket			\
	strerror		\
	strrchr			\
	strsep			\
	strstr			\
	strtok			\
	strtol			\
	strtoul			\
	sysconf			\
	waitpid			\
)

# these functions are required to build a thread_safe -lldap
AC_CHECK_FUNCS(		\
	strtok_r		\
	ctime_r			\
	gethostbyaddr_r \
	gethostbyname_r	\
)

if test $ac_cv_func_strtok_r = yes \
	-a $ac_cv_func_ctime_r = yes \
	-a $ac_cv_func_gethostbyaddr_r = yes \
	-a $ac_cv_func_gethostbyname_r = yes \
	; then

	AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT, 1)
fi

if test $ol_link_threads != no ; then
	AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE, 1)
fi

dnl We actually may need to replace more than this.
AC_REPLACE_FUNCS(getopt strdup tempnam)

dnl ----------------------------------------------------------------
# Check Configuration
OL_SYS_ERRLIST

dnl ----------------------------------------------------------------
dnl Sort out defines

if test "$ol_enable_debug" != no ; then
	AC_DEFINE(LDAP_DEBUG,1)
fi
if test "$ol_enable_syslog" = yes ; then
if test "$ol_enable_libui" = yes ; then
	AC_DEFINE(LDAP_LIBUI,1)
fi
if test "$ol_enable_cache" = no ; then
	AC_DEFINE(LDAP_NOCACHE,1)
fi
if test "$ol_enable_dns" != no ; then
	AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_DNS,LDAP_API_VENDOR_VERSION,1)
if test "$ol_enable_proctitle" != no ; then
Kurt Zeilenga's avatar
Kurt Zeilenga committed
	AC_DEFINE(LDAP_PROCTITLE,1)
fi
if test "$ol_enable_referrals" != no ; then
	AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_API_VENDOR_VERSION,1)
if test "$ol_enable_cldap" != no ; then
	AC_DEFINE(LDAP_CONNECTIONLESS,1)
fi

if test "$ol_enable_aclgroups" != no ; then
	AC_DEFINE(SLAPD_ACLGROUPS,1)
if test "$ol_enable_crypt" != no ; then
	AC_DEFINE(SLAPD_CRYPT,1)
fi
if test "$ol_enable_cleartext" != no ; then
if test "$ol_enable_phonetic" != no ; then
	AC_DEFINE(SLAPD_PHONETIC,1)
fi
if test "$ol_enable_rlookups" != no ; then
	AC_DEFINE(SLAPD_RLOOKUPS,1)
fi

if test "$ol_link_ldbm" != no ; then
	AC_DEFINE(SLAPD_LDBM,1)
	BUILD_SLAPD=yes
	BUILD_LDBM=yes
fi

if test "$ol_enable_passwd" != no ; then
	AC_DEFINE(SLAPD_PASSWD,1)
	BUILD_SLAPD=yes
	BUILD_PASSWD=yes
fi

if test "$ol_enable_shell" != no ; then
	AC_DEFINE(SLAPD_SHELL,1)
	BUILD_SLAPD=yes
	BUILD_SHELL=yes
fi

if test "$ol_enable_slurpd" != no -a "$ol_link_threads" != no -a \
	$BUILD_SLAPD = yes ; then
	BUILD_SLURPD=yes
fi

if test "$ol_link_isode" != no ; then
	BUILD_LDAPD=yes
dnl ----------------------------------------------------------------

AC_SUBST(BUILD_LDAPD)
AC_SUBST(BUILD_SLAPD)
  AC_SUBST(BUILD_LDBM)
  AC_SUBST(BUILD_PASSWD)
  AC_SUBST(BUILD_SHELL)
AC_SUBST(BUILD_SLURPD)


AC_SUBST(LDAP_LIBS)
AC_SUBST(LDAPD_LIBS)
AC_SUBST(SLAPD_LIBS)
AC_SUBST(SLURPD_LIBS)
AC_SUBST(LDBM_LIBS)
AC_SUBST(LTHREAD_LIBS)
AC_SUBST(LUTIL_LIBS)

AC_SUBST(KRB_LIBS)
AC_SUBST(TERMCAP_LIBS)

dnl ----------------------------------------------------------------
dnl final output
dnl

AC_OUTPUT( \
Makefile:build/top.mk:Makefile.in:build/dir.mk \
doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
doc/man/Makefile:build/top.mk:doc/man/Makefile.in:build/dir.mk \
doc/man/man1/Makefile:build/top.mk:doc/man/man1/Makefile.in:build/man.mk \
doc/man/man3/Makefile:build/top.mk:doc/man/man3/Makefile.in:build/man.mk \
doc/man/man5/Makefile:build/top.mk:doc/man/man5/Makefile.in:build/man.mk \
doc/man/man8/Makefile:build/top.mk:doc/man/man8/Makefile.in:build/man.mk \
clients/Makefile:build/top.mk:clients/Makefile.in:build/dir.mk \
clients/finger/Makefile:build/top.mk:clients/finger/Makefile.in:build/rules.mk \
clients/fax500/Makefile:build/top.mk:clients/fax500/Makefile.in:build/rules.mk \
clients/gopher/Makefile:build/top.mk:clients/gopher/Makefile.in:build/rules.mk \
clients/mail500/Makefile:build/top.mk:clients/mail500/Makefile.in:build/rules.mk \
clients/rcpt500/Makefile:build/top.mk:clients/rcpt500/Makefile.in:build/rules.mk \
clients/ud/Makefile:build/top.mk:clients/ud/Makefile.in:build/rules.mk \
clients/tools/Makefile:build/top.mk:clients/tools/Makefile.in:build/rules.mk \
include/Makefile:build/top.mk:include/Makefile.in \
libraries/Makefile:build/top.mk:libraries/Makefile.in:build/dir.mk 	\
libraries/libavl/Makefile:build/top.mk:libraries/libavl/Makefile.in:build/lib.mk:build/lib-static.mk	\
libraries/liblber/Makefile:build/top.mk:libraries/liblber/Makefile.in:build/lib.mk:build/lib-shared.mk	\
libraries/libldap/Makefile:build/top.mk:libraries/libldap/Makefile.in:build/lib.mk:build/lib-shared.mk	\
libraries/libldap_r/Makefile:build/top.mk:libraries/libldap_r/Makefile.in:build/lib.mk:build/lib-shared.mk	\
libraries/libldbm/Makefile:build/top.mk:libraries/libldbm/Makefile.in:build/lib.mk:build/lib-static.mk	\
libraries/libldif/Makefile:build/top.mk:libraries/libldif/Makefile.in:build/lib.mk:build/lib-static.mk	\
libraries/liblthread/Makefile:build/top.mk:libraries/liblthread/Makefile.in:build/lib.mk:build/lib-static.mk	\
libraries/liblutil/Makefile:build/top.mk:libraries/liblutil/Makefile.in:build/lib.mk:build/lib-static.mk	\
servers/Makefile:build/top.mk:servers/Makefile.in:build/dir.mk \
servers/ldapd/Makefile:build/top.mk:servers/ldapd/Makefile.in:build/srv.mk \
servers/slapd/Makefile:build/top.mk:servers/slapd/Makefile.in:build/srv.mk \
servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/srv.mk \
servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/srv.mk \
servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/srv.mk \
servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/Makefile.in:build/srv.mk \
servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
tests/Makefile:build/top.mk:tests/Makefile.in \
Kurt Zeilenga's avatar
Kurt Zeilenga committed
,[
date > stamp-h
echo Please \"make depend\" to build dependencies
])