1 dnl SPDX-License-Identifier: MIT
3 dnl Copyright (C) 2021 EfficiOS, Inc.
5 dnl Process this file with autoconf to produce a configure script.
7 # Project version information
8 m4_define([rseq_version_major], [0])
9 m4_define([rseq_version_minor], [1])
10 m4_define([rseq_version_patch], [0])
11 m4_define([rseq_version_dev_stage], [-pre])
12 m4_define([rseq_version], rseq_version_major[.]rseq_version_minor[.]rseq_version_patch[]rseq_version_dev_stage)
14 # Library version information of "librseq"
15 # Following the numbering scheme proposed by libtool for the library version
16 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
17 m4_define([rseq_lib_version_current], [0])
18 m4_define([rseq_lib_version_revision], [0])
19 m4_define([rseq_lib_version_age], [0])
20 m4_define([rseq_lib_version], rseq_lib_version_current[:]rseq_lib_version_revision[:]rseq_lib_version_age)
24 ## Autoconf base setup ##
28 AC_INIT([librseq],[rseq_version],[mathieu dot desnoyers at efficios dot com],[],[https://github.com/compudj/librseq/])
30 AC_CONFIG_HEADERS([include/config.h])
31 AC_CONFIG_AUX_DIR([config])
32 AC_CONFIG_MACRO_DIR([m4])
39 ## Automake base setup ##
42 AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip nostdinc -Wall -Werror])
43 AM_MAINTAINER_MODE([enable])
45 # Enable silent rules by default
46 AM_SILENT_RULES([yes])
50 ## C compiler checks ##
53 # Choose the C compiler
55 # AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
56 m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
58 # Make sure the C compiler supports C99
59 AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
61 # Enable available system extensions and LFS support
62 AC_USE_SYSTEM_EXTENSIONS
65 # Make sure the C compiler supports __attribute__
67 AS_IF([test "x$ax_cv___attribute__" != "xyes"],
68 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
70 # Make sure we have pthread support
71 AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
73 # Checks for typedefs, structures, and compiler characteristics.
95 AC_CHECK_HEADER([linux/rseq.h], [],
96 [AC_MSG_ERROR([Cannot find 'linux/rseq.h'.])
101 ## Programs checks ##
108 # Initialize and configure libtool
116 # Checks for library functions.
125 # AC_FUNC_MALLOC causes problems when cross-compiling.
130 ## Substitute variables for use in Makefile.am ##
133 # Library versions for libtool
134 AC_SUBST([RSEQ_LIBRARY_VERSION], [rseq_lib_version])
136 # The order in which the include folders are searched is important.
137 # The top_builddir should always be searched first in the event that a build
138 # time generated file is included.
139 AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
140 AC_SUBST(AM_CPPFLAGS)
142 AM_CFLAGS="-Wall -Wextra $PTHREAD_CFLAGS"
147 ## Output files generated by configure ##
165 # Mini-report on what will be built.
173 AS_ECHO("${PPRINT_COLOR_BLDBLU}librseq $PACKAGE_VERSION${PPRINT_COLOR_RST}")
176 PPRINT_SUBTITLE([Features])
178 PPRINT_PROP_STRING([Target architecture], $host_cpu)
180 report_bindir="`eval eval echo $bindir`"
181 report_libdir="`eval eval echo $libdir`"
183 # Print the bindir and libdir this `make install' will install into.
185 PPRINT_SUBTITLE([Install directories])
186 PPRINT_PROP_STRING([Binaries], [$report_bindir])
187 PPRINT_PROP_STRING([Libraries], [$report_libdir])