diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-30 17:37:42 +0100 |
---|---|---|
committer | BOSS_Marco <bossm8@students.bfh.ch> | 2019-10-31 16:08:02 +0100 |
commit | 8c04a7af83a83eefce4046be358d857632cd8376 (patch) | |
tree | 77fa1f8bae341a3783047cf51df88cc26bb1ed38 /configure.ac | |
parent | 895f886cbe84c1b3cf1aa7583f30913e9ee052c4 (diff) | |
download | taler-mdb-8c04a7af83a83eefce4046be358d857632cd8376.tar.gz taler-mdb-8c04a7af83a83eefce4046be358d857632cd8376.tar.bz2 taler-mdb-8c04a7af83a83eefce4046be358d857632cd8376.zip |
revisit build system, except for libnfc should work
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c6415a7 --- /dev/null +++ b/configure.ac @@ -0,0 +1,173 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS]) +AC_CONFIG_SRCDIR([src/product.c]) +AC_CONFIG_HEADERS([config.h]) + +# Checks for programs. +AM_INIT_AUTOMAKE +AC_PROG_CC + +# Checks for libraries. +# FIXME: Replace `main' with a function in `-lcurl': +AC_CHECK_LIB([curl], [main]) +# FIXME: Replace `main' with a function in `-lnfc': +AC_CHECK_LIB([nfc], [main]) + +# Checks for header files. +AC_CHECK_HEADERS([stdlib.h string.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_TYPE_SIZE_T +AC_TYPE_UINT8_T + + + + +# Adam shostack suggests the following for Windows: +# -D_FORTIFY_SOURCE=2 -fstack-protector-all +AC_ARG_ENABLE(gcc-hardening, + AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks), +[AS_IF([test x$enableval = xyes],[ + CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" + CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" + CFLAGS="$CFLAGS --param ssp-buffer-size=1" + LDFLAGS="$LDFLAGS -pie" + ])]) + +# Linker hardening options +# Currently these options are ELF specific - you can't use this with MacOSX +AC_ARG_ENABLE(linker-hardening, + AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups), +[AS_IF([test x$enableval = xyes], + [LDFLAGS="$LDFLAGS -z relro -z now"])]) + + +AC_ARG_ENABLE(sanitizer, + AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer), +[AS_IF([test x$enableval = xyes],[ + LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer" + ])]) + + +# gcov compilation +AC_MSG_CHECKING(whether to compile with support for code coverage analysis) +AC_ARG_ENABLE([coverage], + AS_HELP_STRING([--enable-coverage], + [compile the library with code coverage support]), + [use_gcov=${enableval}], + [use_gcov=no]) +AC_MSG_RESULT($use_gcov) +AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) + + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS([strstr]) + + + +# Save before checking libgnurl/libcurl +CFLAGS_SAVE=$CFLAGS +LDFLAGS_SAVE=$LDFLAGS +LIBS_SAVE=$LIBS + +# check for libgnurl +# libgnurl +LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0) +LIBCURL_CHECK_CONFIG(,7.34.0,[curl=1],[curl=0]) + +AS_IF([test "x$curl" = x1],[ + AC_CHECK_HEADER([curl/curl.h], + AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=1],[curl=0],[[#include <curl/curl.h>]]), + [curl=0]) + # need libcurl-gnutls.so, everything else is not acceptable + AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],,[curl=0]) + # cURL must support CURLINFO_TLS_SESSION, version >= 7.34 +]) + + +# libcurl and libgnurl should be mutually exclusive +AS_IF([test "$gnurl" = 1], + [AM_CONDITIONAL(HAVE_LIBGNURL, true) + AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl]) + AM_CONDITIONAL(HAVE_LIBCURL, false) + AC_DEFINE([HAVE_LIBCURL],[0],[Lacking libcurl])], + [AS_IF([test "$curl" = 1], + [AM_CONDITIONAL(HAVE_LIBGNURL, false) + AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl]) + AM_CONDITIONAL(HAVE_LIBCURL, true) + AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl])], + [AC_MSG_WARN([WARNING: No libgnurl/libcurl, taler-bank support will not be compiled]) + AM_CONDITIONAL(HAVE_LIBGNURL, false) + AC_DEFINE([HAVE_LIBGNURL],[0],[Lacking libgnurl]) + AM_CONDITIONAL(HAVE_LIBCURL, false) + AC_DEFINE([HAVE_LIBCURL],[0],[Lacking libcurl])])]) + +# Check for GNUnet's libgnunetcurl. +libgnunetcurl=0 +AC_MSG_CHECKING([for libgnunetcurl]) +AC_ARG_WITH(gnunet, + [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])], + [AC_MSG_RESULT([given as $with_gnunet])], + [AC_MSG_RESULT(not given) + with_gnunet=yes]) +AS_CASE([$with_gnunet], + [yes], [], + [no], [AC_MSG_ERROR([--with-gnunet is required])], + [LDFLAGS="-L$with_gnunet/lib $LDFLAGS" + CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"]) +AC_CHECK_HEADERS([gnunet/platform.h gnunet/gnunet_curl_lib.h], + [AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)], + [], [#ifdef HAVE_GNUNET_PLATFORM_H + #include <gnunet/platform.h> + #endif]) +AS_IF([test $libgnunetcurl != 1], + [AC_MSG_ERROR([[ +*** +*** You need libgnunetcurl to build this program. +*** Make sure you have libcurl or libgnurl installed while +*** building GNUnet. +*** ]])]) + + +# Restore after gnurl/curl checks messed up these values +CFLAGS=$CFLAGS_SAVE +LDFLAGS=$LDFLAGS_SAVE +LIBS=$LIBS_SAVE + + +# check for libjansson (Jansson JSON library) +jansson=0 +AC_MSG_CHECKING([for jansson]) +AC_ARG_WITH([jansson], + [AS_HELP_STRING([--with-jansson=PFX], [base of jansson installation])], + [AC_MSG_RESULT([given as $with_jansson])], + [AC_MSG_RESULT([not given]) + with_jansson=yes]) +AS_CASE([$with_jansson], + [yes], [], + [no], [AC_MSG_ERROR([--with-jansson is required])], + [LDFLAGS="-L$with_jansson/lib $LDFLAGS" + CPPFLAGS="-I$with_jansson/include $CPPFLAGS"]) +AC_CHECK_LIB(jansson,json_dumpb, + [AC_CHECK_HEADER([jansson.h],[jansson=1])]) +AS_IF([test $jansson = 0], + [AC_MSG_ERROR([[ +*** +*** You need libjansson >= 2.10 to build this program. +*** ]])]) + +# Restore, we link each binary individually as needed +CFLAGS=$CFLAGS_SAVE +LDFLAGS=$LDFLAGS_SAVE +LIBS=$LIBS_SAVE + + +AC_CONFIG_FILES([Makefile + src/Makefile]) +AC_OUTPUT |