forked from frePPLe/frepple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
384 lines (359 loc) · 11.7 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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
#
# Process this file with autoconf to produce a configure script.
#
#
# Copyright (C) 2007-2016 by frePPLe bv
#
# 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/>.
#
# Version definition
define(FREPPLE_MAJOR, 6)
define(FREPPLE_MINOR, 10)
define(FREPPLE_PATCH, 0)
#
# Initialization
#
AC_PREREQ(2.60)
AC_INIT([frepple], [FREPPLE_MAJOR.FREPPLE_MINOR.FREPPLE_PATCH])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([tar-ustar foreign])
#
# 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,
AS_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,
AS_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,
AS_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 a configure argument to enable/disable building of the documentation
#
AC_ARG_ENABLE([doc],
AS_HELP_STRING([--enable-doc],
[Enable documentation generation(default false)]),
[case "${enableval}" in
no) generatedoc=false;;
yes) generatedoc=true
AC_CHECK_PROGS(SPHINXBUILD, sphinx-build sphinx-build-3, notavailable)
if test x$SPHINXBUILD = xnotavailable
then
AC_MSG_ERROR([Could not find sphinx-build, 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.])
#
# Define a configure argument to control which checks are run
#
AC_ARG_VAR([TESTARGS],
[Argument passed to test/runtest.py to control the check to be run.])
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h unistd.h python.h sys/prctl.h])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_STAT
AC_CHECK_FUNCS([dup2 memset strncasecmp strnicmp strptime putenv _putenv localtime_r prctl])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADERS([algorithm forward_list vector map set stack tuple])
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 >= 3.0 ])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include "xercesc/util/XercesVersion.hpp"
#if XERCES_VERSION_MAJOR==3
int main (void) {return 1;}
#else
force compile error;
#endif
])], [],
[AC_MSG_ERROR([
This package requires Xerces-C 3.0 or later.
])])
#
# Verify installation of PYTHON
#
AM_PATH_PYTHON([3.5], [],
[AC_MSG_ERROR([
This package requires Python 3.5 or higher.
])])
AC_PATH_TOOL(PYTHON_CONFIG, "python3-config", notavailable)
if test x$PYTHON_CONFIG = xnotavailable
then
AC_MSG_ERROR([This package requires the Python 3 development libraries.])
fi
if test $($PYTHON -c "import sys; print('higher' if sys.hexversion >= 0x030800F0 else 'lower')") = higher
then
LIBS="$($PYTHON_CONFIG --ldflags --embed) $LIBS"
else
LIBS="$($PYTHON_CONFIG --ldflags) $LIBS"
fi
CPPFLAGS="$($PYTHON_CONFIG --includes) $CPPFLAGS"
AC_CHECK_HEADER([Python.h], [],
[AC_MSG_ERROR([
This package requires Python 3 and its development libraries.
])])
#
# 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://github.com/frePPLe/django/
])
fi
AC_MSG_RESULT([yes])
# Optional extra tools
AC_CHECK_PROGS(DOCKER, docker)
AM_CONDITIONAL(DOCKER, [test x$DOCKER != x])
AC_CHECK_PROGS(GPG, gpg)
AC_CHECK_PROGS(NPM, npm)
AC_CHECK_PROGS(GRUNT, grunt)
#
# 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 -Wno-error=date-time -Wall -std=c++14 $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="-Wno-error=date-time -fprofile-arcs -ftest-coverage -std=c++14 $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 -Wno-error=date-time -Wall -pg -fno-inline $CXXFLAGS"
CXXFLAGS="-g -Wall -std=c++14 $CXXFLAGS "
AC_DEFINE([NDEBUG], [], [Disables assertions])
else
CXXFLAGS="-O3 -Wno-error=date-time -s -std=c++14 $CXXFLAGS"
AC_DEFINE([NDEBUG], [], [Disables assertions])
fi ; fi ; fi
case $host_os in
cygwin*)
# Linker option to avoid some ugly warnings...
LDFLAGS="$LDFLAGS -Wl,--enable-auto-import"
;;
*)
LIBS="-ldl $LIBS"
;;
esac
AM_CONDITIONAL(CYGWIN, test x$host_os = xcygwin)
# Define the output make files
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([
contrib/Makefile
contrib/debian/Makefile
contrib/installer/Makefile
contrib/odoo/Makefile
contrib/vc/Makefile
contrib/linux/Makefile
contrib/linux/alpine-3/Makefile
contrib/linux/centos-8/Makefile
contrib/linux/debian-10/Makefile
contrib/linux/opensuse-15.1/Makefile
contrib/linux/rhel-8/Makefile
contrib/linux/ubuntu-18.04/Makefile
contrib/linux/ubuntu-20.04/Makefile
])
AC_CONFIG_FILES([
test/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_leadtime_3/Makefile
test/constraints_material_1/Makefile
test/constraints_material_2/Makefile
test/constraints_material_3/Makefile
test/constraints_material_4/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/constraints_resource_7/Makefile
test/constraints_resource_8/Makefile
test/criticality/Makefile
test/custom_fields/Makefile
test/datetime/Makefile
test/deletion/Makefile
test/demand_policy/Makefile
test/distribution_1/Makefile
test/flow_alternate_1/Makefile
test/flow_alternate_2/Makefile
test/flow_alternate_3/Makefile
test/flow_effective/Makefile
test/flow_fixed/Makefile
test/flow_offset/Makefile
test/flow_transferbatch/Makefile
test/global_purchase/Makefile
test/jobshop/Makefile
test/load_alternate/Makefile
test/load_bucketized/Makefile
test/load_effective/Makefile
test/cluster/Makefile
test/mto/Makefile
test/operation_alternate/Makefile
test/operation_available/Makefile
test/operation_effective/Makefile
test/operation_pre_post/Makefile
test/operation_routing/Makefile
test/operation_split/Makefile
test/pegging/Makefile
test/problems/Makefile
test/python_1/Makefile
test/python_2/Makefile
test/python_3/Makefile
test/resource_buckets/Makefile
test/resource_efficiency/Makefile
test/safety_stock/Makefile
test/scalability_1/Makefile
test/scalability_2/Makefile
test/scalability_3/Makefile
test/setup_1/Makefile
test/setup_2/Makefile
test/setup_3/Makefile
test/skills/Makefile
test/supplier/Makefile
test/wip_1/Makefile
test/wip_2/Makefile
test/xml/Makefile
])
# Generate all make files
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 "Note that this only compiles and installs the core planning engine."
echo "It does NOT install or configure the web server for the user interface."
echo
echo "--------------------------------------------------------"