-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathconfigure.ac
More file actions
510 lines (444 loc) · 15.6 KB
/
Copy pathconfigure.ac
File metadata and controls
510 lines (444 loc) · 15.6 KB
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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
dnl
dnl Main authors:
dnl Guido Tack <tack@gecode.dev>
dnl
dnl Contributing authors:
dnl Samuel Gagnon <samuel.gagnon92@gmail.com>
dnl
dnl Copyright:
dnl Guido Tack, 2004, 2005
dnl Samuel Gagnon, 2018
dnl
dnl This file is part of Gecode, the generic constraint
dnl development environment:
dnl http://www.gecode.dev
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining
dnl a copy of this software and associated documentation files (the
dnl "Software"), to deal in the Software without restriction, including
dnl without limitation the rights to use, copy, modify, merge, publish,
dnl distribute, sublicense, and/or sell copies of the Software, and to
dnl permit persons to whom the Software is furnished to do so, subject to
dnl the following conditions:
dnl
dnl The above copyright notice and this permission notice shall be
dnl included in all copies or substantial portions of the Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
dnl LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
dnl OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
dnl WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
dnl
dnl
m4_include([gecode-version.m4])
AC_REVISION([$Id$])
AC_PREREQ([2.69])
AC_INIT([GECODE], GECODE_M4_VERSION, [users@gecode.dev])
AC_CONFIG_HEADERS([gecode/support/config.hpp])
AC_CONFIG_SRCDIR(gecode/kernel.hh)
ac_gecode_soversion=GECODE_M4_SOVERSION
AC_SUBST(GECODE_SOVERSION, ${ac_gecode_soversion})
# checks for programs
: ${CXXFLAGS=""} dnl we do not want autoconf's default
: ${CFLAGS=""} dnl we do not want autoconf's default
: ${DLLFLAGS=""} dnl we do not want autoconf's default
: ${GLDFLAGS=""} dnl we do not want autoconf's default
dnl include Gecode specific macros
m4_include([gecode.m4])
dnl determine the operating system
AC_GECODE_GET_OS
if test "${CXX}x" = "x" -a "${CC}x" = "x" \
-a "${gecode_host_os}" = "windows" \
-a "${gecode_host_toolchain}" = "msvc"; then
CC=cl
CXX=cl
fi
AC_PROG_CXX
AC_PROG_CC
AC_LANG(C++)
AC_PROG_RANLIB
dnl check whether we have certain programs we need
AC_CHECK_PROG(PROG_DIFF, diff, [ok])
if test "${PROG_DIFF}x" = "x"; then
AC_MSG_ERROR([In order to compile Gecode, you need the diff tool.])
fi
AC_CHECK_PROG(PROG_TAR, tar, [ok])
if test "${PROG_TAR}x" = "x"; then
AC_MSG_ERROR([In order to compile Gecode, you need the tar tool.])
fi
AC_CHECK_PROG(PROG_MAKE, make, [ok])
if test "${PROG_MAKE}x" = "x"; then
AC_MSG_ERROR([In order to compile Gecode, you need the make tool.])
fi
AC_CHECK_PROG(PROG_SED, sed, [ok])
if test "${PROG_SED}x" = "x"; then
AC_MSG_ERROR([In order to compile Gecode, you need the sed tool.])
fi
AC_CHECK_PROG(PROG_UV, uv, [uv])
if test "${PROG_UV}x" = "x"; then
AC_MSG_ERROR([In order to compile Gecode, you need uv.])
fi
dnl Check for environment to use when running programs in the Makefile
AC_GECODE_RUNENVIRONMENT
dnl determine which compiler we are using
AC_CXX_COMPILER_VENDOR(ac_gecode_compiler_vendor)
case $ac_gecode_compiler_vendor in
gnu)
AC_CHECK_GCC_VERSION(4,2)
;;
intel)
;;
microsoft)
AC_CHECK_MSVC_VERSION(1800,2013)
;;
*)
;;
esac
AC_GECODE_RESOURCE
AC_LANG(C++)
dnl check whether we want to build universal binaries on Mac OS X
AC_GECODE_UNIVERSAL
dnl check whether the user wants a prefix or suffixes for the libraries
AC_GECODE_USER_SUFFIX
dnl check whether we want to build a framework bundle on Mac OS X
AC_GECODE_FRAMEWORK
dnl check whether we want to build static libraries
AC_GECODE_STATICLIBS
dnl check whether we want to have assertions and debugging options
AC_GECODE_DEBUG
dnl check whether we want to have peak heap size tracking
AC_GECODE_PEAKHEAP
dnl check whether to optimize for code size
AC_GECODE_CODESIZE
dnl check whether we want to have support for finding memory leaks
AC_GECODE_LEAK_DEBUG
dnl check whether we want to use default memory allocator
AC_GECODE_ALLOCATOR
dnl check whether we want audit code in our build
AC_GECODE_AUDIT
dnl check whether we want to produce code suitable for profiling
AC_GECODE_PROFILE
dnl check whether we want to produce code instrumented for gcov
AC_GECODE_GCOV
dnl check platform specific behaviour of arithmetic
AC_GECODE_CHECK_ARITH
dnl checking for thread support
AC_GECODE_THREADS
dnl checking for freelist sizes to use
AC_GECODE_FREELIST_32_SIZE
AC_GECODE_FREELIST_64_SIZE
case $ac_gecode_compiler_vendor in
gnu)
dnl general compiler flags
AC_GECODE_UNIX_PATHS
AC_GECODE_GCC_GENERAL_SWITCHES
dnl check whether we want to use visibility attributes with gcc
AC_GECODE_GCC_VISIBILITY
if test "${enable_debug:-no}" = "no" -a "${enable_gcov:-no}" = "no"; then
dnl compiler flags for an optimized build
AC_GECODE_GCC_OPTIMIZED_SWITCHES
dnl compiler flags for optimize float computings
dnl AC_GECODE_CHECK_COMPILERFLAG([-ffast-math])
dnl ffast-math implies:-fno-math-errno -funsafe-math-optimizations -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range
dnl but -funsafe-math-optimizations break IEEE float compatibility, so we have to avoid it
AC_GECODE_CHECK_COMPILERFLAG([-fno-math-errno])
AC_GECODE_CHECK_COMPILERFLAG([-ffinite-math-only])
AC_GECODE_CHECK_COMPILERFLAG([-fno-rounding-math])
AC_GECODE_CHECK_COMPILERFLAG([-fno-signaling-nans])
AC_GECODE_CHECK_COMPILERFLAG([-fcx-limited-range])
AC_GECODE_CHECK_COMPILERFLAG([-mthreads])
else
if test "${enable_debug:-no}" = "yes"; then
dnl compiler flags for a debug build
AC_GECODE_GCC_DEBUG_SWITCHES
fi
fi
AC_GECODE_CHECK_COMPILERFLAG([-Qunused-arguments])
;;
intel)
dnl flags for creating dlls
case $gecode_host_os in
windows*)
AC_GECODE_MSVC_SWITCHES
;;
*)
dnl check whether we want to use visibility attributes with gcc
AC_GECODE_GCC_VISIBILITY
dnl general compiler flags
AC_GECODE_UNIX_PATHS
AC_GECODE_GCC_GENERAL_SWITCHES
if test "${enable_debug:-no}" = "no"; then
dnl compiler flags for an optimized build
AC_GECODE_GCC_OPTIMIZED_SWITCHES
else
dnl compiler flags for a debug build
AC_GECODE_GCC_DEBUG_SWITCHES
fi
;;
esac
;;
microsoft)
AC_GECODE_MSVC_SWITCHES
;;
*)
AC_MSG_ERROR(Gecode currently only supports the GNU and Microsoft compilers.)
;;
esac
dnl check whether the atomic clock representation needs libatomic
AC_GECODE_ATOMIC
dnl find out what parts the user wants to build
AC_GECODE_DOC_SWITCHES
dnl ------------------------------------------------------------------
dnl Definition of variable types
dnl Include contributor's vtis
dnl @VTIS@
AC_GECODE_VIS
AC_GECODE_VTI(float,
[float variable library (implies --enable-int-vars)],
yes,
[\$(top_srcdir)/gecode/float/var-imp/float.vis],
[enable_int_vars="yes";
AC_SUBST(LINKFLOAT,[${LINKLIBDIR}${LINKPREFIX}${FLOAT}${DLL_ARCH}${LINKSUFFIX}])
],
[
AC_SUBST(LINKFLOAT,[])
]
)
AC_GECODE_VTI(set,
[finite set library (implies --enable-int-vars)],
yes,
[\$(top_srcdir)/gecode/set/var-imp/set.vis],
[enable_int_vars="yes";
AC_SUBST(LINKSET,[${LINKLIBDIR}${LINKPREFIX}${SET}${DLL_ARCH}${LINKSUFFIX}])
],
[
AC_SUBST(LINKSET,[])
]
)
AC_GECODE_VTI(int, finite domain library, yes,
[\$(top_srcdir)/gecode/int/var-imp/int.vis \$(top_srcdir)/gecode/int/var-imp/bool.vis],
[
AC_SUBST(LINKINT,[${LINKLIBDIR}${LINKPREFIX}${INT}${DLL_ARCH}${LINKSUFFIX}])
],
[
AC_SUBST(LINKINT,[])
])
dnl End of definition of variable types
dnl ------------------------------------------------------------------
AC_GECODE_MPFR
AC_GECODE_QT
AC_GECODE_GIST
AC_GECODE_CBS
AC_GECODE_CPPROFILER
AC_GECODE_FLEXBISON
AC_FUNC_MMAP
AC_CACHE_CHECK(
[for POSIX_SPAWN_CLOEXEC_DEFAULT and posix_spawn_file_actions_addinherit_np],
[ac_cv_gecode_posix_spawn_cloexec_default_addinherit_np],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <spawn.h>
#ifndef POSIX_SPAWN_CLOEXEC_DEFAULT
#error POSIX_SPAWN_CLOEXEC_DEFAULT is unavailable
#endif
]], [[
posix_spawn_file_actions_t actions;
return posix_spawn_file_actions_addinherit_np(&actions, 2);
]])],
[ac_cv_gecode_posix_spawn_cloexec_default_addinherit_np=yes],
[ac_cv_gecode_posix_spawn_cloexec_default_addinherit_np=no])])
AS_IF([test "x$ac_cv_gecode_posix_spawn_cloexec_default_addinherit_np" = "xyes"], [
AC_DEFINE([GECODE_HAS_POSIX_SPAWN_CLOEXEC_DEFAULT], [1],
[Whether POSIX_SPAWN_CLOEXEC_DEFAULT is available])
AC_DEFINE([GECODE_HAS_POSIX_SPAWN_ADDINHERIT_NP], [1],
[Whether posix_spawn_file_actions_addinherit_np is available])
])
AC_CACHE_CHECK(
[for posix_spawn_file_actions_addclosefrom_np],
[ac_cv_gecode_posix_spawn_addclosefrom_np],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#include <spawn.h>
]], [[
posix_spawn_file_actions_t actions;
return posix_spawn_file_actions_addclosefrom_np(&actions, 3);
]])],
[ac_cv_gecode_posix_spawn_addclosefrom_np=yes],
[ac_cv_gecode_posix_spawn_addclosefrom_np=no])])
AS_IF([test "x$ac_cv_gecode_posix_spawn_addclosefrom_np" = "xyes"], [
AC_DEFINE([GECODE_HAS_POSIX_SPAWN_ADDCLOSEFROM_NP], [1],
[Whether posix_spawn_file_actions_addclosefrom_np is available])
])
AS_IF([test "x$ac_cv_gecode_posix_spawn_cloexec_default_addinherit_np" = "xyes" ||
test "x$ac_cv_gecode_posix_spawn_addclosefrom_np" = "xyes"], [
AC_DEFINE([GECODE_HAS_POSIX_BLACKBOX_EXEC], [1],
[Whether persistent process blackboxes are supported])
])
GECODE_SAVE_LIBS=${LIBS}
AC_SEARCH_LIBS([dlopen], [dl], [GECODE_DL_LIBS=${ac_cv_search_dlopen}],
[GECODE_DL_LIBS=])
LIBS=${GECODE_SAVE_LIBS}
if test "x${GECODE_DL_LIBS}" = "xnone required"; then
GECODE_DL_LIBS=
fi
AC_SUBST([GECODE_DL_LIBS])
AC_GECODE_ENABLE_MODULE(driver, yes,
[build script commandline driver library],
[enable_search="yes";
enable_int="yes";
])
AC_GECODE_ENABLE_MODULE(flatzinc, yes,
[build FlatZinc interpreter],
[enable_search="yes";
enable_driver="yes";
enable_minimodel="yes";
])
AC_GECODE_ENABLE_MODULE(driver, yes,
[build script commandline driver library],
[enable_search="yes";
enable_int="yes";
])
AC_GECODE_ENABLE_MODULE(examples, yes,
[build examples for the enabled variable types],
[enable_search="yes";
enable_driver="yes";
enable_minimodel="yes";
])
AC_GECODE_ENABLE_MODULE(minimodel, yes,
[build modeling support library for the enabled variable types])
AC_GECODE_ENABLE_MODULE(search, yes,
[build search engines])
dnl Configure contributions
AC_CONFIG_SUBDIRS()
dnl @SUBDIRS@
AC_SUBST(VERSION, ${PACKAGE_VERSION})
AC_SUBST(GECODE_VERSION, ${PACKAGE_VERSION})
AC_SUBST(DLLFLAGS, ${DLLFLAGS})
AC_SUBST(GLDFLAGS, ${GLDFLAGS})
AC_SUBST(ALLVIS, ${ac_gecode_vis})
VERSION_DASHES=`echo $PACKAGE_VERSION | sed -e s/\\\\./-/g`
PACKAGE_VERSION_NUMBER=`echo $PACKAGE_VERSION | awk -F. '{print $1 * 100000 + $2 * 100 + $3}'`
AC_DEFINE_UNQUOTED(GECODE_VERSION,
"${PACKAGE_VERSION}",
[Gecode version])
AC_DEFINE_UNQUOTED(GECODE_LIBRARY_VERSION,
"${VERSION_DASHES}",
[Gecode version])
AC_DEFINE_UNQUOTED(GECODE_VERSION_NUMBER,
${PACKAGE_VERSION_NUMBER},
[Gecode version])
ac_gecode_library_architecture=-${VERSION_DASHES}${ac_gecode_library_architecture}
if test "$ac_gecode_compiler_vendor" = "microsoft" \
-o \( "$ac_gecode_compiler_vendor" = "intel" \
-a "$gecode_host_os" = "windows" \) ; then
AC_SUBST(DLL_ARCH,[${ac_gecode_library_architecture}])
else
AC_SUBST(DLL_ARCH,[""])
fi
AC_CONFIG_FILES([Makefile])
if test "${gecode_host_os}" = "windows"; then
AC_SUBST(BATCHFILE, ".bat")
AC_CONFIG_FILES([tools/flatzinc/mzn-gecode.bat:tools/flatzinc/mzn-gecode.bat.in],[chmod +x tools/flatzinc/mzn-gecode.bat])
else
AC_SUBST(BATCHFILE, "")
AC_CONFIG_FILES([tools/flatzinc/mzn-gecode:tools/flatzinc/mzn-gecode.in],[chmod +x tools/flatzinc/mzn-gecode])
fi
gecode_config_prefix=${prefix}
test "x${gecode_config_prefix}" = xNONE && gecode_config_prefix=${ac_default_prefix}
gecode_config_exec_prefix=${exec_prefix}
test "x${gecode_config_exec_prefix}" = xNONE && gecode_config_exec_prefix=${gecode_config_prefix}
gecode_config_datarootdir=${datarootdir}
gecode_config_datadir=${datadir}
gecode_config_bindir=${bindir}
gecode_save_prefix=${prefix}
gecode_save_exec_prefix=${exec_prefix}
gecode_save_datarootdir=${datarootdir}
prefix=${gecode_config_prefix}
exec_prefix=${gecode_config_exec_prefix}
eval "gecode_config_exec_prefix=\"${gecode_config_exec_prefix}\""
eval "gecode_config_datarootdir=\"${gecode_config_datarootdir}\""
datarootdir=${gecode_config_datarootdir}
eval "gecode_config_datadir=\"${gecode_config_datadir}\""
eval "gecode_config_bindir=\"${gecode_config_bindir}\""
prefix=${gecode_save_prefix}
exec_prefix=${gecode_save_exec_prefix}
datarootdir=${gecode_save_datarootdir}
gecode_config_solverdir=${gecode_config_datadir}/minizinc/solvers
gecode_config_mznlibdir=${gecode_config_datadir}/minizinc/gecode
gecode_config_fzn_executable=${gecode_config_bindir}/fzn-gecode${EXEEXT}
gecode_config_relative_path() {
gecode_config_from=$1
gecode_config_to=$2
while test "x${gecode_config_from}" != x/; do
case ${gecode_config_from} in
*/) gecode_config_from=${gecode_config_from%/} ;;
*) break ;;
esac
done
while test "x${gecode_config_to}" != x/; do
case ${gecode_config_to} in
*/) gecode_config_to=${gecode_config_to%/} ;;
*) break ;;
esac
done
case ${gecode_config_from}:${gecode_config_to} in
/*:/*) ;;
*) printf "%s\n" "${gecode_config_to}"; return ;;
esac
if test "x${gecode_config_from}" = "x${gecode_config_to}"; then
printf ".\n"
return
fi
gecode_config_common=${gecode_config_from}
gecode_config_up=
while :; do
if test "x${gecode_config_common}" = x/; then
gecode_config_suffix=${gecode_config_to#/}
break
fi
case ${gecode_config_to} in
"${gecode_config_common}"/*)
gecode_config_suffix=${gecode_config_to#"${gecode_config_common}"/}
break
;;
esac
gecode_config_common=${gecode_config_common%/*}
test "x${gecode_config_common}" != x || gecode_config_common=/
if test "x${gecode_config_up}" = x; then
gecode_config_up=..
else
gecode_config_up=${gecode_config_up}/..
fi
done
if test "x${gecode_config_up}" = x; then
printf "%s\n" "${gecode_config_suffix}"
elif test "x${gecode_config_suffix}" = x; then
printf "%s\n" "${gecode_config_up}"
else
printf "%s/%s\n" "${gecode_config_up}" "${gecode_config_suffix}"
fi
}
GECODE_MZN_DATADIR_FROM_BINDIR=`gecode_config_relative_path "${gecode_config_bindir}" "${gecode_config_datadir}"`
GECODE_MZN_DATADIR_FROM_BINDIR_WIN=`printf "%s\n" "${GECODE_MZN_DATADIR_FROM_BINDIR}" | sed 's,/,\\\\,g'`
GECODE_MSC_MZNLIB_FROM_SOLVERDIR=`gecode_config_relative_path "${gecode_config_solverdir}" "${gecode_config_mznlibdir}"`
GECODE_MSC_EXECUTABLE_FROM_SOLVERDIR=`gecode_config_relative_path "${gecode_config_solverdir}" "${gecode_config_fzn_executable}"`
GECODE_MSC_STD_FLAGS='"-a", "-f", "-n", "-p", "-r", "-s", "-t"'
if test "${enable_cpprofiler:-yes}" = "yes"; then
GECODE_MSC_STD_FLAGS="${GECODE_MSC_STD_FLAGS}, \"--cp-profiler\""
fi
AC_SUBST([GECODE_MZN_DATADIR_FROM_BINDIR])
AC_SUBST([GECODE_MZN_DATADIR_FROM_BINDIR_WIN])
AC_SUBST([GECODE_MSC_MZNLIB_FROM_SOLVERDIR])
AC_SUBST([GECODE_MSC_EXECUTABLE_FROM_SOLVERDIR])
AC_SUBST([GECODE_MSC_STD_FLAGS])
AC_CONFIG_FILES([tools/flatzinc/gecode.msc:tools/flatzinc/gecode.msc.in])
AC_CONFIG_FILES([tools/flatzinc/gecode-gist.msc:tools/flatzinc/gecode-gist.msc.in])
AC_CONFIG_FILES([doxygen.conf:doxygen/doxygen.conf.in])
AC_CONFIG_FILES([doxygen.hh:doxygen/doxygen.hh.in])
AC_OUTPUT