# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(likewise-lwnetmgr, 1.0, support@likewisesoftware.com) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_CONFIG_HEADERS([include/config.h]) AC_PREFIX_DEFAULT(/opt/centeris) # 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]) ;; darwin8.*:*) echo "Detected Mac OS X - Tiger" DS_FRAMEWORK_LDFLAGS="-framework DirectoryService" AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin]) ;; darwin9.*:*) echo "Detected Mac OS X - Leopard" DS_FRAMEWORK_LDFLAGS="-framework DirectoryService" AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin]) ;; darwin10.*:*) echo "Detected Mac OS X - Snow Leopard" DS_FRAMEWORK_LDFLAGS="-framework DirectoryService" AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin - x64 Snow Leopard]) AC_DEFINE([__LWI_DARWIN_X64__], [], [Define if OS is Darwin - x64 Snow Leopard]) ;; 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]) # openldap AC_ARG_WITH([openldap], [AC_HELP_STRING([--with-openldap=], [use openldap located in prefix ])], [ OPENLDAP_INCLUDES="-I$withval/include" OPENLDAP_LDFLAGS="-L$withval/lib" ]) AC_ARG_WITH([openldap-includes], [AC_HELP_STRING([--with-openldap-includes=], [use openldap includes located in ])], [ OPENLDAP_INCLUDES="-I$withval" ]) AC_ARG_WITH([openldap-libs], [AC_HELP_STRING([--with-openldap-libs=], [use openldap libs located in ])], [ OPENLDAP_LDFLAGS="-L$withval" ]) OPENLDAP_LIBS="-lldap_r -llber" # lwreg AC_ARG_WITH([lwreg], [AC_HELP_STRING([--with-lwreg=], [use lwreg located in prefix ])], [ LWREG_INCLUDES="-I$withval/include" LWREG_LDFLAGS="-L$withval/lib" ]) AC_ARG_WITH([lwreg-includes], [AC_HELP_STRING([--with-lwreg-includes=], [use lwreg includes located in ])], [ LWREG_INCLUDES="-I$withval" ]) AC_ARG_WITH([lwreg-libs], [AC_HELP_STRING([--with-lwreg-libs=], [use lwreg libs located in ])], [ LWREG_LDFLAGS="-L$withval" ]) LWREG_LIBS="-lrsutils -lregclient" #AC_CHECK_HEADER([reg/reg.h],,[AC_MSG_ERROR([Could not find lwreg headers])]) AC_SUBST(LWREG_INCLUDES) AC_SUBST(LWREG_LDFLAGS) AC_SUBST(LWREG_LIBS) # lwadvapi AC_ARG_WITH([lwadvapi], [AC_HELP_STRING([--with-lwadvapi=], [use lwadvapi located in prefix ])], [ LWADVAPI_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" LWADVAPI_NOTHR_LIBS="-llwadvapi_nothr" AC_SUBST(LWADVAPI_INCLUDES) AC_SUBST(LWADVAPI_LDFLAGS) AC_SUBST(LWADVAPI_LIBS) AC_SUBST(LWADVAPI_NOTHR_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" ]) AC_SUBST(LIBUNISTR_INCLUDES) AC_SUBST(LIBUNISTR_LDFLAGS) AC_SUBST(LIBUNISTR_LIBS) # pstore AC_ARG_WITH([pstore], [AC_HELP_STRING([--with-pstore=], [use pstore located in prefix ])], [ PSTORE_INCLUDES="-I$withval/include" PSTORE_LDFLAGS="-L$withval/lib" ]) AC_ARG_WITH([pstore-includes], [AC_HELP_STRING([--with-pstore-includes=], [use pstore includes located in ])], [ PSTORE_INCLUDES="-I$withval" ]) AC_ARG_WITH([pstore-libs], [AC_HELP_STRING([--with-pstore-libs=], [use pstore libs located in ])], [ PSTORE_LDFLAGS="-L$withval" ]) AC_SUBST(PSTORE_INCLUDES) AC_SUBST(PSTORE_LDFLAGS) AC_SUBST(PSTORE_LIBS) # lwmsg AC_ARG_WITH([lwmsg], [AC_HELP_STRING([--with-lwmsg=], [use lwmsg located in prefix ])], [ LWMSG_INCLUDES="-I$withval/include" LWMSG_LDFLAGS="-L$withval/lib" ]) AC_ARG_WITH([lwmsg-includes], [AC_HELP_STRING([--with-lwmsg-includes=], [use lwmsg includes located in ])], [ LWMSG_INCLUDES="-I$withval" ]) AC_ARG_WITH([lwmsg-libs], [AC_HELP_STRING([--with-lwmsg-libs=], [use lwmsg libs located in ])], [ LWMSG_LDFLAGS="-L$withval" ]) # Boolean settings AC_ARG_ENABLE([pidfile], [AC_HELP_STRING([--disable-pidfile], [disable pid file creation (default: enabled)])], [], [enable_pidfile="yes"]) if test x"$enable_pidfile" = x"yes" then AC_DEFINE([ENABLE_PIDFILE], [], [Define if pid file should be created]) 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 ]) # minimal AC_ARG_ENABLE([minimal], [AC_HELP_STRING([--enable-minimal], [build minimal netlogon])]) AM_CONDITIONAL(ENABLE_MINIMAL, test x"$enable_minimal" = x"yes") if test x"$enable_minimal" = x"yes" then AC_DEFINE([ENABLE_MINIMAL], [], [Define if should build minimal netlogon]) fi # Basic variables CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_GNU_SOURCE" AM_CPPFLAGS="$AM_CPPFLAGS -I$top_srcdir/include" AM_LDFLAGS="$AM_LDFLAGS -Wall -Werror" AM_CFLAGS="$AM_CFLAGS -Wall -Werror -fno-strict-aliasing" AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CFLAGS) AC_SUBST(AM_LDFLAGS) AC_DEFINE_UNQUOTED([PREFIXDIR], ["$prefix"], [Prefix directory]) AS_AC_EXPAND(netlogonconfdir, ["$sysconfdir"]) AS_AC_EXPAND(netlogonregdir, ["$sysconfdir"]) AS_AC_EXPAND(SBINDIR, ["${sbindir}"]) AC_DEFINE_UNQUOTED([LWNET_CONFIG_DIR], ["$netlogonconfdir"], [Location of netlogon configuration files]) if test x"$localstatedir" = x"/var"; then netlogoncachedir="$localstatedir/lib/likewise" else netlogoncachedir="$localstatedir" fi AC_DEFINE_UNQUOTED([LWNET_CACHE_DIR], ["$netlogoncachedir"], [Location of netlogon cache files]) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LIBTOOL # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([inttypes.h arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdlib.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 synch.h pthread.h wc16str.h wc16printf.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_HEADER_TIME AC_STRUCT_TM AC_C_BIGENDIAN # 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 AC_CHECK_FUNCS([atexit localtime_r memset select socket strchr strerror vsyslog]) AC_CHECK_FUNCS([rpl_realloc rpl_malloc clock_gettime clock_settime]) AC_CHECK_FUNCS([settimeofday gettimeofday timegm strtoll __strtoll strtoull __strtoull]) AC_CHECK_DECLS([isblank, pstat_getproc, res_init, res_query], [], [], [#include #if HAVE_SYS_PARAM_H #include #endif #if HAVE_SYS_PSTAT_H #include #endif]) AC_CHECK_TYPES([wchar16_t], [], [], [AC_INCLUDES_DEFAULT #ifdef HAVE_WC16STR_H # include #endif ]) # Check for external libraries AC_CHECK_LIB([lwpsapi], [LwpsOpenPasswordStore], [PSTORE_LIBS="-llwpsapi"], AC_MSG_ERROR([Could not find liblwpsapi; please use --with-pstore]), [$PSTORE_LDFLAGS]) AC_CHECK_LIB([unistr], [mbstowc16s], [LIBUNISTR_LIBS="-lunistr"], AC_MSG_ERROR([Could not find libunistr; please use --with-libunistr]), [$LIBUNISTR_LDFLAGS]) AC_CHECK_LIB([tdb], [tdb_open], [TDB_LIBS="-ltdb"], [ENABLE_TDB=false], [$TDB_LDFLAGS]) AC_CHECK_LIB([pthread], [pthread_self], [PTHREAD_LIBS="-lpthread"], []) AC_SUBST(PTHREAD_LIBS) # Checks for libraries. have_sigtimedwait=no AC_CHECK_LIB(c, sigtimedwait, [have_sigtimedwait=yes]) if test "$have_sigtimedwait" = no; then AC_CHECK_LIB(rt, sigtimedwait, [RT_LIBS="-lrt"]) fi AC_CHECK_HEADER([lwmsg/lwmsg.h],,[AC_MSG_ERROR([Could not find lwmsg headers])]) AC_CHECK_LIB([lwmsg_nothr], [lwmsg_data_marshal], [LWMSG_NOTHR_LIBS="-llwmsg_nothr"], [AC_MSG_ERROR([Could not find liblwmsg_nothr])], [$LWMSG_LDFLAGS]) AC_CHECK_LIB([lwmsg], [lwmsg_peer_new], [LWMSG_LIBS="-llwmsg"], [AC_MSG_ERROR([Could not find liblwmsg])], [$LWMSG_LDFLAGS]) AC_SUBST(LWMSG_INCLUDES) AC_SUBST(LWMSG_LDFLAGS) AC_SUBST(LWMSG_NOTHR_LIBS) AC_SUBST(LWMSG_LIBS) AC_CHECK_LIB([nsl], [gethostname], [NSL_LIBS="-lnsl"],,) AC_CHECK_LIB([resolv], [res_query], [RESOLV_LIBS="-lresolv"],,) AC_CHECK_LIB([resolv], [__res_query], [RESOLV_LIBS="-lresolv"],,) AC_CHECK_LIB([rt], [clock_settime], [RT_LIBS="-lrt"],,) AC_CHECK_LIB([socket], [bind], [SOCKET_LIBS="-lsocket"],,) AC_SUBST(NSL_LIBS) AC_SUBST(RESOLV_LIBS) AC_SUBST(RT_LIBS) AC_SUBST(SOCKET_LIBS) AC_CHECK_TYPES([socklen_t], [], [], [AC_INCLUDES_DEFAULT #include #include ]) saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_MSG_CHECKING([if getsockname takes socklen_t*]) AC_TRY_COMPILE([ #include #include ], [ int fd = -1; struct sockaddr addr; socklen_t addrlen; (void) getsockname(fd, &addr, &addrlen); ], [ AC_MSG_RESULT([yes]) AC_DEFINE([GETSOCKNAME_TAKES_SOCKLEN_T], [], [Define if getsockname takes socklen_t as its third argument])],[ AC_MSG_RESULT([no]) ]) AC_MSG_CHECKING([if struct msghdr has msg_control]) AC_TRY_COMPILE([ #include #include ], [ struct msghdr hdr; hdr.msg_control = 0; ], [ AC_MSG_RESULT([yes]) AC_DEFINE([MSGHDR_HAS_MSG_CONTROL], [], [Define if struct msghdr has the msg_control field]) ], [ AC_MSG_RESULT([no]) ]) CFLAGS="$saved_CFLAGS" AC_CONFIG_FILES([Makefile utils/Makefile ipc/Makefile common/Makefile client/Makefile server/Makefile server/api/Makefile server/ipc/Makefile server/netlogond/Makefile etc/Makefile etc/netlogond.reg include/Makefile tests/Makefile tests/netlogonclient/Makefile tests/get_domain_controller/Makefile tests/plugin/Makefile tools/Makefile tools/get_dc_info/Makefile tools/get_dc_list/Makefile tools/get_dc_time/Makefile tools/get_current_domain/Makefile tools/export_dc_cache/Makefile tools/set_log_level/Makefile tools/get_log_info/Makefile scripts/Makefile] ) AC_OUTPUT