"Fossies" - the Fresh Open Source Software Archive

Member "inadyn-2.8.1/configure.ac" (31 Jan 2021, 7525 Bytes) of package /linux/misc/dns/inadyn-2.8.1.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 2.8_vs_2.8.1.

    1 AC_PREREQ(2.61)
    2 AC_INIT([In-a-dyn], [2.8.1], [https://github.com/troglobit/inadyn/issues],
    3 	[inadyn], [https://troglobit.com/projects/inadyn/])
    4 AC_CONFIG_AUX_DIR(aux)
    5 AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
    6 AM_SILENT_RULES([yes])
    7 
    8 AC_CONFIG_SRCDIR([src/main.c])
    9 AC_CONFIG_HEADER([include/config.h])
   10 AC_CONFIG_FILES([Makefile inadyn.service src/Makefile include/Makefile man/Makefile examples/Makefile])
   11 AC_CONFIG_MACRO_DIR([m4])
   12 
   13 AC_ARG_ENABLE(ssl,
   14         [AS_HELP_STRING([--disable-ssl], [Disable HTTPS support, default: enabled])],
   15         [ac_enable_ssl="$enableval"],
   16         [ac_enable_ssl="yes"]
   17 )
   18 
   19 AC_ARG_ENABLE(openssl,
   20         [AS_HELP_STRING([--enable-openssl], [Use OpenSSL/LibreSSL for HTTPS, default: GnuTLS])],
   21         [ac_enable_openssl="$enableval"],
   22         [ac_enable_openssl="no"]
   23 )
   24 
   25 AC_ARG_ENABLE(simulation,
   26         [AS_HELP_STRING([--enable-simulation], [Developer simulation mode, do not use!])],
   27         [ac_enable_simulation="$enableval"],
   28         [ac_enable_simulation="no"]
   29 )
   30 
   31 AC_ARG_WITH([systemd],
   32      [AS_HELP_STRING([--with-systemd=DIR], [Directory for systemd service files])],,
   33      [with_systemd=auto]
   34 )
   35 
   36 # Define necessary build flags
   37 AC_GNU_SOURCE
   38 AC_USE_SYSTEM_EXTENSIONS
   39 
   40 # Checks for programs.
   41 AC_PROG_CC
   42 AC_PROG_CC_C99
   43 AM_PROG_CC_C_O
   44 AC_PROG_GCC_TRADITIONAL
   45 AC_PROG_INSTALL
   46 
   47 # Checks for header files.
   48 AC_HEADER_STDC
   49 AC_CHECK_HEADERS([arpa/inet.h arpa/nameser.h netinet/in.h stdlib.h stdint.h \
   50 	          string.h sys/ioctl.h sys/socket.h sys/types.h syslog.h unistd.h],
   51                   [], [],
   52 		  [
   53 		  #ifdef HAVE_SYS_SOCKET_H
   54 		  #include <sys/socket.h>
   55 		  #endif
   56 ])
   57 
   58 # Checks for typedefs, structures, and compiler characteristics.
   59 AC_C_CONST
   60 AC_C_INLINE
   61 AC_TYPE_UINT32_T
   62 
   63 # Checks for library functions.
   64 AC_FUNC_FORK
   65 AC_FUNC_SELECT_ARGTYPES
   66 AC_CHECK_FUNCS([atexit memset poll socket strerror])
   67 AC_SEARCH_LIBS([dlopen], [dl dld], [], [
   68   AC_MSG_ERROR([unable to find the dlopen() function])
   69 ])
   70 
   71 # Check if some func is not in libc
   72 AC_CHECK_LIB([util], [pidfile])
   73 
   74 # Check for usually missing API's, which we can replace
   75 AC_REPLACE_FUNCS([pidfile strlcpy strlcat strtonum utimensat])
   76 AC_CONFIG_LIBOBJ_DIR([lib])
   77 
   78 # Needed for the libraries
   79 AM_PROG_AR
   80 LT_INIT([disable-shared static])
   81 
   82 # Check for required packages
   83 PKG_PROG_PKG_CONFIG
   84 PKG_CHECK_MODULES([confuse], [libconfuse >= 3.0])
   85 
   86 LDFLAGS="$LDFLAGS $confuse_LIBS"
   87 CPPFLAGS="$CPPFLAGS $confuse_CFLAGS"
   88 AC_CHECK_LIB([confuse], [cfg_init], [],
   89              AC_MSG_ERROR([*** Configuration file parser library (libConfuse) not found!]))
   90 AC_CHECK_HEADERS([confuse.h], [],
   91              AC_MSG_ERROR([*** Cannot find required header files!]))
   92 
   93 # If HTTPS is enabled we check for either OpenSSL/LibreSSL or GnuTLS libs+headers
   94 if test "x$ac_enable_ssl" = "xyes"; then
   95    if test "x$ac_enable_openssl" = "xyes"; then
   96       ac_enable_gnutls="no"
   97       PKG_CHECK_MODULES([OpenSSL], [openssl])
   98       LDFLAGS="$LDFLAGS $OpenSSL_LIBS"
   99       CPPFLAGS="$CPPFLAGS $OpenSSL_CFLAGS"
  100       AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
  101                           AC_MSG_ERROR([*** Crypto library (OpenSSL/LibreSSL) not found!]))
  102       AC_CHECK_LIB([ssl], [SSL_library_init], [],
  103                           AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [],
  104                                               AC_MSG_ERROR([*** SSL library (OpenSSL/LibreSSL) not found!])))
  105       AC_CHECK_HEADERS([openssl/crypto.h openssl/x509.h openssl/pem.h openssl/ssl.h \
  106                         openssl/tls1.h openssl/err.h], [],
  107 			AC_MSG_ERROR([*** Cannot find required header files!]),
  108 			[
  109 			#include <openssl/conf.h>
  110 			])
  111       AC_DEFINE([CONFIG_OPENSSL], [], [Enable HTTPS support using OpenSSL/LibreSSL library])
  112    else
  113       ac_enable_gnutls="yes"
  114       PKG_CHECK_MODULES([GnuTLS], [gnutls >= 3.0])
  115       LDFLAGS="$LDFLAGS $GnuTLS_LIBS"
  116       CPPFLAGS="$CPPFLAGS $GnuTLS_CFLAGS"
  117       AC_CHECK_LIB([gnutls], [gnutls_init], [],
  118                           AC_MSG_ERROR([*** SSL library (GnuTLS) not found!]))
  119       AC_CHECK_HEADERS([gnutls/gnutls.h gnutls/x509.h], [],
  120 			  AC_MSG_ERROR([*** Cannot find required header files!]))
  121       AC_DEFINE([CONFIG_GNUTLS], [], [Enable HTTPS support using GnuTLS library])
  122    fi
  123    AC_DEFINE([ENABLE_SSL], [], [Enable HTTPS support])
  124 else
  125    ac_enable_gnutls="no"
  126    ac_enable_openssl="no"
  127 fi
  128 
  129 
  130 # By default we rely on the built-in locations of Open/LibreSSL and GnuTLS,
  131 # on error we fall back to these two locations
  132 # For more excellent information on the topic, see this blog post
  133 #   https://www.happyassassin.net/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
  134 CAFILE1="/etc/ssl/certs/ca-certificates.crt"
  135 CAFILE2="/etc/pki/tls/certs/ca-bundle.trust.crt"
  136 
  137 # Add OS-specific flags
  138 case "$host_os" in
  139 darwin*)
  140    LDFLAGS="$LDFLAGS -lresolv"
  141    CAFILE2="/usr/local/etc/openssl/cert.pem"   # where Homebrew's libressl places it
  142    ;;
  143 esac
  144 
  145 AC_DEFINE_UNQUOTED([CAFILE1], "$CAFILE1", [First fallback location for Open/LibreSSL and GnuTLS trust db])
  146 AC_DEFINE_UNQUOTED([CAFILE2], "$CAFILE2", [Second location for Open/LibreSSL and GnuTLS trust db])
  147 
  148 AM_CONDITIONAL([ENABLE_SSL], test "x$ac_enable_ssl" = "xyes")
  149 AM_CONDITIONAL([ENABLE_OPENSSL], test "x$ac_enable_openssl" = "xyes")
  150 
  151 if test "x$ac_enable_simulation" = "xyes"; then
  152    AC_DEFINE([ENABLE_SIMULATION], [], [Enable developer-only simulation mode])
  153 fi
  154 
  155 # Check where to install the systemd .service file
  156 AS_IF([test "x$with_systemd" = "xyes" -o "x$with_systemd" = "xauto"], [
  157      def_systemd=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
  158      AS_IF([test "x$def_systemd" = "x"],
  159          [AS_IF([test "x$with_systemd" = "xyes"],
  160 	     [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
  161 	     with_systemd=no], [with_systemd="$def_systemd"])]
  162 )
  163 AS_IF([test "x$with_systemd" != "xno"],
  164      [AC_SUBST([systemddir], [$with_systemd])])
  165 AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemd" != "xno"])
  166 
  167 # Expand $sbindir early, into $SBINDIR, for systemd unit file
  168 # NOTE: This does *not* take prefix/exec_prefix override at "make
  169 #       install" into account, unfortunately.
  170 test "x$prefix" = xNONE && prefix=$ac_default_prefix
  171 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  172 SYSCONFDIR=`eval echo $sysconfdir`
  173 SYSCONFDIR=`eval echo $SYSCONFDIR`
  174 AC_SUBST(SYSCONFDIR)
  175 SBINDIR=`eval echo $sbindir`
  176 SBINDIR=`eval echo $SBINDIR`
  177 AC_SUBST(SBINDIR)
  178 
  179 # Workaround for as-of-yet unreleased runstatedir support, planned for
  180 # autoconf 2.70, which some major distros have backported.
  181 AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run")
  182 AC_SUBST(runstatedir)
  183 
  184 AC_OUTPUT
  185 
  186 # Expand directories for configuration summary, unexpanded defaults:
  187 # sysconfdir  => ${prefix}/etc
  188 # runstatedir => ${localstatedir}/run
  189 SYSCONFDIR=`eval echo $sysconfdir`
  190 RUNSTATEDIR=`eval echo $runstatedir`
  191 RUNSTATEDIR=`eval echo $RUNSTATEDIR`
  192 CACHEDIR=`eval echo $localstatedir/cache`
  193 
  194 cat <<EOF
  195 
  196 ------------------ Summary ------------------
  197  $PACKAGE_NAME version $PACKAGE_VERSION
  198   Prefix.........: $prefix
  199   Sysconfdir.....: $SYSCONFDIR
  200   Runstatedir....: $RUNSTATEDIR
  201   Cachedir.......: $CACHEDIR
  202   C Compiler.....: $CC $CFLAGS $CPPFLAGS $LDFLAGS $LIBS
  203 
  204  Optional features:
  205   HTTPS support..: $ac_enable_ssl
  206     GnuTLS.......: $ac_enable_gnutls
  207     Open/LibreSSL: $ac_enable_openssl
  208   systemd........: $with_systemd
  209 
  210 ------------- Compiler version --------------
  211 $($CC --version || true)
  212 ---------------------------------------------
  213 
  214 Check the above options and compile with:
  215  ${MAKE-make}
  216 
  217 EOF