dnl Process this file with autoconf to produce a configure script. AC_INIT(configure.in) AC_PREREQ(2.12) # required version of autoconf LINC_MAJOR_VERSION=1 LINC_MINOR_VERSION=0 LINC_MICRO_VERSION=3 LINC_VERSION=$LINC_MAJOR_VERSION.$LINC_MINOR_VERSION.$LINC_MICRO_VERSION AC_SUBST(LINC_MAJOR_VERSION) AC_SUBST(LINC_MINOR_VERSION) AC_SUBST(LINC_MICRO_VERSION) AC_SUBST(LINC_VERSION) # Before making a release, the LT_VERSION string should be modified. # The string is of the form C:R:A. # - If interfaces have been changed or added, but binary compatibility has # been preserved, change to C+1:0:A+1 # - If binary compatibility has been broken (eg removed or changed interfaces) # change to C+1:0:0 # - If the interface is the same as the previous version, change to C:R+1:A LT_VERSION=1:0:0 AC_SUBST(LT_VERSION) dnl --with-ssl-dir option AC_ARG_WITH( ssl-dir, [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], ssl_dir="$withval", ssl_dir="" ) dnl --disable-comile-warnings AC_ARG_ENABLE(compile-warnings, [ --enable-compile-warnings=[no/yes] Turn on compiler warnings.], [enable_compile_warnings="$enableval"],[enable_compile_warnings="yes"]) # For automake. AM_CONFIG_HEADER(config.h) dnl Initialize automake stuff AM_INIT_AUTOMAKE(linc, $LINC_VERSION, no-define) AM_PROG_LIBTOOL AM_MAINTAINER_MODE dnl Cache $ACLOCAL_FLAGS AC_CACHE_CHECK([for aclocal flags], ac_cv_linc_aclocal_flags,[ ac_cv_linc_aclocal_flags="$ACLOCAL_FLAGS" ]) ACLOCAL="$ACLOCAL $ac_cv_linc_aclocal_flags" dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL GLIB_REQUIRED=1.3.11 AC_SUBST(GLIB_REQUIRED) dnl Checks for libraries. PKG_CHECK_MODULES(LINC, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED) AC_SUBST(LINC_LIBS) AC_SUBST(LINC_CFLAGS) dnl Check for OpenSSL libraries enable_openssl=false try_openssl=false LINC_SSL_SUPPORT=0 AC_ARG_WITH(openssl, [--{with,without}-openssl Compile with OpenSSL support or without it], if test "x$withval" = xyes; then try_openssl=true fi ) if $try_openssl; then _save_ldflags="$LDFLAGS" if test x$ssl_dir != x ; then LDFLAGS="$_save_ldflags -L$ssl_dir/lib" fi AC_CHECK_LIB(ssl,SSL_new, [ LINC_SSL_SUPPORT=1 SSL_LIBS="-lssl -lcrypto" if test x$ssl_dir != x ; then SSL_LIBS="-L$ssl_dir/lib $SSL_LIBS"; SSL_CFLAGS="-I$ssl_dir/include" fi ],, "-lcrypto") LDFLAGS="$_save_ldflags" fi AC_SUBST(LINC_SSL_SUPPORT) AC_SUBST(SSL_LIBS) AC_SUBST(SSL_CFLAGS) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h unistd.h sys/endian.h endian.h machine/endian.h sys/machine.h sys/isa_defs.h sys/poll.h) AC_CHECK_HEADERS(stddef.h wchar.h wcstr.h wctype.h machine/types.h) AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h sys/un.h linux/irda.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T dnl Checks for library functions. AC_CHECK_FUNCS(poll basename) AC_CHECK_FUNC(res_init,,[AC_CHECK_LIB(resolv,res_init)]) AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)]) AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) have_inet_pton=no AC_CHECK_FUNC(inet_pton,,) if test x"$ac_cv_func_inet_pton" = "xyes" ; then have_inet_pton=yes AC_DEFINE(HAVE_INET_PTON) fi # AC_CHECK_TYPE doesn't work here. AC_MSG_CHECKING([for socklen_t]) AC_TRY_COMPILE( [#include #include ], [socklen_t len;], [AC_MSG_RESULT(yes)], [AC_DEFINE(socklen_t, size_t) AC_MSG_RESULT(no)]) # Blatantly stolen from configure.in in the sample code from # "UNIX Network Programming, Volume 1" by W. Richard Stevens AC_CACHE_CHECK(if sockaddr has sa_len member, ac_cv_sockaddr_has_sa_len, AC_TRY_COMPILE([ # include # include ], [unsigned int i = sizeof(((struct sockaddr *)0)->sa_len)], ac_cv_sockaddr_has_sa_len=yes, ac_cv_sockaddr_has_sa_len=no)) if test x"$ac_cv_sockaddr_has_sa_len" = "xyes" ; then AC_DEFINE(HAVE_SOCKADDR_SA_LEN) fi AC_C_BIGENDIAN if test "x$GCC" = "xyes" -a "x$enable_compile_warnings" != "xno"; then WARN_CFLAGS="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations" else WARN_CFLAGS= fi AC_MSG_CHECKING(what warning flags to pass to the C compiler) AC_MSG_RESULT($WARN_CFLAGS) AC_SUBST(WARN_CFLAGS) ################################################## # Check for gtk-doc. ################################################## AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ]) if test "x$with_html_dir" = "x" ; then HTML_DIR='${datadir}/gtk-doc/html' else HTML_DIR=$with_html_dir fi AC_SUBST(HTML_DIR) AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false) gtk_doc_min_version=0.6 if $GTKDOC ; then gtk_doc_version=`gtkdoc-mkdb --version` AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version]) IFS="${IFS= }"; linc_save_IFS="$IFS"; IFS="." set $gtk_doc_version for min in $gtk_doc_min_version ; do cur=$1; shift if test -z $min ; then break; fi if test -z $cur ; then GTKDOC=false; break; fi if test $cur -gt $min ; then break ; fi if test $cur -lt $min ; then GTKDOC=false; break ; fi done IFS="$linc_save_IFS" if $GTKDOC ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi dnl Let people disable the gtk-doc stuff. AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto) if test x$enable_gtk_doc = xauto ; then if test x$GTKDOC = xtrue ; then enable_gtk_doc=yes else enable_gtk_doc=no fi fi AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) AC_OUTPUT([ linc.pc linc.spec Makefile src/Makefile test/Makefile docs/Makefile include/Makefile include/linc/Makefile include/linc/linc-config.h linc-config ],[case "$CONFIG_FILES" in *linc-config*) chmod +x linc-config;; esac]) echo "linc configuration: Source code location: ${srcdir} Compiler: ${CC} IPv6 can do raw addrs: ${have_inet_pton} "