1# 2## Process this file with autoconf to produce a configure script 3# 4AC_PREREQ(2.59) 5AC_INIT([OpenSLP], [2.0.0], [openslp-devel@lists.sourceforge.net]) 6AM_INIT_AUTOMAKE 7AC_CANONICAL_HOST 8AC_CONFIG_HEADERS([config.h]) 9AC_CONFIG_SRCDIR([slpd/slpd_main.c]) 10AC_CONFIG_MACRO_DIR([m4]) 11 12# 13# This is enabled for pthread UNIX98 extensions 14AC_USE_SYSTEM_EXTENSIONS 15 16# 17# Checks for tools (programs) 18# 19AC_PROG_CC 20AC_PROG_CPP 21AC_PROG_INSTALL 22AC_PROG_LN_S 23AC_PROG_MAKE_SET 24AC_PROG_LIBTOOL 25AM_PROG_LEX 26AC_PROG_YACC 27AM_PROG_CC_C_O 28 29# 30# Checks for libraries 31# 32AC_CHECK_LIB([resolv], [inet_aton]) 33AC_CHECK_LIB([socket], [socket]) 34AC_CHECK_LIB([nsl], [gethostbyname]) 35AC_CHECK_LIB([m], [log10]) 36AC_CHECK_LIB([pthread], [pthread_create]) 37 38# 39# Checks for header files 40# 41AC_HEADER_STDC 42AC_HEADER_TIME 43AC_HEADER_STAT 44AC_CHECK_HEADERS([unistd.h stdio.h stdlib.h stddef.h stdarg.h stdint.h inttypes.h ctype.h string.h strings.h memory.h math.h limits.h errno.h signal.h fcntl.h pthread.h arpa/inet.h netdb.h sys/types.h sys/time.h sys/socket.h pwd.h grp.h]) 45 46# 47# Checks for types 48# 49AC_TYPE_SIGNAL 50OPENSLP_CHECK_TYPE([socklen_t], [int], 51 [defined to size_t if <sys/socket.h> does not support socklen_t data type]) 52OPENSLP_STRUCT_SA_RESTORER 53 54# 55# Checks for structure members 56# 57AC_CHECK_MEMBER([struct sockaddr_storage.ss_family], 58 [AC_DEFINE(HAVE_SOCKADDR_STORAGE_SS_FAMILY,1,[whether sockaddr_storage 59has ss_family])], 60 [], [#include <sys/socket.h>]) 61 62AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 63 [AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN,1,[whether sockaddr_in has sin_len])], 64 [], [#include <netinet/in.h>]) 65 66AC_CHECK_MEMBER([struct sockaddr_storage.ss_len], 67 [AC_DEFINE(HAVE_SOCKADDR_STORAGE_SS_LEN,1,[whether sockaddr_storage has ss_len])], 68 [], [#include <netinet/in.h>]) 69 70# 71# Checks for compiler characteristics 72# 73AC_C_CONST 74AC_C_INLINE 75AC_C_BIGENDIAN 76 77# 78# Checks for library functions 79# 80AC_REPLACE_FNMATCH 81AC_FUNC_FORK 82AC_FUNC_MEMCMP 83AC_FUNC_SELECT_ARGTYPES 84AC_FUNC_VPRINTF 85AC_CHECK_FUNCS([strchr memcpy strcasecmp strdup strtol strerror isascii alarm gethostname gettimeofday select socket poll]) 86AC_CHECK_FUNCS([pthread_mutexattr_settype pthread_mutexattr_setkind_np]) 87 88# 89# SLPv1 support - default is ON 90# ON means ENABLE_SLPv1 is defined to 1 91# 92AC_ARG_ENABLE([slpv1], 93 [AS_HELP_STRING([--disable-slpv1], [Turn off SLPv1 support @<:@default is ON@:>@])], 94 [case "${enableval}" in 95 yes) slpv1=yes ;; 96 no) slpv1=no ;; 97 *) AC_MSG_ERROR([bad value ${enableval} for --disable-slpv1]) ;; 98 esac], [slpv1=yes]) 99AM_CONDITIONAL([ENABLE_SLPv1], [test "${slpv1}" = yes]) 100if test "${slpv1}" = yes; then 101 AC_DEFINE([ENABLE_SLPv1], 1, [Defined for SLPv1 support]) 102fi 103 104# 105# Predicate support - default is ON 106# ON means ENABLE_PREDICATES is defined to 1 107# 108AC_ARG_ENABLE([predicates], 109 AS_HELP_STRING([--disable-predicates], [Turn off predicates @<:@default is ON@:>@]), 110 [case "${enableval}" in 111 yes) predicates=yes ;; 112 no) predicates=no ;; 113 *) AC_MSG_ERROR([bad value ${enableval} for --disable-predicates]) ;; 114 esac], [predicates=yes]) 115AM_CONDITIONAL([ENABLE_PREDICATES], [test "x${predicates}" = xyes]) 116if test "x${predicates}" = xyes; then 117 AC_DEFINE([ENABLE_PREDICATES], 1, [Defined for predicate support]) 118fi 119 120# 121# Asyncronous API support - default is OFF 122# ON means ENABLE_ASYNC_API is defined to 1 123# 124AC_ARG_ENABLE([async-api], 125 AS_HELP_STRING([--enable-async-api], [Turn on async API support @<:@default is OFF@:>@]), 126 [case "${enableval}" in 127 yes) asyncapi=yes ;; 128 no) asyncapi=no ;; 129 *) AC_MSG_ERROR([bad value ${enableval} for --enable-async-api]) ;; 130 esac], [asyncapi=no]) 131AM_CONDITIONAL([ENABLE_ASYNC_API], [test "x${asyncapi}" = xyes]) 132if test "x${asyncapi}" = xyes; then 133 AC_DEFINE([ENABLE_ASYNC_API], 1, [Defined for async API support]) 134fi 135 136# 137# SLPv2 Security features support - default is OFF 138# ON means ENABLE_SLPv2_SECURITY is defined 139# 140AC_ARG_ENABLE(slpv2-security, 141 AS_HELP_STRING([--enable-slpv2-security], [Turn on security support @<:@default is OFF@:>@]), 142 [case "${enableval}" in 143 yes) slpv2security=yes ;; 144 no) slpv2security=no ;; 145 *) AC_MSG_ERROR([bad value ${enableval} for --enable-slpv2-security]) ;; 146 esac], [slpv2security=no]) 147if test "x${slpv2security}" = xyes; then 148 AC_CHECK_LIB([crypto], [DSA_sign], [], 149 [echo "------------------------------------------------------------" 150 echo " The OpenSSL crypto library is required for SLPv2 security. " 151 echo " Continuing without SLPv2 security functionality. " 152 echo "------------------------------------------------------------" 153 slpv2security=no], [-ldl -lz]) 154 AC_CHECK_LIB([z], [inflate], [], 155 [echo "--------------------------------------------------------------" 156 echo " The OpenSSL crypto library requires zlib for SLPv2 security. " 157 echo " Continuing without SLPv2 security functionality. " 158 echo "--------------------------------------------------------------" 159 slpv2security=no]) 160 AC_CHECK_LIB([dl], [dlopen], [], 161 [echo "------------------------------------------------------------" 162 echo " The OpenSSL crypto library requires dl for SLPv2 security. " 163 echo " Continuing without SLPv2 security functionality. " 164 echo "------------------------------------------------------------" 165 slpv2security=no]) 166fi 167AM_CONDITIONAL([ENABLE_SLPv2_SECURITY], [test "x${slpv2security}" = xyes]) 168if test "x${slpv2security}" = xyes; then 169 AC_DEFINE([ENABLE_SLPv2_SECURITY], 1, [Defined for SLPv2 security support]) 170fi 171 172# 173# Generic DEBUG support - default is OFF 174# ON means with symbols, no optimization, DEBUG is defined to 1 175# OFF means with symbols, full optimization, NDEBUG is defined to 1 176# 177AC_ARG_ENABLE([debug], 178 AS_HELP_STRING([--enable-debug], [Turn on debugging @<:@default is OFF@:>@]), 179 [case "${enableval}" in 180 yes) debug=yes ;; 181 no) debug=no ;; 182 *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; 183 esac], [debug=no]) 184AM_CONDITIONAL([DEBUG], [test "x${debug}" = xyes]) 185AM_CONDITIONAL([NDEBUG], [test "x${debug}" = xno]) 186if test "x${debug}" = xyes; then 187 AC_DEFINE([DEBUG], 1, [Defined for debug builds]) 188else 189 AC_DEFINE([NDEBUG], 1, [Defined for non-debug builds]) 190fi 191 192# 193# System type macros used in OpenSLP source code 194# 195case "${host_os}" in 196 *linux*) CPPFLAGS="$CPPFLAGS -DLINUX" ;; 197 *solaris*) CPPFLAGS="$CPPFLAGS -DSOLARIS" ;; 198 *aix*) CPPFLAGS="$CPPFLAGS -DAIX" ;; 199 *hpux*) CPPFLAGS="$CPPFLAGS -DHPUX" ;; 200 *darwin*) CPPFLAGS="$CPPFLAGS -DDARWIN" ;; 201esac 202 203# Determine if building for sparc and if so set cpu to v9 204if test "x${host_cpu}" = xsparc; then 205 GCC_OS_FLAGS="-mcpu=v9" 206fi 207 208# 209# Set C/C++ compiler-specific warning/optimization/option flags 210# 211if test "x${GCC}" = xyes; then 212 # GCC: turn on all warnings, DON'T set warnings as errors 213 # disable optimization for debug builds 214 # enable high-level optimizations for non-debug builds 215 CFLAGS="$CFLAGS -Wall $GCC_OS_FLAGS" 216 if test "x${debug}" = xyes; then 217 OPTFLAGS="-O0" 218 else 219 OPTFLAGS="-O2" 220 fi 221elif $CC -V 2>&1 | grep "WorkShop Compilers"; then 222 # Solaris Workshop: enable optimizations for debug builds 223 if test "x${debug}" = xno; then 224 OPTFLAGS="-fast" 225 if echo $CC | grep "xarch=v9"; then 226 # "-fast" sets -xarch=v8 disabling 64-bit mode, enable it again 227 OPTFLAGS="$OPTFLAGS -xarch=v9" 228 fi 229 fi 230elif echo ${host_os} | grep -i "osf" >/dev/null; then 231 # OSF: enable standard C (shouldn't be necessary) 232 # enable optimizations for non-debug builds 233 CFLAGS="$CFLAGS -std" 234 if test "x${debug}" = xno; then 235 OPTFLAGS="-O" 236 fi 237else 238 # everything else: take a wild guess (shouldn't need this) 239 if test "x${debug}" = xno; then 240 OPTFLAGS="-O" 241 fi 242fi 243CFLAGS="$CFLAGS $OPTFLAGS" 244 245# 246# Configuration and output 247# 248AC_CONFIG_FILES([Makefile 249 common/Makefile 250 libslpattr/Makefile 251 libslp/Makefile 252 slpd/Makefile 253 slptool/Makefile 254 etc/Makefile 255 doc/Makefile 256 doc/doxyfile 257 obs/Makefile 258 obs/debian.changelog 259 obs/debian.control 260 obs/debian.rules 261 obs/openslp.dsc 262 obs/openslp.spec]) 263AC_OUTPUT 264 265echo \ 266"------------------------------------------------------------ 267 268 ${PACKAGE_NAME} Version ${PACKAGE_VERSION} Configuration: 269 270 Prefix: '${prefix}'. 271 Compiler: '${CC} ${CFLAGS} ${CPPFLAGS}' 272 273 Package features: 274 SLPv1 Messages: ${slpv1} 275 SLPv2 Security: ${slpv2security} 276 SLP Async API: ${asyncapi} 277 SLP Predicates: ${predicates} 278 Debugging: ${debug} 279 280 Now type 'make @<:@prefix=<user-prefix>@:>@ @<:@<target>@:>@' 281 where the optional <target> is: 282 all - build all binaries (default). 283 docs - build doxygen documentation. 284 install - install all binaries and data. 285 286 additionally, on rpm-based systems only: 287 rpmcheck - check whether rpms may be built. 288 srcrpm - build only source rpm. 289 rpms - build source and binary rpms. 290 291------------------------------------------------------------" 292