1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
AC_PREREQ([2.69])
AC_INIT([Bip Sexy IRC Proxy], [0.9.0-rc3],
[http://bip.milkypond.org/projects/bip/activity], [bip],
[http://bip.milkypond.org/])
AM_INIT_AUTOMAKE([subdir-objects])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_SRCDIR([src/bip.h])
AC_CONFIG_HEADERS([src/config.h])
# Checks for programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AM_PROG_LEX
AC_PROG_YACC
# AC_PROG_YACC falls back to YACC = "yacc" if bison or byacc are not found,
# but it does not mean it is present
AS_IF([test x"$YACC" = "xyacc"], [
AC_CHECK_PROG([YACC_EXISTS], [yacc], [yes], [no])
AS_IF([test x"$YACC_EXISTS" != xyes], [
YACC=${am_missing_run}yacc
])
])
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h malloc.h \
netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \
sys/socket.h sys/time.h termios.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AX_C___ATTRIBUTE__
AH_BOTTOM([
/* Unused attributes such as function parameters (GCC extension) */
#ifdef HAVE___ATTRIBUTE__
# define UNUSED(ATTRIBUTE) ATTRIBUTE __attribute__((unused))
#else
# define UNUSED(ATTRIBUTE) ATTRIBUTE
#endif])
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_CHECK_FUNCS(clock_gettime ftruncate gethostname gettimeofday localtime_r memmove)
AC_CHECK_FUNCS(memset mkdir select socket strcasecmp strchr strcspn strdup strerror)
AC_CHECK_FUNCS(strrchr strstr)
# Deal with parameters
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debug build]))
AC_ARG_WITH([openssl], AS_HELP_STRING([--without-openssl],
[Disable SSL using OpenSSL]))
AC_ARG_ENABLE([oidentd], AS_HELP_STRING([--enable-oidentd],
[Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)]))
AC_ARG_ENABLE([pie], AS_HELP_STRING([--disable-pie],
[Do not build a position independent executable]))
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
AS_IF([test "x$enable_debug" = "xyes"], [
AC_CHECK_FUNC(backtrace_symbols_fd, [
AC_DEFINE(HAVE_BACKTRACE, [], [Use glibc backtrace on fatal()])
LDFLAGS="-rdynamic $LDFLAGS"
backtrace="(with backtrace)"
])
], [
enable_debug=no
])
AM_CONDITIONAL(OIDENTD, test x$enable_identd = xyes)
AS_IF([test "x$enable_oidentd" = "xyes"], [
AC_DEFINE([HAVE_OIDENTD], [], [Have bip edit ~/.oidentd.conf])
], [
enable_oidentd=no
])
AS_IF([test "x$with_openssl" != "xno"], [
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [
AC_MSG_ERROR([library 'crypto' is required for OpenSSL support])
with_openssl=no
], -lcrypto)
AC_CHECK_LIB(ssl, SSL_read, [], [
AC_MSG_ERROR([library 'ssl' is required for OpenSSL support])
with_openssl=no
], -lssl)
], [
with_openssl=no
])
AS_IF([test "x$enable_pie" != "xno"], [
AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
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
])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AS_IF([test "x$with_openssl" != "xno"], [
echo OPENSSL: yes
])
echo DEBUG: $enable_debug $backtrace
echo OIDENTD: $enable_oidentd
echo PIE: $enable_pie
|