forked from frePPLe/frepple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
331 lines (306 loc) · 12 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
#
# Process this file with autoconf to produce a configure script.
#
#
# Copyright (C) 2007-2014 by Johan De Taeye, frePPLe bvba
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Initialization
#
AC_PREREQ(2.60)
AC_INIT([frepple], [2.2.beta])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.9 tar-ustar])
#
# Checks for programs and initialize libtool
#
AC_GNU_SOURCE
LT_INIT([disable-static], [win32-dll], [dlopen])
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_LANG(C++)
AC_LANG_COMPILER_REQUIRE
AC_PROG_LIBTOOL
# Note: the library version number and the package version number are
# INDEPENDENT. The library version is the concatenation of LIBCURRENT,
# LIBREVISION and LIBAGE (in this order and separated by a colon).
# Use the following rules for updating the numbering scheme.
# 1) Increment LIBREVISION if source code has changed at all
# 2) If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
# 3) If the API changes compatibly (i.e. simply adding a new function
# without changing or removing earlier interfaces), then increment LIBAGE.
# 4) If the API changes incompatibly set LIBAGE back to 0
LIBRARY_VERSION=[0:0:0]
AC_SUBST(LIBRARY_VERSION)
#
# Define an extra configure argument to enable debugging
#
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Turn on debugging]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
#
# Define an extra configure argument to compile for test coverage measurement
# This works only with the gcov tool and the gcc compiler
#
AC_ARG_ENABLE(coverage,
AC_HELP_STRING([--enable-coverage],
[Compile for test coverage measurement (GCC only, using gcov)]),
[case "${enableval}" in
yes) coverage=true
AC_CHECK_PROGS(GCOV, gcov, nogcov)
if test x$GCOV = xnogcov
then
AC_MSG_ERROR([Could not find gcov, no coverage build is possible])
fi
;;
no) coverage=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-coverage]) ;;
esac],[coverage=false])
AM_CONDITIONAL(COVERAGE, test x$coverage = xtrue)
#
# Define an extra configure argument to compile an executable suitable for
# profiling. This compiler settings work only with the gcc compiler.
# Valgrind is highly recommended as the profiling tool. (gprof doesn't do
# trick because frePPLe uses shared libraries)
#
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile],
[Compile for profiling (GCC only)]),
[case "${enableval}" in
yes) profile=true ;;
no) profile=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-profile]) ;;
esac],[profile=false])
AM_CONDITIONAL(PROFILE, test x$profile = xtrue)
#
# Define an extra configure argument to enable the lp solver
#
AC_ARG_ENABLE(lp_solver,
AC_HELP_STRING([--enable-lp_solver],
[Build the linear programming solver module (default: true if the GLPK package is installed)]),
[case "${enableval}" in
yes) lp=true ;;
no) lp=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-lp_solver]) ;;
esac], [AC_CHECK_PROG(lp, [glpsol], true, false)])
AM_CONDITIONAL(LP, test x$lp = xtrue)
#
# Define a configure argument to enable/disable building of the documentation
#
AC_ARG_ENABLE([doc],
AC_HELP_STRING([--enable-doc],
[Enable documentation generation(default false)]),
[case "${enableval}" in
no) generatedoc=false;;
yes) generatedoc=true
AC_CHECK_PROGS(DOXYGEN, doxygen, notavailable)
if test x$DOXYGEN = xnotavailable
then
AC_MSG_ERROR([Could not find doxygen, no documentation can be built])
generatedoc=false
fi
AC_CHECK_PROGS(WGET, wget, notavailable)
if test x$WGET = xnotavailable
then
AC_MSG_ERROR([Could not find wget, no documentation can be built])
generatedoc=false
fi
;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-doc]) ;;
esac],[generatedoc=false])
AM_CONDITIONAL(DOC, test x$generatedoc = xtrue)
#
# Define a configure argument to pass python installation parameters
#
AC_ARG_VAR([PYFLAGS],
[Argument passed to setup.py when installing frePPLe's Python application.])
# Check the availability of the external programs
AC_CHECK_PROG(HAVE_DOT, dot, [YES], [NO])
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h unistd.h perl.h python.h pthread.h])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([dup2 memset strncasecmp strnicmp strptime putenv _putenv setlocale localtime_r])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADERS([ext/slist slist vector map set stack])
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Verify support for namespaces
AC_TRY_COMPILE(
[namespace Outer { namespace Inner { int i = 0; }}],
[using namespace Outer::Inner; return i;],
[],
[AC_MSG_ERROR([
This package requires a C++ compiler that supports namespaces.
])])
#
# Verify installation of XERCES-C
#
AC_CHECK_HEADER([xercesc/util/XercesDefs.hpp], [],
[AC_MSG_ERROR([
This package requires the XERCES-C XML parser...
Please install this package and its development libraries.
Check out http://xml.apache.org/xerces-c for more information.
])])
AC_CHECK_LIB([xerces-c], [main], [],
[AC_MSG_ERROR([
This package requires the XERCES-C XML parser...
Please install this package and its development libraries.
Check out http://xml.apache.org/xerces-c for more information.
])])
AC_CHECKING([for xerces-c version >= 2.8 ])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include "xercesc/util/XercesVersion.hpp"
#if (XERCES_VERSION_MAJOR==2 && XERCES_VERSION_MINOR>=8) || XERCES_VERSION_MAJOR==3
int main (void) {return 1;}
#else
force compile error;
#endif
])], [],
[AC_MSG_ERROR([
This package requires Xerces-C 2.8 or later. Your version is older...
])])
#
# Verify installation of GLPK (GNU linear programming kit)
#
if test x$lp = xtrue
then
AC_CHECK_LIB(glpk, glp_simplex,
[ true ], # dummy action to avoid that glpk is added to the list list of required libraries
[AC_MSG_ERROR([
Can't link with the glpk library.en
This package requires the GLPK linear programming solver.
Install its development library, or reconfigure with the option '--disable-lp_solver'
])])
AC_CHECK_HEADERS([glpk.h], [],
[AC_CHECK_HEADERS([glpk/glpk.h], [],
[AC_MSG_ERROR([
The glpk libray has been installed, but its header file could not be found
This package requires the GLPK linear programming solver.
Install its development library, or reconfigure with the option '--disable-lp_solver'
])])])
fi
#
# Verify installation of PYTHON
# Edit the minimum required version to 3.0 to switch to using Python 3.
#
AM_PATH_PYTHON([2.6], [],
[AC_MSG_ERROR([
This package requires Python 2.6 or higher.
Preferred versions are 2.6 and 2.7.
Support for Python 3.0 and higher is experimental.
])])
LIBS="-L/usr/lib/python$PYTHON_VERSION/config $LIBS"
CPPFLAGS="-I/usr/include/python$PYTHON_VERSION $CPPFLAGS"
AC_CHECK_LIB(python$PYTHON_VERSION, PyModule_GetDict, [],
[AC_MSG_ERROR([
Can't link with the Python library.
This package requires the Python development libraries.
])])
AC_CHECK_HEADER([Python.h], [],
[AC_MSG_ERROR([
This package requires Python.
Please install this package and its development libraries.
Check out http://www.python.org for more information.
])])
#
# Verify installation of django
#
AC_MSG_CHECKING([django Python module])
$PYTHON -c "import django" 2>/dev/null
if test $? -ne 0 ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
This package requires the django web application framework.
Please install this package from https://www.djangoproject.com/
and also make sure to apply frePPLe's patches for it.
])
fi
AC_MSG_RESULT([yes])
#
# Check whether we are running on a Windows operating system
#
AC_CHECK_HEADER(windows.h,
[AC_DEFINE(HAVE_WINDOWS_H, 1, [Define to 1 when running on windows platform.])
])
#
# Compiler&linker flags and include&library directories
#
CPPFLAGS="-I\$(top_builddir)/include $CPPFLAGS"
if test x$debug = xtrue ; then
# The settings on the next line are the normal debugging parameters
CXXFLAGS="-ggdb -Wall $CXXFLAGS -O0"
AC_DEFINE([DEBUG], [], [Used for debugging builds])
else if test x$coverage = xtrue ; then
# The settings on the next line are suitable for creating an executable to
# be used for code coverage measurement using gcc and gprof.
CXXFLAGS="-fprofile-arcs -ftest-coverage $CXXFLAGS"
AC_DEFINE([NDEBUG], [], [Disables assertions])
else if test x$profile = xtrue ; then
# The settings on the next line are suitable for creating an executable to
# be used for profiling using gcc.
# CXXFLAGS="-g -Wall -pg -fno-inline $CXXFLAGS"
CXXFLAGS="-g -Wall $CXXFLAGS"
AC_DEFINE([NDEBUG], [], [Disables assertions])
else
CXXFLAGS="-O3 -s $CXXFLAGS"
AC_DEFINE([NDEBUG], [], [Disables assertions])
fi ; fi ; fi
case $host_os in
cygwin*)
LIBS="-lpthread $LIBS"
# Linker option to avoid some ugly warnings...
LDFLAGS="$LDFLAGS -Wl,--enable-auto-import"
;;
*)
LIBS="-ldl $LIBS"
CXXFLAGS="-pthread $CXXFLAGS"
;;
esac
AM_CONDITIONAL(CYGWIN, test x$host_os = xcygwin)
# Generating the output makefiles
AC_CONFIG_FILES([ Makefile bin/Makefile doc/Makefile ])
AC_CONFIG_FILES([ include/Makefile include/frepple/Makefile ])
AC_CONFIG_FILES([ src/Makefile src/model/Makefile src/solver/Makefile src/utils/Makefile ])
AC_CONFIG_FILES([ modules/Makefile modules/lp_solver/Makefile ])
AC_CONFIG_FILES([ contrib/Makefile contrib/vc/Makefile contrib/django/Makefile contrib/installer/Makefile contrib/rpm/Makefile contrib/debian/Makefile ])
AC_CONFIG_FILES([ test/Makefile test/cluster/Makefile test/calendar/Makefile test/constraints_combined_1/Makefile test/constraints_combined_2/Makefile test/constraints_leadtime_1/Makefile test/constraints_leadtime_2/Makefile test/constraints_material_1/Makefile test/constraints_material_2/Makefile test/constraints_material_3/Makefile test/constraints_material_4/Makefile test/datetime/Makefile test/flow_alternate_1/Makefile test/flow_alternate_2/Makefile test/flow_fixed/Makefile test/lpsolver_1/Makefile test/scalability_1/Makefile test/scalability_2/Makefile test/scalability_3/Makefile test/jobshop/Makefile test/xml/Makefile test/xml_remote/Makefile test/constraints_resource_1/Makefile test/constraints_resource_2/Makefile test/constraints_resource_3/Makefile test/constraints_resource_4/Makefile test/constraints_resource_5/Makefile test/constraints_resource_6/Makefile test/problems/Makefile test/deletion/Makefile test/demand_policy/Makefile test/operation_alternate/Makefile test/operation_available/Makefile test/operation_effective/Makefile test/operation_pre_post/Makefile test/operation_routing/Makefile test/multithreading/Makefile test/name/Makefile test/python_1/Makefile test/python_2/Makefile test/python_3/Makefile test/sample_module/Makefile test/callback/Makefile test/pegging/Makefile test/safety_stock/Makefile test/buffer_procure_1/Makefile test/flow_effective/Makefile test/load_alternate/Makefile test/load_effective/Makefile test/setup_1/Makefile test/setup_2/Makefile test/setup_3/Makefile test/skills/Makefile test/wip/Makefile ])
AC_OUTPUT
# Byebye message
echo
echo "--------------------------------------------------------"
echo "Configuration is complete"
echo
echo "Run the following commands to compile and install:"
echo " make "
echo " make install"
echo
echo "--------------------------------------------------------"