# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(likewise-dns, 1.0, support@likewisesoftware.com) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_CONFIG_HEADERS([include/config.h]) # Configuration settings # 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) # 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) # 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" ]) PSTORE_LIBS="-llwpsapi" AC_SUBST(PSTORE_INCLUDES) AC_SUBST(PSTORE_LDFLAGS) AC_SUBST(PSTORE_LIBS) # 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" ]) # 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 ]) # tests ENABLE_TESTS=true AC_ARG_ENABLE([tests], [AC_HELP_STRING([--disable-tests], [disable tests (default: enabled)])], [ if test x"$enableval" = x"yes" then ENABLE_TESTS=true else ENABLE_TESTS=false fi ]) AM_CONDITIONAL(ENABLE_TESTS, [$ENABLE_TESTS]) # Basic variables CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_GNU_SOURCE" AM_CPPFLAGS="$AM_CPPFLAGS -I$top_builddir/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(dnsconfdir, ["$sysconfdir"]) AC_DEFINE_UNQUOTED([LWPS_CONFIG_DIR], ["$dnsconfdir"], [Location of pstore configuration files]) AS_AC_EXPAND(dnscachedir, ["$localstatedir/lib/likewise"]) AC_DEFINE_UNQUOTED([LWPS_CACHE_DIR], ["$dnscachedir"], [Location of pstore cache files]) AS_AC_EXPAND(providerdir, $libdir) # System-specific configuration MOD_EXT=".so" case "$host_os:$host_cpu" in netbsd*:*) AC_DEFINE([__LWI_NETBSD__], [], [Define if the host system is NetBSD]) ;; solaris2.*:*) AC_DEFINE([__LWI_SOLARIS__], [], [Define if the host system is Solaris]) ;; hpux11.*:hppa*) AC_DEFINE([__LWI_HP_UX__], [], [Define if the host system is HP-UX]) MOD_EXT=".sl" ;; hpux11.*:ia64*) AC_DEFINE([__LWI_HP_UX__], [], [Define if the host system is HP-UX]) ;; darwin8.*:*) echo "Detected Mac OS X - Tiger" AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin]) ;; darwin9.*:*) echo "Detected Mac OS X - Leopard" AC_DEFINE([__LWI_DARWIN__], [], [Define if OS is Darwin]) ;; darwin10.*:*) echo "Detected Mac OS X - Snow Leopard" 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]) ;; aix*:*) AC_DEFINE([__LWI_AIX__], [], [Define if OS is AIX]) ;; esac AC_SUBST(MOD_EXT) # 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]) AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/socket.h syslog.h unistd.h]) AC_CHECK_HEADERS([sys/types.h fcntl.h iconv.h sys/stat.h time.h sys/time.h]) AC_CHECK_HEADERS([synch.h pthread.h wc16str.h wc16printf.h res_init res_query]) AC_CHECK_HEADERS([net/if.h ifaddrs.h arpa/nameser.h sys/sockio.h]) AC_CHECK_HEADERS([sys/ioctl.h net/if_dl.h]) AC_CHECK_HEADERS([resolv.h],[],[], [[#ifdef HAVE_NETINET_IN_H #include #endif ]]) # 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([memset select strchr strerror strerror_r getifaddrs]) AC_CHECK_MEMBER([struct sockaddr.sa_len], [], [], [AC_INCLUDES_DEFAULT #include #include ]) AC_CHECK_DECLS([res_init, res_query, AF_INET6, NS_IN6ADDRSZ], [], [], [AC_INCLUDES_DEFAULT #ifdef HAVE_ARPA_NAMESER_H #include #endif ]) AC_CHECK_LIB([pthread], [pthread_self], [PTHREAD_LIBS="-lpthread"]) AC_CHECK_LIB([uuid], [uuid_copy], [UUID_LIBS="-luuid"]) AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"]) AC_CHECK_LIB([nsl], [gethostname], [NSL_LIBS="-lnsl"]) AC_CHECK_LIB([socket], [bind], [SOCKET_LIBS="-lsocket"]) AC_CHECK_LIB([resolv], [res_query], [RESOLV_LIBS="-lresolv"]) AC_CHECK_LIB([resolv], [__res_query], [RESOLV_LIBS="-lresolv"]) AC_CHECK_LIB([unistr], [mbstowc16s], [LIBUNISTR_LIBS="-lunistr"], [], [$LIBUNISTR_LDFLAGS]) 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(NSL_LIBS) AC_SUBST(DL_LIBS) AC_SUBST(SOCKET_LIBS) AC_SUBST(UUID_LIBS) AC_SUBST(PTHREAD_LIBS) AC_SUBST(RESOLV_LIBS) AC_SUBST(LWBASE_INCLUDES) AC_SUBST(LWBASE_LDFLAGS) AC_SUBST(LWBASE_NOTHR_LIBS) AC_SUBST(LWBASE_LIBS) # Create output files AC_CONFIG_FILES([Makefile lwdns/Makefile include/Makefile tools/Makefile tools/lw-update-dns/Makefile ]) AC_OUTPUT