diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2018-06-04 18:52:11 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2018-06-04 18:52:11 +0200 |
commit | 9560792623cc5368bff7c00618c6646dab9f3391 (patch) | |
tree | cbd40b33d32965d073c02056cf5cb68a7c25dfb9 | |
parent | d300ff8d8a19ec8d8d2297257dda6c4796711a46 (diff) |
POTD skeleton #92.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | configure.ac | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index c4839bd..d54e399 100644 --- a/configure.ac +++ b/configure.ac @@ -5,20 +5,17 @@ AM_INIT_AUTOMAKE AM_SILENT_RULES([yes]) AM_MAINTAINER_MODE -if test -z "$CFLAGS"; then - CFLAGS="-Os -g" -fi +AS_IF([test -z "$CFLAGS"], [CFLAGS="-Os -g"]) AC_CANONICAL_HOST AC_PROG_CC AC_PROG_CC_STDC +AC_PROG_RANLIB AC_PROG_INSTALL AC_TYPE_SIZE_T AC_CHECK_TOOL([PKGCONFIG], [pkg-config], [:]) -if test "x${PKGCONFIG}" = x; then - AC_MSG_ERROR([pkg-config not found]) -fi +AS_IF([test "x${PKGCONFIG}" = x], [ AC_MSG_ERROR([pkg-config not found]) ]) # check for spectre mitigation saved_CFLAGS="$CFLAGS" @@ -50,6 +47,44 @@ PKG_CHECK_MODULES([libssh], [libssh >= 0.7.3], [], [ AC_MSG_ERROR([libssh >= 0.7.3 not found]) ]) AC_SUBST([libssh_CFLAGS]) AC_SUBST([libssh_LIBS]) +dnl Some libssh versions require libssl,libcrypto,zlib. +dnl This is because the libssh.pc file does not sets additional required shlibs. +additional_libssh_libs="" + +AC_MSG_CHECKING([if libssh requires -lcrypto]) +AC_TRY_LINK([#include <libssh/libssh.h>], + [ return ssh_init(); ], [ libssh_require_libcrypto="no" ], + [ libssh_require_libcrypto="yes"]) +AC_MSG_RESULT([${libssh_require_libcrypto}]) +AS_IF([test "x${libssh_require_libcrypto}" = xyes], + [ additional_libssh_libs="${additional_libssh_libs} -lcrypto" + AC_CHECK_LIB([crypto], [RSA_new], [], + [AC_MSG_ERROR([libcrypto not found])]) + ]) + +AC_MSG_CHECKING([if libssh requires -lssl]) +AC_TRY_LINK([#include <libssh/libssh.h>], + [ return ssh_init(); ], [ libssh_require_libssl="no" ], + [ libssh_require_libssl="yes"]) +AC_MSG_RESULT([${libssh_require_libssl}]) +AS_IF([test "x${libssh_require_libssl}" = xyes], + [ additional_libssh_libs="${additional_libssh_libs} -lssl" + AC_CHECK_LIB([ssl], [SSL_new], [], + [AC_MSG_ERROR([libssl not found])]) + ]) + +AC_MSG_CHECKING([if libssh requires -lz]) +AC_TRY_LINK([#include <libssh/libssh.h>], + [ return ssh_init(); ], [ libssh_require_libz="no" ], + [ libssh_require_libz="yes"]) +AC_MSG_RESULT([${libssh_require_libz}]) +AS_IF([test "x${libssh_require_libz}" = xyes], + [ additional_libssh_libs="${additional_libssh_libs} -lz" + AC_CHECK_LIB([z], [inflate], [], + [AC_MSG_ERROR([libz not found])]) + ]) +AC_MSG_CHECKING([if libssh link works]) + dnl libseccomp-dev PKG_CHECK_MODULES([libseccomp], [libseccomp >= 2.2.1], [], @@ -60,8 +95,9 @@ AC_SUBST([libseccomp_LIBS]) dnl Check for valgrind PKG_CHECK_MODULES([valgrind], [valgrind >= 3.12.0], [ AC_DEFINE([HAVE_VALGRIND], [1], - [Define to 1 if you have/want valgrind support]) ], - []) + [Define to 1 if you have/want valgrind support]), + valgrind_enabled="yes" ], + [ valgrind_enabled="no" ]) AC_SUBST([valgrind_CFLAGS]) AC_SUBST([valgrind_LIBS]) |