-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
180 lines (158 loc) · 7.2 KB
/
configure.ac
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
dnl -*- Autoconf -*-
dnl Process this file with autoconf to produce a configure script. Use
dnl `autoscan` to find dependencies to be added to this file.
dnl Process any command-line arguments and perform various initializations and
dnl verifications.
AC_INIT([my_program],[0.1.0],[user@mail.com])
dnl Make AC_OUTPUT create the file(s) in the blank-or-newline-separated list
dnl header containing C preprocessor #define statements, and replace ‘@DEFS@’ in
dnl generated files with -DHAVE_CONFIG_H instead of the value of DEFS.
AC_CONFIG_HEADERS([config.h])
dnl Ensure that a recent enough version of Autoconf is being used.
AC_PREREQ([2.69])
dnl Configure scripts will have a comment with the version of this file.
AC_REVISION([$Revision: 0.1.2$])
dnl This checks if the script is running in the appropiate directory.
AC_CONFIG_SRCDIR([src/my_program.c])
dnl Runs many macros required for proper operation of the generated Makefiles.
dnl -Wall Turn on all categories of warnings.
dnl foreign Automake will check for only those things that are absolutely
dnl required for proper operation.
dnl subdir-objects If this option is specified, then objects are placed into the
dnl subdirectory of the build directory corresponding to the subdirectory of
dnl the source file.
dnl std-options Make the installcheck rule check that installed scripts and
dnl progrms support the --help and --version options.
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects std-options])
dnl You must use this macro when you use the archiver in your project, if you
dnl want support for unusual archivers such as Microsoft lib.
AM_PROG_AR
dnl Specify dir as the location of additional local Autoconf macros.
AC_CONFIG_MACRO_DIR([m4])
dnl Ensure that a recent enough version of Libtool is being used.
LT_PREREQ([2.2])
dnl This macro adds many new tests to the configure script so that the generated
dnl libtool script will understand the characteristics of the host.
LT_INIT([dlopen shared])
dnl Do compilation tests using the compiler, preprocessor, and file extensions
dnl for the specified language. C and Erlang are supported languages.
AC_LANG(C)
AC_PROG_CC dnl Determines a C compiler to use.
AC_PROG_CXX dnl Determines a C++ compiler to use.
AX_COVERAGE dnl Enables code coverage.
AX_VALGRIND_CHECK dnl Automatically generates rules to run valgrind in tests.
dnl If the Make command, $MAKE if set or else `make', predefines $(MAKE), define
dnl output variable SET_MAKE to be empty. Otherwise, define SET_MAKE to a macro
dnl definition that sets $(MAKE), such as `MAKE=make'.
AC_PROG_MAKE_SET
dnl ############################################################################
dnl Configuration flags.
dnl ############################################################################
dnl Check for doxygen.
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN"; then
AC_MSG_WARN([Unable to find Doxygen.])
fi
dnl Check for dot.
AC_CHECK_PROGS([DOT], [dot])
if test -z "$DOT"; then
AC_MSG_ERROR([Unable to find dot, needed by Doxygen.])
fi
dnl Check for pdflatex.
AC_CHECK_PROGS([PDFLATEX], [pdflatex])
if test -z "$PDFLATEX"; then
AC_MSG_ERROR([Unable to find pdflatex, needed by Doxygen.])
fi
dnl Set variable as result of checking for doxygen.
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
dnl Adds feature as a configuration flag.
AC_ARG_ENABLE([MY_FEATURE], dnl feature.
dnl help-string.
[AS_HELP_STRING([--enable-my-feature],[Enables my feature.])],
[], dnl action-if-given.
[] dnl action-if-not-given.
)
dnl Generates a conditional in Makefiles,"yes" with --enable_my_feature.
AM_CONDITIONAL([ENABLE_MY_FEATURE], [test "x$enable_my_feature" = "xyes"])
AM_COND_IF([ENABLE_MY_FEATURE], (
AC_DEFINE([ENABLE_MY_FEATURE], [1], [Enables my feature.])))
dnl ############################################################################
dnl Checks for libraries.
dnl ############################################################################
dnl This macro figures out how to build C programs using POSIX threads.
AX_PTHREAD(, [AC_MSG_ERROR([Unable to find library libpthread])])
# Dependency for the GNU Scientific Library.
AC_CHECK_LIB([m], [cos], [],
[AC_MSG_ERROR([Unable to find math library.])])
# Dependency for the GNU Sclientific Library.
AC_CHECK_LIB([gslcblas], [cblas_dgemm], [],
[AC_MSG_ERROR([Unable to find cblas library.])])
dnl Chefk for GNU Scientific Library.
AC_CHECK_LIB([gsl], [gsl_blas_dgemm], [],
[AC_MSG_ERROR([Unable to find gsl library.])])
dnl Check for libcmocka.
AC_CHECK_LIB([cmocka], [_run_group_tests], [],
[AC_MSG_ERROR([Unable to find cmocka library.])])
dnl ############################################################################
dnl Checks for header files.
dnl ############################################################################
dnl Checks for multiple headers in the system.
dnl AC_CHECK_HEADERS([])
dnl ############################################################################
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ############################################################################
dnl If the C compiler recognizes the restrict keyword, don't do anything. If it
dnl recognizes only a variant spelling (__restrict, __restrict__, or _Restrict),
dnl then define restrict to that. Otherwise, define restrict to be empty. Thus,
dnl programs may simply use restrict as if every C compiler supported it; for
dnl those that do not, the makefile or configuration header defines it away.
AC_C_RESTRICT
dnl ############################################################################
dnl Checks for library functions.
dnl ############################################################################
dnl Search for the following functions.
AC_CHECK_FUNCS([strerror])
dnl ############################################################################
dnl Config files.
dnl ############################################################################
dnl If doxygen is available, add DoxyFile in doc folder.
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([Doxyfile])])
dnl Make AC_OUTPUT create each file by copying an input file (by default
dnl file.in), substituting the output variable values.
AC_CONFIG_FILES([
Makefile
src/Makefile
include/Makefile
include/my_program/Makefile
tests/Makefile
])
AC_OUTPUT dnl Generate config.status and launch it.
dnl Check configuration to print it.
if test "x$enable_my_feature" == "xyes"; then
MY_FEATURE="yes"
else
MY_FEATURE="no"
fi
dnl Report if user manual is available.
if test "x$DOXYGEN" == "xdoxygen"; then
user_manual="yes"
else
user_manual="no"
fi
dnl Prints selected configuration.
AC_MSG_NOTICE([
Host setup: ${host}
Install prefix: ${prefix}
Compiler: ${CC}
CFLAGS: ${CFLAGS}
CPPFLAGS: ${CPPFLAGS}
LDFLAGS: ${LDFLAGS}
LIBS: ${LIBS}
my_program version: ${VERSION}
Build my_program: Shared=${enable_shared}, Static=${enable_static}
Built-in manual: ${user_manual}
Log level: ${log_level}
Valgrind support: ${enable_valgrind}
Code coverage support: ${COVERAGE_SUPPORT}
My feature: ${MY_FEATURE}
])