[BACK]Return to configure.ac CVS log [TXT][DIR] Up to [local] / acopm

Annotation of acopm/configure.ac, Revision 1.1.1.1

1.1       bountyht    1: # Initialise autoconf
                      2:
                      3: AC_PREREQ([2.65])
                      4: AC_LANG([C])
                      5: AC_INIT([ACOPM], [0.99], [], [acopm], [https://packages.alphachat.net/projects/ACOPM.git/])
                      6: AC_CONFIG_MACRO_DIR([m4])
                      7: AC_CONFIG_SRCDIR([src/acopm.c])
                      8: AC_PREFIX_DEFAULT([$HOME/ACOPM])
                      9:
                     10:
                     11:
                     12: # Initialise automake
                     13:
                     14: AM_INIT_AUTOMAKE([subdir-objects])
                     15:
                     16:
                     17:
                     18: # Optional features
                     19:
                     20: AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [build with debugging information and runtime checks]), [], [enable_debug="no"])
                     21: AC_ARG_WITH([mbedtls], AS_HELP_STRING([--with-mbedtls], [build with support for ARM mbedTLS, =internal to build internal copy]), [], [with_mbedtls="no"])
                     22:
                     23:
                     24:
                     25: # Test for required toolchain utilities or features
                     26:
                     27: CFLAGS_GIVEN="${CFLAGS}"
                     28: CFLAGS=""
                     29:
                     30: AC_PROG_CC_C99
                     31: AM_PROG_CC_C_O
                     32: AM_PROG_AR
                     33: AC_PROG_RANLIB
                     34: AC_PROG_INSTALL
                     35: AC_PROG_MKDIR_P
                     36:
                     37:
                     38:
                     39: # Test for required compiler keywords, header includes, functions, or data types (and members)
                     40:
                     41: AC_C_CONST
                     42: AC_C_INLINE
                     43: AC_C_RESTRICT
                     44:
                     45: AC_CHECK_HEADERS(
                     46:        [arpa/inet.h errno.h fcntl.h getopt.h limits.h netdb.h netinet/in.h regex.h signal.h stdarg.h stdbool.h],
                     47:        [], AC_MSG_ERROR([required header not found])
                     48: )
                     49:
                     50: AC_CHECK_HEADERS(
                     51:        [stddef.h stdio.h sys/socket.h sys/wait.h time.h],
                     52:        [], AC_MSG_ERROR([required header not found])
                     53: )
                     54:
                     55: AC_CHECK_FUNCS(
                     56:        [calloc close dup2 execve exit fclose fcntl fileno fflush fopen fork fprintf free malloc memchr memmove],
                     57:        [], AC_MSG_ERROR([required function not found])
                     58: )
                     59:
                     60: AC_CHECK_FUNCS(
                     61:        [memset open realloc socket strcasecmp strchr strcmp strdup strerror strstr strtoul vfprintf vsprintf],
                     62:        [], AC_MSG_ERROR([required function not found])
                     63: )
                     64:
                     65: AC_CHECK_FUNCS(
                     66:        [vsnprintf],
                     67:        [], AC_MSG_ERROR([required function not found])
                     68: )
                     69:
                     70: AC_CHECK_FUNCS(
                     71:        [regcomp regerror regexec regfree],
                     72:        [], AC_MSG_ERROR([required function not found]), [[#include <regex.h>]]
                     73: )
                     74:
                     75: AC_CHECK_FUNCS(
                     76:        [localtime strftime time],
                     77:        [], AC_MSG_ERROR([required function not found]), [[#include <time.h>]]
                     78: )
                     79:
                     80: AC_CHECK_TYPES(
                     81:        [pid_t, size_t, ssize_t, uid_t, uint8_t, uint16_t, uint32_t, uint64_t, long long int],
                     82:        [], AC_MSG_ERROR([required type not found])
                     83: )
                     84:
                     85: AC_CHECK_TYPES(
                     86:        [sa_family_t, socklen_t],
                     87:        [], AC_MSG_ERROR([required type not found]), [[#include <sys/socket.h>]]
                     88: )
                     89:
                     90: AC_CHECK_MEMBERS(
                     91:        [regex_t.re_nsub, regmatch_t.rm_so, regmatch_t.rm_eo],
                     92:        [], AC_MSG_ERROR([required 'regex_t' or 'regmatch_t' member not found]), [[#include <regex.h>]]
                     93: )
                     94:
                     95: AC_CHECK_MEMBERS(
                     96:        [struct addrinfo.ai_flags, struct addrinfo.ai_family, struct addrinfo.ai_socktype],
                     97:        [], AC_MSG_ERROR([required 'struct addrinfo' member not found]), [[#include <netdb.h>]]
                     98: )
                     99:
                    100: AC_CHECK_MEMBERS(
                    101:        [struct addrinfo.ai_protocol, struct addrinfo.ai_addrlen, struct addrinfo.ai_addr, struct addrinfo.ai_next],
                    102:        [], AC_MSG_ERROR([required 'struct addrinfo' member not found]), [[#include <netdb.h>]]
                    103: )
                    104:
                    105:
                    106:
                    107: # Test for libconfig
                    108:
                    109: LIBCONFIG_ERRSTR="your libconfig is missing, broken or too old"
                    110: AC_CHECK_HEADERS([libconfig.h], [], AC_MSG_ERROR([$LIBCONFIG_ERRSTR]))
                    111: AC_SEARCH_LIBS([config_init], [config], [], AC_MSG_ERROR([$LIBCONFIG_ERRSTR]))
                    112:
                    113:
                    114:
                    115: # Test for libevent
                    116:
                    117: LIBEVENT_ERRSTR="your libevent is missing, broken or too old"
                    118: AC_CHECK_HEADERS([event2/dns.h event2/event.h], [], AC_MSG_ERROR([$LIBEVENT_ERRSTR]))
                    119: AC_SEARCH_LIBS([event_base_dispatch], [event], [], AC_MSG_ERROR([$LIBEVENT_ERRSTR]))
                    120:
                    121:
                    122:
                    123: # Test for MbedTLS
                    124:
                    125: AM_CONDITIONAL([WITH_MBEDTLS_INTERNAL], [test "x${with_mbedtls}" = "xinternal"])
                    126:
                    127: if test "x${with_mbedtls}" = "xyes"
                    128: then
                    129:        AC_DEFINE([BUILD_WITH_MBEDTLS], [1], [build with support for ARM mbedTLS])
                    130:
                    131:        LIBMBEDTLS_ERRSTR="your ARM mbedTLS libraries are missing, broken or too old"
                    132:        AC_CHECK_HEADERS(
                    133:                [mbedtls/ctr_drbg.h mbedtls/entropy.h mbedtls/error.h mbedtls/md.h],
                    134:                [], AC_MSG_ERROR([$LIBMBEDTLS_ERRSTR])
                    135:        )
                    136:        AC_CHECK_HEADERS(
                    137:                [mbedtls/pk.h mbedtls/ssl.h mbedtls/version.h mbedtls/x509_crt.h],
                    138:                [], AC_MSG_ERROR([$LIBMBEDTLS_ERRSTR])
                    139:        )
                    140:        AC_SEARCH_LIBS([mbedtls_ctr_drbg_init], [mbedcrypto], [], AC_MSG_ERROR($LIBMBEDTLS_ERRSTR))
                    141:        AC_SEARCH_LIBS([mbedtls_x509_crt_init], [mbedx509], [], AC_MSG_ERROR($LIBMBEDTLS_ERRSTR))
                    142:        AC_SEARCH_LIBS([mbedtls_ssl_init], [mbedtls], [], AC_MSG_ERROR($LIBMBEDTLS_ERRSTR))
                    143:
                    144:        test_cflags_mbedtls="yes"
                    145:        with_mbedtls="Yes"
                    146: else
                    147:        if test "x${with_mbedtls}" = "xinternal"
                    148:        then
                    149:                AC_DEFINE([BUILD_WITH_MBEDTLS], [1], [build with support for ARM mbedTLS])
                    150:
                    151:                git_submodule_update_remote="yes"
                    152:                test_cflags_mbedtls="yes"
                    153:                with_mbedtls="Yes (Building Internal Copy)"
                    154:        else
                    155:                if test "x${with_mbedtls}" = "xno"
                    156:                then
                    157:                        with_mbedtls="No"
                    158:                else
                    159:                        with_mbedtls="No (unrecognised argument '${with_mbedtls}')"
                    160:                fi
                    161:        fi
                    162: fi
                    163:
                    164:
                    165:
                    166: # If we were instructed to build with debugging support, check assert(3) works correctly
                    167:
                    168: if test "x${enable_debug}" = "xyes"
                    169: then
                    170:        AC_DEFINE([BUILD_WITH_DEBUG], [1], [build with debugging information and runtime checks])
                    171:        AC_CHECK_HEADERS([assert.h], [], AC_MSG_ERROR([assert.h not found or unusable]))
                    172:        ACOPM_TEST_ASSERT
                    173: fi
                    174:
                    175:
                    176:
                    177: # Test for C compiler diagnostic flags
                    178:
                    179: ACOPM_TEST_CFLAGS_DIAGNOSTICS
                    180:
                    181: if test "x${test_cflags_mbedtls}" = "xyes"
                    182: then
                    183:        ACOPM_TEST_CFLAGS([-Wno-redundant-decls])
                    184:        ACOPM_TEST_CFLAGS([-Wno-switch-enum])
                    185: fi
                    186:
                    187:
                    188:
                    189: # If no CFLAGS were given to the configure script, check for optimisation flags
                    190:
                    191: if test "x${CFLAGS_GIVEN}" = "x"
                    192: then
                    193:        ACOPM_TEST_CFLAGS_EXTRA
                    194:
                    195:        if test "x${enable_debug}" = "xno"
                    196:        then
                    197:                ACOPM_TEST_CFLAGS_NODEBUG
                    198:
                    199:                enable_debug="No"
                    200:        fi
                    201: else
                    202:        CFLAGS="${CFLAGS} ${CFLAGS_GIVEN}"
                    203: fi
                    204:
                    205: if test "x${enable_debug}" = "xyes"
                    206: then
                    207:        ACOPM_TEST_CFLAGS_DEBUG
                    208:
                    209:        enable_debug="Yes"
                    210: fi
                    211:
                    212:
                    213:
                    214: # Define some compile-time directories
                    215:
                    216: AC_DEFINE_PATH([BINDIR], ["${bindir}"], [Binary installation directory])
                    217: AC_DEFINE_PATH([SYSCONFDIR], ["${sysconfdir}"], [System configuration directory])
                    218:
                    219:
                    220:
                    221: # Generate the output files
                    222:
                    223: if test "x${git_submodule_update_remote}" = "xyes"
                    224: then
                    225:        AC_MSG_NOTICE([checking out ARM mbedTLS repository])
                    226:
                    227:        if ! git submodule update --init --remote --recursive
                    228:        then
                    229:                AC_MSG_ERROR([failed])
                    230:        fi
                    231: fi
                    232:
                    233: AC_CONFIG_FILES([Makefile dist/acopm-dronebl-submit.py])
                    234: AC_CONFIG_HEADERS([lib/acopm-config.h])
                    235: AC_OUTPUT
                    236:
                    237:
                    238:
                    239: # Give some information to the user
                    240:
                    241: echo "  "
                    242: echo "  Configuration of ${PACKAGE_NAME} version ${PACKAGE_VERSION}"
                    243: echo "  "
                    244: echo "    Installation prefix .......: $(eval echo ${prefix})"
                    245: echo "    Binary directory ..........: $(eval echo ${bindir})"
                    246: echo "    Configuration directory ...: $(eval echo ${sysconfdir})"
                    247: echo "  "
                    248: echo "    Debugging Support .........: ${enable_debug}"
                    249: echo "    ARM mbedTLS Support .......: ${with_mbedtls}"
                    250: echo "  "

CVSweb