# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(lwreg, 5.0.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="" AM_LDFLAGS="" PKG_VERSION="5.0.0" # Platform-specific stuff MOD_EXT=".so" CF_FRAMEWORK_LDFLAGS="" SC_FRAMEWORK_LDFLAGS="" DS_FRAMEWORK_LDFLAGS="" AC_DEFINE(__LW_MOTD_FILE__, "/etc/motd", [File which contains the message of the day]) AC_DEFINE(__LW_MOTD_MAX_SIZE__, 4096, [The maximum number of bytes which will be displayed from the MOTD]) AC_USE_SYSTEM_EXTENSIONS case "$host_os:$host_cpu" in linux*:i?86) AC_DEFINE([__LWI_LINUX__], [], [Define if OS is Linux]) ;; linux*:x86_64) AC_DEFINE([__LWI_LINUX__], [], [Define if OS is Linux]) ;; 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([_XOPEN_SOURCE], [500], [Define to desired XOPEN compliance level]) ;; darwin8.*:*) echo "Detected Mac OS X - Tiger" CF_FRAMEWORK_LDFLAGS="-framework CoreFoundation" SC_FRAMEWORK_LDFLAGS="-framework SystemConfiguration" DS_FRAMEWORK_LDFLAGS="-framework DirectoryService" # MACCLIENT_DIR="macclient" AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin]) ;; darwin9.*:*) echo "Detected Mac OS X - Leopard" CF_FRAMEWORK_LDFLAGS="-framework CoreFoundation" SC_FRAMEWORK_LDFLAGS="-framework SystemConfiguration" DS_FRAMEWORK_LDFLAGS="-framework DirectoryService" # MACCLIENT_DIR="macclient" AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin]) ;; darwin10.*:*) echo "Detected Mac OS X - Snow Leopard" CF_FRAMEWORK_LDFLAGS="-framework CoreFoundation" SC_FRAMEWORK_LDFLAGS="-framework SystemConfiguration" DS_FRAMEWORK_LDFLAGS="-framework DirectoryService" # MACCLIENT_DIR="macclient" 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(MACCLIENT_DIR) AC_SUBST(MOD_EXT) AC_SUBST(CF_FRAMEWORK_LDFLAGS) AC_SUBST(SC_FRAMEWORK_LDFLAGS) AC_SUBST(DS_FRAMEWORK_LDFLAGS) AC_DEFINE_UNQUOTED([MOD_EXT], ["$MOD_EXT"], [Extension of shared modules]) # Package version AC_ARG_WITH([version], [AC_HELP_STRING([--with-version=], [package version ..])], [ PKG_VERSION="$withval" ]) AC_DEFINE_UNQUOTED(PKG_VERSION, "$PKG_VERSION", [Package Version]) # sqlite AC_ARG_WITH([sqlite], [AC_HELP_STRING([--with-sqlite=], [use sqlite located in prefix ])], [ SQLITE_INCLUDES="-I$withval/include" SQLITE_LDFLAGS="-L$withval/lib" ]) AC_ARG_WITH([sqlite-includes], [AC_HELP_STRING([--with-sqlite-includes=], [use sqlite includes located in ])], [ SQLITE_INCLUDES="-I$withval" ]) AC_ARG_WITH([sqlite-libs], [AC_HELP_STRING([--with-sqlite-libs=], [use sqlite libs located in ])], [ SQLITE_LDFLAGS="-L$withval" ]) SQLITE_LIBS="-lsqlite3" AC_SUBST(SQLITE_INCLUDES) AC_SUBST(SQLITE_LDFLAGS) AC_SUBST(SQLITE_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" ]) # lwbase AC_ARG_WITH([lwbase], [AC_HELP_STRING([--with-lwbase=], [use lwbase located in prefix ])], [ LWBASE_INCLUDES="-I$withval/include" LWBASE_LDFLAGS="-L$withval/lib" ]) AC_ARG_WITH([lwbase-includes], [AC_HELP_STRING([--with-lwbase-includes=], [use lwbase includes located in ])], [ LWBASE_INCLUDES="-I$withval" ]) AC_ARG_WITH([lwbase-libs], [AC_HELP_STRING([--with-lwbase-libs=], [use lwbase libs located in ])], [ LWBASE_LDFLAGS="-L$withval" ]) # 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) # lwmapsecurity AC_ARG_WITH([lwmapsecurity], [AC_HELP_STRING([--with-lwmapsecurity=], [use lwmapsecurity located in prefix ])], [ LWMAPSECURITY_INCLUDES="-I$withval/include" LWMAPSECURITY_LDFLAGS="-L$withval/lib" ]) AC_ARG_WITH([lwmapsecurity-includes], [AC_HELP_STRING([--with-lwmapsecurity-includes=], [use lwmapsecurity includes located in ])], [ LWMAPSECURITY_INCLUDES="-I$withval" ]) AC_ARG_WITH([lwmapsecurity-libs], [AC_HELP_STRING([--with-lwmapsecurity-libs=], [use lwmapsecurity libs located in ])], [ LWMAPSECURITY_LDFLAGS="-L$withval" ]) LWMAPSECURITY_LIBS="-llwmapsecurity" AC_SUBST(LWMAPSECURITY_INCLUDES) AC_SUBST(LWMAPSECURITY_LDFLAGS) AC_SUBST(LWMAPSECURITY_LIBS) # backend REG_BACKEND="sqlite" USE_SQLITE_BACKEND=false USE_FILE_BACKEND=false REG_BACKEND_DEFINES=-DREG_USE_SQLITE AC_ARG_WITH([backend], [AC_HELP_STRING([--with-backend=], [use backend located in prefix ])], [ REG_BACKEND = "$withval" ]) if test x"$REG_BACKEND" = x"sqlite" then USE_SQLITE_BACKEND=true; REG_BACKEND_DEFINES=-DREG_USE_SQLITE fi AM_CONDITIONAL(USE_SQLITE_BACKEND, [$USE_SQLITE_BACKEND]) if test x"$REG_BACKEND" = x"file" then USE_FILE_BACKEND=true; REG_BACKEND_DEFINES=-DREG_USE_FILE fi AM_CONDITIONAL(USE_FILE_BACKEND, [$USE_FILE_BACKEND]) AC_SUBST(REG_BACKEND) AC_SUBST(REG_BACKEND_DEFINES) # 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]) # 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 ]) AC_ARG_ENABLE([profiling], [AC_HELP_STRING([--enable-profiling], [enable profiling (default: disabled)])], [ if test x"$enableval" = x"yes" then AM_CFLAGS="$AM_CFLAGS -fprofile-arcs -ftest-coverage" LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" fi ]) CPPFLAGS="$CPPFLAGS -D_REENTRANT" 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) registryconfdir="$sysconfdir" AC_SUBST(registryconfdir) AS_AC_EXPAND(CONFIGDIR, $registryconfdir) AC_DEFINE_UNQUOTED(CONFIGDIR, "$CONFIGDIR", [Config directory]) if test x"$localstatedir" = x"/var"; then registrycachedir="$localstatedir/lib/likewise" else registrycachedir="$localstatedir" fi AC_SUBST(registrycachedir) AS_AC_EXPAND(CACHEDIR, $registrycachedir) AC_DEFINE_UNQUOTED(CACHEDIR, "$CACHEDIR", [Cache directory]) AS_AC_EXPAND(providerdir, $libdir) AS_AC_EXPAND(rpcserverdir, $libdir) testbindir='$(exec_prefix)/test' AC_SUBST(testbindir) testlibdir='$(exec_prefix)/test' AC_SUBST(testlibdir) 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) AS_AC_EXPAND(BINDIR, $bindir) AC_C_BIGENDIAN AC_PROG_CC AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_MKDIR_P LW_USE_DOXYGEN([1.5.3]) AC_SUBST([DOXYGEN],[$DOXYGEN]) AM_CONDITIONAL([HAVE_DOXYGEN], [$HAVE_DOXYGEN]) AM_CONDITIONAL([HAVE_DOXYGEN_PDF], [$HAVE_DOXYGEN_PDF]) 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([kvm], [kvm_open], [KVM_LIBS="-lkvm"]) AC_CHECK_LIB([proc], [openproc], [PROC_LIBS="-lproc"]) 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) AC_SUBST(KVM_LIBS) AC_SUBST(PROC_LIBS) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([inttypes.h arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h]) AC_CHECK_HEADERS([stdint.h stdlib.h stdbool.h string.h strings.h sys/socket.h]) AC_CHECK_HEADERS([syslog.h unistd.h sys/types.h iconv.h sys/stat.h sys/pstat.h]) AC_CHECK_HEADERS([proc/readproc.h procfs.h sys/procfs.h kvm.h sys/utsname.h]) AC_CHECK_HEADERS([time.h sys/time.h sys/varargs.h sys/systeminfo.h]) AC_CHECK_HEADERS([nss.h nss_common.h nsswitch.h]) AC_CHECK_HEADERS([synch.h pthread.h wc16str.h wc16printf.h sys/param.h]) AC_CHECK_HEADERS([sys/sysctl.h sys/user.h pwd.h stdio.h grp.h sys/wait.h]) AC_PATH_PROG([IDL], [dceidl], [no], [$PATH:$DCERPC_PATH]) if test x"$IDL" = x"no"; then AC_MSG_WARN([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_TYPE(suseconds_t, [USEC_T="suseconds_t"], [USEC_T="long int"], [#include ]) AC_DEFINE_UNQUOTED([USEC_T], [$USEC_T], [Type of tv_usec field of struct timeval]) 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]) AC_CHECK_FUNCS([strtoll __strtoll strtoull __strtoull strtol strtoul]) AC_CHECK_FUNCS([strchr strerror strerror_r]) AC_CHECK_FUNCS([vsyslog rpl_realloc rpl_malloc]) AC_CHECK_FUNCS([clock_gettime clock_settime settimeofday gettimeofday timegm]) AC_CHECK_FUNCS([getgrouplist sysinfo]) LDFLAGS="$old_LDFLAGS" AC_CHECK_DECLS([isblank], [], [], [#include ]) AC_CHECK_TYPES([wchar16_t], [], [], [AC_INCLUDES_DEFAULT #ifdef HAVE_WC16STR_H # include #endif ]) 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_HEADER([lw/base.h],,[AC_MSG_ERROR([Could not find lwbase headers])]) AC_CHECK_LIB([lwbase_nothr], [LwRtlMemoryAllocate], [LWBASE_NOTHR_LIBS="-llwbase_nothr"], [AC_MSG_ERROR([Could not find liblwbase_nothr])], [$LWBASE_LDFLAGS]) AC_CHECK_LIB([lwbase], [LwInterlockedIncrement], [LWBASE_LIBS="-llwbase"], [AC_MSG_ERROR([Could not find liblwbase])], [$LWBASE_LDFLAGS]) AC_SUBST(LWBASE_INCLUDES) AC_SUBST(LWBASE_LDFLAGS) AC_SUBST(LWBASE_NOTHR_LIBS) AC_SUBST(LWBASE_LIBS) AC_CHECK_TYPES([socklen_t], [], [], [AC_INCLUDES_DEFAULT #include #include ]) AC_CHECK_DECLS([isblank, pstat_getproc, KERN_PROC_PATHNAME], [], [], [ #include #if HAVE_SYS_PARAM_H #include #endif #if HAVE_SYS_SYSCTL_H #include #endif #if HAVE_SYS_PSTAT_H #include #endif]) AC_CHECK_TYPES([struct psinfo], , , [ #if HAVE_PROCFS_H #include #elif HAVE_SYS_PROCFS_H #include #endif ]) if test "$ac_cv_have_decl_pstat_getproc" = yes; then AM_CPPFLAGS="$AM_CPPFLAGS -D_PSTAT64" fi saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_MSG_CHECKING([whether iconv() takes const char** as its second parameter]) AC_TRY_COMPILE( [#include #include ], [iconv_t h = iconv_open(NULL, NULL); char* in; (void) iconv(h, (const char**) &in, NULL, NULL, NULL); ], [AC_MSG_RESULT([yes]); AC_DEFINE_UNQUOTED(ICONV_IN_TYPE, [const char**], [iconv in type])], [AC_MSG_RESULT([no]); AC_DEFINE_UNQUOTED(ICONV_IN_TYPE, [char**], [iconv in type])]) CFLAGS="$saved_CFLAGS" 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_SUBDIRS(libedit) AC_CONFIG_FILES([Makefile utils/Makefile server/Makefile server/api/Makefile server/providers/Makefile server/providers/sqlite/Makefile server/providers/file/Makefile server/lwregd/Makefile server/lwregd/lwreg.reg ipc/Makefile include/Makefile client/Makefile parse/Makefile test/Makefile shellutil/Makefile shell/Makefile shell/lw-edit-reg.sh logging_r/Makefile]) AC_OUTPUT