configure.in   [plain text]


dnl	This file is an input file used by the GNU "autoconf" program to
dnl	generate the file "configure", which is run during Tk installation
dnl	to configure the system for the local environment.
AC_INIT(neoXldap.c)
# $OpenLDAP$

AC_REVISION([$Id: 16b135293616700c63077e9a1a601681d4442fdd $])

NEO_VERSION=2.0
NEO_MAJOR_VERSION=2
NEO_MINOR_VERSION=0
VERSION=${NEO_VERSION}

if test "${prefix}" = "NONE"; then
    prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
    exec_prefix=$prefix
fi

AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
    [neo_ok=$enableval], [neo_ok=no])
if test "$neo_ok" = "yes"; then
    AC_PROG_CC
else
    CC=${CC-cc}
AC_SUBST(CC)
fi

AC_PROG_INSTALL(install-sh)
AC_PROG_RANLIB

if test ! -f $exec_prefix/lib/tclConfig.sh
then
    AC_MSG_ERROR(Tcl must be installed first)
fi

. $exec_prefix/lib/tclConfig.sh

if test ! -f $exec_prefix/lib/tclxConfig.sh
then
    AC_MSG_ERROR(Extended Tcl must be installed first)
fi
. $exec_prefix/lib/tclxConfig.sh


#--------------------------------------------------------------------
#	See if there was a command-line option for where Tk is;  if
#	not, assume that its top-level directory is a sibling of ours.
#--------------------------------------------------------------------

AC_ARG_WITH(tk, [  --with-tk=DIR          use Tk 8.0 binaries from DIR],
	, with_tk=yes)

case "$with_tk" in
    yes)
	if test -f $exec_prefix/lib/tkConfig.sh &&
	   test -f $exec_prefix/lib/tkxConfig.sh
	then
	    :
	else
	    AC_MSG_ERROR(Tk does not appear to be installed at $exec_prefix)
	fi
	;;
    no) ;;
    *)  AC_MSG_ERROR(Tk cannot be specified and must be in $exec_prefix)
	;;
esac

AC_ARG_WITH(x, [  --without-x            do not build/install ldapwish])
if test "$with_x" = "no"
then
    with_tk=no
fi

if test "$with_tk" != "no"
then
    LDAPWISH=ldapwish
    . $exec_prefix/lib/tkConfig.sh
    . $exec_prefix/lib/tkxConfig.sh
fi
AC_SUBST(TK_LIBS)
AC_SUBST(TK_LIB_SPEC)
AC_SUBST(TK_XINCLUDES)
AC_SUBST(TK_VERSION)
AC_SUBST(TKX_LIB_SPEC)
AC_SUBST(LDAPWISH)

#--------------------------------------------------------------------
#	Read in configuration information generated by Tcl for shared
#	libraries, and arrange for it to be substituted into our
#	Makefile.
#--------------------------------------------------------------------

CC=$TCL_CC
SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
SHLIB_LD=$TCL_SHLIB_LD
SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
SHLIB_VERSION=$TCL_SHLIB_VERSION
DL_LIBS=$TCL_DL_LIBS
LD_FLAGS=$TCL_LD_FLAGS
NEO_LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS

eval "NEO_SHARED_LIB_FILE=libldaptcl${TCL_SHARED_LIB_SUFFIX}"
eval "NEO_UNSHARED_LIB_FILE=libldaptcl${TCL_UNSHARED_LIB_SUFFIX}"

#--------------------------------------------------------------------
#	The statements below define a collection of symbols related to
#	building libldap as a shared library instead of a static library.
#--------------------------------------------------------------------

# Warning: in order to use the following code for libldap and libdb versions,
# the VERSION shell variable is modified, and then is restored after.

AC_ARG_ENABLE(shared,
    [  --enable-shared         build libldaptcl as a shared library],
    [ok=$enableval], [ok=no])
