this repo has no description
1dnl 2dnl Main authors: 3dnl Guido Tack <tack@gecode.org> 4dnl 5dnl Contributing authors: 6dnl Samuel Gagnon <samuel.gagnon92@gmail.com> 7dnl Mikael Lagerkvist <lagerkvist@gecode.org> 8dnl 9dnl Copyright: 10dnl Guido Tack, 2004, 2005 11dnl Samuel Gagnon, 2018 12dnl Mikael Lagerkvist, 2020 13dnl 14dnl This file is part of Gecode, the generic constraint 15dnl development environment: 16dnl http://www.gecode.org 17dnl 18dnl Permission is hereby granted, free of charge, to any person obtaining 19dnl a copy of this software and associated documentation files (the 20dnl "Software"), to deal in the Software without restriction, including 21dnl without limitation the rights to use, copy, modify, merge, publish, 22dnl distribute, sublicense, and/or sell copies of the Software, and to 23dnl permit persons to whom the Software is furnished to do so, subject to 24dnl the following conditions: 25dnl 26dnl The above copyright notice and this permission notice shall be 27dnl included in all copies or substantial portions of the Software. 28dnl 29dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 30dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 31dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 32dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 33dnl LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 34dnl OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 35dnl WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 36dnl 37dnl 38 39AC_DEFUN([AC_GECODE_GET_OS], 40 [AC_ARG_WITH([host-os], 41 AC_HELP_STRING([--with-host-os], 42 [Override operating system test. Valid values are Linux, Darwin, FreeBSD, NetBSD, and Windows.])) 43 AC_MSG_CHECKING([for the host operating system]) 44 if test "${with_host_os:-no}" = "no"; then 45 guess_host_os=$(uname -s 2>/dev/null) 46 else 47 guess_host_os=${with_host_os} 48 fi 49 dnl Try to find out operating system 50 case ${guess_host_os} in 51 GNU/kFreeBSD|*inux*|FreeBSD|NetBSD) 52 host_os=linux 53 AC_MSG_RESULT([Linux]) 54 ;; 55 *arwin*) 56 host_os=darwin 57 AC_MSG_RESULT([Darwin]) 58 ;; 59 CYGWIN*|*indows*) 60 host_os=windows 61 AC_MSG_RESULT([Windows]) 62 ;; 63 *) 64 AC_MSG_ERROR([Host OS not supported.]) 65 ;; 66 esac]) 67 68dnl Macros: 69dnl AC_GECODE_ADD_TO_CXXFLAGS ([FLAG...]) 70dnl 71dnl Description: 72dnl Add the flags to the corresponding variables 73dnl 74dnl Author: 75dnl Marco Kuhlmann <kuhlmann@ps.uni-sb.de> 76dnl 77AC_DEFUN([AC_GECODE_ADD_TO_CXXFLAGS], 78 [CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS}"]) 79AC_DEFUN([AC_GECODE_ADD_TO_COMPILERFLAGS], 80 [CFLAGS="$1${CFLAGS:+ }${CFLAGS}" 81 CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS}"]) 82AC_DEFUN([AC_GECODE_ADD_TO_CFLAGS], 83 [CFLAGS="$1${CFLAGS:+ }${CFLAGS}"]) 84AC_DEFUN([AC_GECODE_ADD_TO_DLLFLAGS], 85 [DLLFLAGS="$1${DLLFLAGS:+ }${DLLFLAGS}"]) 86 87 88dnl Macro: 89dnl AC_GECODE_CHECK_MS_CL_FLAG (FLAG, ACTION-IF-TRUE, 90dnl ACTION-IF-FALSE) 91dnl 92dnl Description: 93dnl Check whether FLAG is supported by the Microsoft C++ compiler. Run 94dnl the shell commands ACTION-IF-TRUE if it is, ACTION-IF-FALSE 95dnl otherwise. 96dnl 97dnl Authors: 98dnl Guido Tack <tack@gecode.org> 99dnl 100AC_DEFUN([AC_GECODE_CHECK_MS_CL_FLAG], 101 [AC_MSG_CHECKING(whether ${CXX} accepts [$1]) 102 if ${CXX} $1 2>&1 | grep "ignoring unknown option" -q; then 103 AC_MSG_RESULT([no]) 104 ifelse([$3], , :, [$3]) 105 else 106 AC_MSG_RESULT([yes]) 107 ifelse([$2], , :, [$2]) 108 fi]) 109 110dnl Macro: 111dnl AC_GECODE_CHECK_GXX_FLAG (FLAG, ACTION-IF-TRUE, 112dnl ACTION-IF-FALSE) 113dnl 114dnl Description: 115dnl Check whether FLAG is supported by the Gnu C++ compiler. Run 116dnl the shell commands ACTION-IF-TRUE if it is, ACTION-IF-FALSE 117dnl otherwise. 118dnl 119dnl Authors: 120dnl Guido Tack <tack@gecode.org> 121dnl 122AC_DEFUN([AC_GECODE_CHECK_GXX_FLAG], 123 [AC_MSG_CHECKING(whether ${CXX} accepts [$1]) 124 ac_gecode_save_CXXFLAGS="${CXXFLAGS}" 125 CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS} -Werror" 126 AC_LANG_PUSH(C++) 127 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], 128 [if grep -q "unrecognized\|argument unused" conftest.err; then 129 CXXFLAGS="${ac_gecode_save_CXXFLAGS}" 130 AC_MSG_RESULT([no]) 131 ifelse([$3], , :, [$3]) 132 else 133 CXXFLAGS="${ac_gecode_save_CXXFLAGS}" 134 AC_MSG_RESULT([yes]) 135 ifelse([$2], , :, [$2]) 136 fi 137 ], 138 [CXXFLAGS="${ac_gecode_save_CXXFLAGS}" 139 AC_MSG_RESULT([no]) 140 ifelse([$3], , :, [$3])]) 141 AC_LANG_POP]) 142 143dnl Macro: 144dnl AC_GECODE_CHECK_GCC_FLAG (FLAG, ACTION-IF-TRUE, 145dnl ACTION-IF-FALSE) 146dnl 147dnl Description: 148dnl Check whether FLAG is supported by the Gnu C compiler. Run 149dnl the shell commands ACTION-IF-TRUE if it is, ACTION-IF-FALSE 150dnl otherwise. 151dnl 152dnl Authors: 153dnl Guido Tack <tack@gecode.org> 154dnl 155AC_DEFUN([AC_GECODE_CHECK_GCC_FLAG],[ 156 AC_MSG_CHECKING(whether ${CC} accepts [$1]) 157 ac_gecode_save_CFLAGS="${CFLAGS}" 158 CFLAGS="$1${CFLAGS:+ }${CFLAGS} -Werror" 159 AC_LANG_PUSH(C) 160 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], 161 [if grep -q "unrecognized\|argument unused" conftest.err; then 162 CFLAGS="${ac_gecode_save_CFLAGS}" 163 AC_MSG_RESULT([no]) 164 ifelse([$3], , :, [$3]) 165 else 166 CFLAGS="${ac_gecode_save_CFLAGS}" 167 AC_MSG_RESULT([yes]) 168 ifelse([$2], , :, [$2]) 169 fi 170 ], 171 [CFLAGS="${ac_gecode_save_CFLAGS}" 172 AC_MSG_RESULT([no]) 173 ifelse([$3], , :, [$3])]) 174 AC_LANG_POP]) 175 176dnl Macro: 177dnl AC_GECODE_CHECK_CXXFLAG (FLAG, [ACTION-IF-TRUE, 178dnl [ACTION-IF-FALSE]]) 179dnl 180dnl Description: 181dnl Check whether FLAG is supported by the C++ compiler. Run 182dnl the shell commands ACTION-IF-TRUE if it is, ACTION-IF-FALSE 183dnl otherwise. If ACTION-IF-TRUE is not given, append FLAG to 184dnl the contents of $CXXFLAGS. 185dnl 186dnl Authors: 187dnl Leif Kornstaedt <kornstae@ps.uni-sb.de> 188dnl Marco Kuhlmann <kuhlmann@ps.uni-sb.de> 189dnl 190AC_DEFUN([AC_GECODE_CHECK_CXXFLAG], 191 [if test "${ac_cv_cxx_compiler_vendor}" = "microsoft"; then 192 AC_GECODE_CHECK_MS_CL_FLAG($1,[ 193 ifelse([$2], , CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS}", [$2])], 194 [ifelse([$3], , :, [$3])]) 195 else 196 AC_GECODE_CHECK_GXX_FLAG($1,[ 197 ifelse([$2], , CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS}", [$2])], 198 [ifelse([$3], , :, [$3])]) 199 fi 200 ])dnl 201 202AC_DEFUN([AC_GECODE_CHECK_COMPILERFLAG], 203 [ 204 if test "${ac_cv_cxx_compiler_vendor}" = "microsoft"; then 205 AC_GECODE_CHECK_MS_CL_FLAG($1,[ 206 CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS}" 207 CFLAGS="$1${CFLAGS:+ }${CFLAGS}"],[]) 208 else 209 AC_GECODE_CHECK_GXX_FLAG($1,[ 210 CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS}"],[]) 211 AC_GECODE_CHECK_GCC_FLAG($1,[ 212 CFLAGS="$1${CFLAGS:+ }${CFLAGS}"],[]) 213 fi])dnl 214 215dnl @synopsis _AC_C_IFDEF(MACRO-NAME, ACTION-IF-DEF, ACTION-IF-NOT-DEF) 216dnl 217dnl Check for the definition of macro MACRO-NAME using the current 218dnl language's compiler. 219dnl 220dnl @category Misc 221dnl @author Ludovic Courtès <ludo@chbouib.org> 222dnl @version 2004-09-07 223dnl @license AllPermissive 224AC_DEFUN([_AC_C_IFDEF], 225 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef $1 226 # error "Macro $1 is undefined!" 227 /* For some compilers (eg. SGI's CC), #error is not 228 enough... */ 229 please, do fail 230 #endif]],[[]])], 231 [$2], [$3])]) 232 233dnl @synopsis AC_CXX_COMPILER_VENDOR(VENDOR-NAME) 234dnl 235dnl Set VENDOR-NAME to the lower-case name of the compiler vendor or `unknown' 236dnl if the compiler's vendor is unknown. 237dnl 238dnl @version 20040907 239dnl @author Ludovic Courtès <ludo@chbouib.org> 240dnl Modified by G. Tack to recognize only those compilers we need. 241AC_DEFUN([AC_ADD_DLL_ARCH], 242 [ac_gecode_library_architecture="-$1${ac_gecode_library_architecture}"]) 243 244AC_DEFUN([AC_CXX_COMPILER_VENDOR], 245 [AC_ARG_WITH([compiler-vendor], 246 AC_HELP_STRING([--with-compiler-vendor], 247 [Override compiler test. Valid values are gnu, intel, and microsoft.])) 248 AC_REQUIRE([AC_PROG_CXX]) 249 AC_REQUIRE([AC_PROG_CXXCPP]) 250 if test "${with_compiler_vendor:-no}" = "no"; then 251 AC_LANG_PUSH([C++]) 252 dnl GNU C++ 253 _AC_C_IFDEF([__GNUG__], 254 [ac_cv_cxx_compiler_vendor=gnu], 255 [_AC_C_IFDEF([__INTEL_COMPILER], 256 [ac_cv_cxx_compiler_vendor=intel 257 _AC_C_IFDEF([_M_IX86], 258 [AC_ADD_DLL_ARCH([x86])],[]) 259 _AC_C_IFDEF([_M_IA64], 260 [AC_ADD_DLL_ARCH([ia64])],[]) 261 _AC_C_IFDEF([_M_X64], 262 [AC_ADD_DLL_ARCH([x64])],[])], 263 [dnl Note: We are using the C compiler because VC++ doesn't 264 dnl recognize `.cc'(which is used by `configure') as a C++ file 265 dnl extension and requires `/TP' to be passed. 266 AC_LANG_PUSH([C]) 267 _AC_C_IFDEF([_MSC_VER], 268 [ac_cv_cxx_compiler_vendor=microsoft 269 _AC_C_IFDEF([_M_IX86], 270 [AC_ADD_DLL_ARCH([x86])],[]) 271 _AC_C_IFDEF([_M_IA64], 272 [AC_ADD_DLL_ARCH([ia64])],[]) 273 _AC_C_IFDEF([_M_X64], 274 [AC_ADD_DLL_ARCH([x64])],[])], 275 [ac_cv_cxx_compiler_vendor=unknown]) 276 AC_LANG_POP()])]) 277 278 AC_LANG_POP() 279 else 280 ac_cv_cxx_compiler_vendor=${with_compiler_vendor} 281 fi 282 $1="$ac_cv_cxx_compiler_vendor"])dnl 283 284 285AC_DEFUN([AC_CHECK_GCC_VERSION], 286 [ 287 AC_LANG_PUSH(C) 288 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 289 #if __GNUC__ < $1 || (__GNUC__ == $1 && __GNUC_MINOR__ < $2) 290 #error Version too old 291 really, the version is too old 292 #endif]],[[]])],[], 293 [AC_MSG_ERROR([Your version of gcc is too old. You need at least version $1.$2.])] 294 ) 295 AC_LANG_POP() 296 AC_LANG_PUSH(C++) 297 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 298 #if __GNUC__ < $1 || (__GNUC__ == $1 && __GNUC_MINOR__ < $2) 299 #error Version too old 300 really, the version is too old 301 #endif]],[[]])],[], 302 [AC_MSG_ERROR([Your version of g++ is too old. You need at least version $1.$2.])] 303 ) 304 AC_LANG_POP() 305 ]) 306 307AC_DEFUN([AC_CHECK_MSVC_VERSION], 308 [ 309 AC_LANG_PUSH(C) 310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 311 #if _MSC_VER < $1 312 #error Version too old 313 really, the version is too old 314 #endif]],[[]])],[], 315 [AC_MSG_ERROR([Your version of cl is too old. You need at least Microsoft Visual C++ $2.])] 316 AC_LANG_POP() 317 ) 318 ]) 319 320dnl Macro: 321dnl AC_GECODE_VTI (vartype, help-string, default, vtidef, 322dnl [ACTION-IF-ENABLED], [ACTION-IF-DISABLED]) 323dnl 324dnl Description: 325dnl Introduce --enable-vartype-vars configure switch. The help-string 326dnl is used for the configure --help output. 327dnl default is either yes or no and says whether this option should be 328dnl enabled by default. ACTION-IF-ENABLED can be used to perform additional 329dnl actions in case this variable type is enabled. 330dnl 331dnl Authors: 332dnl Guido Tack <tack@gecode.org> 333AC_DEFUN([AC_GECODE_ADD_VTI], 334 [AC_DEFINE(GECODE_HAS_$1_VARS, [], [Whether to build $1 variables])]) 335AC_DEFUN([AC_GECODE_VIS],[ 336 AC_ARG_WITH([vis], 337 AC_HELP_STRING([--with-vis], 338 [additional variable implementation specifications])) 339 if test "${with_vis:-no}" != "no"; then 340 with_vis=${with_vis//,/ } 341 ac_gecode_vis="${with_vis}${ac_gecode_vis:+ }${ac_gecode_vis}" 342 fi]) 343AC_DEFUN([AC_GECODE_VTI], 344 [ 345 AC_ARG_ENABLE([$1-vars], 346 AC_HELP_STRING([--enable-$1-vars],[build $2 @<:@default=$3@:>@])) 347 ac_gecode_vis="$4${ac_gecode_vis:+ }${ac_gecode_vis}" 348 AC_MSG_CHECKING(whether to build the $1 variables library) 349 if test "${enable_$1_vars:-$3}" = "yes"; then 350 AC_MSG_RESULT(yes) 351 enable_$1_vars="yes"; 352 $5 353 AC_GECODE_ADD_VTI(translit($1,`a-z', `A-Z')) 354 else 355 enable_$1_vars="no"; 356 $6 357 AC_MSG_RESULT(no) 358 fi 359 AC_SUBST(enable_$1_vars, ${enable_$1_vars}) 360 ]) 361 362dnl Macro: 363dnl AC_GECODE_ENABLE_MODULE (module, default, help-string, 364dnl [ACTION-IF-ENABLED]) 365dnl 366dnl Description: 367dnl Produces a configure switch --enable-<module>. 368dnl 369dnl Authors: 370dnl Guido Tack <tack@gecode.org> 371AC_DEFUN([AC_GECODE_ENABLE_MODULE], 372 [ 373 AC_ARG_ENABLE([$1], 374 AC_HELP_STRING([--enable-$1], 375 [$3 @<:@default=$2@:>@])) 376 AC_MSG_CHECKING(whether to build $1) 377 if test "${enable_$1:-$2}" = "yes"; then 378 enable_$1="yes"; 379 AC_MSG_RESULT(yes) 380 $4 381 else 382 enable_$1="no"; 383 AC_MSG_RESULT(no) 384 fi 385 AC_SUBST(enable_$1, ${enable_$1})]) 386 387dnl Description: 388dnl Makes an enable check for a contrib 389dnl The third argument can be used for dependency checking 390dnl 391dnl Authors: 392dnl Grégoire Dooms <dooms@info.ucl.ac.be> 393AC_DEFUN([AC_GECODE_ENABLE_CONTRIB], 394[ 395 AC_ARG_ENABLE([$1], 396 AC_HELP_STRING([--enable-$1],[build $2 @<:@default=yes@:>@])) 397 AC_MSG_CHECKING(whether to build the $1 contrib library) 398 if test "${enable_$1:-yes}" = "yes"; then 399 AC_MSG_RESULT(yes) 400 enable_$1="yes"; 401 $3 402 else 403 enable_$1="no"; 404 AC_MSG_RESULT(no) 405 fi 406 AC_SUBST(enable_$1, ${enable_$1})]) 407 408 409AC_DEFUN([AC_GECODE_STATICLIBS], 410 [if test "${host_os}" = "windows" -a \ 411 "${ac_gecode_compiler_vendor}" = "gnu"; then 412 enable_static="yes" 413 enable_shared="no" 414 fi 415 AC_ARG_ENABLE([static], 416 AC_HELP_STRING([--enable-static], 417 [build static libraries @<:@default=no@:>@])) 418 AC_MSG_CHECKING(whether to build static libraries) 419 if test "${enable_static:-no}" = "yes"; then 420 AC_DEFINE([GECODE_STATIC_LIBS],[], 421 [Whether we are compiling static libraries]) 422 AC_SUBST(BUILDSTATIC, "yes") 423 AC_MSG_RESULT(yes) 424 enable_shared=no 425 else 426 AC_SUBST(BUILDSTATIC, "no") 427 enable_shared=yes 428 AC_MSG_RESULT(no) 429 fi 430 AC_ARG_ENABLE([shared], 431 AC_HELP_STRING([--enable-shared], 432 [build shared libraries @<:@default=yes@:>@])) 433 AC_MSG_CHECKING(whether to build shared libraries) 434 if test "${enable_shared:-yes}" = "yes"; then 435 AC_SUBST(BUILDDLL, "yes") 436 AC_MSG_RESULT(yes) 437 else 438 AC_SUBST(BUILDDLL, "no") 439 if test "${enable_static:-no}" = "no"; then 440 AC_MSG_ERROR([One of --enable-static or --enable-shared must be given]) 441 fi 442 AC_MSG_RESULT(no) 443 fi 444 ]) 445 446AC_DEFUN([AC_GECODE_CODESIZE], 447 [AC_ARG_ENABLE([small-codesize], 448 AC_HELP_STRING([--enable-small-codesize], 449 [optimize for code size @<:@default=no@:>@])) 450 AC_MSG_CHECKING(whether to optimize for code size) 451 if test "${enable_debug:-no}" = "yes"; then 452 AC_MSG_RESULT(not in debug builds) 453 elif test "${enable_small_codesize:-no}" = "yes"; then 454 AC_MSG_RESULT(yes) 455 case $host_os in 456 darwin*) 457 ac_gecode_gcc_optimize_flag=-Oz 458 ;; 459 *) 460 ac_gecode_gcc_optimize_flag=-Os 461 ac_gecode_cl_optimize_flag=-O1 462 ;; 463 esac 464 else 465 AC_MSG_RESULT(no) 466 ac_gecode_gcc_optimize_flag=-O3 467 ac_gecode_cl_optimize_flag=-O2 468 fi]) 469 470 471AC_DEFUN([AC_GECODE_DEBUG], 472 [AC_ARG_ENABLE([debug], 473 AC_HELP_STRING([--enable-debug], 474 [build with assertions @<:@default=no@:>@])) 475 AC_MSG_CHECKING(whether to build with debug symbols and assertions) 476 if test "${enable_debug:-no}" = "yes"; then 477 AC_ADD_DLL_ARCH([d]) 478 AC_SUBST(DEBUG_BUILD, [yes]) 479 AC_MSG_RESULT(yes) 480 else 481 AC_ADD_DLL_ARCH([r]) 482 AC_SUBST(DEBUG_BUILD, [no]) 483 AC_MSG_RESULT(no) 484 AC_GECODE_ADD_TO_COMPILERFLAGS(-DNDEBUG) 485 fi]) 486 487AC_DEFUN([AC_GECODE_LEAK_DEBUG], 488 [AC_ARG_ENABLE([leak-debug], 489 AC_HELP_STRING([--enable-leak-debug], 490 [build with support for finding memory leaks @<:@default=no@:>@])) 491 AC_MSG_CHECKING(whether to build with support for finding memory leaks) 492 if test "${enable_leak_debug:-no}" = "yes"; then 493 AC_MSG_RESULT(yes) 494 AC_CHECK_DECL(mtrace, 495 [AC_DEFINE([GECODE_HAS_MTRACE],[], 496 [Whether we have mtrace for memory leak debugging])], 497 [AC_MSG_ERROR(mtrace not available.)], 498 [[#include <mcheck.h>]]) 499 else 500 AC_MSG_RESULT(no) 501 fi]) 502 503AC_DEFUN([AC_GECODE_PEAKHEAP], 504 [AC_ARG_ENABLE([peakheap], 505 AC_HELP_STRING([--enable-peakheap], 506 [build with peak heap size tracking @<:@default=no@:>@])) 507 if test "${enable_peakheap:-no}" = "yes"; then 508 AC_CHECK_FUNC(_msize, 509 [ 510 AC_DEFINE([GECODE_PEAKHEAP],[],[Whether to track peak heap size]) 511 AC_DEFINE([GECODE_PEAKHEAP_MALLOC_H],[],[Whether we need malloc.h]) 512 AC_DEFINE([GECODE_MSIZE],[_msize],[How to check allocation size]) 513 AC_MSG_CHECKING(whether to build with peak heap size tracking) 514 AC_MSG_RESULT(yes) 515 ], 516 [ 517 AC_CHECK_HEADERS([malloc/malloc.h], 518 [ 519 AC_CHECK_FUNC(malloc_size, 520 [ 521 AC_DEFINE([GECODE_PEAKHEAP],[],[]) 522 AC_DEFINE([GECODE_PEAKHEAP_MALLOC_MALLOC_H],[],[Whether we need malloc/malloc.h]) 523 AC_DEFINE([GECODE_MSIZE],[malloc_size],[]) 524 AC_MSG_CHECKING(whether to build with peak heap size tracking) 525 AC_MSG_RESULT(yes) 526 ], 527 [ 528 AC_MSG_CHECKING(whether to build with peak heap size tracking) 529 AC_MSG_RESULT(no) 530 ]) 531 ], 532 [ 533 AC_CHECK_HEADERS([malloc.h], 534 [ 535 AC_CHECK_FUNC(malloc_usable_size, 536 [ 537 AC_DEFINE([GECODE_PEAKHEAP],[],[]) 538 AC_DEFINE([GECODE_PEAKHEAP_MALLOC_H],[],[Whether we need malloc.h]) 539 AC_DEFINE([GECODE_MSIZE],[malloc_usable_size],[]) 540 AC_MSG_CHECKING(whether to build with peak heap size tracking) 541 AC_MSG_RESULT(yes) 542 ], 543 [ 544 AC_MSG_CHECKING(whether to build with peak heap size tracking) 545 AC_MSG_RESULT(no) 546 ]) 547 ], 548 [ 549 AC_MSG_CHECKING(whether to build with peak heap size tracking) 550 AC_MSG_RESULT(no) 551 ]) 552 ] 553 ) 554 ]) 555 else 556 AC_MSG_CHECKING(whether to build with peak heap size tracking) 557 AC_MSG_RESULT(no) 558 fi]) 559 560AC_DEFUN([AC_GECODE_ALLOCATOR], 561 [AC_ARG_ENABLE([allocator], 562 AC_HELP_STRING([--enable-allocator], 563 [build with default memory allocator @<:@default=yes@:>@])) 564 AC_MSG_CHECKING(whether to build with default memory allocator) 565 if test "${enable_allocator:-yes}" = "yes"; then 566 AC_DEFINE([GECODE_ALLOCATOR],[], 567 [Whether to build with default memory allocator]) 568 AC_MSG_RESULT(yes) 569 else 570 AC_MSG_RESULT(no) 571 fi]) 572 573 574AC_DEFUN([AC_GECODE_AUDIT], 575 [AC_ARG_ENABLE([audit], 576 AC_HELP_STRING([--enable-audit], 577 [build with auditing code @<:@default=no@:>@])) 578 AC_MSG_CHECKING(whether to build with auditing code) 579 if test "${enable_audit:-no}" = "yes"; then 580 AC_DEFINE([GECODE_AUDIT],[], 581 [Whether to include audit code]) 582 AC_MSG_RESULT(yes) 583 else 584 AC_MSG_RESULT(no) 585 fi]) 586 587 588AC_DEFUN([AC_GECODE_PROFILE], 589 [AC_ARG_ENABLE([profile], 590 AC_HELP_STRING([--enable-profile], 591 [build with profiling information @<:@default=no@:>@])) 592 AC_MSG_CHECKING(whether to build with profiling information) 593 if test "${enable_profile:-no}" = "yes"; then 594 AC_MSG_RESULT(yes) 595 AC_GECODE_CHECK_CXXFLAG(-pg, 596 AC_GECODE_ADD_TO_COMPILERFLAGS(-pg), 597 AC_GECODE_CHECK_COMPILERFLAG(-p)) 598 else 599 AC_MSG_RESULT(no) 600 fi]) 601 602AC_DEFUN([AC_GECODE_GCOV], 603 [AC_ARG_ENABLE([gcov], 604 AC_HELP_STRING([--enable-gcov], 605 [build with gcov support @<:@default=no@:>@])) 606 AC_MSG_CHECKING(whether to build with gcov support) 607 if test "${enable_gcov:-no}" = "yes"; then 608 AC_MSG_RESULT(yes) 609 AC_GECODE_CHECK_COMPILERFLAG(-fprofile-arcs) 610 AC_GECODE_CHECK_COMPILERFLAG(-ftest-coverage) 611 AC_GECODE_ADD_TO_DLLFLAGS("-fprofile-arcs") 612 AC_GECODE_ADD_TO_DLLFLAGS("-ftest-coverage") 613 else 614 AC_MSG_RESULT(no) 615 fi]) 616 617AC_DEFUN([AC_GECODE_FREELIST_32_SIZE], 618 [dnl max size of freelist on 32 bit platforms 619 AC_ARG_WITH([freelist32-size-max], 620 AC_HELP_STRING([--with-freelist32-size-max], 621 [max size of freelist on 32 bit platforms])) 622 if test "${with_freelist32_size_max:-no}" != "no"; then 623 AC_DEFINE_UNQUOTED([GECODE_FREELIST_SIZE_MAX32],[${with_freelist32_size_max}],[max freelist size on 32 bit platforms]) 624 fi 625 ] 626) 627 628AC_DEFUN([AC_GECODE_FREELIST_64_SIZE], 629 [dnl max size of freelist on 64 bit platforms 630 AC_ARG_WITH([freelist64-size-max], 631 AC_HELP_STRING([--with-freelist64-size-max], 632 [max size of freelist on 64 bit platforms])) 633 if test "${with_freelist64_size_max:-no}" != "no"; then 634 AC_DEFINE_UNQUOTED([GECODE_FREELIST_SIZE_MAX64],[${with_freelist64_size_max}],[max freelist size on 64 bit platforms]) 635 fi 636 ] 637) 638 639# Test for platform specific behaviour of arithmetic 640 641AC_DEFUN([AC_GECODE_CHECK_ARITH], 642 [AC_LANG_PUSH([C]) 643 AC_CHECK_SIZEOF(int) 644 AC_MSG_CHECKING([if int has at least 32 bit]) 645 AC_TRY_COMPILE([], 646 [ 647 #if SIZEOF_INT>=4 648 #else 649 blablub 650 #endif 651 ], 652 [AC_MSG_RESULT(yes)], 653 [AC_MSG_ERROR([Gecode needs at least 32 bit integers.])]) 654 655 AC_MSG_CHECKING([if doubles have a big enough mantissa]) 656 AC_TRY_COMPILE([#include <float.h>], 657 [ 658 #if DBL_MANT_DIG>=53 659 #else 660 blablub 661 #endif 662 ], 663 [AC_MSG_RESULT(yes)], 664 [AC_MSG_ERROR([Gecode needs a double mantissa of at least 53 bits.])]) 665 666 AC_LANG_POP([C])]) 667 668AC_DEFUN([AC_GECODE_GCC_GENERAL_SWITCHES], 669 [AC_GECODE_CHECK_COMPILERFLAG([-fPIC]) 670 AC_GECODE_CHECK_COMPILERFLAG([-Wextra]) 671 AC_GECODE_CHECK_COMPILERFLAG([-Wall]) 672 AC_GECODE_CHECK_COMPILERFLAG([-Wno-unknown-pragmas]) 673 AC_GECODE_CHECK_COMPILERFLAG([-pipe]) 674 AC_GECODE_CHECK_COMPILERFLAG([-std=c++11]) 675 676 AC_GECODE_CHECK_CXXFLAG(-ggdb, 677 AC_GECODE_ADD_TO_COMPILERFLAGS(-ggdb), 678 AC_GECODE_CHECK_COMPILERFLAG(-g)) 679 AC_CHECK_FUNC([__builtin_ffsll], 680 [AC_DEFINE([GECODE_HAS_BUILTIN_FFSLL],[], 681 [whether __builtin_ffsll is available])]) 682 AC_CHECK_FUNC([__builtin_popcountll], 683 [AC_DEFINE([GECODE_HAS_BUILTIN_POPCOUNTLL],[], 684 [whether __builtin_popcountll is available])]) 685 686 AC_SUBST(docdir, "${datadir}/doc/gecode") 687 688 dnl do not use manifest tool with gcc 689 AC_SUBST(MANIFEST, "@true") 690 691 dnl file extensions 692 AC_SUBST(SBJEXT, "s") 693 AC_SUBST(LIBEXT, "${DLLEXT}") 694 AC_SUBST(LIBPREFIX, "lib${ac_gecode_userprefix}gecode") 695 AC_SUBST(STATICLIBEXT, "a") 696 AC_SUBST(MINUSLDIR, "-L${libdir}") 697 AC_SUBST(LINKLIBDIR, "") 698 699 cygpathprefix=$prefix 700 test "x$cygpathprefix" = xNONE && cygpathprefix=$ac_default_prefix 701 AC_SUBST(cygpathprefix, "${cygpathprefix}") 702 703 AC_SUBST(COMPILEOBJ, "-c -o ") 704 AC_SUBST(COMPILESBJ, "-S -o ") 705 AC_SUBST(CXXIN, " ") 706 AC_SUBST(CCIN, " ") 707 AC_SUBST(EXAMPLES_EXTRA_CXXFLAGS, "") 708 709 dnl Do not install stub .lib files (required for msvc) 710 AC_SUBST(INSTALLLIBS, "no") 711 712 AC_SUBST(LINKPREFIX, "-l${ac_gecode_userprefix}gecode") 713 AC_SUBST(LINKSUFFIX, "") 714 715 dnl how to tell the compiler to output an object file 716 AC_SUBST(LINKOUTPUT, "-o ") 717 dnl how to tell the compiler to output an executable 718 AC_SUBST(EXEOUTPUT, "-o ") 719 720 dnl the names of the generated dlls 721 AC_SUBST(SUPPORT, "support") 722 AC_SUBST(KERNEL, "kernel") 723 AC_SUBST(SEARCH, "search") 724 AC_SUBST(INT, "int") 725 AC_SUBST(FLOAT, "float") 726 AC_SUBST(SET, "set") 727 AC_SUBST(MM, "minimodel") 728 AC_SUBST(GIST, "gist") 729 AC_SUBST(FLATZINC, "flatzinc") 730 AC_SUBST(DRIVER, "driver")]) 731 732 733AC_DEFUN([AC_GECODE_GCC_OPTIMIZED_SWITCHES], 734 [AC_MSG_CHECKING([if compiler supports forced inlining]) 735 AC_LANG_PUSH([C++]) 736 ac_gecode_save_CXXFLAGS="${CXXFLAGS}" 737 CXXFLAGS="$1${CXXFLAGS:+ }${CXXFLAGS} -Werror" 738 _AC_C_IFDEF([__clang__], 739 [AC_MSG_RESULT(no) 740 AC_DEFINE(forceinline, [inline], 741 [How to tell the compiler to really, really inline])], 742 [AC_COMPILE_IFELSE( 743 [AC_LANG_PROGRAM([ 744 [inline __attribute__ ((__always_inline__)) void foo(void) {}]], 745 [])], 746 [AC_MSG_RESULT(yes) 747 AC_DEFINE(forceinline, [inline __attribute__ ((__always_inline__))], 748 [How to tell the compiler to really, really inline])], 749 [AC_MSG_RESULT(no) 750 AC_DEFINE(forceinline, [inline], 751 [How to tell the compiler to really, really inline])])]) 752 CXXFLAGS=${ac_gecode_save_CXXFLAGS} 753 AC_LANG_POP([C++]) 754 AC_GECODE_CHECK_COMPILERFLAG([${ac_gecode_gcc_optimize_flag}]) 755 AC_GECODE_CHECK_COMPILERFLAG([-fno-strict-aliasing])]) 756 757AC_DEFUN([AC_GECODE_GCC_VISIBILITY], 758 [AC_ARG_ENABLE([gcc-visibility], 759 AC_HELP_STRING([--enable-gcc-visibility], 760 [use gcc visibility attributes @<:@default=yes@:>@])) 761 AC_MSG_CHECKING(whether to use gcc visibility attributes) 762 if test "${enable_gcc_visibility:-yes}" = "yes"; then 763 AC_MSG_RESULT(yes) 764 AC_GECODE_CHECK_CXXFLAG([-fvisibility=hidden], 765 [AC_DEFINE([GECODE_GCC_HAS_CLASS_VISIBILITY],[], 766 [Whether gcc understands visibility attributes]) 767 AC_GECODE_ADD_TO_COMPILERFLAGS([-fvisibility=hidden])], 768 []) 769 else 770 AC_MSG_RESULT(no) 771 fi]) 772 773AC_DEFUN([AC_GECODE_GCC_DEBUG_SWITCHES], 774 [AC_DEFINE(forceinline, [inline], 775 [How to tell the compiler to really, really inline]) 776 AC_GECODE_CHECK_COMPILERFLAG([-fno-inline-functions]) 777 AC_GECODE_CHECK_COMPILERFLAG([-fimplement-inlines])]) 778 779AC_DEFUN([AC_GECODE_NO_BUILDFLAGS], 780 [AC_SUBST(GECODE_BUILD_SUPPORT_FLAG, "") 781 AC_SUBST(GECODE_BUILD_KERNEL_FLAG, "") 782 AC_SUBST(GECODE_BUILD_SEARCH_FLAG, "") 783 AC_SUBST(GECODE_BUILD_INT_FLAG, "") 784 AC_SUBST(GECODE_BUILD_FLOAT_FLAG, "") 785 AC_SUBST(GECODE_BUILD_SET_FLAG, "") 786 AC_SUBST(GECODE_BUILD_MINIMODEL_FLAG, "") 787 AC_SUBST(GECODE_BUILD_GIST_FLAG, "") 788 AC_SUBST(GECODE_BUILD_FLATZINC_FLAG, "") 789 AC_SUBST(GECODE_BUILD_DRIVER_FLAG, "")]) 790 791AC_DEFUN([AC_GECODE_BUILDFLAGS], 792 [AC_SUBST(GECODE_BUILD_SUPPORT_FLAG, "-DGECODE_BUILD_SUPPORT") 793 AC_SUBST(GECODE_BUILD_KERNEL_FLAG, "-DGECODE_BUILD_KERNEL") 794 AC_SUBST(GECODE_BUILD_SEARCH_FLAG, "-DGECODE_BUILD_SEARCH") 795 AC_SUBST(GECODE_BUILD_INT_FLAG, "-DGECODE_BUILD_INT") 796 AC_SUBST(GECODE_BUILD_FLOAT_FLAG, "-DGECODE_BUILD_FLOAT") 797 AC_SUBST(GECODE_BUILD_SET_FLAG, "-DGECODE_BUILD_SET") 798 AC_SUBST(GECODE_BUILD_MINIMODEL_FLAG, "-DGECODE_BUILD_MINIMODEL") 799 AC_SUBST(GECODE_BUILD_GIST_FLAG, "-DGECODE_BUILD_GIST") 800 AC_SUBST(GECODE_BUILD_FLATZINC_FLAG, "-DGECODE_BUILD_FLATZINC") 801 AC_SUBST(GECODE_BUILD_DRIVER_FLAG, "-DGECODE_BUILD_DRIVER")]) 802 803 804AC_DEFUN([AC_GECODE_UNIX_PATHS], 805 [AC_SUBST(DLLPATH, [-L.]) 806 dnl flags for creating dlls 807 case $host_os in 808 darwin*) 809 AC_SUBST(need_soname, "yes") 810 AC_GECODE_ADD_TO_DLLFLAGS([-Wl,-single_module]) 811 AC_GECODE_ADD_TO_DLLFLAGS("-dynamiclib") 812 AC_SUBST(DLLEXT, "${ac_gecode_soversion}.0.dylib") 813 AC_SUBST(SOSUFFIX, ".${ac_gecode_soversion}.dylib") 814 AC_SUBST(SOLINKSUFFIX, ".dylib") 815 AC_SUBST(sharedlibdir, "${libdir}") 816 AC_SUBST(WLSONAME, "-compatibility_version ${ac_gecode_soversion}.0 -current_version ${ac_gecode_soversion}.0 -install_name ${libdir}/") 817 AC_GECODE_NO_BUILDFLAGS 818 ;; 819 windows*) 820 AC_SUBST(need_soname, "no") 821 if test "${enable_static:-no}" = "yes" -a \ 822 "${enable_shared:-yes}" = "yes"; then 823 AC_MSG_ERROR([Only either static or shared libraries can be built.]) 824 fi 825 AC_GECODE_ADD_TO_DLLFLAGS("-shared") 826 AC_SUBST(DLLEXT, "dll") 827 AC_SUBST(SOSUFFIX, "") 828 AC_SUBST(SOLINKSUFFIX, "") 829 AC_SUBST(WLSONAME, "") 830 if test "${enable_static:-no}" = "no"; then 831 AC_SUBST(sharedlibdir, "${bindir}") 832 else 833 AC_SUBST(sharedlibdir, "${libdir}") 834 fi 835 AC_GECODE_BUILDFLAGS 836 ;; 837 *) 838 AC_SUBST(need_soname, "yes") 839 AC_GECODE_ADD_TO_DLLFLAGS("-shared") 840 AC_SUBST(DLLEXT, "so.${ac_gecode_soversion}.0") 841 AC_SUBST(SOSUFFIX, ".so.${ac_gecode_soversion}") 842 AC_SUBST(SOLINKSUFFIX, ".so") 843 AC_SUBST(WLSONAME, ["-Wl,-soname="]) 844 AC_SUBST(sharedlibdir, "${libdir}") 845 AC_GECODE_NO_BUILDFLAGS 846 ;; 847 esac]) 848 849AC_DEFUN([AC_GECODE_MSVC_SWITCHES], 850 [dnl general compiler flags 851 AC_DEFINE(forceinline,[__forceinline]) 852 AC_GECODE_ADD_TO_COMPILERFLAGS([-nologo -bigobj]) 853 AC_GECODE_ADD_TO_CFLAGS([-D_CRT_SECURE_NO_DEPRECATE]) 854 AC_GECODE_ADD_TO_CXXFLAGS([-EHsc]) 855 AC_DEFINE([GECODE_MEMORY_ALIGNMENT], [sizeof(void*)], 856 [Heap memory alignment]) 857 if test "${enable_debug:-no}" = "no"; then 858 dnl compiler flags for an optimized build 859 AC_GECODE_ADD_TO_COMPILERFLAGS([${ac_gecode_cl_optimize_flag}]) 860 AC_GECODE_ADD_TO_COMPILERFLAGS([-MD -GS- -wd4355 -wd4068]) 861 AC_GECODE_CHECK_COMPILERFLAG([-arch:SSE2]) 862 863 dnl flags for creating optimized dlls 864 AC_GECODE_ADD_TO_DLLFLAGS([${CXXFLAGS} -LD]) 865 dnl linker flags 866 GLDFLAGS="-link -DEBUG -OPT:REF -OPT:ICF -MANIFEST -INCREMENTAL:NO" 867 else 868 dnl compiler flags for a debug build 869 AC_GECODE_ADD_TO_COMPILERFLAGS([-MDd -Zi -wd4355 -wd4068]) 870 871 dnl flags for creating debug dlls 872 AC_GECODE_ADD_TO_DLLFLAGS([${CXXFLAGS} -LDd]) 873 GLDFLAGS="-link -MANIFEST -INCREMENTAL:NO" 874 fi 875 876 AC_SUBST(sharedlibdir, "${bindir}") 877 AC_SUBST(docdir, "${prefix}") 878 if test "${enable_static:-no}" = "yes"; then 879 AC_MSG_ERROR([Static linking not supported for Windows/cl.]) 880 fi 881 882 AC_CHECK_PROG(MANIFEST, mt.exe, mt.exe) 883 884 AC_SUBST(DLLPATH, "") 885 886 dnl file extensions 887 AC_SUBST(SBJEXT, "sbj") 888 AC_SUBST(DLLEXT, "dll") 889 AC_SUBST(SOSUFFIX, "") 890 AC_SUBST(SOLINKSUFFIX, "") 891 AC_SUBST(WLSONAME, "") 892 AC_SUBST(LIBEXT, "lib") 893 AC_SUBST(LIBPREFIX, "${ac_gecode_userprefix}Gecode") 894 AC_SUBST(LINKPREFIX, "${ac_gecode_userprefix}Gecode") 895 AC_SUBST(LINKSUFFIX, ".lib") 896 AC_SUBST(MINUSLDIR, "") 897 AC_SUBST(LINKLIBDIR, "${libdir}/") 898 899 cygpathprefix=$prefix 900 test "x$cygpathprefix" = xNONE && cygpathprefix=$ac_default_prefix 901 cygpathprefix=`cygpath -m ${cygpathprefix}` 902 903 AC_SUBST(cygpathprefix, "${cygpathprefix}") 904 AC_GECODE_BUILDFLAGS 905 906 dnl compiler options 907 AC_SUBST(COMPILEOBJ, "-c -Fo") 908 AC_SUBST(COMPILESBJ, "-c -Fa") 909 AC_SUBST(CXXIN, "-Tp") 910 AC_SUBST(CCIN, "-Tc") 911 912 dnl Install stub .lib files (required for msvc) 913 AC_SUBST(INSTALLLIBS, "yes") 914 915 dnl how to tell the compiler to output an object file 916 AC_SUBST(LINKOUTPUT, "-Fe") 917 dnl how to tell the compiler to output an executable 918 AC_SUBST(EXEOUTPUT, "-Fe") 919 920 dnl the names of the generated dlls 921 AC_SUBST(SUPPORT, "Support") 922 AC_SUBST(KERNEL, "Kernel") 923 AC_SUBST(SEARCH, "Search") 924 AC_SUBST(INT, "Int") 925 AC_SUBST(FLOAT, "Float") 926 AC_SUBST(SET, "Set") 927 AC_SUBST(MM, "Minimodel") 928 AC_SUBST(GIST, "Gist") 929 AC_SUBST(FLATZINC, "FlatZinc") 930 AC_SUBST(DRIVER, "Driver")]) 931 932dnl Macro: 933dnl AC_GECODE_DOC_SWITCHES 934dnl 935dnl Description: 936dnl Produces the configure switches --enable-doc-search, 937dnl --enable-doc-chm, and --enable-doc-tagfile. 938dnl 939dnl Authors: 940dnl Guido Tack <tack@gecode.org> 941AC_DEFUN([AC_GECODE_DOC_SWITCHES], 942 [dnl check if we can use dot for generating graphs in the documentation 943 AC_ARG_ENABLE([doc-dot], 944 AC_HELP_STRING([--enable-doc-dot], 945 [enable graphs in documentation @<:@default=yes@:>@])) 946 AC_CHECK_PROG(DOT, dot, dot) 947 AC_MSG_CHECKING(whether to enable graphs in the documentation) 948 if test "${enable_doc_dot:-yes}" = "yes"; then 949 if test x$DOT = x; then 950 if test x"${enable_doc_dot}" = x; then 951 AC_MSG_RESULT(no) 952 AC_SUBST(GECODE_DOXYGEN_DOT, NO) 953 else 954 AC_MSG_ERROR(you need the dot tool from graphviz to generate graphs in the documentation) 955 fi 956 else 957 AC_MSG_RESULT(yes) 958 AC_SUBST(GECODE_DOXYGEN_DOT, YES) 959 fi 960 else 961 AC_MSG_RESULT(no) 962 AC_SUBST(GECODE_DOXYGEN_DOT, NO) 963 fi 964 965 AC_ARG_ENABLE([doc-search], 966 AC_HELP_STRING([--enable-doc-search], 967 [enable documentation search engine @<:@default=no@:>@])) 968 AC_MSG_CHECKING(whether to enable the documentation search engine) 969 if test "${enable_doc_search:-no}" = "yes"; then 970 AC_MSG_RESULT(yes) 971 AC_SUBST(ENABLEDOCSEARCH, "yes") 972 else 973 AC_MSG_RESULT(no) 974 AC_SUBST(ENABLEDOCSEARCH, "no") 975 fi 976 AC_ARG_ENABLE([doc-tagfile], 977 AC_HELP_STRING([--enable-doc-tagfile], 978 [generate doxygen tagfile @<:@default=yes@:>@])) 979 AC_MSG_CHECKING(whether to generate a doxygen tagfile) 980 if test "${enable_doc_tagfile:-yes}" = "yes"; then 981 AC_MSG_RESULT(yes) 982 AC_SUBST(GECODE_DOXYGEN_TAGFILE, "doc/gecode-doc.tag") 983 else 984 AC_MSG_RESULT(no) 985 AC_SUBST(GECODE_DOXYGEN_TAGFILE, []) 986 fi 987 AC_ARG_ENABLE([doc-chm], 988 AC_HELP_STRING([--enable-doc-chm], 989 [build compressed html documentation @<:@default=yes on Windows@:>@])) 990 AC_MSG_CHECKING(whether to build compressed html documentation) 991 case $host_os in 992 windows*) 993 if test "${enable_doc_chm:-yes}" = "yes"; then 994 AC_MSG_RESULT(yes) 995 AC_SUBST(ENABLEDOCCHM, "yes") 996 AC_SUBST(ENABLEDOCSEARCH, "no") 997 else 998 AC_MSG_RESULT(no) 999 AC_SUBST(ENABLEDOCCHM, "no") 1000 fi 1001 ;; 1002 *) 1003 if test "${enable_doc_chm:-no}" = "yes"; then 1004 AC_MSG_ERROR([building chms is only supported on Windows.]) 1005 else 1006 AC_MSG_RESULT(no) 1007 AC_SUBST(ENABLEDOCCHM, "no") 1008 fi 1009 ;; 1010 esac 1011 AC_ARG_ENABLE([doc-docset], 1012 AC_HELP_STRING([--enable-doc-docset], 1013 [build docset documentation for XCode @<:@default=no@:>@])) 1014 AC_MSG_CHECKING(whether to build docset documentation for XCode) 1015 case $host_os in 1016 darwin*) 1017 if test "${enable_doc_docset:-no}" = "yes"; then 1018 AC_MSG_RESULT(yes) 1019 AC_SUBST(ENABLEDOCDOCSET, "yes") 1020 AC_SUBST(ENABLEDOCSEARCH, "no") 1021 else 1022 AC_MSG_RESULT(no) 1023 AC_SUBST(ENABLEDOCDOCSET, "no") 1024 fi 1025 ;; 1026 *) 1027 if test "${enable_doc_docset:-no}" = "yes"; then 1028 AC_MSG_ERROR([building docsets is only supported on Mac OS X.]) 1029 else 1030 AC_MSG_RESULT(no) 1031 AC_SUBST(ENABLEDOCDOCSET, "no") 1032 fi 1033 ;; 1034 esac 1035 ]) 1036 1037dnl Macro: 1038dnl AC_GECODE_UNIVERSAL 1039dnl 1040dnl Description: 1041dnl Produces the configure switches --enable-universal and --with-sdk 1042dnl for compiling universal binaries on Mac OS X. 1043dnl 1044dnl Authors: 1045dnl Guido Tack <tack@gecode.org> 1046AC_DEFUN([AC_GECODE_UNIVERSAL], 1047 [dnl build universal binaries on Mac OS X 1048 AC_ARG_WITH([sdk], 1049 AC_HELP_STRING([--with-sdk], 1050 [SDK to use on Mac OS X])) 1051 if test "${host_os}" = "darwin"; then 1052 if test "${with_sdk:-no}" != "no"; then 1053 AC_GECODE_CHECK_COMPILERFLAG([-isysroot ${with_sdk}]) 1054 AC_GECODE_ADD_TO_DLLFLAGS([-Wl,-syslibroot,${with_sdk}]) 1055 fi 1056 fi 1057 AC_ARG_WITH([macosx-version-min], 1058 AC_HELP_STRING([--with-macosx-version-min], 1059 [minimum version of Mac OS X to support])) 1060 if test "${host_os}" = "darwin"; then 1061 if test "${with_macosx_version_min:-no}" != "no"; then 1062 AC_GECODE_CHECK_COMPILERFLAG( 1063 [-mmacosx-version-min=${with_macosx_version_min}]) 1064 AC_GECODE_ADD_TO_DLLFLAGS( 1065 [-mmacosx-version-min=${with_macosx_version_min}]) 1066 fi 1067 fi 1068 AC_ARG_WITH([architectures], 1069 AC_HELP_STRING([--with-architectures], 1070 [architectures to compile for on Mac OS X])) 1071 AC_MSG_CHECKING(Whether to build for different architectures) 1072 if test "${host_os}" = "darwin"; then 1073 if test "${with_architectures:-no}" != "no"; then 1074 archflags=""; 1075 for a in `echo ${with_architectures} | sed -e "s/,/ /g"`; do 1076 archflags="${archflags} -arch $a"; 1077 done 1078 AC_GECODE_CHECK_COMPILERFLAG([${archflags}]) 1079 AC_GECODE_ADD_TO_DLLFLAGS([${archflags}]) 1080 AC_MSG_RESULT(yes) 1081 else 1082 AC_MSG_RESULT(no) 1083 fi 1084 else 1085 AC_MSG_RESULT(no) 1086 fi 1087]) 1088 1089dnl Macro: 1090dnl AC_GECODE_FRAMEWORK 1091dnl 1092dnl Description: 1093dnl Produces the configure switch --enable-framework 1094dnl for creating a Mac OS X framework instead of individual libraries. 1095dnl 1096dnl Authors: 1097dnl Guido Tack <tack@gecode.org> 1098AC_DEFUN([AC_GECODE_FRAMEWORK], 1099 [dnl build framework bundle on Mac OS X 1100 AC_ARG_ENABLE([framework], 1101 AC_HELP_STRING([--enable-framework], 1102 [build framework bundle on Mac OS X @<:@default=no@:>@])) 1103 if test "${host_os}" = "darwin"; then 1104 AC_MSG_CHECKING(whether to build framework bundle on Mac OS X) 1105 if test "${enable_framework:-no}" = "yes"; then 1106 AC_MSG_RESULT(yes) 1107 AC_SUBST(BUILD_MACOS_FRAMEWORK, "yes") 1108 enable_static="yes"; 1109 enable_shared="no"; 1110 else 1111 AC_MSG_RESULT(no) 1112 AC_SUBST(BUILD_MACOS_FRAMEWORK, "no") 1113 fi 1114 fi 1115]) 1116 1117dnl Macro: 1118dnl AC_GECODE_MPFR_INCLUDE 1119dnl 1120dnl Description: 1121dnl Produces the configure switch --with-mpfr-include 1122dnl for supplying the path to the mpfr header. 1123dnl 1124AC_DEFUN([AC_GECODE_MPFR_INCLUDE], 1125 [dnl build with support for the mpfr header 1126 AC_ARG_WITH([mpfr-include], 1127 AC_HELP_STRING([--with-mpfr-include], 1128 [path to the mpfr header file])) 1129 if test "${with_mpfr_include:-no}" != "no"; then 1130 AC_SUBST(MPFR_CPPFLAGS,[-I${with_mpfr_include}]) 1131 fi 1132]) 1133 1134dnl Macro: 1135dnl AC_GECODE_MPFR_LIB 1136dnl 1137dnl Description: 1138dnl Produces the configure switch --with-mpfr-lib 1139dnl for supplying the path to the mpfr library. 1140dnl 1141AC_DEFUN([AC_GECODE_MPFR_LIB], 1142 [dnl build with support for the mpfr library 1143 AC_ARG_WITH([mpfr-lib], 1144 AC_HELP_STRING([--with-mpfr-lib], 1145 [path to the mpfr library])) 1146 if test "${with_mpfr_lib:-no}" != "no"; then 1147 case $ac_gecode_compiler_vendor in 1148 gnu) 1149 AC_SUBST(MPFR_LIB_PATH,["-L${with_mpfr_lib}"]) 1150 ;; 1151 microsoft) 1152 AC_SUBST(MPFR_LIB_PATH,["/LIBPATH:${with_mpfr_lib}"]) 1153 ;; 1154 esac 1155 else 1156 AC_SUBST(MPFR_LIB_PATH,[""]) 1157 fi 1158 case $ac_gecode_compiler_vendor in 1159 gnu) 1160 AC_SUBST(MPFR_LINK,["-lmpfr"]) 1161 ;; 1162 microsoft) 1163 AC_SUBST(MPFR_LINK,["mpfr.lib"]) 1164 ;; 1165 esac 1166]) 1167 1168dnl Macro: 1169dnl AC_GECODE_GMP_INCLUDE 1170dnl 1171dnl Description: 1172dnl Produces the configure switch --with-gmp-include 1173dnl for supplying the path to the gmp or mpir headers. 1174dnl 1175AC_DEFUN([AC_GECODE_GMP_INCLUDE], 1176 [dnl build with support for the gmp headers 1177 AC_ARG_WITH([gmp-include], 1178 AC_HELP_STRING([--with-gmp-include], 1179 [path to the gmp or mpir header files])) 1180 if test "${with_gmp_include:-no}" != "no"; then 1181 AC_SUBST(GMP_CPPFLAGS,[-I${with_gmp_include}]) 1182 fi 1183]) 1184 1185dnl Macro: 1186dnl AC_GECODE_GMP_LIB 1187dnl 1188dnl Description: 1189dnl Produces the configure switch --with-gmp-lib 1190dnl for supplying the path to the GMP library. 1191dnl 1192AC_DEFUN([AC_GECODE_GMP_LIB], 1193 [dnl build with support for the GMP library 1194 AC_ARG_WITH([gmp-lib], 1195 AC_HELP_STRING([--with-gmp-lib], 1196 [path to the gmp or mpir library])) 1197 1198 ac_gecode_tmp_gmp_lib="" 1199 if test "${with_gmp_lib:-no}" != "no"; then 1200 case $ac_gecode_compiler_vendor in 1201 gnu) 1202 AC_SUBST(GMP_LIB_PATH,["-L${with_gmp_lib}"]) 1203 ;; 1204 microsoft) 1205 AC_SUBST(GMP_LIB_PATH,["/LIBPATH:${with_gmp_lib}"]) 1206 ;; 1207 esac 1208 else 1209 AC_SUBST(GMP_LIB_PATH,[""]) 1210 fi 1211 1212 ac_gecode_save_CPPFLAGS="${CPPFLAGS}" 1213 ac_gecode_save_LIBS="${LIBS}" 1214 case $ac_gecode_compiler_vendor in 1215 gnu) 1216 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ } ${GMP_CPPFLAGS}" 1217 LIBS="${LIBS}${LIBS:+ } ${GMP_LIB_PATH}" 1218 AC_CHECK_LIB(gmp, __gmpz_init,[ 1219 AC_SUBST(GMP_LINK,"${ac_gecode_tmp_gmp_lib} -lgmp") 1220 ],[ 1221 AC_CHECK_LIB(mpir, __gmpz_init,[ 1222 AC_SUBST(GMP_LINK,"${ac_gecode_tmp_gmp_lib} -lmpir") 1223 ],[ 1224 enable_mpfr=no; 1225 ]) 1226 ]) 1227 ;; 1228 microsoft) 1229 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ } ${GMP_CPPFLAGS}" 1230 LIBS="${LIBS}${LIBS:+ } /link ${GMP_LIB_PATH} gmp.lib" 1231 AC_CHECK_LIB(gmp, __gmpz_init,[ 1232 AC_SUBST(GMP_LINK,"${ac_gecode_tmp_gmp_lib} gmp.lib") 1233 ],[ 1234 LIBS="${ac_gecode_save_LIBS}" 1235 LIBS="${LIBS}${LIBS:+ } /link ${GMP_LIB_PATH} mpir.lib" 1236 AC_CHECK_LIB(mpir, __gmpz_init,[ 1237 AC_SUBST(GMP_LINK,"${ac_gecode_tmp_gmp_lib} mpir.lib") 1238 ],[ 1239 enable_mpfr=no; 1240 ]) 1241 ]) 1242 ;; 1243 esac 1244 CPPFLAGS="${ac_gecode_save_CPPFLAGS}" 1245 LIBS="${ac_gecode_save_LIBS}" 1246 ]) 1247 1248 1249dnl Macro: 1250dnl AC_GECODE_MPFR 1251dnl 1252dnl Description: 1253dnl Produces the configure switch --enable-mpfr 1254dnl for compiling parts of Gecode that need the MPFR library. 1255dnl 1256dnl Authors: 1257AC_DEFUN([AC_GECODE_MPFR], 1258 [ 1259 AC_ARG_ENABLE([mpfr], 1260 AC_HELP_STRING([--enable-mpfr], 1261 [build with MPFR support @<:@default=yes@:>@])) 1262 if test "${enable_float_vars:-yes}" = "yes"; then 1263 AC_MSG_CHECKING(whether to build with MPFR support) 1264 if test "${enable_mpfr:-yes}" = "yes"; then 1265 AC_MSG_RESULT(yes) 1266 AC_GECODE_GMP_INCLUDE 1267 AC_GECODE_GMP_LIB 1268 AC_GECODE_MPFR_INCLUDE 1269 AC_GECODE_MPFR_LIB 1270 ac_gecode_save_CPPFLAGS="${CPPFLAGS}" 1271 ac_gecode_save_LIBS="${LIBS}" 1272 case $ac_gecode_compiler_vendor in 1273 gnu) 1274 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ } ${MPFR_CPPFLAGS} ${GMP_CPPFLAGS}" 1275 LIBS="${LIBS}${LIBS:+ } ${MPFR_LIB_PATH} ${GMP_LIB_PATH} ${MPFR_LINK} ${GMP_LINK}" 1276 AC_CHECK_HEADERS([gmp.h], 1277 AC_CHECK_HEADERS([mpfr.h], 1278 AC_CHECK_LIB(mpfr, mpfr_add, 1279 AC_DEFINE([GECODE_HAS_MPFR],[],[Whether MPFR is available]) 1280 enable_mpfr=yes;, 1281 enable_mpfr=no;), 1282 enable_mpfr=no; ), 1283 enable_mpfr=no; ) 1284 ;; 1285 microsoft) 1286 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ } ${MPFR_CPPFLAGS} ${GMP_CPPFLAGS}" 1287 LIBS="${LIBS}${LIBS:+ } /link ${MPFR_LIB_PATH} ${GMP_LIB_PATH} ${MPFR_LINK} ${GMP_LINK}" 1288 AC_CHECK_HEADERS([gmp.h], 1289 AC_CHECK_HEADERS([mpfr.h], 1290 AC_CHECK_FUNC(mpfr_add, 1291 AC_DEFINE([GECODE_HAS_MPFR],[],[Whether MPFR is available]) 1292 enable_mpfr=yes;, 1293 enable_mpfr=no;), 1294 enable_mpfr=no; ), 1295 enable_mpfr=no; ) 1296 ;; 1297 esac 1298 CPPFLAGS="${ac_gecode_save_CPPFLAGS}" 1299 LIBS="${ac_gecode_save_LIBS}" 1300 else 1301 AC_MSG_RESULT(no) 1302 enable_mpfr=no; 1303 fi 1304 else 1305 enable_mpfr=no; 1306 fi 1307 AC_SUBST(enable_mpfr, ${enable_mpfr}) 1308]) 1309 1310 1311dnl Macro: 1312dnl AC_GECODE_QT 1313dnl 1314dnl Description: 1315dnl Produces the configure switch --enable-qt 1316dnl for compiling parts of Gecode that need the Qt library. 1317dnl 1318dnl Authors: 1319dnl Guido Tack <tack@gecode.org> 1320AC_DEFUN([AC_GECODE_QT], 1321 [ 1322 AC_ARG_ENABLE([qt], 1323 AC_HELP_STRING([--enable-qt], 1324 [build with Qt support, requires at least Qt 4.3 @<:@default=yes@:>@])) 1325 AC_CHECK_PROGS(QMAKE, [qmake-qt4 qmake]) 1326 AC_CHECK_PROGS(MOC, [moc-qt4 moc]) 1327 AC_MSG_CHECKING(whether to build with Qt support) 1328 if test "${enable_qt:-yes}" = "yes"; then 1329 if test "${QMAKE}x" = "x" -o "${MOC}x" = "x"; then 1330 AC_MSG_RESULT(no) 1331 else 1332 ac_gecode_qt_version=`${QMAKE} -query QT_VERSION` 1333 ac_gecode_qt_major=`echo ${ac_gecode_qt_version} | grep -o '^[[0-9]]*'` 1334 ac_gecode_qt_minor=`echo ${ac_gecode_qt_version} | sed -e 's/^[[0-9]]*\\.//g' -e 's/\\.[[0-9]]*$//g'` 1335 ac_gecode_qt_ok="yes" 1336 if test ${ac_gecode_qt_major} -lt 4; then ac_gecode_qt_ok="no"; 1337 else if test ${ac_gecode_qt_major} -eq 4 \ 1338 -a ${ac_gecode_qt_minor} -lt 3; then ac_gecode_qt_ok="no"; 1339 fi 1340 fi 1341 if test "${ac_gecode_qt_ok}" != "yes"; then 1342 AC_MSG_RESULT(no) 1343 else 1344 AC_MSG_RESULT(yes) 1345 AC_DEFINE([GECODE_HAS_QT],[],[Whether Qt is available]) 1346 dnl use qmake to find the Qt installation 1347 ac_gecode_qt_tmpdir=`mktemp -d gistqt.XXXXXX` || exit 1 1348 cd ${ac_gecode_qt_tmpdir} 1349 echo "CONFIG += release" > a.pro 1350 if test ${ac_gecode_qt_major} -eq 5; then 1351 echo "QT += widgets printsupport" >> a.pro 1352 fi 1353 ${QMAKE} 1354 if test -d a.xcodeproj; then 1355 ac_gecode_qt_makefile=a.xcodeproj/qt_preprocess.mak 1356 elif test -d a.pbproj; then 1357 ac_gecode_qt_makefile=a.pbproj/qt_preprocess.mak 1358 elif test -f Makefile.Debug; then 1359 if test "${enable_debug:-no}" = "no"; then 1360 ac_gecode_qt_makefile=Makefile.Release 1361 else 1362 ac_gecode_qt_makefile=Makefile.Debug 1363 fi 1364 else 1365 ac_gecode_qt_makefile=Makefile 1366 fi 1367 ac_gecode_qt_defines=`grep ${ac_gecode_qt_makefile} -e 'DEFINES.*=' | sed -e 's/.*=//' -e 's|\\\\|/|g' -e 's|-I\\("*\\)\\.\\./\\.\\.|-I\\1..|g'` 1368 ac_gecode_qt_inc=`grep ${ac_gecode_qt_makefile} -e 'INCPATH.*=' | sed -e 's/.*=//' -e 's|\\\\|/|g' -e 's|-I\\("*\\)\\.\\./\\.\\.|-I\\1..|g'` 1369 ac_gecode_qt_libs=`grep ${ac_gecode_qt_makefile} -e 'LIBS.*=' | sed -e 's/.*=//' -e 's|\\\\|/|g' -e 's|-I\\("*\\)\\.\\./\\.\\.|-I\\1..|g'` 1370 if test -d a.xcodeproj -o -d a.pbproj; then 1371 ac_gecode_qt_libs="-framework QtGui -framework QtCore" 1372 fi 1373 cd .. 1374 rm -r ${ac_gecode_qt_tmpdir} 1375 AC_SUBST(QTINCLUDES, ${ac_gecode_qt_inc}) 1376 AC_SUBST(QTDEFINES, ${ac_gecode_qt_defines}) 1377 AC_SUBST(QTLIBS, ${ac_gecode_qt_libs}) 1378 AC_SUBST(enable_qt,yes) 1379 enable_qt=yes; 1380 fi 1381 fi 1382 else 1383 AC_MSG_RESULT(no) 1384 enable_qt=no; 1385 fi 1386 AC_SUBST(enable_qt, ${enable_qt}) 1387]) 1388 1389dnl Macro: 1390dnl AC_GECODE_GIST 1391dnl 1392dnl Description: 1393dnl Produces the configure switch --enable-gist 1394dnl for compiling the Gecode Interactive Search Tool. 1395dnl 1396dnl Authors: 1397dnl Guido Tack <tack@gecode.org> 1398AC_DEFUN([AC_GECODE_GIST], 1399 [ 1400 AC_ARG_ENABLE([gist], 1401 AC_HELP_STRING([--enable-gist], 1402 [build Gecode Interactive Search Tool @<:@default=yes@:>@])) 1403 AC_MSG_CHECKING(whether to build Gist) 1404 if test "${enable_gist:-yes}" = "yes" -a "${enable_qt}" = "yes"; then 1405 AC_MSG_RESULT(yes) 1406 AC_SUBST(enable_gist, yes) 1407 AC_DEFINE([GECODE_HAS_GIST],[],[Whether Gist is available]) 1408 else 1409 AC_MSG_RESULT(no) 1410 fi 1411]) 1412 1413dnl 1414dnl Macro: 1415dnl AC_GECODE_CBS 1416dnl 1417dnl Description: 1418dnl Produces the configure switch --enable-cbs 1419dnl for compiling with support for counting-based search. 1420dnl 1421dnl Authors: 1422dnl Samuel Gagnon <samuel.gagnon92@gmail.com> 1423AC_DEFUN([AC_GECODE_CBS], 1424 [ 1425 AC_ARG_ENABLE([cbs], 1426 AC_HELP_STRING([--enable-cbs], 1427 [build with support for counting-based search @<:@default=no@:>@])) 1428 AC_MSG_CHECKING(whether to build with support for cbs) 1429 if test "${enable_cbs:-no}" = "yes"; then 1430 AC_MSG_RESULT(yes) 1431 AC_SUBST(enable_cbs, yes) 1432 AC_DEFINE([GECODE_HAS_CBS],[],[Whether counting-based search support available]) 1433 else 1434 AC_MSG_RESULT(no) 1435 fi 1436]) 1437 1438dnl Macro: 1439dnl AC_GECODE_CPPROFILER 1440dnl 1441dnl Description: 1442dnl Produces the configure switch --enable-cpprofiler 1443dnl for compiling with support for the CPProfiler. 1444dnl 1445dnl Authors: 1446dnl Guido Tack <tack@gecode.org> 1447dnl Christian Schulte <schulte@gecode.org> 1448AC_DEFUN([AC_GECODE_CPPROFILER], 1449 [ 1450 AC_ARG_ENABLE([cpprofiler], 1451 AC_HELP_STRING([--enable-cpprofiler], 1452 [build with support for CPProfiler @<:@default=yes@:>@])) 1453 AC_MSG_CHECKING(whether to build with support for CPProfiler) 1454 if test "${enable_cpprofiler:-no}" = "yes"; then 1455 AC_MSG_RESULT(yes) 1456 AC_SUBST(enable_cpprofiler, yes) 1457 AC_DEFINE([GECODE_HAS_CPPROFILER],[],[Whether CPProfiler support available]) 1458 else 1459 AC_MSG_RESULT(no) 1460 fi 1461]) 1462 1463AC_DEFUN([AC_GECODE_USER_SUFFIX], 1464 [ 1465 AC_ARG_WITH([lib-prefix], 1466 AC_HELP_STRING([--with-lib-prefix], 1467 [add user-defined prefix to library names])) 1468 AC_MSG_CHECKING(for user-defined library name prefix) 1469 if test "x${with_lib_prefix}" != "x"; then 1470 ac_gecode_userprefix=${with_lib_prefix} 1471 AC_MSG_RESULT(${with_lib_prefix}) 1472 else 1473 ac_gecode_userprefix= 1474 AC_MSG_RESULT(no) 1475 fi 1476 AC_DEFINE_UNQUOTED(GECODE_DLL_USERPREFIX,"${ac_gecode_userprefix}", 1477 [User-defined prefix of dll names]) 1478 AC_ARG_WITH([lib-suffix], 1479 AC_HELP_STRING([--with-lib-suffix], 1480 [add user-defined suffix to library names])) 1481 AC_MSG_CHECKING(for user-defined library name suffix) 1482 if test "x${with_lib_suffix}" != "x"; then 1483 ac_gecode_usersuffix=${with_lib_suffix} 1484 AC_SUBST(USERSUFFIX,${with_lib_suffix}) 1485 AC_MSG_RESULT(${with_lib_suffix}) 1486 else 1487 ac_gecode_usersuffix= 1488 AC_SUBST(USERSUFFIX,[""]) 1489 AC_MSG_RESULT(no) 1490 fi 1491 AC_DEFINE_UNQUOTED(GECODE_DLL_USERSUFFIX,"${ac_gecode_usersuffix}", 1492 [User-defined suffix of dll names]) 1493]) 1494 1495AC_DEFUN([AC_GECODE_THREADS],[ 1496 AC_ARG_ENABLE([thread], 1497 AC_HELP_STRING([--enable-thread], 1498 [build with multi-threading support @<:@default=yes@:>@])) 1499 AC_MSG_CHECKING(whether to build with multi-threading support) 1500 if test "${enable_thread:-yes}" = "yes"; then 1501 AC_MSG_RESULT(yes) 1502 AC_CHECK_HEADER(unistd.h, 1503 [AC_DEFINE(GECODE_HAS_UNISTD_H,1,[Whether unistd.h is available])] 1504 ) 1505 AC_CHECK_HEADER(pthread.h, 1506 [AC_DEFINE(GECODE_THREADS_PTHREADS,1,[Whether we have posix threads]) 1507 AC_GECODE_ADD_TO_COMPILERFLAGS([-pthread]) 1508 AC_GECODE_ADD_TO_DLLFLAGS([-pthread]) 1509 AC_CHECK_HEADER([os/lock.h], 1510 [AC_DEFINE(GECODE_THREADS_OSX_UNFAIR,1,[Whether we have Mac OS threads (new version)])], 1511 AC_CHECK_HEADER([libkern/OSAtomic.h], 1512 [AC_DEFINE(GECODE_THREADS_OSX,1,[Whether we have Mac OS threads])], 1513 AC_MSG_CHECKING([for spin locks]) 1514 AC_TRY_COMPILE([#include <pthread.h>], 1515 [pthread_spinlock_t t;], 1516 [AC_MSG_RESULT(yes) 1517 AC_DEFINE(GECODE_THREADS_PTHREADS_SPINLOCK,1,Whether we have posix spinlocks)], 1518 [AC_MSG_RESULT(no)] 1519 ) 1520 ) 1521 )], 1522 [AC_CHECK_HEADER(windows.h, 1523 [AC_DEFINE(GECODE_THREADS_WINDOWS,1,[Whether we have windows threads])])] 1524 ) 1525 else 1526 AC_MSG_RESULT(no) 1527 fi 1528]) 1529 1530AC_DEFUN([AC_GECODE_TIMER],[ 1531 AC_CHECK_HEADER(sys/time.h, 1532 [AC_DEFINE(GECODE_USE_GETTIMEOFDAY,1,[Use gettimeofday for time-measurement])], 1533 [AC_DEFINE(GECODE_USE_CLOCK,1,[Use clock() for time-measurement])]) 1534]) 1535 1536dnl check whether we have suifficiently recent versions of flex/bison 1537AC_DEFUN([AC_GECODE_FLEXBISON], 1538 [AC_CHECK_TOOL(HAVEFLEX, flex) 1539 AC_MSG_CHECKING(whether we have at least flex 2.5.33) 1540 if test "${HAVEFLEX}x" = "x"; then 1541 AC_MSG_RESULT(no) 1542 AC_SUBST(HAVE_FLEXBISON, "no") 1543 else 1544 if flex --version | grep ' 2\.5\.3[[3-9]].*$' >/dev/null 2>&1 || 1545 flex --version | grep ' 2\.5\.4[[0-9]].*$' >/dev/null 2>&1 || 1546 flex --version | grep ' 2\.[[6-9]]\.[[0-9]]*$' >/dev/null 2>&1 1547 then 1548 AC_MSG_RESULT(yes) 1549 AC_CHECK_TOOL(HAVEBISON, bison) 1550 AC_MSG_CHECKING(whether we have at least bison 2.3) 1551 if test "${HAVEBISON}x" = "x"; then 1552 AC_MSG_RESULT(no) 1553 AC_SUBST(HAVE_FLEXBISON, "no") 1554 else 1555 if bison --version | grep -e ' 2\.[[3-9]][[0-9]]*' >/dev/null 2>&1 || 1556 bison --version | grep -e ' 3\.*' >/dev/null 2>&1 1557 then 1558 AC_MSG_RESULT(yes) 1559 AC_SUBST(HAVE_FLEXBISON, "yes") 1560 else 1561 AC_MSG_RESULT(no) 1562 AC_SUBST(HAVE_FLEXBISON, "no") 1563 fi 1564 fi 1565 else 1566 AC_MSG_RESULT(no) 1567 AC_SUBST(HAVE_FLEXBISON, "no") 1568 fi 1569 fi]) 1570 1571AC_DEFUN([AC_GECODE_RESOURCE],[ 1572 AC_ARG_ENABLE([resource], 1573 AC_HELP_STRING([--enable-resource], 1574 [build Gecode with resource files for Microsoft Visual Studio @<:@default=no@:>@])) 1575 AC_CHECK_PROG(HAVE_RC, rc.exe, [found]) 1576 AC_MSG_CHECKING(whether to build with Visual Studio resource files) 1577 if test "${enable_resource:-no}" = "yes" -a \ 1578 "${ac_gecode_compiler_vendor}" = "microsoft"; then 1579 if test "${HAVE_RC}x" = "x"; then 1580 AC_MSG_RESULT(no) 1581 AC_SUBST(RESCOMP, [@true]) 1582 AC_SUBST(enable_resource, no) 1583 else 1584 AC_MSG_RESULT(yes) 1585 AC_SUBST(RESCOMP, ["rc.exe"]) 1586 AC_SUBST(enable_resource, yes) 1587 fi 1588 else 1589 AC_MSG_RESULT(no) 1590 AC_SUBST(enable_resource, no) 1591 AC_SUBST(RESCOMP, [@true]) 1592 fi 1593]) 1594 1595dnl Macro: 1596dnl AC_GECODE_RUNENVIRONMENT 1597dnl 1598dnl Description: 1599dnl Configure appropriate run environment flags for different platforms for running 1600dnl executables from the makefile with compiled but not installed shared libraries 1601dnl 1602dnl Authors: 1603dnl Mikael Lagerkvist <lagerkvist@gecode.org> 1604dnl 1605AC_DEFUN([AC_GECODE_RUNENVIRONMENT], 1606 [case $host_os in 1607 darwin*) 1608 AC_SUBST(RUNENVIRONMENT, [DYLD_LIBRARY_PATH=.]) 1609 ;; 1610 windows*) 1611 AC_SUBST(RUNENVIRONMENT, ['']) 1612 ;; 1613 *) 1614 AC_SUBST(RUNENVIRONMENT, [LD_LIBRARY_PATH=.]) 1615 ;; 1616 esac])