Changeset 2578 for branches/autotools-update/coin.m4
- Timestamp:
- Jul 3, 2012 3:22:43 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autotools-update/coin.m4
r2553 r2578 206 206 207 207 ########################################################################### 208 # COIN_MINGW_LD_FIX # 209 ########################################################################### 210 211 # This macro is included by any PROG_compiler macro, to set the LD 212 # environment variable on MinGW to the correct value (link). But note that 213 # if we're building in cygwin with -mno-cygwin, we still want ld! If we're 214 # building from cygwin with MSVC tools (cl/link), then we do want link and 215 # you'd better have your PATH variable straight, else you'll be doing file 216 # links instead of code links! Arguably, LDFLAGS should include -mno-cygwin 217 # but in practice all linking seems to be handled through the compilers, so 218 # CFLAGS and CXXFLAGS suffice. 219 220 AC_DEFUN([AC_COIN_MINGW_LD_FIX], 221 [case $build in 222 *-mingw*) 223 if test "${LD+set}" = set; then :; else 224 LD=link 225 fi 226 ;; 227 esac 228 case $enable_doscompile in 229 msvc) 230 if test "x${LD+set}" = xset; then :; else 231 LD=link 232 fi 233 ;; 234 esac 235 ]) 236 237 ########################################################################### 238 # COIN_ENABLE_DOSCOMPILE # 239 ########################################################################### 240 241 # This macro is invoked by any PROG_compiler macro to establish the 242 # --enable-doscompile option, used when one wants to compile an executable 243 # under Cygwin which also runs directly under DOS (without requiring 244 # Cygwin1.dll). The job of this macro is to make sure the option is correct and 245 # to set enable_doscompile. Legal values are mingw, msvc, and no (disabled). 246 # mingw: Fake mingw under cygwin, using GCC tools and -mno-cygwin. The most 247 # important thing here is that preprocess, compile, and link steps 248 # *all* see -mno-cygwin. 249 # msvc: Assume the presence of cl/link. It's the user's responsibility to 250 # make sure their PATH is correct. In particular, that MSVC link is 251 # found and not cygwin link (we want to do code linking, not file 252 # linking). 253 # It's the responsibility of individual PROG_compiler macros to ensure that 254 # they correctly set the compiler search list and preprocess, compile, and 255 # link flags. This is tied to compiler setup because in practice invocations 256 # of the preprocessor and linker are made through the compiler. 257 258 AC_DEFUN([AC_COIN_ENABLE_DOSCOMPILE], 259 [AC_REQUIRE([AC_CANONICAL_BUILD]) 260 AC_ARG_ENABLE([doscompile], 261 [AC_HELP_STRING([--enable-doscompile], 262 [Under Cygwin, compile so that executables run under DOS. 263 Set to mingw to use gcc/g++/ld with -mno-cygwin. 264 Set to msvc to use cl/link (or icl/link). 265 Default when mentioned: mingw. 266 Default when not mentioned: disabled.])], 267 [if test "$enable_doscompile" != no; then 268 case $build in 269 *-cygwin* | *-mingw*) ;; 270 *) AC_MSG_ERROR([--enable-doscompile option makes sense only under Cygwin or MinGW]) ;; 271 esac 272 fi], 273 [enable_doscompile=no]) 274 case "$enable_doscompile" in 275 mingw) 276 case $build in 277 *-mingw*) enable_doscompile=no ;; 278 esac 279 ;; 280 msvc|no) ;; 281 yes) enable_doscompile=mingw ;; 282 *) AC_MSG_ERROR([Invalid value $enable_doscompile for --enable-doscompile. 283 Try configure --help=recursive.]) 284 ;; 285 esac 286 if test "$enable_doscompile" != no ; then 287 AC_MSG_NOTICE([DOS compile style is: $enable_doscompile]) 288 fi 289 ]) 290 291 ########################################################################### 208 292 # COIN_PROG_CXX # 209 293 ########################################################################### 210 294 295 # Find the compile command by running AC_PROG_CXX (with compiler names for 296 # different operating systems) and put it into CXX (unless it was given by the 297 # user). Then find an appropriate value for CXXFLAGS. If either of CXXFLAGS or 298 # PRJCT_CXXFLAGS is defined, that value is used (replace PRJCT with the upper 299 # case name of this project). It is possible to provide additional -D flags 300 # in the variable CXXDEFS, and additional compilation flags with ADD_CXXFLAGS. 301 211 302 AC_DEFUN([AC_COIN_PROG_CXX], 212 [AC_REQUIRE([AC_PROG_CXX]) 213 214 # add automake conditional so we can recognize cl compiler in makefile 303 [AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0 304 AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) 305 AC_LANG_PUSH(C++) 306 307 AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.]) 308 AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options]) 309 AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options]) 310 AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options]) 311 312 coin_has_cxx=yes 313 314 save_cxxflags="$CXXFLAGS" 315 # For *-*-solaris*, promote Studio/Workshop compiler to front of list. 316 case $build in 317 *-cygwin* | *-mingw*) 318 if test "$enable_doscompile" = msvc ; then 319 comps="icl cl" 320 else 321 comps="g++ cl" 322 fi ;; 323 *-*-solaris*) 324 comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; 325 *-darwin*) comps="g++ c++ CC" ;; 326 *-linux-gnu*) 327 comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;; 328 *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;; 329 esac 330 331 # We delete the cached value, since the test might not have been 332 # performed with our choice of compilers earlier 333 $as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; } 334 # AC_MSG_NOTICE([C++ compiler candidates: $comps]) 335 AC_PROG_CXX([$comps]) 336 337 #AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler 338 #thus, we test here whether $CXX is actually working 339 AC_LANG_PUSH(C++) 340 AC_MSG_CHECKING([whether C++ compiler $CXX works]); 341 AC_COMPILE_IFELSE( 342 [AC_LANG_PROGRAM(, [int i=0;])], 343 [AC_MSG_RESULT(yes)], 344 [AC_MSG_RESULT(no) 345 AC_MSG_ERROR(failed to find a C++ compiler or C++ compiler $CXX does not work)] 346 ) 347 AC_LANG_POP(C++) 348 215 349 coin_cxx_is_cl=false 350 # It seems that we need to cleanup something here for the Windows 216 351 case "$CXX" in 217 352 clang* ) ;; 218 353 cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) 354 sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh 355 mv confdefs.hh confdefs.h 219 356 coin_cxx_is_cl=true 220 357 ;; 221 358 esac 359 360 # add automake conditional so we can recognize cl compiler in makefile 222 361 AM_CONDITIONAL(COIN_CXX_IS_CL, [test $coin_cxx_is_cl = true]) 362 363 # Autoconf incorrectly concludes that cl recognises -g. It doesn't. 364 case "$CXX" in 365 clang* ) ;; 366 cl* | */cl* | CL* | */CL* ) 367 if test "$ac_cv_prog_cxx_g" = yes ; then 368 ac_cv_prog_cxx_g=no 369 AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.]) 370 fi ;; 371 esac 372 CXXFLAGS="$save_cxxflags" 373 374 # Check if a project specific CXXFLAGS variable has been set 375 if test x$COIN_PRJCT != x; then 376 eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set} 377 if test x$coin_tmp = xset; then 378 eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS} 379 fi 380 fi 381 382 if test x"$CXXFLAGS" = x; then 383 384 # ToDo decide whether we want -DNDEBUG for optimization 385 coin_add_cxxflags= 386 coin_opt_cxxflags= 387 coin_dbg_cxxflags= 388 coin_warn_cxxflags= 389 390 if test "$GXX" = "yes"; then 391 case "$CXX" in 392 icpc* | */icpc*) 393 ;; 394 *) 395 # ToDo decide about unroll-loops 396 coin_opt_cxxflags="-O3" 397 coin_add_cxxflags="-pipe" 398 coin_dbg_cxxflags="-g -O0" 399 coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long" 400 case $build in 401 *-darwin*) 402 ;; 403 *) 404 coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags" 405 ;; 406 esac 407 408 case $enable_doscompile in 409 mingw) 410 CXXFLAGS="-mno-cygwin" 411 AC_TRY_LINK(,[int i=0; i++;],[coin_add_cxxflags="-mno-cygwin $coin_add_cxxflags"]) 412 CXXFLAGS= 413 ;; 414 esac 415 esac 416 fi 417 418 # Note that we do not need to cover GCC in the following tests. 419 420 if test -z "$coin_opt_cxxflags"; then 421 case $build in 422 *-cygwin* | *-mingw*) 423 case "$CXX" in 424 clang* ) ;; 425 cl* | */cl* | CL* | */CL*) 426 # The MT and MTd options are mutually exclusive 427 coin_opt_cxxflags='-MT -O2' 428 coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE' 429 coin_dbg_cxxflags='-MTd' 430 ;; 431 icl* | */icl* | ICL* | */ICL*) 432 # The MT and MTd options are mutually exclusive 433 coin_opt_cxxflags='-MT -Ox' 434 coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE' 435 coin_dbg_cxxflags='-MTd -debug' 436 ;; 437 esac 438 ;; 439 *-linux-*) 440 case "$CXX" in 441 icpc* | */icpc*) 442 coin_opt_cxxflags="-O3 -ip -mp1" 443 coin_add_cxxflags="" 444 coin_dbg_cxxflags="-g" 445 # Check if -i_dynamic is necessary (for new glibc library) 446 CXXFLAGS= 447 AC_TRY_LINK(,[int i=0; i++;],[], 448 [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"]) 449 ;; 450 pgCC* | */pgCC*) 451 coin_opt_cxxflags="-fast" 452 coin_add_cxxflags="-Kieee -pc 64" 453 coin_dbg_cxxflags="-g" 454 ;; 455 esac 456 ;; 457 *-ibm-*) 458 case "$CXX" in 459 xlC* | */xlC* | mpxlC* | */mpxlC*) 460 coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" 461 coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++" 462 coin_dbg_cxxflags="-g" 463 ;; 464 esac 465 ;; 466 *-hp-*) 467 case "$CXX" in 468 aCC* | */aCC* ) 469 coin_opt_cxxflags="-O" 470 coin_add_cxxflags="-AA" 471 coin_dbg_cxxflags="-g" 472 ;; 473 esac 474 ;; 475 *-*-solaris*) 476 coin_opt_cxxflags="-O4" 477 coin_dbg_cxxflags="-g" 478 ;; 479 esac 480 fi 481 482 # Generic flag settings. If these don't work, add a case above. 483 484 if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then 485 coin_dbg_cxxflags="-g" 486 fi 487 488 if test -z "$coin_opt_cxxflags"; then 489 # Try if -O option works if nothing else is set 490 CXXFLAGS=-O 491 AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"]) 492 fi 493 494 # if PM doesn't want the warning messages, take them out 495 if test x"$coin_skip_warn_cxxflags" = xyes; then 496 coin_warn_cxxflags= 497 fi 498 499 # Do final setup of flags based on values determined above. 500 501 if test x${DBG_CXXFLAGS+set} != xset; then 502 DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags" 503 fi 504 if test x${OPT_CXXFLAGS+set} != xset; then 505 OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags" 506 fi 507 508 DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" 509 OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" 510 511 if test "$coin_debug_compile" = "true"; then 512 CXXFLAGS="$DBG_CXXFLAGS" 513 else 514 CXXFLAGS="$OPT_CXXFLAGS" 515 fi 516 517 # Handle the case where CXXFLAGS was set externally. 518 else 519 CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS" 520 if test x${DBG_CXXFLAGS+set} != xset; then 521 DBG_CXXFLAGS="$CXXFLAGS" 522 fi 523 if test x${OPT_CXXFLAGS+set} != xset; then 524 OPT_CXXFLAGS="$CXXFLAGS" 525 fi 526 fi 527 528 # If CXXFLAGS contains -mno-cygwin, CPPFLAGS must also have it. 529 530 case "$CXXFLAGS" in 531 *-mno-cygwin*) 532 if test x${CPPFLAGS+set} != xset ; then 533 CPPFLAGS="-mno-cygwin" 534 else 535 case "$CPPFLAGS" in 536 *-mno-cygwin*) 537 ;; 538 *) 539 CPPFLAGS="$CPPFLAGS -mno-cygwin" 540 ;; 541 esac 542 fi ;; 543 esac 223 544 224 545 # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include … … 227 548 fi 228 549 550 # Try if CXXFLAGS works 551 save_CXXFLAGS="$CXXFLAGS" 552 AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) 553 if test -z "$CXXFLAGS"; then 554 AC_MSG_WARN([The flags CXXFLAGS="$save_CXXFLAGS" do not work. I will now just try '-O', but you might want to set CXXFLAGS manually.]) 555 CXXFLAGS='-O' 556 AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=]) 557 if test -z "$CXXFLAGS"; then 558 AC_MSG_WARN([This value for CXXFLAGS does not work. I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.]) 559 fi 560 fi 561 229 562 AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS]) 230 563 564 AC_ARG_VAR(MPICXX,[C++ MPI Compiler]) 565 if test x"$MPICXX" = x; then :; else 566 AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX]) 567 CXX="$MPICXX" 568 fi 569 570 # correct the LD variable in a mingw build with MS or intel compiler 571 case "$CXX" in 572 clang* ) ;; 573 cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) 574 AC_COIN_MINGW_LD_FIX 575 ;; 576 esac 577 578 AC_LANG_POP(C++) 231 579 ]) # AC_COIN_PROG_CXX 232 580 233 581 234 582 ########################################################################### 583 # COIN_CXXLIBS # 584 ########################################################################### 585 586 # Determine the C++ runtime libraries required for linking a C++ library 587 # with a Fortran or C compiler. The result is available in CXXLIBS. 588 589 AC_DEFUN([AC_COIN_CXXLIBS], 590 [AC_REQUIRE([AC_PROG_CXX])dnl 591 AC_LANG_PUSH(C++) 592 AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler]) 593 if test -z "$CXXLIBS"; then 594 if test "$GXX" = "yes"; then 595 case "$CXX" in 596 icpc* | */icpc*) 597 CXXLIBS="-lstdc++" 598 ;; 599 *) 600 CXXLIBS="-lstdc++ -lm" # -lgcc" 601 ;; 602 esac 603 else 604 case $build in 605 *-mingw32 | *-cygwin* ) 606 case "$CXX" in 607 clang* ) ;; 608 cl* | */cl* | CL* | */CL*) 609 CXXLIBS=nothing;; 610 esac;; 611 *-linux-*) 612 case "$CXX" in 613 icpc* | */icpc*) 614 CXXLIBS="-lstdc++" 615 ;; 616 pgCC* | */pgCC*) 617 CXXLIBS="-lstd -lC -lc" 618 ;; 619 esac;; 620 *-ibm-*) 621 CXXLIBS="-lC -lc" 622 ;; 623 *-hp-*) 624 CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc" 625 ;; 626 *-*-solaris*) 627 CXXLIBS="-lCstd -lCrun" 628 esac 629 fi 630 fi 631 if test -z "$CXXLIBS"; then 632 AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C).]) 633 else 634 AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".]) 635 fi 636 if test x"$CXXLIBS" = xnothing; then 637 CXXLIBS= 638 fi 639 AC_LANG_POP(C++) 640 ]) # AC_COIN_CXXLIBS 641 642 ########################################################################### 235 643 # COIN_CHECK_HEADER # 236 644 ########################################################################### 237 645 238 AC_DEFUN([AC_COIN_CHECK_HEADER],[AC_CHECK_HEADERS([$1],[$2],[$3],[$4])]) 239 240 ########################################################################### 241 # COIN_CHECK_CXX_CHEADER # 242 ########################################################################### 243 244 # This macro checks for C header files that are used from C++. For a given 646 # This macro checks for a header file, but it does so without the 647 # standard header. This avoids warning messages like: 648 # 649 # configure: WARNING: dlfcn.h: present but cannot be compiled 650 # configure: WARNING: dlfcn.h: check for missing prerequisite headers? 651 # configure: WARNING: dlfcn.h: see the Autoconf documentation 652 # configure: WARNING: dlfcn.h: section "Present But Cannot Be Compiled" 653 # configure: WARNING: dlfcn.h: proceeding with the preprocessor's result 654 # configure: WARNING: dlfcn.h: in the future, the compiler will take precedence 655 656 # My guess that the problem lay with CPPFLAGS seems to be correct. With this 657 # macro reduced to a direct call to AC_CHECK_HEADERS, there are no warnings 658 # now that CPPFLAGS contains -mno-cygwin when it needs it. -- lh, 061214 -- 659 660 # AW 070609: I restored the previous version, since otherwise the warnings 661 # still pop up for the cl compiler 662 663 AC_DEFUN([AC_COIN_CHECK_HEADER], 664 [#if test x"$4" = x; then 665 # hdr="#include <$1>" 666 #else 667 # hdr="$4" 668 #fi 669 #AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr]) 670 AC_CHECK_HEADERS([$1],[$2],[$3],[$4]) 671 ]) # AC_COIN_CHECK_HEADER 672 673 ########################################################################### 674 # COIN_CHECK_CXX_CHEADER # 675 ########################################################################### 676 677 # This macro checks for C header files that are used from C++. For a give 245 678 # stub (e.g., math), it first checks if the C++ library (cmath) is available. 246 679 # If it is, it defines HAVE_CMATH (or whatever the stub is). If it is not … … 261 694 ########################################################################### 262 695 696 # Find the compile command by running AC_PROG_CC (with compiler names 697 # for different operating systems) and put it into CC (unless it was 698 # given my the user), and find an appropriate value for CFLAGS. It is 699 # possible to provide additional -D flags in the variable CDEFS. 700 263 701 AC_DEFUN([AC_COIN_PROG_CC], 264 [AC_REQUIRE([AC_PROG_CC]) 702 [AC_REQUIRE([AC_COIN_MINGW_LD_FIX]) 703 AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) 704 AC_LANG_PUSH(C) 705 706 # For consistency, we set the C compiler to the same value of the C++ 707 # compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl) 708 if test x"$CXX" != x; then 709 case "$CXX" in 710 clang* ) ;; 711 cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) 712 if test x"$CC" = x; then 713 CC="$CXX" 714 AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX]) 715 fi 716 ;; 717 esac 718 fi 719 720 AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.]) 721 AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options]) 722 AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options]) 723 AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options]) 724 725 coin_has_cc=yes 726 727 save_cflags="$CFLAGS" 728 729 # For *-*-solaris*, promote Studio/Workshop cc compiler to front of list. 730 # Depending on the user's PATH, when Studio/Workshop cc is not present we may 731 # find /usr/ucb/cc, which is almost certainly not a good choice for the C 732 # compiler. In this case, put cc after gcc. 733 734 case $build in 735 *-cygwin* | *-mingw*) 736 if test "$enable_doscompile" = msvc ; then 737 comps="icl cl" 738 else 739 comps="gcc cl" 740 fi ;; 741 *-*-solaris*) 742 AC_CHECK_PROG(sol_cc_compiler,cc,cc,[],[],/usr/ucb/cc) 743 if test "$sol_cc_compiler" = "cc" ; then 744 comps="cc xlc gcc pgcc icc" 745 else 746 comps="xlc gcc pgcc icc cc" 747 fi 748 ;; 749 *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;; 750 *-linux-*) comps="xlc gcc cc pgcc icc" ;; 751 *) comps="xlc_r xlc cc gcc pgcc icc" ;; 752 esac 753 754 # We delete the cached value, since the test might not have been 755 # performed with our choice of compilers earlier 756 $as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; } 757 # AC_MSG_NOTICE([C compiler candidates: $comps]) 758 AC_PROG_CC([$comps]) 759 if test -z "$CC" ; then 760 AC_MSG_ERROR([Failed to find a C compiler!]) 761 fi 762 # Autoconf incorrectly concludes that cl recognises -g. It doesn't. 763 case "$CC" in 764 clang* ) ;; 765 cl* | */cl* | CL* | */CL* ) 766 if test "$ac_cv_prog_cc_g" = yes ; then 767 ac_cv_prog_cc_g=no 768 AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.]) 769 fi ;; 770 esac 771 CFLAGS="$save_cflags" 265 772 266 773 # add automake conditional so we can recognize cl compiler in makefile … … 274 781 AM_CONDITIONAL(COIN_CC_IS_CL, [test $coin_cc_is_cl = true]) 275 782 783 # Check if a project specific CFLAGS variable has been set 784 if test x$COIN_PRJCT != x; then 785 eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set} 786 if test x$coin_tmp = xset; then 787 eval CFLAGS=\${${COIN_PRJCT}_CFLAGS} 788 fi 789 fi 790 791 if test x"$CFLAGS" = x; then 792 793 coin_add_cflags= 794 coin_opt_cflags= 795 coin_dbg_cflags= 796 coin_warn_cflags= 797 798 if test "$GCC" = "yes"; then 799 case "$CC" in 800 icc* | */icc*) 801 ;; 802 *) 803 coin_opt_cflags="-O3" 804 coin_add_cflags="-pipe" 805 coin_dbg_cflags="-g -O0" 806 coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long" 807 case $build in 808 *-darwin*) 809 ;; 810 *) 811 coin_warn_cflags="-pedantic-errors $coin_warn_cflags" 812 ;; 813 esac 814 case $enable_doscompile in 815 mingw) 816 CFLAGS="-mno-cygwin" 817 AC_TRY_LINK([],[int i=0; i++;], 818 [coin_add_cflags="-mno-cygwin $coin_add_cflags"]) 819 CFLAGS= 820 ;; 821 esac 822 esac 823 fi 824 if test -z "$coin_opt_cflags"; then 825 case $build in 826 *-cygwin* | *-mingw*) 827 case "$CC" in 828 clang* ) ;; 829 cl* | */cl* | CL* | */CL*) 830 coin_opt_cflags='-MT -O2' 831 coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE' 832 coin_dbg_cflags='-MTd' 833 ;; 834 icl* | */icl* | ICL* | */ICL*) 835 coin_opt_cflags='-MT -Ox' 836 coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE' 837 coin_dbg_cflags='-MTd -debug' 838 ;; 839 esac 840 ;; 841 *-linux-*) 842 case "$CC" in 843 icc* | */icc*) 844 coin_opt_cflags="-O3 -ip -mp1" 845 coin_add_cflags="" 846 coin_dbg_cflags="-g" 847 # Check if -i_dynamic is necessary (for new glibc library) 848 CFLAGS= 849 AC_TRY_LINK([],[int i=0; i++;],[], 850 [coin_add_cflags="-i_dynamic $coin_add_cflags"]) 851 ;; 852 pgcc* | */pgcc*) 853 coin_opt_cflags="-fast" 854 coin_add_cflags="-Kieee -pc 64" 855 coin_dbg_cflags="-g" 856 ;; 857 esac 858 ;; 859 *-ibm-*) 860 case "$CC" in 861 xlc* | */xlc* | mpxlc* | */mpxlc*) 862 coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" 863 coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" 864 coin_dbg_cflags="-g" 865 ;; 866 esac 867 ;; 868 *-hp-*) 869 coin_opt_cflags="-O" 870 coin_add_cflags="-Ae" 871 coin_dbg_cflags="-g" 872 ;; 873 *-*-solaris*) 874 coin_opt_cflags="-xO4" 875 coin_dbg_cflags="-g" 876 ;; 877 *-sgi-*) 878 coin_opt_cflags="-O -OPT:Olimit=0" 879 coin_dbg_cflags="-g" 880 ;; 881 esac 882 fi 883 884 if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then 885 coin_dbg_cflags="-g" 886 fi 887 888 if test -z "$coin_opt_cflags"; then 889 # Try if -O option works if nothing else is set 890 CFLAGS="-O" 891 AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"]) 892 fi 893 894 # if PM doesn't want the warning messages, take them out 895 if test x"$coin_skip_warn_cflags" = xyes; then 896 coin_warn_cflags= 897 fi 898 899 if test x${DBG_CFLAGS+set} != xset; then 900 DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags" 901 fi 902 if test x${OPT_CFLAGS+set} != xset; then 903 OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags" 904 fi 905 906 DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS" 907 OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS" 908 909 if test "$coin_debug_compile" = "true"; then 910 CFLAGS="$DBG_CFLAGS" 911 else 912 CFLAGS="$OPT_CFLAGS" 913 fi 914 else 915 CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS" 916 if test x${DBG_CFLAGS+set} != xset; then 917 DBG_CFLAGS="$CFLAGS" 918 fi 919 if test x${OPT_CFLAGS+set} != xset; then 920 OPT_CFLAGS="$CFLAGS" 921 fi 922 fi 923 924 # If CFLAGS contains -mno-cygwin, CPPFLAGS must also have it. 925 926 case "$CFLAGS" in 927 *-mno-cygwin*) 928 if test x${CPPFLAGS+set} != xset ; then 929 CPPFLAGS="-mno-cygwin" 930 else 931 case "$CPPFLAGS" in 932 *-mno-cygwin*) 933 ;; 934 *) 935 CPPFLAGS="$CPPFLAGS -mno-cygwin" 936 ;; 937 esac 938 fi ;; 939 esac 940 276 941 # add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include 277 942 if test x$COIN_PRJCT != x; then … … 279 944 fi 280 945 946 # Try if CFLAGS works 947 save_CFLAGS="$CFLAGS" 948 AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) 949 if test -z "$CFLAGS"; then 950 AC_MSG_WARN([The value CFLAGS="$save_CFLAGS" do not work. I will now just try '-O', but you might want to set CFLAGS manually.]) 951 CFLAGS='-O' 952 AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=]) 953 if test -z "$CFLAGS"; then 954 AC_MSG_WARN([This value for CFLAGS does not work. I will continue with empty CFLAGS, but you might want to set CFLAGS manually.]) 955 fi 956 fi 957 281 958 AC_MSG_NOTICE([C compiler options are: $CFLAGS]) 282 959 960 AC_ARG_VAR(MPICC,[C MPI Compiler]) 961 if test x"$MPICC" = x; then :; else 962 AC_MSG_NOTICE([Will use MPI C compiler $MPICC]) 963 CC="$MPICC" 964 fi 965 966 # Correct the LD variable if we are using the MS or Intel-windows compiler 967 case "$CC" in 968 clang* ) ;; 969 cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) 970 AC_COIN_MINGW_LD_FIX 971 ;; 972 esac 973 974 AC_LANG_POP(C) 283 975 ]) # AC_COIN_PROG_CC 284 976 … … 287 979 ########################################################################### 288 980 981 # Find the compile command by running AC_PROG_F77 (with compiler names 982 # for different operating systems) and put it into F77 (unless it was 983 # given by the user), and find an appropriate value for FFLAGS 289 984 290 985 AC_DEFUN([AC_COIN_PROG_F77], 291 [AC_REQUIRE([AC_PROG_F77]) 986 [AC_REQUIRE([AC_COIN_MINGW_LD_FIX]) 987 AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) 988 AC_REQUIRE([AC_COIN_PROG_CC]) 989 AC_REQUIRE([AC_COIN_F77_COMPS]) 990 AC_LANG_PUSH([Fortran 77]) 991 992 AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options]) 993 AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options]) 994 AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options]) 995 996 coin_has_f77=yes 997 998 save_fflags="$FFLAGS" 999 1000 # We delete the cached value, since the test might not have been 1001 # performed with our choice of compilers earlier 1002 $as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; } 1003 1004 # This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use 1005 # coin_f77_comps to see if there's a program that matches one of the names. 1006 # If there's no such program, F77 = unavailable. If we match the name, 1007 # feed AC_PROG_F77 the same search list, just to be sure it's a functioning 1008 # compiler. 1009 # AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps]) 1010 AC_COIN_FIND_F77 1011 if test "$F77" != "unavailable" ; then 1012 AC_PROG_F77($coin_f77_comps) 1013 else 1014 AC_MSG_WARN([Failed to find a Fortran compiler!]) 1015 fi 1016 1017 FFLAGS="$save_fflags" 1018 1019 # Check if a project specific FFLAGS variable has been set 1020 if test x$COIN_PRJCT != x; then 1021 eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set} 1022 if test x$coin_tmp = xset; then 1023 eval FFLAGS=\${${COIN_PRJCT}_FFLAGS} 1024 fi 1025 fi 1026 1027 if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then 1028 1029 coin_add_fflags= 1030 coin_opt_fflags= 1031 coin_dbg_fflags= 1032 coin_warn_fflags= 1033 1034 if test "$G77" = "yes"; then 1035 coin_opt_fflags="-O3" 1036 coin_add_fflags="-pipe" 1037 coin_dbg_fflags="-g -O0" 1038 case $enable_doscompile in 1039 mingw) 1040 FFLAGS="-mno-cygwin" 1041 AC_TRY_LINK(,[ write(*,*) 'Hello world'], 1042 [coin_add_fflags="-mno-cygwin $coin_add_fflags"]) 1043 FFLAGS= 1044 ;; 1045 esac 1046 else 1047 case $build in 1048 *-cygwin* | *-mingw*) 1049 case $F77 in 1050 ifort* | */ifort* | IFORT* | */IFORT* ) 1051 coin_opt_fflags='-MT -O3' 1052 coin_add_fflags='-fpp -nologo' 1053 coin_dbg_fflags='-MTd -debug' 1054 ;; 1055 compile_f2c*) 1056 coin_opt_fflags='-MT -O2' 1057 coin_add_fflags='-nologo -wd4996' 1058 coin_dbg_fflags='-MTd' 1059 ;; 1060 esac 1061 ;; 1062 *-linux-*) 1063 case $F77 in 1064 ifc* | */ifc* | ifort* | */ifort*) 1065 coin_opt_fflags="-O3 -ip" 1066 coin_add_fflags="-cm -w90 -w95" 1067 coin_dbg_fflags="-g -CA -CB -CS" 1068 # Check if -i_dynamic is necessary (for new glibc library) 1069 FFLAGS= 1070 AC_TRY_LINK(,[ write(*,*) 'Hello world'],[], 1071 [coin_add_fflags="-i_dynamic $coin_add_fflags"]) 1072 ;; 1073 pgf77* | */pgf77* | pgf90* | */pgf90*) 1074 coin_opt_fflags="-fast" 1075 coin_add_fflags="-Kieee -pc 64" 1076 coin_dbg_fflags="-g" 1077 ;; 1078 esac 1079 ;; 1080 *-ibm-*) 1081 case "$F77" in 1082 xlf* | */xlf* | mpxlf* | */mpxlf* ) 1083 coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1" 1084 coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029" 1085 coin_dbg_fflags="-g -C" 1086 ;; 1087 esac 1088 ;; 1089 *-hp-*) 1090 coin_opt_fflags="+O3" 1091 coin_add_fflags="+U77" 1092 coin_dbg_fflags="-C -g" 1093 ;; 1094 *-*-solaris*) 1095 coin_opt_fflags="-O4" 1096 coin_dbg_fflags="-g" 1097 ;; 1098 *-sgi-*) 1099 coin_opt_fflags="-O5 -OPT:Olimit=0" 1100 coin_dbg_fflags="-g" 1101 ;; 1102 esac 1103 fi 1104 1105 if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then 1106 coin_dbg_fflags="-g" 1107 fi 1108 1109 if test -z "$coin_opt_fflags"; then 1110 # Try if -O option works if nothing else is set 1111 FFLAGS=-O 1112 AC_TRY_LINK(,[ integer i], [coin_opt_fflags="-O"]) 1113 fi 1114 1115 # if PM doesn't want the warning messages, take them out 1116 if test x"$coin_skip_warn_fflags" = xyes; then 1117 coin_warn_fflags= 1118 fi 1119 1120 if test x${DBG_FFLAGS+set} != xset; then 1121 DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags" 1122 fi 1123 if test x${OPT_FFLAGS+set} != xset; then 1124 OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags" 1125 fi 1126 1127 DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS" 1128 OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS" 1129 1130 if test "$coin_debug_compile" = "true"; then 1131 FFLAGS="$DBG_FFLAGS" 1132 else 1133 FFLAGS="$OPT_FFLAGS" 1134 fi 1135 else 1136 FFLAGS="$FFLAGS $ADD_FFLAGS" 1137 if test x${DBG_FFLAGS+set} != xset; then 1138 DBG_FFLAGS="$FFLAGS" 1139 fi 1140 if test x${OPT_FFLAGS+set} != xset; then 1141 OPT_FFLAGS="$FFLAGS" 1142 fi 1143 fi 1144 1145 # If FFLAGS contains -mno-cygwin, CPPFLAGS must have it. 1146 case "$FFLAGS" in 1147 *-mno-cygwin*) 1148 if test x${CPPFLAGS+set} != xset ; then 1149 CPPFLAGS="-mno-cygwin" 1150 else 1151 case "$CPPFLAGS" in 1152 *-mno-cygwin*) 1153 ;; 1154 *) 1155 CPPFLAGS="$CPPFLAGS -mno-cygwin" 1156 ;; 1157 esac 1158 fi ;; 1159 esac 1160 1161 # Try if FFLAGS works 1162 if test "$F77" != "unavailable" ; then 1163 AC_TRY_LINK(,[ integer i],[],[FFLAGS=]) 1164 if test -z "$FFLAGS"; then 1165 AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work. I will now just try '-O', but you might want to set FFLAGS manually.]) 1166 FFLAGS='-O' 1167 AC_TRY_LINK(,[ integer i],[],[FFLAGS=]) 1168 if test -z "$FFLAGS"; then 1169 AC_MSG_WARN([This value for FFLAGS does not work. I will continue with empty FFLAGS, but you might want to set FFLAGS manually.]) 1170 fi 1171 fi 1172 fi 292 1173 293 1174 AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS]) 294 1175 1176 AC_ARG_VAR(MPIF77,[Fortran MPI Compiler]) 1177 if test x"$MPIF77" = x; then :; else 1178 AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77]) 1179 F77="$MPIF77" 1180 fi 1181 1182 # correct the LD variable if we use the intel fortran compiler in windows 1183 case "$F77" in 1184 ifort* | */ifort* | IFORT* | */IFORT*) 1185 AC_COIN_MINGW_LD_FIX 1186 ;; 1187 esac 1188 1189 AC_LANG_POP([Fortran 77]) 295 1190 ]) # AC_COIN_PROG_F77 296 1191 … … 299 1194 ########################################################################### 300 1195 301 AC_DEFUN([AC_COIN_F77_WRAPPERS],[AC_REQUIRE([AC_F77_WRAPPERS])]) 1196 # Calls autoconfs AC_F77_LIBRARY_LDFLAGS and does additional corrections to FLIBS. 1197 # Then calls AC_F77_WRAPPERS to get Fortran namemangling scheme. 1198 # 1199 # To ensure that the FLIBS are determined and corrected before linking against 1200 # Fortran compilers is attempted by other macros, we put it into an extra macro 1201 # and call it via AC_REQUIRE. This way it seems to be called before the macros 1202 # required by AC_F77_WRAPPERS. 1203 1204 AC_DEFUN([_AC_COIN_F77_LIBRARY_LDFLAGS], 1205 [AC_BEFORE([AC_PROG_F77],[$0])dnl 1206 1207 # get FLIBS 1208 AC_F77_LIBRARY_LDFLAGS 1209 orig_FLIBS="$FLIBS" 1210 1211 # If FLIBS has been set by the user, we just restore its value here 1212 if test x"$save_FLIBS" != x; then 1213 FLIBS="$save_FLIBS" 1214 else 1215 # This is to correct a missing exclusion in autoconf 2.59 1216 if test x"$FLIBS" != x; then 1217 my_flibs= 1218 for flag in $FLIBS; do 1219 case $flag in 1220 -lcrt*.o) ;; 1221 -lcygwin) ;; 1222 *) my_flibs="$my_flibs $flag" ;; 1223 esac 1224 done 1225 FLIBS="$my_flibs" 1226 fi 1227 1228 case $build in 1229 # The following is a fix to define FLIBS for ifort on Windows 1230 # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly. 1231 # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables. 1232 # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line. 1233 # Further, excluding libc.lib from the default libs seemed to be necessary only for VS < 8. 1234 # Since the corresponding flag seems to make more trouble than it avoids, it has been removed now. 1235 *-cygwin* | *-mingw*) 1236 case "$F77" in 1237 # ifort* | */ifort* | IFORT* | */IFORT*) 1238 # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib" 1239 # if "$coin_debug_compile" = true ; then 1240 # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib" 1241 # else 1242 # FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib" 1243 # fi 1244 # ;; 1245 compile_f2c*) 1246 FLIBS=`$F77 -FLIBS` ;; 1247 esac;; 1248 *-hp-*) 1249 FLIBS="$FLIBS -lm";; 1250 *-ibm-*) 1251 FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;; 1252 *-linux-*) 1253 case "$F77" in 1254 pgf77* | */pgf77* | pgf90* | */pgf90*) 1255 # ask linker to go through the archives multiple times 1256 # (the Fortran compiler seems to do that automatically...) 1257 FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;; 1258 esac 1259 esac 1260 ac_cv_f77_libs="$FLIBS" 1261 fi 1262 1263 if test "x$orig_FLIBS" != "x$FLIBS" ; then 1264 AC_MSG_NOTICE([Corrected Fortran libraries: $FLIBS]) 1265 fi 1266 ]) # _AC_COIN_F77_LIBRARY_LDFLAGS 1267 1268 AC_DEFUN([AC_COIN_F77_WRAPPERS], 1269 [AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl 1270 AC_REQUIRE([_AC_COIN_F77_LIBRARY_LDFLAGS])dnl 1271 1272 AC_LANG_PUSH([Fortran 77]) 1273 AC_F77_WRAPPERS 1274 AC_LANG_POP([Fortran 77]) 1275 1276 ]) # AC_COIN_F77_WRAPPERS 1277 1278 ########################################################################### 1279 # COIN_FIND_F77 # 1280 ########################################################################### 1281 1282 # Attempt to preempt autoconf by locating an appropriate F77 program. This 1283 # macro will not trigger a fatal error if a suitable compiler cannot be 1284 # found. It should be called before COIN_PROG_F77 or COIN_TRY_FLINK. 1285 1286 AC_DEFUN([AC_COIN_FIND_F77], 1287 [AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE]) 1288 AC_REQUIRE([AC_COIN_F77_COMPS]) 1289 AC_MSG_NOTICE([Trying to determine Fortran compiler name]) 1290 AC_CHECK_TOOLS([F77],[$coin_f77_comps],[unavailable]) 1291 ]) 1292 1293 # Auxilliary macro to make sure both COIN_PROG_F77 and COIN_FIND_F77 use 1294 # the same search lists for compiler names. 1295 # For *-*-solaris*, promote Studio/Workshop compilers to front of list. 1296 AC_DEFUN([AC_COIN_F77_COMPS], 1297 [case $build in 1298 *-cygwin* | *-mingw*) 1299 if test "$enable_doscompile" = msvc ; then 1300 coin_f77_comps="ifort fl32 compile_f2c" 1301 else 1302 coin_f77_comps="gfortran ifort g95 g77 fl32 compile_f2c" 1303 fi ;; 1304 *-*-solaris*) 1305 coin_f77_comps="f95 f90 g95 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;; 1306 *-linux-gnu*) 1307 coin_f77_comps="gfortran ifort g95 fort77 f77 g77 pgf90 pgf77 ifc frt af77 xlf_r" ;; 1308 *) coin_f77_comps="xlf_r fort77 gfortran ifort g95 f77 g77 pgf90 pgf77 ifc frt af77" ;; 1309 esac 1310 ]) 302 1311 303 1312 ########################################################################### … … 353 1362 354 1363 # Check whether autoconf is the correct version 355 correct_version='2. 69'1364 correct_version='2.59' 356 1365 grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` 357 1366 AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf]) … … 390 1399 391 1400 # Check whether automake is the correct version 392 correct_version='1. 12'1401 correct_version='1.9.6' 393 1402 grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` 394 1403 AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake]) … … 426 1435 want_dir=$AUTOTOOLS_DIR/share 427 1436 fi 428 correct_version=' 2.4.2'1437 correct_version='1.5.22' 429 1438 grep_version=`echo $correct_version | sed -e 's/\\./\\\\\\./g'` 430 1439 AC_COIN_CHECK_FILE([$want_dir/libtool/ltmain.sh], 431 1440 [have_ltmain=yes], 432 1441 [have_ltmain=no]) 433 1442 AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.]) … … 553 1562 554 1563 # Initialize automake and libtool 1564 # AC_MSG_NOTICE([Calling INIT_AUTO_TOOLS from CREATE_LIBTOOL.]) 555 1565 AC_COIN_INIT_AUTO_TOOLS 1566 # AC_MSG_NOTICE([Finished INIT_AUTO_TOOLS from CREATE_LIBTOOL.]) 556 1567 ]) 557 1568 … … 565 1576 # RPATH_FLAGS link flags for hardcoding path to shared objects 566 1577 1578 # This is a trick to have this code before AC_COIN_PROG_LIBTOOL 1579 AC_DEFUN([AC_COIN_DISABLE_STATIC], 1580 [ 1581 # Test if force_shared has been set 1582 if test "x$1" = xforce_shared; then 1583 if test x$enable_shared = xno; then 1584 AC_MSG_ERROR([Shared libraries are disabled by user, but this is not feasible with the given options]) 1585 fi 1586 enable_shared=yes; 1587 else 1588 # On Cygwin and AIX, building DLLs doesn't work 1589 case $build in 1590 *-cygwin*) 1591 coin_disable_shared=yes 1592 platform=Cygwin 1593 ;; 1594 *-aix*) 1595 coin_disable_shared=yes 1596 platform=AIX 1597 ;; 1598 *-mingw*) 1599 coin_disable_shared=yes 1600 platform="Msys" 1601 # case "$CXX" in 1602 # cl*) 1603 # coin_disable_shared=yes 1604 # platform="Msys with cl" 1605 # ;; 1606 # esac 1607 ;; 1608 esac 1609 fi 1610 if test x"$coin_disable_shared" = xyes; then 1611 if test x"$enable_shared" = xyes; then 1612 AC_MSG_WARN([On $platform, shared objects are not supported. I'm disabling your choice.]) 1613 fi 1614 enable_shared=no 1615 fi 1616 # By default, we only want the shared objects to be compiled 1617 AC_DISABLE_STATIC 1618 ]) 1619 567 1620 m4_define([AC_COIN_INIT_AUTO_TOOLS], 568 1621 [{AC_BEFORE([AC_COIN_PROG_CXX],[$0]) … … 570 1623 AC_BEFORE([AC_COIN_PROG_F77],[$0]) 571 1624 1625 # START 1626 AC_COIN_DISABLE_STATIC([$1]) 1627 572 1628 # Initialize automake 573 1629 AC_COIN_INIT_AUTOMAKE … … 585 1641 fi 586 1642 587 # ToDo for now, do not reuse libtool script because code below may need some updates588 # e.g., getting the SED and ECHO variables589 LIBTOOL=590 591 1643 if test "x$LIBTOOL" = x; then 1644 # AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).]) 592 1645 # Stuff for libtool 593 1646 AC_COIN_PROG_LIBTOOL 1647 # AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.]) 594 1648 # set RPATH_FLAGS to the compiler link flags required to hardcode location 595 1649 # of the shared objects … … 613 1667 s,@ac_c_preproc_warn_flag@* | s,@ac_cxx_preproc_warn_flag@* ) 614 1668 command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'` 1669 # echo "$command" 615 1670 eval "$command" 616 1671 ;; 617 1672 s,@DEFS@* ) 618 1673 command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'` 1674 # echo "$command" 619 1675 eval "$command" 620 1676 ;; … … 623 1679 IFS=$as_save_IFS 624 1680 625 # And some defines (assuming here that the packages base dir doesn't have a config.h file) 1681 # And some defines (assuming here that the packages base dir 1682 # doesn't have a config.h file 626 1683 for word in $defsline; do 1684 # echo word $word 627 1685 case $word in 628 1686 -DHAVE_@<:@A-Z_@:>@*_H=1 | -DSTDC_HEADERS=1 ) 629 1687 i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'` 1688 # echo dd $i 630 1689 echo $i >>confdefs.h 631 1690 ;; … … 633 1692 done 634 1693 fi 1694 1695 # AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.]) 635 1696 636 1697 # ToDo … … 651 1712 AC_SUBST(LT_LDFLAGS) 652 1713 1714 #END 653 1715 }]) 654 1716 655 1717 ########################################################################### 1718 # COIN_PATCH_LIBTOOL_CYGWIN # 1719 ########################################################################### 1720 1721 # Patches to libtool for cygwin. Lots for cl, a few for GCC. 1722 # For cl: 1723 # - cygpath is not correctly quoted in fix_srcfile_path 1724 # - paths generated for .lib files is not run through cygpath -w 1725 1726 1727 AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN], 1728 [ case "$CXX" in 1729 clang* ) 1730 # we assume that libtool patches for CLANG are the same as for GNU compiler - correct??? 1731 AC_MSG_NOTICE(Applying patches to libtool for CLANG compiler) 1732 sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ 1733 -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ 1734 -e 's|libext="lib"|libext="a"|' \ 1735 libtool > conftest.bla 1736 ;; 1737 cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) 1738 AC_MSG_NOTICE(Applying patches to libtool for cl compiler) 1739 sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ 1740 -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ 1741 -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ 1742 -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \ 1743 -e 's%lib /OUT:%lib -OUT:%' \ 1744 -e "s%cygpath -w%$CYGPATH_W%" \ 1745 -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\`lib -nologo -list \\$f_ex_an_ar_oldlib | xargs echo '"$mydos2unix"'\\`; echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$f_ex_an_ar_oldlib; done%' \ 1746 -e 's/$AR t/lib -nologo -list/' \ 1747 -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \ 1748 -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \ 1749 -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \ 1750 libtool > conftest.bla 1751 ;; 1752 *) 1753 AC_MSG_NOTICE(Applying patches to libtool for GNU compiler) 1754 sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \ 1755 -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \ 1756 -e 's|libext="lib"|libext="a"|' \ 1757 libtool > conftest.bla 1758 ;; 1759 esac 1760 mv conftest.bla libtool 1761 chmod 755 libtool 1762 ]) # COIN_PATCH_LIBTOOL_CYGWIN 1763 1764 ########################################################################### 1765 # COIN_PATCH_LIBTOOL_SOLARIS # 1766 ########################################################################### 1767 # If we want to do a 64-bit build with GCC on Solaris, the system search 1768 # libraries need to point to 64-bit subdirectories. If they do not already do 1769 # that, fix them. This patch is evolving, as are GCC compilers. GCC 4.2.1 1770 # reports the correct search list, given the correct call. GCC 4.1.1 does not. 1771 # `Correct call' means -m64 is specified. `Correct search list' seems to amount 1772 # to prepending the list of 64-bit subdirectories to the 32-bit directories. 1773 # Both SPARC and x86 have this issue, but a different hardware id string is 1774 # required depending on the underlying CPU. The macro executes isainfo to get 1775 # the string. This will fail, of course, if we're cross-compiling. The 1776 # alternative is to fail on a regular basis each time a new CPU identifier is 1777 # needed. This macro will also fail if the search list reported with 1778 # -print-search-dirs differs between the C, C++, and Fortran compilers; each 1779 # have their own setting in libtool. If GCC reports the correct search list 1780 # given the -m64 flag, the best solution is to define CC='gcc -m64', and 1781 # similarly for CXX, F77, so that libtool will make the correct call. 1782 ########################################################################### 1783 AC_DEFUN([AC_COIN_PATCH_LIBTOOL_SOLARIS], 1784 [ if test "$GCC" = yes && \ 1785 (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then 1786 hdwisa=`isainfo | sed -e 's/\(@<:@^ @:>@*\) .*$/\1/'` 1787 if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then 1788 AC_MSG_NOTICE([Applying patches to libtool for 64-bit GCC compilation]) 1789 fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'` 1790 fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'` 1791 if `echo "$fixlibtmp" | $EGREP -v $hdwisa >/dev/null 2>&1` ; then 1792 # AC_MSG_NOTICE(Compensating for broken gcc) 1793 for lib in $fixlibtmp ; do 1794 if test -d "${lib}${hdwisa}" ; then 1795 syslibpath64="$syslibpath64 ${lib}${hdwisa}/" 1796 fi 1797 done 1798 syslibpath64="${syslibpath64} ${fixlibtmp}" 1799 else 1800 syslibpath64="$fixlibtmp" 1801 fi 1802 sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla 1803 mv conftest.bla libtool 1804 chmod 755 libtool 1805 fi 1806 # AC_MSG_NOTICE(Result is ) 1807 # $EGREP 'sys_lib_search_path_spec=' libtool 1808 fi ]) # COIN_PATCH_LIBTOOL_SOLARIS 1809 1810 ########################################################################### 656 1811 # COIN_PROG_LIBTOOL # 657 1812 ########################################################################### 658 1813 659 1814 # Setup the libtool stuff together with any modifications to make it 660 # work on additional platforms. 661 # If libtool exists in the directory higher up, we use that one 662 # instead of creating a new one. 1815 # work on additional platforms 663 1816 664 1817 AC_DEFUN([AC_COIN_PROG_LIBTOOL], 665 [ 1818 [# No longer needed now that CPPFLAGS is correctly set -- lh, 061214 -- 1819 # AC_REQUIRE([AC_COIN_DLFCN_H]) 1820 1821 # NEW: If libtool exists in the directory higher up, we use that one 1822 # instead of creating a new one 1823 666 1824 # It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED 667 1825 # out in front of this macro body. You'll notice that LIBTOOL is already … … 687 1845 esac 688 1846 1847 case $build in 1848 # Here we need to check if -m32 is specified. If so, we need to correct 1849 # sys_lib_search_path_spec 1850 *x86_64-*) 1851 if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then 1852 AC_MSG_NOTICE(Applying patches to libtool for 32bit compilation) 1853 sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla 1854 mv conftest.bla libtool 1855 chmod 755 libtool 1856 fi 1857 ;; 1858 1859 *-solaris*) 1860 AC_COIN_PATCH_LIBTOOL_SOLARIS 1861 ;; 1862 # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro. 1863 *-cygwin* | *-mingw*) 1864 AC_COIN_PATCH_LIBTOOL_CYGWIN 1865 ;; 1866 *-darwin*) 1867 AC_MSG_NOTICE(Applying patches to libtool for Darwin) 1868 sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \ 1869 -e 's/ -dynamiclib / -dynamiclib -single_module /g' \ 1870 libtool > conftest.bla 1871 1872 mv conftest.bla libtool 1873 chmod 755 libtool 1874 ;; 1875 esac 689 1876 # This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of 690 1877 # the macro. -- lh, 061214 -- 691 1878 # fi 692 1879 693 sed -e 's|tool_oldlib|oldlib|' \694 libtool > conftest.bla695 mv conftest.bla libtool696 chmod 755 libtool697 698 1880 # AC_MSG_NOTICE([End libtool initialisation.]) 699 1881 ]) # AC_COIN_PROG_LIBTOOL 1882 1883 # This is a trick to force the check for the dlfcn header to be done before 1884 # the checks for libtool 1885 # No longer needed now that CPPFLAGS is correctly set. -- lh, 061214 -- 1886 # ACDEFUN([AC_COIN_DLFCN_H], 1887 # [AC_LANG_PUSH(C) 1888 # AC_COIN_CHECK_HEADER([dlfcn.h]) 1889 # AC_LANG_POP(C) 1890 # ]) # AC_COIN_DLFCN_H 700 1891 701 1892 ########################################################################### … … 793 1984 if test x$coin_skip_ac_output != xyes; then 794 1985 1986 # library extension 1987 AC_SUBST(LIBEXT) 1988 case "$CC" in 1989 clang* ) 1990 LIBEXT=a ;; 1991 cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*) 1992 LIBEXT=lib ;; 1993 *) LIBEXT=a ;; 1994 esac 1995 795 1996 # Define VPATH_DISTCLEANFILES to be everything that needs to be 796 1997 # cleaned for distclean in a vpath configuration … … 892 2093 [AC_HELP_STRING([--enable-gnu-packages], 893 2094 [compile with GNU packages (disabled by default)])], 894 895 2095 [coin_enable_gnu=$enableval], 2096 [coin_enable_gnu=no]) 896 2097 ]) # AC_COIN_ENABLE_GNU_PACKAGES 897 2098 … … 906 2107 [AC_BEFORE([AC_COIN_PROG_CC],[$0]) 907 2108 908 if test x$coin_cxx_is_cl != xtrue && test x$coin_cc_is_cl != xtrue ; then2109 if test $coin_cc_is_cl != true ; then 909 2110 coin_foreach_w([myvar], [$1], [ 910 2111 m4_toupper(myvar)_LIBS="-lm $m4_toupper(myvar)_LIBS" … … 1315 2516 AC_LANG_POP(C++) 1316 2517 ]) 2518 2519 ########################################################################### 2520 # COIN_DATA_PATH # 2521 ########################################################################### 2522 2523 # This macro defines a preprocessor macro with the absolute path to a 2524 # subdirectory of Data. The argument of this macro is the name of the 2525 # subdirectory (in correct case), and the name of the macro is 2526 # COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of 2527 # the directory. The path ends with a separator ("/" for linux and 2528 # '\\' for Windows). The default value for this path can be 2529 # overwritten with the input variable with the same name 2530 # (COIN_DATA_DIR_PATH). At this point we chech only for the 2531 # $srcdir/../Data subdirectory. 2532 2533 AC_DEFUN([AC_COIN_DATA_PATH], 2534 [AC_MSG_CHECKING([absolute path to data directory $1]) 2535 2536 AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory]) 2537 2538 if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then 2539 m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd` 2540 fi 2541 2542 # Under Cygwin, use Windows path. Add separator 2543 case $build in 2544 *-cygwin*) 2545 m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\ 2546 ;; 2547 *) 2548 m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/" 2549 ;; 2550 esac 2551 2552 if test -r $m4_toupper(COIN_DATA_$1_PATH); then 2553 AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"], 2554 [Define to absolute path for Data subdirectory $1]) 2555 AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH)) 2556 else 2557 AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist) 2558 fi 2559 ]) # AC_COIN_DATA_PATH 1317 2560 1318 2561 ###########################################################################
Note: See TracChangeset
for help on using the changeset viewer.