if test "$ok" = "yes" && test "${SHLIB_SUFFIX}" != ""; then
    NEO_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
    eval "NEO_LIB_FILE=libldaptcl${TCL_SHARED_LIB_SUFFIX}"
    MAKE_LIB="\${SHLIB_LD} $TCL_LIB_HNAME -o ${NEO_LIB_FILE} \${OBJS} \${LDAP_LIBFLAGS}"
    RANLIB=":"
else
    NEO_SHLIB_CFLAGS=""
    eval "NEO_LIB_FILE=libldaptcl${TCL_UNSHARED_LIB_SUFFIX}"
    MAKE_LIB="ar cr ${NEO_LIB_FILE} \${OBJS}"
fi

AC_ARG_WITH(ldap, [  --with-ldap=<dir>           common parent of ldap include and lib dirs],
	[neo_ldap=$withval
	case $withval in
	    yes) ldapdir=/usr/local
		 ;;
	    no)  ;;
	    *)	 ldapdir=$withval
		 neo_ldap=yes
		 ;;
	esac
	], [
	    neo_ldap=yes
	    ldapdir=/usr/local
	])

ldapincdir=$ldapdir/include
AC_ARG_WITH(ldap-incdir, [  --with-ldap-incdir=<dir>    path to ldap.h],
	[ldapincdir=$withval])

ldaplibdir=$ldapdir/lib
AC_ARG_WITH(ldap-libdir, [  --with-ldap-libdir=<dir>    path to ldap and lber libs],
	[ldaplibdir=$withval])

AC_ARG_WITH(ldap-libraries, [  --with-ldap-libflags=<libnames>   -l flags for ldap libraries],
	[ldaplibflags="-L$ldaplibdir $withval"],
	[ldaplibflags="-L$ldaplibdir -lldap -llber"])

ldapinclude="-I$ldapincdir"

ldapbuild=yes

AC_SUBST(ldaplibflags)
AC_SUBST(ldapinclude)
AC_SUBST(ldapbuild)
AC_SUBST(ldapdir)
AC_SUBST(ldapincdir)


VERSION=${NEO_VERSION}
# Note:  in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..":  this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.

if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
    NEO_BUILD_LIB_SPEC="-L`pwd` -lldaptcl${VERSION}"
    NEO_LIB_SPEC="-L${exec_prefix}/lib -lldaptcl${VERSION}"
else
    NEO_BUILD_LIB_SPEC="-L`pwd` -lldaptcl`echo ${VERSION} | tr -d .`"
    NEO_LIB_SPEC="-L${exec_prefix}/lib -lldaptcl`echo ${VERSION} | tr -d .`"
fi

AC_SUBST(CC)
AC_SUBST(LIBS)
AC_SUBST(DL_LIBS)
AC_SUBST(LD_FLAGS)
AC_SUBST(MATH_LIBS)
AC_SUBST(MAKE_LIB)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(SHLIB_VERSION)
AC_SUBST(TCLX_TOP_DIR)
AC_SUBST(TCLX_TCL_DIR)
AC_SUBST(TCLX_LIB_SPEC)
AC_SUBST(ITCL_LIB_SPEC)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_LD_SEARCH_FLAGS)
AC_SUBST(TCL_LIB_HNAME)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_VERSION)
AC_SUBST(NEO_BUILD_LIB_SPEC)
AC_SUBST(NEO_LD_SEARCH_FLAGS)
AC_SUBST(NEO_SHARED_LIB_FILE)
AC_SUBST(NEO_UNSHARED_LIB_FILE)
AC_SUBST(NEO_LIB_FILE)
AC_SUBST(NEO_LIB_SPEC)
AC_SUBST(NEO_MAJOR_VERSION)
AC_SUBST(NEO_MINOR_VERSION)
AC_SUBST(NEO_SHLIB_CFLAGS)
AC_SUBST(NEO_VERSION)
dnl AC_SUBST(XINCLUDES)
dnl AC_SUBST(XLIBSW)

AC_OUTPUT(Makefile pkgIndex.tcl)