# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(srvsvc, 1.0, support@likewisesoftware.com)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_CPPFLAGS='-I$(top_srcdir)/include -I$(top_builddir)/include'
AM_CFLAGS="-Wall -Werror -fno-strict-aliasing"
AM_LDFLAGS=""
# Platform-specific stuff
MOD_EXT=".so"
DS_FRAMEWORK_LDFLAGS=""
case "$host_os:$host_cpu" in
linux*:i?86|linux*:x86_64|linux*:s390*)
AC_DEFINE([__LWI_LINUX__], [], [Define if OS is Linux])
;;
solaris*:i?86|solaris*:sparc*)
AC_DEFINE([__LWI_SOLARIS__], [], [Define if OS is Solaris])
AC_DEFINE([__EXTENSIONS__], [], [Solaris requires this macro to be defined to enable
several function declarations like:
settimeofday(3) in sys/time.h
vsyslog(3) in syslog.h])
AC_DEFINE([_XOPEN_SOURCE], [500], [Define to desired XOPEN compliance level])
;;
darwin*:*)
DS_FRAMEWORK_LDFLAGS="-framework DirectoryService"
AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin])
;;
freebsd*:*)
AC_DEFINE([__LWI_FREEBSD__], [], [Define if OS is FreeBSD])
;;
hpux*:hppa*)
MOD_EXT=".sl"
AC_DEFINE([__LWI_HP_UX__], [], [Define if OS is HP-UX])
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [Define on HP-UX])
;;
hpux*:ia64*)
AC_DEFINE([__LWI_HP_UX__], [], [Define if OS is HP-UX])
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [Define on HP-UX])
;;
aix*:*)
AC_DEFINE([__LWI_AIX__], [], [Define if OS is AIX])
AC_DEFINE([_LINUX_SOURCE_COMPAT], [], [Enable Linux source compatibility on AIX])
;;
esac
AC_SUBST(MOD_EXT)
AC_SUBST(DS_FRAMEWORK_LDFLAGS)
AC_DEFINE_UNQUOTED([MOD_EXT], ["$MOD_EXT"], [Extension of shared modules])
# krb5
AC_ARG_WITH([krb5],
[AC_HELP_STRING([--with-krb5=
], [use krb5 located in prefix ])],
[
KRB5_INCLUDES="-I$withval/include"
KRB5_LDFLAGS="-L$withval/lib"
])
AC_ARG_WITH([krb5-includes],
[AC_HELP_STRING([--with-krb5-includes=], [use krb5 includes located in ])],
[
KRB5_INCLUDES="-I$withval"
])
AC_ARG_WITH([krb5-libs],
[AC_HELP_STRING([--with-krb5-libs=], [use krb5 libs located in ])],
[
KRB5_LDFLAGS="-L$withval"
])
KRB5_LIBS="-lgssapi_krb5 -lkrb5 -lk5crypto"
AC_SUBST(KRB5_INCLUDES)
AC_SUBST(KRB5_LDFLAGS)
AC_SUBST(KRB5_LIBS)
# libunistr
AC_ARG_WITH([libunistr],
[AC_HELP_STRING([--with-libunistr=], [use libunistr located in prefix ])],
[
LIBUNISTR_INCLUDES="-I$withval/include"
LIBUNISTR_LDFLAGS="-L$withval/lib"
])
AC_ARG_WITH([libunistr-includes],
[AC_HELP_STRING([--with-libunistr-includes=], [use libunistr includes located in ])],
[
LIBUNISTR_INCLUDES="-I$withval"
])
AC_ARG_WITH([libunistr-libs],
[AC_HELP_STRING([--with-libunistr-libs=], [use libunistr libs located in ])],
[
LIBUNISTR_LDFLAGS="-L$withval"
])
LIBUNISTR_LIBS="-lunistr"
AC_SUBST(LIBUNISTR_INCLUDES)
AC_SUBST(LIBUNISTR_LDFLAGS)
AC_SUBST(LIBUNISTR_LIBS)
# dcerpc
AC_ARG_WITH([dcerpc],
[AC_HELP_STRING([--with-dcerpc=], [use dcerpc located in prefix ])],
[
DCERPC_INCLUDES="-I$withval/include"
DCERPC_LDFLAGS="-L$withval/lib"
DCERPC_PATH="$withval/bin"
])
AC_ARG_WITH([dcerpc-includes],
[AC_HELP_STRING([--with-dcerpc-includes=], [use dcerpc includes located in ])],
[
DCERPC_INCLUDES="-I$withval"
])
AC_ARG_WITH([dcerpc-libs],
[AC_HELP_STRING([--with-dcerpc-libs=], [use dcerpc libs located in ])],
[
DCERPC_LDFLAGS="-L$withval"
])
DCERPC_LIBS="-ldcerpc"
AC_SUBST(DCERPC_INCLUDES)
AC_SUBST(DCERPC_LDFLAGS)
AC_SUBST(DCERPC_LIBS)
# librpc
AC_ARG_WITH([librpc],
[AC_HELP_STRING([--with-librpc=], [use librpc located in prefix ])],
[
LIBRPC_INCLUDES="-I$withval/include"
LIBRPC_LDFLAGS="-L$withval/lib"
LIBRPC_PATH="$withval/bin"
])
AC_ARG_WITH([librpc-includes],
[AC_HELP_STRING([--with-librpc-includes=], [use librpc includes located in ])],
[
LIBRPC_INCLUDES="-I$withval"
])
AC_ARG_WITH([librpc-libs],
[AC_HELP_STRING([--with-librpc-libs=], [use librpc libs located in ])],
[
LIBRPC_LDFLAGS="-L$withval"
])
LIBRPC_LIBS="-lnetapi"
AC_SUBST(LIBRPC_INCLUDES)
AC_SUBST(LIBRPC_LDFLAGS)
AC_SUBST(LIBRPC_LIBS)
# gssapi
AC_ARG_WITH([gssapi],
[AC_HELP_STRING([--with-gssapi=], [use gssapi located in prefix ])],
[
GSSAPI_INCLUDES="-I$withval/include"
GSSAPI_LDFLAGS="-L$withval/lib"
])
AC_ARG_WITH([gssapi-includes],
[AC_HELP_STRING([--with-gssapi-includes=], [use gssapi includes located in ])],
[
GSSAPI_INCLUDES="-I$withval"
])
AC_ARG_WITH([gssapi-libs],
[AC_HELP_STRING([--with-gssapi-libs=], [use gssapi libs located in ])],
[
GSSAPI_LDFLAGS="-L$withval"
])
GSSAPI_LIBS="-lgssapi_krb5"
AC_SUBST(GSSAPI_INCLUDES)
AC_SUBST(GSSAPI_LDFLAGS)
AC_SUBST(GSSAPI_LIBS)
# lwio
AC_ARG_WITH([lwio],
[AC_HELP_STRING([--with-lwio=], [use lwio located in prefix ])],
[
LWIO_INCLUDES="-I$withval/include"
LWIO_LDFLAGS="-L$withval/lib"
])
AC_ARG_WITH([lwio-includes],
[AC_HELP_STRING([--with-lwio-includes=], [use lwio includes located in ])],
[
LWIO_INCLUDES="-I$withval"
])
AC_ARG_WITH([lwio-libs],
[AC_HELP_STRING([--with-lwio-libs=], [use lwio libs located in ])],
[
LWIO_LDFLAGS="-L$withval"
])
LWIO_LIBS="-llwioclient -llwioshareinfo"
AC_SUBST(LWIO_INCLUDES)
AC_SUBST(LWIO_LDFLAGS)
AC_SUBST(LWIO_LIBS)
# netlogon
AC_ARG_WITH([netlogon],
[AC_HELP_STRING([--with-netlogon=], [use netlogon located in prefix ])],
[
NETLOGON_INCLUDES="-I$withval/include"
NETLOGON_LDFLAGS="-L$withval/lib"
])
AC_ARG_WITH([netlogon-includes],
[AC_HELP_STRING([--with-netlogon-includes=], [use netlogon includes located in ])],
[
NETLOGON_INCLUDES="-I$withval"
])
AC_ARG_WITH([netlogon-libs],
[AC_HELP_STRING([--with-netlogon-libs=], [use netlogon libs located in ])],
[
NETLOGON_LDFLAGS="-L$withval"
])
NETLOGON_LIBS="-llwnetclientapi"
AC_SUBST(NETLOGON_INCLUDES)
AC_SUBST(NETLOGON_LDFLAGS)
AC_SUBST(NETLOGON_LIBS)
# lwadvapi
AC_ARG_WITH([lwadvapi],
[AC_HELP_STRING([--with-lwadvapi=], [use lwadvapi located in prefix ])],
[
LWADVAVPI_INCLUDES="-I$withval/include"
LWADVAPI_LDFLAGS="-L$withval/lib"
])
AC_ARG_WITH([lwadvapi-includes],
[AC_HELP_STRING([--with-lwadvapi-includes=], [use lwadvapi includes located in ])],
[
LWADVAPI_INCLUDES="-I$withval"
])
AC_ARG_WITH([lwadvapi-libs],
[AC_HELP_STRING([--with-lwadvapi-libs=], [use lwadvapi libs located in ])],
[
LWADVAPI_LDFLAGS="-L$withval"
])
LWADVAPI_LIBS="-llwadvapi"
AC_SUBST(LWADVAPI_INCLUDES)
AC_SUBST(LWADVAPI_LDFLAGS)
AC_SUBST(LWADVAPI_LIBS)
# compat
ENABLE_COMPAT=false
AC_ARG_ENABLE([compat],
[AC_HELP_STRING([--enable-compat], [enable compat-only build (default: disabled)])],
[
if test x"$enableval" = x"yes"
then
ENABLE_COMPAT=true
else
ENABLE_COMPAT=false
fi
])
AM_CONDITIONAL(ENABLE_COMPAT, [$ENABLE_COMPAT])
# unicode
AC_ARG_ENABLE([unicode],
[AC_HELP_STRING([--disable-unicode], [disable unicode support (default: enabled)])],[use_unicode=$enableval],[use_unicode=yes])
if test x"$use_unicode" = x"yes"
then
AM_CFLAGS="$AM_CFLAGS -DUNICODE"
fi
# debugging
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--enable-debug], [enable debugging (default: disabled)])],
[
if test x"$enableval" = x"yes"
then
AM_CFLAGS="$AM_CFLAGS -g -O0"
AM_CPPFLAGS="$AM_CPPFLAGS -DDEBUG"
fi
])
CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_GNU_SOURCE"
AM_CPPFLAGS="$AM_CPPFLAGS -I${top_srcdir}/include"
AM_CFLAGS="$AM_CFLAGS -Wall -Werror -fno-strict-aliasing"
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CFLAGS)
for i in $CPPFLAGS ${DCERPC_INCLUDES} ${UNISTR_INCLUDES} ${LSASS_INCLUDES}; do
j=`echo $i | grep '^-I'`
if test x != x"$j"
then
IDLFLAGS="$IDLFLAGS $j"
fi
done
AC_SUBST(IDLFLAGS)
srvsvcconfdir="$sysconfdir"
AC_SUBST(srvsvcconfdir)
AS_AC_EXPAND(CONFIGDIR, $srvsvcconfdir)
AC_DEFINE_UNQUOTED(CONFIGDIR, "$CONFIGDIR", [Config directory])
srvsvcregdir="$sysconfdir"
AC_SUBST(srvsvcregdir)
if test x"$localstatedir" = x"/var"; then
srvsvccachedir="$localstatedir/lib/likewise"
else
srvsvccachedir="$localstatedir"
fi
AC_SUBST(srvsvccachedir)
AS_AC_EXPAND(CACHEDIR, $srvsvccachedir)
AC_DEFINE_UNQUOTED(CACHEDIR, "$CACHEDIR", [Cache directory])
AS_AC_EXPAND(PREFIXDIR, $prefix)
AC_DEFINE_UNQUOTED(PREFIXDIR, "$PREFIXDIR", [Prefix directory])
AS_AC_EXPAND(LIBDIR, $libdir)
AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Library directory])
AS_AC_EXPAND(SBINDIR, $sbindir)
AC_C_BIGENDIAN
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_CHECK_LIB([nsl], [gethostname], [NSL_LIBS="-lnsl"])
AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"])
AC_CHECK_LIB([resolv], [res_query], [RESOLV_LIBS="-lresolv"])
AC_CHECK_LIB([resolv], [__res_query], [RESOLV_LIBS="-lresolv"])
AC_CHECK_LIB([pthread], [pthread_self], [PTHREAD_LIBS="-lpthread"])
AC_CHECK_LIB([rt], [clock_settime], [RT_LIBS="-lrt"])
AC_CHECK_LIB([uuid], [uuid_copy], [UUID_LIBS="-luuid"])
AC_CHECK_LIB([socket], [bind], [SOCKET_LIBS="-lsocket"])
AC_CHECK_LIB([unistr], [mbstowc16s], [LIBUNISTR_LIBS="-lunistr"], [], [$LIBUNISTR_LDFLAGS])
AC_CHECK_LIB([dcerpc], [rpc__init], [DCERPC_LIBS="-ldcerpc"],[],[$DCERPC_LDFLAGS])
AC_SUBST(NSL_LIBS)
AC_SUBST(DL_LIBS)
AC_SUBST(RESOLV_LIBS)
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(RT_LIBS)
AC_SUBST(UUID_LIBS)
AC_SUBST(SOCKET_LIBS)
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h arpa/inet.h fcntl.h limits.h sys/param.h sys/syslimits.h sys/limits.h netdb.h netinet/in.h stdint.h stdlib.h stdbool.h string.h strings.h sys/socket.h syslog.h unistd.h sys/types.h fcntl.h iconv.h sys/stat.h time.h sys/time.h sys/varargs.h synch.h pthread.h dlfcn.h wc16str.h wc16printf.h])
AC_PATH_PROG([IDL], [dceidl], [no], [$PATH:$DCERPC_PATH])
if test x"$IDL" = x"no"; then
AC_MSG_ERROR([DCERPC IDL compiler not found])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_HEADER_TIME
AC_STRUCT_TM
# Check for basic types
AC_CHECK_TYPES([int8, int16, int32, int64], [], [],
[#include
#if __ia64
#include
#endif])
AC_CHECK_TYPES([uint8, uint16, uint32, uint64])
AC_CHECK_SIZEOF([long long int])
AC_CHECK_SIZEOF([long int])
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_FUNC_STRERROR_R
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $RT_LIBS"
AC_CHECK_FUNCS([atexit localtime_r memset select socket strchr strerror strerror_r strndup vsyslog rpl_realloc rpl_malloc clock_gettime clock_settime settimeofday gettimeofday timegm strtoll __strtoll strtoull __strtoull strtol strtoul])
LDFLAGS="$old_LDFLAGS"
AC_CHECK_DECLS([isblank], [], [], [#include ])
AC_CHECK_TYPES([wchar16_t], [], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_WC16STR_H
# include
#endif
])
AC_CONFIG_FILES([Makefile
include/Makefile
etc/Makefile
etc/srvsvcd.reg
utils/Makefile
logging_r/Makefile
client/Makefile
test/Makefile
server/Makefile
])
AC_OUTPUT