forked from mittinatten/freesasa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
188 lines (157 loc) · 6.15 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
181
182
183
184
185
186
187
188
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([FreeSASA], [2.0.3])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
m4_include([m4/ax_compare_version.m4])
AC_DEFINE([REPORTBUG], ["Report bugs to <https://github.com/mittinatten/freesasa/issues>"], [Bug report string])
AC_DEFINE([HOMEPAGE], ["<http://freesasa.github.io>"], [Project homepage])
AC_DEFINE([FREESASA_XMLNS], ["http://freesasa.github.io/"], [XML namespace])
# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
# Checks for libraries.
AC_CHECK_LIB([m], [sqrt])
AC_CHECK_LIB([dl], [dlsym])
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([inttypes.h libintl.h malloc.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h dlfcn.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
AC_C_RESTRICT
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# use C99
AC_PROG_CC_C99
AC_C_INLINE
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memset mkdir sqrt strchr strdup strerror strncasecmp getopt_long getline])
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile doc/Doxyfile doc/man/freesasa.1 tests/Makefile share/Makefile])
AC_CONFIG_FILES([tests/test-cli], [chmod +x tests/test-cli])
# Optionally disable thread support
AC_ARG_ENABLE([threads],
AS_HELP_STRING([--disable-threads],
[Build without support for multiple threads]))
if test "x$enable_threads" != "xno"; then
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_HEADER([pthread.h])
fi
if test "$ac_cv_header_pthread_h" != yes || \
test "$ac_cv_lib_pthread_pthread_create" != yes; then
AC_DEFINE([USE_THREADS], [0], [])
AM_CONDITIONAL([USE_THREADS], false)
echo "Building without thread support"
else
AC_DEFINE([USE_THREADS], [1], [Define if threads should be used.])
AM_CONDITIONAL([USE_THREADS], true)
fi
# disable XML
AC_ARG_ENABLE([xml],
AS_HELP_STRING([--disable-xml],
[Build without support for XML output]))
AC_DEFINE([USE_XML], [0], [Define if XML should be included.])
AM_CONDITIONAL([USE_XML], false)
if test "x$enable_xml" != "xno" ; then
AC_CHECK_PROG([XMLLINT],[xmllint],[xmllint],[])
PKG_CHECK_MODULES([libxml2], [libxml-2.0],
[AC_DEFINE([USE_XML], [1])
AC_SUBST([USE_XML], [yes])
AM_CONDITIONAL([USE_XML], true)],
[AC_MSG_ERROR([Library libxml2 not found, install library or build without (using --disable-xml).])])
else
AC_MSG_NOTICE([Building without support for XML output.])
fi
# Disable json-c
AC_ARG_ENABLE([json],
AS_HELP_STRING([--enable-json],
[Build without support for JSON output]))
AC_DEFINE([USE_JSON], [0], [Define if JSON should be included])
AM_CONDITIONAL([USE_JSON], false)
if test "x$enable_json" != "xno" ; then
AC_CHECK_LIB([json-c], [json_object_get],
[AC_CHECK_HEADER([json-c/json_object.h],
[AC_DEFINE([USE_JSON], [1])
AC_SUBST([USE_JSON], [yes])
AM_CONDITIONAL([USE_JSON], true)])])
AM_COND_IF([USE_JSON],[],
[AC_MSG_ERROR([Library JSON-C not found, install library or build without (using --disable-json).])])
AC_CHECK_PROG([JSONLINT],[jsonlint],[jsonlint],[])
else
AC_MSG_NOTICE([Building without support for JSON output.])
fi
# Enable parser generation with Flex/Bison
AC_ARG_ENABLE([parser-generator],
[AS_HELP_STRING([--enable-parser-generator],
[Regenerate parser/lexer using Flex and Bison (for developers)])])
AM_CONDITIONAL([GENERATE_PARSER],false)
if test "x$enable_parser_generator" = "xyes" ; then
AC_PROG_LEX
AC_CHECK_PROGS([YACC], [bison byacc yacc])
AM_CONDITIONAL([GENERATE_PARSER], [test -n $LEX && test "x$LEX" != "x:" && test -n $YACC])
AM_COND_IF([GENERATE_PARSER],[],
[AC_MSG_ERROR([Lexer and/or parser generator missing. Install Flex/lex and/or Bison/Yacc or configure without flag --enable-parser-generator.])])
fi
# Enable Doxygen
AC_ARG_ENABLE([doxygen],
[AS_HELP_STRING([--enable-doxygen],
[Build Doxygen html-documentation])])
AM_CONDITIONAL([HAVE_DOXYGEN],false)
if test "x$enable_doxygen" = "xyes" ; then
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen)
AM_CONDITIONAL([HAVE_DOXYGEN],[test -n "$DOXYGEN"])
AM_COND_IF([HAVE_DOXYGEN],[build_doc=yes],
[AC_MSG_ERROR([Doxygen not available, can not build documentation. Install library or configure without --enable-doxygen.])])
if test -n "$DOXYGEN"; then
DOXYGEN_V=`doxygen --version`
DOXYGEN_REQ=1.8.8
AX_COMPARE_VERSION([$DOXYGEN_V],[lt],[$DOXYGEN_REQ],
[echo "Warning: Doxygen should preferrably be of version $DOXYGEN_REQ or higher (found $DOXYGEN_V)"])
fi
fi
AM_CONDITIONAL([BUILD_DOC],[test -n "$build_doc"])
# Enable testing
AC_ARG_ENABLE([check],
[AS_HELP_STRING([--enable-check],
[Enable the Check unit testing framework])])
AM_CONDITIONAL([USE_CHECK],false)
AC_DEFINE([USE_CHECK],[0],[Build with Check unit testing framework])
if test "x$enable_check" = "xyes" ; then
AC_CHECK_LIB(rt, setitimer) # necessary on some platforms
AC_CHECK_LIB([check],[suite_create],
[],
[AC_MSG_ERROR[Library Check not available, install libary or configure without flag --enable-check]])
AC_DEFINE([USE_CHECK], [1])
AM_CONDITIONAL([USE_CHECK], true)
fi
# Enable gcov
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[Compile with Gcov to measure coverage])])
AM_CONDITIONAL([COND_GCOV],false)
if test "x$enable_gcov" = "xyes" ; then
AC_CHECK_LIB([gcov], [__gcov_init], [], [AC_MSG_ERROR([Missing gcov library])])
AM_CONDITIONAL([COND_GCOV],true)
fi
# Disable test for CLI
AC_ARG_ENABLE([CLI-tests],
AS_HELP_STRING([--disable-CLI-tests],
[Disable testing of command-line interface. These take time and
disabling them can help speed up development when only unit
tests are needed.]))
if test "x$enable_CLI_tests" != "xno" ; then
AM_CONDITIONAL([RUN_CLI_TESTS],true)
else
AM_CONDITIONAL([RUN_CLI_TESTS],false)
fi
AC_OUTPUT