1
0
forked from bip/bip

Fewer build options.

Eagerly depend on openssl and check, build degraded without.
This commit is contained in:
Arnaud Cornet 2018-11-18 14:23:06 -05:00 committed by Pierre-Louis Bonicoli
parent c0fafe669d
commit 87f3415330
Signed by untrusted user: pilou
GPG Key ID: ADC2651DDACD3538

View File

@ -1,6 +1,6 @@
AC_PREREQ([2.69]) AC_PREREQ([2.69])
AC_INIT([Bip IRC Proxy],[0.9.0-rc3-git],[http://bip.milkypond.org/projects/bip/activity],[bip],[http://bip.milkypond.org/]) AC_INIT([Bip IRC Proxy],[0.9.0-rc3-git],[http://bip.milkypond.org/projects/bip/activity],[bip],[http://bip.milkypond.org/])
AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_HEADERS([src/config.h])
@ -12,6 +12,8 @@ AC_PROG_RANLIB
AC_PROG_INSTALL AC_PROG_INSTALL
AM_PROG_LEX AM_PROG_LEX
AC_PROG_YACC AC_PROG_YACC
m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([Please install pkg-config.])])
PKG_PROG_PKG_CONFIG
# Deal with parameters # Deal with parameters
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debug build])) AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debug build]))
@ -21,7 +23,6 @@ AC_ARG_ENABLE([oidentd], AS_HELP_STRING([--enable-oidentd],
[Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)])) [Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)]))
AC_ARG_ENABLE([pie], AS_HELP_STRING([--disable-pie], AC_ARG_ENABLE([pie], AS_HELP_STRING([--disable-pie],
[Do not build a position independent executable])) [Do not build a position independent executable]))
AC_ARG_ENABLE([tests], AS_HELP_STRING([--enable-tests], [Build tests]))
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes) AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
AS_IF([test "x$enable_debug" = "xyes"], [ AS_IF([test "x$enable_debug" = "xyes"], [
@ -41,46 +42,34 @@ AS_IF([test "x$enable_oidentd" = "xyes"], [
enable_oidentd=no enable_oidentd=no
]) ])
AS_IF([test "x$with_openssl" != "xno"], [ PKG_CHECK_MODULES(OPENSSL, [libssl >= 0.9.8 libcrypto >= 0.9.8], [with_openssl=yes], [with_openssl=no])
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [
AC_MSG_ERROR([library 'crypto' is required for OpenSSL support]) AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
with_openssl=no save_CFLAGS=$CFLAGS
], -lcrypto) save_LDFLAGS=$LDFLAGS
AC_CHECK_LIB(ssl, SSL_read, [], [ CFLAGS="$CFLAGS -fPIE"
AC_MSG_ERROR([library 'ssl' is required for OpenSSL support]) LDFLAGS="$LDFLAGS -pie"
with_openssl=no AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
], -lssl) [ap_cv_cc_pie=yes],
], [ [ap_cv_cc_pie=no],
with_openssl=no [ap_cv_cc_pie=yes]
)
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
]) ])
if test "$ap_cv_cc_pie" = "yes"; then
CFLAGS="$CFLAGS -fPIE"
LDFLAGS="$LDFLAGS -pie"
enable_pie=yes
fi
AS_IF([test "x$enable_pie" != "xno"], [ PKG_CHECK_MODULES([CHECK], [check >= 0.9.6], [
AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [ AC_CONFIG_FILES([tests/Makefile])
save_CFLAGS=$CFLAGS enable_tests=yes
save_LDFLAGS=$LDFLAGS ], [ enable_tests=no ])
CFLAGS="$CFLAGS -fPIE"
LDFLAGS="$LDFLAGS -pie"
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
[ap_cv_cc_pie=yes],
[ap_cv_cc_pie=no],
[ap_cv_cc_pie=yes]
)
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
])
if test "$ap_cv_cc_pie" = "yes"; then
CFLAGS="$CFLAGS -fPIE"
LDFLAGS="$LDFLAGS -pie"
enable_pie=yes
fi
])
AS_IF([test "x$enable_tests" != "xno"], [
PKG_CHECK_MODULES([CHECK], [check >= 0.9.6])
])
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile]) AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT AC_OUTPUT
AS_IF([test "x$with_openssl" != "xno"], [ AS_IF([test "x$with_openssl" != "xno"], [
@ -89,6 +78,4 @@ echo OPENSSL: yes
echo DEBUG: $enable_debug $backtrace echo DEBUG: $enable_debug $backtrace
echo OIDENTD: $enable_oidentd echo OIDENTD: $enable_oidentd
echo PIE: $enable_pie echo PIE: $enable_pie
AS_IF([test "x$enable_tests" != "xno"], [
echo TESTS: $enable_tests echo TESTS: $enable_tests
])