param test: Only provide rseq_gettid if BENCHMARK is not defined
[librseq.git] / configure.ac
CommitLineData
4a97c059
MJ
1dnl SPDX-License-Identifier: MIT
2dnl
3dnl Copyright (C) 2021 EfficiOS, Inc.
4dnl
5dnl Process this file with autoconf to produce a configure script.
6
7# Project version information
8m4_define([rseq_version_major], [0])
9m4_define([rseq_version_minor], [1])
10m4_define([rseq_version_patch], [0])
11m4_define([rseq_version_dev_stage], [-pre])
12m4_define([rseq_version], rseq_version_major[.]rseq_version_minor[.]rseq_version_patch[]rseq_version_dev_stage)
13
14# Library version information of "librseq"
2cbca301
MJ
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
4a97c059
MJ
17m4_define([rseq_lib_version_current], [0])
18m4_define([rseq_lib_version_revision], [0])
19m4_define([rseq_lib_version_age], [0])
20m4_define([rseq_lib_version], rseq_lib_version_current[:]rseq_lib_version_revision[:]rseq_lib_version_age)
21
22
23## ##
24## Autoconf base setup ##
25## ##
26
27AC_PREREQ([2.69])
28AC_INIT([librseq],[rseq_version],[mathieu dot desnoyers at efficios dot com],[],[https://github.com/compudj/librseq/])
2cbca301
MJ
29
30AC_CONFIG_HEADERS([include/config.h])
31AC_CONFIG_AUX_DIR([config])
32AC_CONFIG_MACRO_DIR([m4])
33
34AC_CANONICAL_TARGET
35AC_CANONICAL_HOST
36
4a97c059
MJ
37
38## ##
39## Automake base setup ##
40## ##
41
42AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip nostdinc -Wall -Werror])
2cbca301
MJ
43AM_MAINTAINER_MODE([enable])
44
4a97c059
MJ
45# Enable silent rules by default
46AM_SILENT_RULES([yes])
2cbca301 47
4a97c059
MJ
48
49## ##
50## C compiler checks ##
51## ##
52
53# Choose the C compiler
2cbca301 54AC_PROG_CC
4a97c059
MJ
55# AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
56m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
2cbca301 57
4a97c059
MJ
58# Make sure the C compiler supports C99
59AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
2cbca301 60
4a97c059
MJ
61# Enable available system extensions and LFS support
62AC_USE_SYSTEM_EXTENSIONS
63AC_SYS_LARGEFILE
64
65# Make sure the C compiler supports __attribute__
66AX_C___ATTRIBUTE__
67AS_IF([test "x$ax_cv___attribute__" != "xyes"],
68 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
69
70# Make sure we have pthread support
71AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
2cbca301
MJ
72
73# Checks for typedefs, structures, and compiler characteristics.
74AC_C_INLINE
4a97c059 75AC_C_TYPEOF
2cbca301
MJ
76AC_TYPE_INT32_T
77AC_TYPE_INT64_T
78AC_TYPE_OFF_T
79AC_TYPE_SIZE_T
80AC_TYPE_UINT32_T
81AC_TYPE_UINT64_T
82
2cbca301 83
4a97c059
MJ
84## ##
85## Header checks ##
86## ##
87
88AC_HEADER_STDBOOL
89AC_CHECK_HEADERS([ \
90 limits.h \
91 stddef.h \
92 sys/time.h \
93])
94
95AC_CHECK_HEADER([linux/rseq.h], [],
96 [AC_MSG_ERROR([Cannot find 'linux/rseq.h'.])
97])
98
99
100## ##
101## Programs checks ##
102## ##
103
104AM_PROG_AR
105AC_PROG_AWK
106AC_PROG_MAKE_SET
107
108# Initialize and configure libtool
109LT_INIT
2cbca301 110
4a97c059
MJ
111
112## ##
113## Library checks ##
114## ##
2cbca301
MJ
115
116# Checks for library functions.
117AC_FUNC_MMAP
118AC_FUNC_FORK
119AC_CHECK_FUNCS([ \
4a97c059 120 atexit \
2cbca301
MJ
121 memset \
122 strerror \
123])
124
125# AC_FUNC_MALLOC causes problems when cross-compiling.
126#AC_FUNC_MALLOC
127
9698c399
MD
128# Check dor dlopen() in -ldl or -lc
129AC_CHECK_LIB([dl], [dlopen], [
130 libdl_name=dl
131 DL_LIBS="-ldl"
132], [
133 # dlopen not found in libdl, check in libc
134 AC_CHECK_LIB([c], [dlopen], [
135 libdl_name=c
136 DL_LIBS="-lc"
137 ], [
138 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
139 ])
140])
141AC_SUBST(DL_LIBS)
2cbca301 142
4a97c059
MJ
143## ##
144## Substitute variables for use in Makefile.am ##
145## ##
146
147# Library versions for libtool
148AC_SUBST([RSEQ_LIBRARY_VERSION], [rseq_lib_version])
2cbca301 149
4a97c059
MJ
150# The order in which the include folders are searched is important.
151# The top_builddir should always be searched first in the event that a build
152# time generated file is included.
153AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
2cbca301
MJ
154AC_SUBST(AM_CPPFLAGS)
155
4a97c059 156AM_CFLAGS="-Wall -Wextra $PTHREAD_CFLAGS"
2cbca301
MJ
157AC_SUBST(AM_CFLAGS)
158
4a97c059
MJ
159
160## ##
161## Output files generated by configure ##
162## ##
163
2cbca301
MJ
164AC_CONFIG_FILES([
165 Makefile
6146efae
MD
166 doc/Makefile
167 doc/man/Makefile
2cbca301
MJ
168 include/Makefile
169 src/Makefile
2cbca301 170 src/librseq.pc
b848736e 171 tests/Makefile
544cdc88 172 tests/utils/Makefile
2cbca301
MJ
173])
174
175AC_OUTPUT
aa4ed6d6 176
4a97c059 177
aa4ed6d6
MJ
178#
179# Mini-report on what will be built.
180#
181
182PPRINT_INIT
183PPRINT_SET_INDENT(1)
184PPRINT_SET_TS(38)
185
186AS_ECHO
187AS_ECHO("${PPRINT_COLOR_BLDBLU}librseq $PACKAGE_VERSION${PPRINT_COLOR_RST}")
188AS_ECHO
189
190PPRINT_SUBTITLE([Features])
191
192PPRINT_PROP_STRING([Target architecture], $host_cpu)
193
aa4ed6d6
MJ
194report_bindir="`eval eval echo $bindir`"
195report_libdir="`eval eval echo $libdir`"
196
197# Print the bindir and libdir this `make install' will install into.
198AS_ECHO
199PPRINT_SUBTITLE([Install directories])
200PPRINT_PROP_STRING([Binaries], [$report_bindir])
201PPRINT_PROP_STRING([Libraries], [$report_libdir])
This page took 0.030518 seconds and 4 git commands to generate.