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
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([libmd], [m4_esyscmd([./get-version])], [libbsd@lists.freedesktop.org])
AC_CONFIG_SRCDIR([src/sha2.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(
[1.11]
[-Wall]
[foreign]
[nostdinc]
[no-dist-gzip dist-xz]
)
AM_SILENT_RULES([yes])
LIBMD_ABI_MAJOR=0
LIBMD_ABI_MINOR=1
LIBMD_ABI_PATCH=0
LIBMD_ABI="$LIBMD_ABI_MAJOR:$LIBMD_ABI_MINOR:$LIBMD_ABI_PATCH"
AC_SUBST([LIBMD_ABI])
# Check and store if we got user supplied variables.
user_CFLAGS=${CFLAGS-unset}
# Checks for operating system services and capabilities.
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AM_PROG_AR
LT_INIT
LIBMD_LINKER_VERSION_SCRIPT
# Checks for programs.
AC_PROG_SED
AC_PROG_CC
# Checks for the build machinery.
AS_IF([test "$user_CFLAGS" = unset], [
LIBMD_CHECK_COMPILER_FLAG([-Wall])
LIBMD_CHECK_COMPILER_FLAG([-Wextra])
LIBMD_CHECK_COMPILER_FLAG([-Wbad-function-cast])
LIBMD_CHECK_COMPILER_FLAG([-Wc99-c11-compat])
LIBMD_CHECK_COMPILER_FLAG([-Wcast-align])
LIBMD_CHECK_COMPILER_FLAG([-Wdeclaration-after-statement])
LIBMD_CHECK_COMPILER_FLAG([-Wdocumentation])
LIBMD_CHECK_COMPILER_FLAG([-Wduplicated-branches])
LIBMD_CHECK_COMPILER_FLAG([-Wduplicated-cond])
LIBMD_CHECK_COMPILER_FLAG([-Wformat -Wformat-security])
LIBMD_CHECK_COMPILER_FLAG([-Wformat=2])
LIBMD_CHECK_COMPILER_FLAG([-Winit-self])
LIBMD_CHECK_COMPILER_FLAG([-Wlogical-not-parentheses])
LIBMD_CHECK_COMPILER_FLAG([-Wlogical-op])
LIBMD_CHECK_COMPILER_FLAG([-Wmissing-declarations])
LIBMD_CHECK_COMPILER_FLAG([-Wmissing-format-attribute])
LIBMD_CHECK_COMPILER_FLAG([-Wmissing-prototypes])
LIBMD_CHECK_COMPILER_FLAG([-Wnested-externs])
LIBMD_CHECK_COMPILER_FLAG([-Wno-tautological-constant-out-of-range-compare])
LIBMD_CHECK_COMPILER_FLAG([-Wno-unused-parameter])
LIBMD_CHECK_COMPILER_FLAG([-Wnull-dereference])
LIBMD_CHECK_COMPILER_FLAG([-Wold-style-definition])
LIBMD_CHECK_COMPILER_FLAG([-Wpointer-arith])
LIBMD_CHECK_COMPILER_FLAG([-Wredundant-decls])
LIBMD_CHECK_COMPILER_FLAG([-Wregister])
LIBMD_CHECK_COMPILER_FLAG([-Wrestrict])
LIBMD_CHECK_COMPILER_FLAG([-Wshadow])
LIBMD_CHECK_COMPILER_FLAG([-Wshift-negative-value])
LIBMD_CHECK_COMPILER_FLAG([-Wsizeof-array-argument])
LIBMD_CHECK_COMPILER_FLAG([-Wstrict-prototypes])
LIBMD_CHECK_COMPILER_FLAG([-Wswitch-bool])
LIBMD_CHECK_COMPILER_FLAG([-Wvla])
LIBMD_CHECK_COMPILER_FLAG([-Wwrite-strings])
CFLAGS="$LIBMD_COMPILER_FLAGS $CFLAGS"
AC_ARG_ENABLE([sanitize],
[AS_HELP_STRING([--enable-sanitize], [enable compiler sanitizer support])],
[
LIBMD_COMPILER_FLAGS=''
LIBMD_CHECK_COMPILER_FLAG([-fsanitize=address])
LIBMD_CHECK_COMPILER_FLAG([-fsanitize=leak])
LIBMD_CHECK_COMPILER_FLAG([-fsanitize=undefined])
CFLAGS="$LIBMD_COMPILER_FLAGS $CFLAGS"
LDFLAGS="$LIBMD_COMPILER_FLAGS $LDFLAGS"
])
])
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
# Checks for library functions.
AC_CONFIG_FILES([
Makefile
include/Makefile
man/Makefile
src/Makefile
src/libmd.pc
test/Makefile
])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT