1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335
|
dnl Copyright (C) 1999-2020 Yves Renard
dnl
dnl This file is a part of GetFEM
dnl
dnl GetFEM is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or
dnl (at your option) any later version along with the GCC Runtime Library
dnl Exception either version 3.1 or (at your option) any later version.
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License and GCC Runtime Library Exception for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
dnl Process this file with autoconf to produce a configure script.
dnl ------------------------------------------------------------------------
dnl initialisation
dnl ------------------------------------------------------------------------
dnl ./configure: sh internal 2K buffer overflow on HP-UX 9.xx
dnl thus, updating cache ./config.cache avoided.
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
AC_INIT([getfem],[5.4.4])
MAJOR_VERSION="5"
MINOR_VERSION="4"
PATCH_VERSION="4"
AC_DEFINE_UNQUOTED(GETFEM_PACKAGE_NAME,"${PACKAGE_NAME}",[GetFEM package name])
AC_DEFINE_UNQUOTED(GETFEM_PACKAGE_STRING,"${PACKAGE_STRING}",[GetFEM package string])
AC_DEFINE_UNQUOTED(GETFEM_PACKAGE_TARNAME,"${PACKAGE_TARNAME}",[GetFEM package tarname])
AC_DEFINE_UNQUOTED(GETFEM_VERSION,"${PACKAGE_VERSION}",[GetFEM version])
AC_DEFINE_UNQUOTED(GMM_VERSION,"${PACKAGE_VERSION}",[GMM version])
AC_CONFIG_SRCDIR([install-sh])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config_autogenerated_not_used.h src/getfem/getfem_arch_config.h src/gmm/gmm_arch_config.h])
AC_PREREQ([2.69])
AC_ARG_PROGRAM
dnl ------------------------------------------------------------------------
dnl init automake
dnl ------------------------------------------------------------------------
dnl AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
AM_INIT_AUTOMAKE([1.11 parallel-tests])
WARNING_MSG=""
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
dnl --------------------------
dnl set the optimization level
dnl --------------------------
AC_ARG_WITH(optimization,
AS_HELP_STRING([--with-optimization=FLAG],[Set the optimization level (-O3 by default)]),
[with_optimization=$withval],
[with_optimization='-O3']
)
dnl ---------------------------PARA LEVEL--------------------------
paralevel=0
AC_ARG_ENABLE(paralevel,
[AS_HELP_STRING([--enable-paralevel[=level]],[enable the parallel version of GetFEM (use MPI and METIS)])],
[ case $enableval in
yes | "") paralevel=2;;
no) ;;
*) paralevel=$enableval ;;
esac
])
if test $paralevel -ge 1; then
AC_DEFINE_UNQUOTED(GETFEM_PARA_LEVEL,$paralevel,[Parallelization level (0|1|2)])
fi;
dnl ---------------------------END OF PARA LEVEL-------------------
dnl -----------------------------------------------
dnl test du c++
dnl -----------------------------------------------
USER_CXXFLAGS="$CXXFLAGS"
USER_CFLAGS="$CFLAGS"
AX_PROG_CXX_MPI( [test $paralevel -ge 1],[usempi=yes],[usempi=no])
AX_PROG_CC_MPI([test "x$usempi" = "xyes"],[usempi=yes],[usempi=no])
AX_PROG_FC_MPI([test "x$usempi" = "xyes"],[usempi=yes],[usempi=no])
if test "x$usempi" = "xyes"; then
AC_DEFINE(GMM_USES_MPI,,[defined if GMM uses MPI])
# mpi_cxx is not present in all mpi installations,
# but when it is present it needs to be linked
AC_CHECK_LIB(mpi_cxx, _init, [LIBS="$LIBS -lmpi_cxx"])
fi
AC_PROG_CXXCPP
CXXFLAGS="${USER_CXXFLAGS}"
CFLAGS="${USER_CFLAGS}"
SUPLDFLAGS=""
AC_FC_LIBRARY_LDFLAGS
AC_LANG([C++])
if test "x$prefix" = "xNONE"; then
GFPREFIX=/usr/local;
else
GFPREFIX="$prefix";
fi;
dnl AC_CXX_FULL_SPECIALIZATION_SYNTAX (c)Luc Maisonobe v 1.1.1.1 (2001/07/26) 0.5.41
dnl with some modification to test partial specialization
AC_CACHE_CHECK(whether the compiler recognizes the partial specialization syntax,
ac_cv_cxx_partial_specialization_syntax,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
template<class T> class A { public : int f () const { return 1; } };
template<class T> class A<T*> { public : int f () const { return 0; } };]], [[
A<float*> a; return a.f();]])],[ac_cv_cxx_partial_specialization_syntax=yes],[ac_cv_cxx_partial_specialization_syntax=no])
AC_LANG_POP([C++])
])
if test "$ac_cv_cxx_partial_specialization_syntax" != yes; then
echo "Your compiler ($CXX) does not support partial template specialization, trash it"
exit 1;
fi
AC_CANONICAL_HOST
echo "you are compiling GetFEM on a $host"
case $CXX in
clang++)
GLANGVER=`$CXX --version | head -n 1 | grep -o -E "[[:digit:]]+.[[:digit:]]+.[[:digit:]]+"`
echo "Using the clang++ compiler $GLANGVER"
AC_CHECK_CXX_FLAG([$with_optimization],CXXFLAGS)
AC_CHECK_CXX_FLAG([-fmessage-length=0],CXXFLAGS)
AC_CHECK_CXX_FLAG([-fvisibility-inlines-hidden],CXXFLAGS)
AC_CHECK_CXX_FLAG([-ftemplate-depth-100],CXXFLAGS)
AC_CHECK_CXX_FLAG([-std=c++14], CXXFLAGS, [AC_MSG_ERROR([Used clang++ version does not support option -std=c++14.])])
AC_CHECK_CXX_FLAG([-fPIC],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wall -W -Wextra],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wshadow],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-unknown-pragmas],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-variadic-macros],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-unused-but-set-variable],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wpointer-arith],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wcast-qual],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wwrite-strings],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wconversion],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wredundant-decls],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-long-long],CXXFLAGS)
AC_CHECK_CXX_FLAG([-rdynamic],SUPLDFLAGS)
CFLAGS="$CFLAGS $with_optimization -fPIC"
;;
*g++* | c++)
GCCVER=`$CXX --version | head -1 | cut -d ' ' -f3`
echo "Using the GNU g++ compiler $GCCVER"
AC_CHECK_CXX_FLAG([$with_optimization],CXXFLAGS)
AC_CHECK_CXX_FLAG([-fmessage-length=0],CXXFLAGS)
AC_CHECK_CXX_FLAG([-fvisibility-inlines-hidden],CXXFLAGS)
AC_CHECK_CXX_FLAG([-ftemplate-depth-100],CXXFLAGS)
AC_CHECK_CXX_FLAG([-std=c++14], CXXFLAGS,[AC_CHECK_CXX_FLAG([-std=c++0x],CXXFLAGS,[AC_MSG_ERROR([Used g++ does not support option -std=c++14. Update g++ to at least release 4.9])] )])
AC_CHECK_CXX_FLAG([-fPIC],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wall -W -Wextra],CXXFLAGS)
dnl AC_CHECK_CXX_FLAG([-pedantic],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wshadow],CXXFLAGS)
dnl AC_CHECK_CXX_FLAG([-Wno-terminate],CXXFLAGS)
dnl AC_CHECK_CXX_FLAG([-Wno-implicit-fallthrough],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-unknown-pragmas],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-variadic-macros],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-unused-but-set-variable],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wpointer-arith],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wcast-qual],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wwrite-strings],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wconversion],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wredundant-decls],CXXFLAGS)
dnl -Wno-long-double fixes a warning on Darwin
dnl AC_CHECK_CXX_FLAG([-Wno-long-double],CXXFLAGS)
AC_CHECK_CXX_FLAG([-Wno-long-long],CXXFLAGS)
dnl -rdynamic used for backtraces
AC_CHECK_CXX_FLAG([-rdynamic],SUPLDFLAGS)
dnl SUPLDFLAGS="-rdynamic" # -rdynamic for backtraces
CFLAGS="$CFLAGS $with_optimization -fPIC"
;;
icc | icpc)
echo "Using INTEL icc"
CXXFLAGS="$CXXFLAGS $with_optimization -Xc -ansi -std=c++14"
dnl CXXFLAGS="$CXXFLAGS $with_optimization -Xc -ansi"
CFLAGS="$CFLAGS $with_optimization -Xc -ansi"
;;
*)
echo "Using a unknown compiler"
CXXFLAGS="$CXXFLAGS $with_optimization -std=c++14"
dnl CXXFLAGS="$CXXFLAGS $with_optimization"
CFLAGS="$CFLAGS $with_optimization"
;;
esac
AC_SUBST(SUPLDFLAGS)
dnl ------------------------------------------------------------------------
dnl init libtools for shared libraries
dnl ------------------------------------------------------------------------
dnl option pic-only is not working: a libtool bug ...
LT_INIT([pic-only disable-shared])
AC_SUBST([LIBTOOL_DEPS])
dnl -----------------------------------------------
dnl MATLAB Interface
dnl -----------------------------------------------
# list of pseudo functions
PSEUDO_FUNCTIONS_LOC=`$srcdir/bin/extract_doc $srcdir/interface/src pseudo_loc`
echo $PSEUDO_FUNCTIONS_LOC
PSEUDO_FUNCTIONS=`$srcdir/bin/extract_doc $srcdir/interface/src pseudo_gen`
MATLAB_OBJ_DIRS=`$srcdir/bin/extract_doc $srcdir/interface/src mobj_dirs`
AC_SUBST(PSEUDO_FUNCTIONS)
AC_SUBST(PSEUDO_FUNCTIONS_LOC)
AC_SUBST(MATLAB_OBJ_DIRS)
AC_ARG_ENABLE(matlab,
[AS_HELP_STRING([--enable-matlab],[turn on/off matlab support])],
[case "${enableval}" in
yes) usematlab=YES ;;
no) usematlab=NO ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-matlab]) ;;
esac],[usematlab=NO])
AC_ARG_WITH(matlab-toolbox-dir,
[AS_HELP_STRING([--with-matlab-toolbox-dir],[directory in which the matlab interface will be installed])],
TOOLBOXDIR="$withval",TOOLBOXDIR="$GFPREFIX/getfem_toolbox")
AC_SUBST(TOOLBOXDIR)
if test "$usematlab" != NO; then
AC_CHECK_PROGS(MEX, mex)
if test x"$MEX" = x""; then
AC_CHECK_PROGS(MEX, mex.bat)
if test x"$MEX" = x""; then
if test x$usematlab = xYES; then
AC_MSG_ERROR([Impossible to build the matlab interface without mex -- specify its full path with the MEX=/path/to/mex option, or use --enable-matlab=no])
exit 1
fi
else
MEX=gnumex;
MATLAB_COM_EXT=".dll";
echo "You are using Matlab on a windows platform (assuming MingW compiler)";
if test -f gnumex.opts; then
echo "sourcing gnumex.opts.."
source gnumex.opts;
echo "MATLAB_ROOT=$MATLAB_ROOT"
echo "Matlab release is : R$MATLAB_RELEASE"
elif test x$usematlab = xYES; then
echo "You need to fill the gnumex.opts file, for example (use MSys-style paths, not DOS-style paths)"
echo '#!/bin/sh'
echo 'MATLAB_ROOT="c:\\MATLAB6p5"'
echo 'MATLAB_RELEASE=13'
echo 'MATLAB_INC_DIR="$MATLAB_ROOT\\extern\\include"'
echo 'MEXOPTS=c:\\gnumex\\mexopts.bat'
echo "when this is done, check that the gnumex script works correctly"
echo " (i.e. gnumex gnumex.opts -v prints the rights options to use the MinGW gcc)"
exit 1
fi
fi
else
dnl thanks to paolo for pointing the 'twin mex' problem
if $(echo "" | $MEX 2>&1 | grep 'This is .*TeX'); then
AC_MSG_ERROR([the mex binary which is in the PATH appears to be part of LaTeX, not matlab !! run ./configure MEX=/path/to/matlab/mex]);
fi;
# MATLAB_ROOT=`$MEX -v 2>&1 | grep "MATLAB " | awk '{print $4}'|sed -e '2,$d'`
MEX_EXE=`which $MEX`
MEX_EXE=`readlink -e $MEX_EXE`
MATLAB_ROOT=`echo $MEX_EXE | sed -e 's/bin.*$//'`
MEXEXT=$MATLAB_ROOT/bin/mexext
Matlab_INC_DIR=$MATLAB_ROOT/extern/include
echo "checking for matlab path... " $MATLAB_ROOT
MATLAB_COM_EXT=.`$MEXEXT`
echo "checking for mex extension... " $MATLAB_COM_EXT
# MATLAB_RELEASE=`grep "MATLAB R" $MATLAB_ROOT/extern/src/mexversion.c | awk '{print $4}' | sed -e 's/R//'`
# MATLAB_RELEASE=`grep "full_ver="$(which $MEX) | sed 's/[[^0-9]]//g'` # double brackets are for escaping reasons.
MATLAB_RELEASE=`matlab -nosplash -nojvm -r "a=version;display(a);exit" | grep "(R2" | sed -n '1p' | sed 's/^.*R//g' | sed 's/).*$//'`
echo "Matlab release is : R$MATLAB_RELEASE"
AC_DEFINE(GMM_MATLAB_INTERFACE,,[Matlab interface will be built])
fi
fi
AM_CONDITIONAL(BUILDMEX, test x$usematlab = xYES)
AC_SUBST(MATLAB_ROOT)
AC_SUBST(MATLAB_INC_DIR)
AC_SUBST(MATLAB_RELEASE)
AC_SUBST(MATLAB_COM_EXT)
AC_SUBST(MEX)
AM_CONDITIONAL(USE_MINGW_MEX, test x"$MATLAB_COM_EXT" = x".dll")
dnl ----------------------------
dnl RPCs -- matlab interface communication with a separated getfem process
dnl useful for debugging..
GETFEM_SERVER="";
use_rpc="no";
AC_ARG_ENABLE(matlab-rpc,
[AS_HELP_STRING([--enable-matlab-rpc],[enable use of RPCs for matlab interface])],
[ matlab_rpc="yes"; use_rpc="yes";
echo "Matlab mex-file will use sun RPCs in order to communicate with the getfem server"],
[matlab_rpc="no"])
if test x$use_rpc = xyes; then
GETFEM_SERVER="getfem_server";
AC_ARG_WITH(rpc-include,
[AS_HELP_STRING([--with-rpc-include],[directory in which the rpc/rpc.h header can be found])],
RPC_INC_DIR="-I$withval",RPC_INC_DIR="")
case $host in
*alpha*)
RPC_LIB="-lrpc";
;;
*darwin*)
RPC_LIB="";
;;
*)
RPC_LIB="-lnsl";
;;
esac
AC_ARG_WITH(rpc-lib,
[AS_HELP_STRING([--with-rpc-lib],[linker flags for the RPC library])],
RPC_LIB="$withval")
AC_SUBST(RPC_INC_DIR)
AC_SUBST(RPC_LIB)
AC_DEFINE(GETFEM_USE_RPC,,[Use rpc for getfem communication with matlab])
fi;
AC_SUBST(GETFEM_SERVER)
AM_CONDITIONAL(BUILDMEXRPC, test x$matlab_rpc = xyes)
dnl -----------------------------------------------
dnl Octave Interface
dnl -----------------------------------------------
# list of pseudo functions
# PSEUDO_FUNCTIONS_LOC=`$srcdir/bin/extract_doc $srcdir/interface/src pseudo_loc`
# echo $PSEUDO_FUNCTIONS_LOC
# PSEUDO_FUNCTIONS=`$srcdir/bin/extract_doc $srcdir/interface/src pseudo_gen`
# MATLAB_OBJ_DIRS=`$srcdir/bin/extract_doc $srcdir/interface/src mobj_dirs`
# AC_SUBST(PSEUDO_FUNCTIONS)
# AC_SUBST(PSEUDO_FUNCTIONS_LOC)
# AC_SUBST(MATLAB_OBJ_DIRS)
AC_ARG_ENABLE(octave,
[AS_HELP_STRING([--enable-octave],[turn on/off octave support])],
[case "${enableval}" in
yes) useoctave=YES ;;
no) useoctave=NO ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-octave]) ;;
esac],[useoctave=NO])
AC_ARG_WITH(octave-toolbox-dir,
[AS_HELP_STRING([--with-octave-toolbox-dir],[directory in which the octave interface will be installed])],
OCTAVETOOLBOXDIR="$withval",OCTAVETOOLBOXDIR="$GFPREFIX/getfem_octavetoolbox")
AC_SUBST(OCTAVETOOLBOXDIR)
if test "$useoctave" != NO; then
AC_CHECK_PROGS(MKOCTFILE, mkoctfile)
if test x"$MKOCTFILE" = x""; then
if test x$useoctave = xYES; then
AC_MSG_ERROR([Impossible to build the octave interface without mkoctfile -- specify its full path with the MKOCTFILE=/path/to/mkoctfile option, or use --enable-octave=no])
exit 1
fi
else
# MATLAB_ROOT=`$MEX -v 2>&1 | grep "MATLAB " | awk '{print $4}'|sed -e '2,$d'`
MKOCTFILE_EXE=`which $MKOCTFILE`
MKOCTFILE_EXE=`readlink -e $MKOCTFILE_EXE`
OCTAVE_ROOT=`echo $MKOCTFILE_EXE | sed -e 's/bin.*$//'`
OCTAVE_COM_EXT=".mex"
OCTAVE_RELEASE=`octave --version | grep "GNU Octave" | sed -n '1p' | sed 's/^.*version //g'`
echo "Octave release is $OCTAVE_RELEASE"
fi
fi
AM_CONDITIONAL(BUILDOCTAVE, test x$useoctave = xYES)
AC_SUBST(OCTAVE_RELEASE)
AC_SUBST(OCTAVE_COM_EXT)
AC_SUBST(MKOCTFILE)
AM_CONDITIONAL(USE_MINGW_OCTAVE, test x"$OCTAVE_COM_EXT" = x".dll")
dnl the pb is that we cannot link the libstdc++.so in the mex-file without horrible problems
dnl with dynamic_casts (with matlab 6.5 -- the pb seems to have disappeared since matlab-7).
dnl Hence the gf_matlab.mexglx should be linked against the libstdc++.a ..
STDCPP_STATICLIBS=""
if test x$usematlab = xYES || test x$useoctave = xYES; then
dnl ------------------------------------
dnl COMPILER SETTINGS
compiler_type=dontcare
case $CXX in
*g++* | c++)
case $host in
x86_64-*)
echo "Compiling on an x86_64 architecture..."
;;
*-darwin*)
echo "Compiling on Darwin (MacOS)"
STDCPP_STATICLIBS=$($CXX -print-file-name=libstdc++.a)
;;
*)
STDCPP_STATICLIBS=$($CXX -print-file-name=libstdc++.a)
echo "The MEX file will be linked against the static c++ library '$STDCPP_STATICLIBS'"
;;
esac
;;
*icc | *icpc)
dnl a small remark: with icpc 8.0, the getfem_server will crash
dnl at the first exception throwed (except with -g)
dnl the fix is to pass the -static flag at the linker
dnl unfortunately, the lovely libtool assumes that icpc won't
dnl understand it, and removes it. I hate libtool.
dnl so I added the -Wl,-static -- it works for now.
GFSERVERFLAGS="-Wl,-static -static"
;;
*)
;;
esac
fi
AC_SUBST(GFSERVERFLAGS)
AC_SUBST(STDCPP_STATICLIBS)
dnl ----------------------------------------------
dnl python
dnl ----------------------------------------------
AC_ARG_ENABLE(python,
[AS_HELP_STRING([--enable-python],[turn on/off python support])],
[case "${enableval}" in
yes) usepython=YES ;;
no) usepython=NO ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
esac],[usepython=YES])
if test x$usepython = xYES; then
AM_PATH_PYTHON(3.6, usepython=YES, usepython=NO)
if test x$usepython = xNO; then
AM_PATH_PYTHON(2.7, usepython=YES, usepython=NO)
fi
fi
case $host in
*mingw*)
PYTHON_CC_ARG="--compiler=mingw32"
PYTHON_EXTRA_EXT_PARAM="extra_compile_args=[['-D MS_WIN64']]"
;;
*)
PYTHON_CC_ARG=""
PYTHON_EXTRA_EXT_PARAM=""
;;
esac
AC_SUBST(PYTHON_CC_ARG)
AC_SUBST(PYTHON_EXTRA_EXT_PARAM)
if test "x$usepython" = "xYES"; then
echo "Building with python ($PYTHON) support (use --enable-python=no to disable it) "
echo "You will need the python-numpy and python-scipy packages."
dnl AM_PATH_PYTHON(2.2)
AX_PYTHON_DEVEL
ac_python_numpy=`$PYTHON -c 'import numpy; print("YES")' 2>/dev/null`
if test "x$ac_python_numpy" != "xYES"; then
usepython=NO
MSG="PYTHON DISABLED: numpy not found. You need to install the python-numpy package."
echo $MSG
WARNING_MSG="$WARNING_MSG\n$MSG"
fi
ac_python_scipy=`$PYTHON -c 'import scipy; print("YES")' 2>/dev/null`
if test "x$ac_python_scipy" != "xYES"; then
usepython=NO
MSG="PYTHON DISABLED: scipy not found. You need to install the python-scipy package."
echo $MSG
WARNING_MSG="$WARNING_MSG\n$MSG"
fi
if test $paralevel -ge 1; then
ac_python_mpi4py=`$PYTHON -c 'import mpi4py; print("YES")' 2>/dev/null`
if test "x$ac_python_mpi4py" != "xYES"; then
usepython=NO
MSG="PARALLEL PYTHON DISABLED: mpi4py not found. You need to install the python-mpi4py package."
echo $MSG
WARNING_MSG="$WARNING_MSG\n$MSG"
fi
fi
PYTHON_SO=`$PYTHON -c "import sysconfig, sys; get = sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
AC_SUBST(PYTHON_SO)
fi
AM_CONDITIONAL(BUILDPYTHON, test x$usepython = xYES)
AM_CONDITIONAL(BUILDPYTHONPAR, test x$ac_python_mpi4py = xYES)
dnl -------------------------------BLAS----------------------------------
dnl why I hate autoconf: if the code below is put into a separate file,
dnl the generated ./configure will stop if no Fortran compiler is found. always. even
dnl if no AC_FC_FUNC is executed.
acx_blas_ok=no
AC_ARG_WITH(blas,
[AS_HELP_STRING([--with-blas=<lib>],[use BLAS library <lib>])])
case $with_blas in
yes | "") ;;
no) acx_blas_ok=disable ;;
-* | */* | *.a | *.so | *.so.* | *.o| builtin) BLAS_LIBS="$with_blas" ;;
*) BLAS_LIBS="-l$with_blas" ;;
esac
# Get fortran linker names of BLAS functions to check for.
if test x"$FC" = "x"; then
echo "No fortran compiler found, assuming c-name for SGEMM is 'sgemm_'"
sgemm=sgemm_
dgemm=dgemm_
else
AC_FC_FUNC(sgemm)
AC_FC_FUNC(dgemm)
fi
acx_blas_save_LIBS="$LIBS"
LIBS="$LIBS $FLIBS"
echo "BLAS_LIBS=$BLAS_LIBS"
# First, check BLAS_LIBS environment variable (can also be set using the --with-blas=<lib> option)
if test "x$BLAS_LIBS" = xbuiltin; then
echo "Using builtin blas lib";
BLAS_LIBS=""
else
if test $acx_blas_ok = no; then
if test "x$BLAS_LIBS" != x; then
save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
AC_TRY_LINK_FUNC($sgemm, [acx_blas_ok=yes], [BLAS_LIBS=""])
AC_MSG_RESULT($acx_blas_ok)
LIBS="$save_LIBS"
fi
fi
# BLAS linked to by default? (happens on some supercomputers)
if test $acx_blas_ok = no; then
save_LIBS="$LIBS"; LIBS="$LIBS"
AC_CHECK_FUNC($sgemm, [acx_blas_ok=yes])
LIBS="$save_LIBS"
fi
# Generic BLAS library?
if test $acx_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lblas"])
fi
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(atlas, ATL_xerbla,
[AC_CHECK_LIB(f77blas, $sgemm,
[AC_CHECK_LIB(cblas, cblas_dgemm,
[acx_blas_ok=yes
BLAS_LIBS="-lf77blas -latlas $FCLIBS"],
[], [-lf77blas -latlas])],
[], [-latlas])])
fi
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm,
[AC_CHECK_LIB(dgemm, $dgemm,
[AC_CHECK_LIB(sgemm, $sgemm,
[acx_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
[], [-lblas])],
[], [-lblas])])
fi
# BLAS in Alpha CXML library?
if test $acx_blas_ok = no; then
AC_CHECK_LIB(cxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-lcxml"])
fi
# BLAS in Alpha DXML library? (now called CXML, see above)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(dxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-ldxml"])
fi
# BLAS in Sun Performance library?
if test $acx_blas_ok = no; then
if test "x$GCC" != xyes; then # only works with Sun CC
AC_CHECK_LIB(sunmath, acosp,
[AC_CHECK_LIB(sunperf, $sgemm,
[BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
acx_blas_ok=yes],[],[-lsunmath])])
fi
fi
# BLAS in SCSL library? (SGI/Cray Scientific Library)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(scs, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lscs"])
fi
# BLAS in SGIMATH library?
if test $acx_blas_ok = no; then
AC_CHECK_LIB(complib.sgimath, $sgemm,
[acx_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
fi
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm,
[AC_CHECK_LIB(essl, $sgemm,
[acx_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
[], [-lblas $FLIBS])])
fi
# Generic BLAS library with fortran dependency?
if test $acx_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lblas $FCLIBS"])
fi
fi # if BLAS_LIBS=builtin
AC_SUBST(BLAS_LIBS)
LIBS="$acx_blas_save_LIBS"
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_blas_ok" = xyes; then
echo "OK, You have working BLAS libs ! Using $BLAS_LIBS"
AC_DEFINE(GMM_USES_BLAS,,[defined if GMM is linked to a blas library])
LIBS="$LIBS $BLAS_LIBS"
else
echo " *** YOU DONT HAVE BLAS! *** Using a cheap replacement"
fi
useblas64support=NO
AC_ARG_ENABLE(blas64-support,
[AS_HELP_STRING([--enable-blas64-support],[enable the 64 bits integer blas and lapack support])],
[ case $enableval in
yes | "") useblas64support=YES;;
no) useblas64support=NO;;
esac], [useblas64support=NO])
if test x$useblas64support = xYES; then
AC_DEFINE(GMM_USE_BLAS64_INTERFACE,,[Use blas with 64 bits integers])
fi
# check fortran ABI with regard to complex function in BLAS
# by defult assume a fortran ABI where complex real/double functions return by value
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <complex>
#if defined(GMM_USE_BLAS64_INTERFACE)
#define INT long
#else
#define INT int
#endif
extern "C" {
void cdotu_(std::complex<float>*, const INT*, const std::complex<float>*, const INT*,
const std::complex<float>*, const INT*);
}
int main() {
const INT one=1;
std::complex<float> x(1.,2.), y(1.,-2.), result;
cdotu_(&result, &one, &x, &one, &y, &one);
return (fabs(result.real()-5.) < 1e-8) ? 0 : 1;
}
]])],[ acx_blas_fortan_abi=Intel ], [ acx_blas_fortan_abi=GNU ], [])
if test x$acx_blas_fortan_abi = xIntel; then
echo "BLAS found to have the Intel fortran ABI, i.e. returning complex function value by argument";
AC_DEFINE(GMM_BLAS_RETURN_COMPLEX_AS_ARGUMENT,,[defined if the BLAS fortran ABI does not return complex values directly (e.g. Intel's MKL)])
fi
dnl ------------------------------LAPACK TEST--------------------------------
if test x"$acx_blas_ok" = xyes; then
#This name mangling detection is currently not in use
# if test x"$FC" = "x"; then
# dgetrf=dgetrf_
# else
# AC_FC_FUNC(dgetrf)
# fi;
# LAPACK linked to by default? (is sometimes included in BLAS lib)
AC_CHECK_FUNC(dgetrf_, [acx_lapack_ok=yes; LAPACK_LIBS=""])
if test "x$acx_lapack_ok" != xyes; then
AC_CHECK_LIB(lapack, dgetrf_, [acx_lapack_ok=yes; LAPACK_LIBS="-llapack"])
fi
if test x"$acx_lapack_ok" = xyes; then
AC_DEFINE(GMM_USES_LAPACK,,[defined if GMM is linked to a lapack library])
LIBS="$LAPACK_LIBS $LIBS"
fi
fi
AM_CONDITIONAL(LAPACK, test x$acx_lapack_ok = xyes)
dnl -----------------------------END OF LAPACK TEST--------------------------
dnl ---------------------------multithread-blas--------------------------
multithread_blas=NO
AC_ARG_ENABLE(multithread-blas,
[AS_HELP_STRING([--enable-multithread-blas],[enable openblas to be multithreaded])],
[ case $enableval in
yes | "") multithread_blas=YES;;
no) multithread_blas=NO;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-multithread-blas], [multithread_blas=NO]) ;;
esac
])
if test x$multithread_blas = xNO; then
AC_CHECK_LIB(dl, dlsym, [acx_dl_ok=yes; DL_LIBS="-ldl"])
if test x"$acx_dl_ok" = xyes; then
AC_DEFINE(GETFEM_FORCE_SINGLE_THREAD_BLAS,,[enable openblas to be multithreaded])
LIBS="$DL_LIBS $LIBS"
fi
fi;
dnl --------------------------end of multithread-blas--------------------
dnl ---------------------------OPENMP------------------------------
useopenmp=0
AC_ARG_ENABLE(openmp,
[AS_HELP_STRING([--enable-openmp],[enable the multihreaded version of GetFEM])],
[ case $enableval in
yes | "") useopenmp=YES ;;
no) useopenmp=NO ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-openmp]) ;;
esac],
[useopenmp=NO]
)
if test x$useopenmp = xYES; then
AC_OPENMP
if test "x$ac_cv_prog_cxx_openmp" != "xunsupported" && test "x$ac_cv_prog_cxx_openmp" != "x"; then
AC_SUBST(AM_CXXFLAGS,"$OPENMP_CXXFLAGS")
AC_DEFINE(GETFEM_HAS_OPENMP,,[defined if GetFEM is built with OpenMP parallelization])
else
AC_MSG_ERROR([OpenMP support not found. Use --enable-openmp=no flag to compile GetFEM without OpenMP]);
fi
fi;
dnl ---------------------------END OF OPENMP-----------------------
dnl ------------------------------SUPERLU TEST---------------------------
require_superlu="auto"
AC_ARG_ENABLE(superlu,
[AS_HELP_STRING([--enable-superlu], [Enable SuperLU support])],
[require_superlu=$enableval],
[require_superlu="auto"])
SUPERLU_LIBS="-lsuperlu"
# the user can override these defaults using --with-superlu=
AC_ARG_WITH(superlu,
[AS_HELP_STRING([--with-superlu=<lib>],[use SuperLU library <lib>])],
[case $with_superlu in
yes | "")
if test "x$require_superlu" = "xno"; then
AC_MSG_ERROR([Contradicting arguments between --enable-superlu and --with-superlu.])
elif test "x$require_superlu" = "xauto"; then
require_superlu="yes"
fi;;
no)
if test "x$require_superlu" = "xyes"; then
AC_MSG_ERROR([Contradicting arguments between --enable-superlu and --with-superlu.])
elif test "x$require_superlu" = "xauto"; then
require_superlu="no"
fi;;
-* | */* | *.a | *.so | *.so.* | *.o| builtin) SUPERLU_LIBS="$with_superlu";;
*) SUPERLU_LIBS=`echo $with_superlu | sed -e 's/^/-l/g;s/ \+/ -l/g'`;;
esac]
)
SUPERLUINC=""
AC_ARG_WITH(superlu-include-dir,
[AS_HELP_STRING([--with-superlu-include-dir],[directory in which the superlu/sl*.h or just sl*.h headers can be found])],
[ if test x$require_superlu = xno; then
AC_MSG_ERROR([Inconsistent options for --enable-superlu, --with-superlu and --with-superlu-include-dir.]);
else
require_superlu="yes"
case $withval in
-I* ) SUPERLUINC="$withval";;
* ) SUPERLUINC="-I$withval";;
esac
fi;],
)
CPPFLAGS="$CPPFLAGS $SUPERLUINC"
if test "x$require_superlu" = "xno"; then
SUPERLU_LIBS=""
found_superlu="no"
echo "Building with SuperLU explicitly disabled";
else
AC_CHECK_HEADERS(
[superlu/slu_Cnames.h superlu/slu_cdefs.h superlu/slu_ddefs.h superlu/slu_sdefs.h superlu/slu_zdefs.h \
superlu/slu_dcomplex.h superlu/slu_scomplex.h],
[found_superlu="yes"],
[found_superlu="no"])
if test x$found_superlu = xno; then
AC_CHECK_HEADERS(
[slu_Cnames.h slu_cdefs.h slu_ddefs.h slu_sdefs.h lu_zdefs.h slu_dcomplex.h slu_scomplex.h],
[found_superlu="yes";
AC_DEFINE(GMM_NO_SUPERLU_INCLUDE_SUBDIR,,[defined if SuperLU headers are not in a superlu subdirectory])],
[found_superlu="no"])
fi
if test x$found_superlu = xno && test "x$require_superlu" = "xyes"; then
AC_MSG_ERROR([Header files of SuperLU not found]);
fi
if test x$found_superlu = xyes; then
save_LIBS="$LIBS";
AC_SEARCH_LIBS(dCreate_CompCol_Matrix, [`echo $SUPERLU_LIBS | sed -e 's/^-l//g;s/ -l/ /g'`],
[AC_DEFINE(GMM_USES_SUPERLU,,[defined if GMM is to be linked to the SuperLU library])],
[if test "x$require_superlu" = "xyes"; then
AC_MSG_ERROR([SuperLU library not found]);
fi;
found_superlu="no"]
)
if test "x$found_superlu" = "xyes"; then
echo "Building with SuperLU (use --enable-superlu=no to disable it)"
LIBS="$SUPERLU_LIBS $save_LIBS"
else
SUPERLU_LIBS=""
LIBS="$save_LIBS"
fi
elif test "x$require_superlu" = "xyes"; then
AC_MSG_ERROR([SuperLU header files not found but required by the user. Aborting configure...]);
else
echo "SuperLU header files not found, building without SuperLU"
SUPERLU_LIBS=""
fi
fi
AM_CONDITIONAL(SUPERLU, test x$found_superlu = xyes)
AC_SUBST([SUPERLU_LIBS])
if test "x$found_superlu" = "xyes"; then
echo "Configuration of SuperLU done"
fi
dnl ---------------------------END OF SUPERLU TEST-----------------------
dnl ------------------------------MUMPS TEST-----------------------------
require_mumps="auto"
AC_ARG_ENABLE(mumps,
[AS_HELP_STRING([--enable-mumps], [Enable MUMPS support])],
[require_mumps=$enableval],
[require_mumps="auto"])
MUMPS_LIBS=""
# the user can override these defaults using --with-mumps=
if test $paralevel -le 1; then # default to the typical naming of the sequential libraries
MUMPS_LIBS="-lsmumps_seq -ldmumps_seq -lcmumps_seq -lzmumps_seq"
else # default to the common name for the parallel libraries (the user can override this using --with-mumps=)
MUMPS_LIBS="-lsmumps -ldmumps -lcmumps -lzmumps"
fi
AC_ARG_WITH(mumps,
[AS_HELP_STRING([--with-mumps=<lib>],[use MUMPS library <lib>])],
[case $with_mumps in
yes | "")
if test "x$require_mumps" = "xno"; then
AC_MSG_ERROR([Contradicting arguments between --enable-mumps and --with-mumps.])
elif test "x$require_mumps" = "xauto"; then
require_mumps="yes"
fi;;
no)
if test "x$require_mumps" = "xyes"; then
AC_MSG_ERROR([Contradicting arguments between --enable-(par-)mumps and --with-mumps.])
elif test "x$require_mumps" = "xauto"; then
require_mumps="no"
fi;;
-* | */* | *.a | *.so | *.so.* | *.o| builtin) MUMPS_LIBS="$with_mumps";;
*) MUMPS_LIBS=`echo $with_mumps | sed -e 's/^/-l/g;s/ \+/ -l/g'`;;
esac]
)
MUMPSINC=""
AC_ARG_WITH(mumps-include-dir,
[AS_HELP_STRING([--with-mumps-include-dir],[directory in which the dmumps.h header can be found])],
[case $withval in
-I* ) MUMPSINC="$withval";;
* ) MUMPSINC="-I$withval";;
esac],
)
CPPFLAGS="$CPPFLAGS $MUMPSINC"
save_LIBS="$LIBS";
if test "x$require_mumps" = "xno"; then
found_mumps="no"
MUMPS_LIBS=""
echo "Building with MUMPS explicitly disabled";
else
AC_CHECK_HEADERS([smumps_c.h dmumps_c.h cmumps_c.h zmumps_c.h],
[found_mumps="1"],
[if test "x$require_mumps" = "xyes"; then
AC_MSG_ERROR([header file dmumps_c.h not found]);
fi;
found_mumps="0"]
)
AC_SEARCH_LIBS(smumps_c, [`echo $MUMPS_LIBS | sed -e 's/^-l//g;s/ -l/ /g'`],
[found_mumps=$found_mumps"2"],
[if test "x$require_mumps" = "xyes"; then
AC_MSG_ERROR([The function smumps_c couldn't be found in the provided MUMPS libraries.]);
fi;
found_mumps=$found_mumps"0"]
)
AC_SEARCH_LIBS(dmumps_c, [`echo $MUMPS_LIBS | sed -e 's/^-l//g;s/ -l/ /g'`],
[found_mumps=$found_mumps"3"],
[if test "x$require_mumps" = "xyes"; then
AC_MSG_ERROR([The function dmumps_c couldn't be found in the provided MUMPS libraries.]);
fi;
found_mumps=$found_mumps"0"]
)
AC_SEARCH_LIBS(cmumps_c, [`echo $MUMPS_LIBS | sed -e 's/^-l//g;s/ -l/ /g'`],
[found_mumps=$found_mumps"4"],
[if test "x$require_mumps" = "xyes"; then
AC_MSG_ERROR([The function cmumps_c couldn't be found in the provided MUMPS libraries.]);
fi;
found_mumps=$found_mumps"0"]
)
AC_SEARCH_LIBS(zmumps_c, [`echo $MUMPS_LIBS | sed -e 's/^-l//g;s/ -l/ /g'`],
[found_mumps=$found_mumps"5"],
[if test "x$require_mumps" = "xyes"; then
AC_MSG_ERROR([The function zmumps_c couldn't be found in the provided MUMPS libraries.]);
fi;
found_mumps=$found_mumps"0"]
)
if test x"$found_mumps" = x"12345"; then
found_mumps="yes"
echo "Building with MUMPS (use --enable-mumps=no to disable it)"
AC_DEFINE(GMM_USES_MUMPS,,[defined if GMM is linked to the mumps library])
LIBS="$MUMPS_LIBS $save_LIBS"
else
found_mumps="no"
MUMPS_LIBS=""
LIBS="$save_LIBS"
fi;
fi;
AM_CONDITIONAL(MUMPS, test x$found_mumps = xyes)
AC_SUBST([MUMPS_LIBS])
if test "x$found_mumps" = "xyes"; then
echo "Configuration of MUMPS done"
fi
dnl ---------------------------END OF MUMPS TEST--------------------------
if test "x$found_superlu" = "xno" -a "x$found_mumps" = "xno"; then
AC_MSG_ERROR([Neither MUMPS nor SuperLU was enabled. At least one linear solver is required.])
exit 1
fi
dnl ----------------EXPERIMENTAL PARTS OF THE LIBRARY---------------------
EXPER=""
AC_ARG_ENABLE(experimental,
[AS_HELP_STRING([--enable-experimental],[compile experimental parts of the library])],
[ if test "x$enableval" = "xyes" ; then EXPER="-DEXPERIMENTAL_PURPOSE_ONLY"; fi], [EXPER=""])
CPPFLAGS="$CPPFLAGS $EXPER"
dnl ----------------END OF EXPERIMENTAL PARTS OF THE LIBRARY-------------
dnl -----------------------------QD TESTS--------------------------------
AC_ARG_WITH(qd-lib-dir,
[AS_HELP_STRING([--with-qd-lib-dir],[directory in which the libqd.a can be found])],
QDLIB="$withval/libqd.a",QDLIB="$GFPREFIX/lib/libqd.a")
AC_ARG_WITH(qd-include-dir,
[AS_HELP_STRING([--with-qd-include-dir],[directory in which the qd.h header can be found])],
QDINC="-I$withval",QDINC="-I$GFPREFIX/include")
AC_ARG_ENABLE(dd,
[AS_HELP_STRING([--enable-dd],[enable the use of the qd library (some computation will be done with double-double precision, useful for high order FEMs)])],
[ if test "x$enableval" = "xyes" ; then useQDlib="yes"; QD_PREC="double"; fi], [useQDlib="no"])
AC_ARG_ENABLE(qd,
[AS_HELP_STRING([--enable-qd],[enable the use of the qd library (some computation will be done with quad-double precision, useful for high order FEMs)])],
[ if test "x$enableval" = "xyes" ; then useQDlib="yes"; QD_PREC="quad"; fi], [if test "x$useQDlib" = "xyes"; then useQDlib="yes"; else useQDlib="no"; fi])
if test "x$useQDlib" = "xyes" ; then
LIBS="$LIBS $QDLIB -lm"
CPPFLAGS="$CPPFLAGS $QDINC"
dnl #define NO_INLINE
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <qd/qd_real.h>
#include <qd/dd_real.h>
#include <qd/fpu.h>
#include <iostream>
int main() {
unsigned int old_cw;
int ok;
fpu_fix_start(&old_cw);
qd_real q = 1.0;
qd_real qq = qd_real("0.01");
qd_real qqq = "1.010101010101010101010101010101010101010101010101010101010101010E0";
dd_real d = 1.0;
dd_real dd = dd_real("0.1");
dd_real ddd = "1.1111111111111111111111111111111E0";
for (int i=0; i < 100; ++i) { d += dd; dd *= dd_real("0.1"); }
for (int i=0; i < 100; ++i) { q += qq; qq *= qd_real("0.01"); }
std::cerr << "d = " << d << std::endl << "q = " << q << std::endl;
std::cerr << abs(q - qqq) << std::endl;
std::cerr << abs(d - ddd) << std::endl;
if (abs(q - qqq) < 1e-63 && abs(d -ddd) < 1e-31) ok = 1;
else ok = 0;
fpu_fix_end(&old_cw); return 1-ok;
}
]])],[echo "checking if qd library is working...yes"],[ echo "QD library is not working (check config.log)"; exit 1],[])
AC_DEFINE(GETFEM_HAVE_QDLIB,,[defined if the qd library was found and is working])
HAVE_QDLIB=1;
if test "x$QD_PREC" = "xquad"; then
AC_DEFINE(GETFEM_QDLIB_USE_QUAD,,[defined if quad-doubles are to be used instead of double-double])
fi;
fi;
dnl -----------------------------END QD TESTS--------------------------------
dnl ------------------------------QHULL TEST---------------------------------
useQHULL="no"
AC_ARG_ENABLE(qhull,
[AS_HELP_STRING([--enable-qhull],[enable the use of the qhull library (required for generation of non regular meshes)])],
[ if test "x$enableval" = "xyes" ; then useQHULL="yes"; fi], [useQHULL="test"])
QHULL_LIBS=""
save_LIBS="$LIBS";
if test "x$useQHULL" = "xno"; then
echo "Building with libqhull explicitly disabled";
else
AC_CHECK_LIB(qhull_r, qh_new_qhull, [QHULL_LIBS="-lqhull_r"],
[
AC_CHECK_LIB(qhullstatic_r, qh_new_qhull,[QHULL_LIBS="-lqhullstatic_r"],[QHULL_LIBS=""])
])
AC_CHECK_HEADERS(libqhull_r/qhull_ra.h,
[useQHULL="yes"; AC_DEFINE(GETFEM_HAVE_LIBQHULL_R_QHULL_RA_H,,
[defined if the <libqhull_r/qhull_ra.h> header file is available])],
[
if test "x$useQHULL" = "xyes"; then
AC_MSG_ERROR([header files libqhull_r/qhull_ra.h not found. Use --enable-qhull=no flag]);
useQHULL="no"
fi;
])
echo "Building with libqhull (use --enable-qhull=no to disable it)"
fi;
AM_CONDITIONAL(QHULL, test x$useQHULL = xyes)
LIBS="$QHULL_LIBS $save_LIBS"
AC_SUBST([QHULL_LIBS])
echo "Configuration of qhull done"
dnl -----------------------------END OF QHULL TEST---------------------------
dnl ---------------------------METIS--------------------------
METIS_LIBS=""
AC_ARG_ENABLE(metis,
[AS_HELP_STRING([--enable-metis],[enable the use of the METIS library.])],
[case $enableval in
yes | "") usemetis="yes" ;;
no) usemetis="no"; METIS_LIBS="" ;;
esac],
[usemetis="test"]
)
if test $paralevel -ge 1 -a "x$usemetis" = "xno"; then
echo "Parallel getfem requires the METIS library, --enable-metis=no will be ignored";
usemetis="yes"
fi;
if test "x$usemetis" = "xno"; then
echo "Building without METIS";
else
if test $paralevel -ge 1; then
AC_CHECK_LIB(metis, METIS_PartGraphRecursive,
[usemetis="yes"],
[usemetis="no";
AC_MSG_ERROR([METIS library required for parallel getfem was not found])
])
METIS_LIBS="-lmetis"
LIBS="$LIBS $METIS_LIBS"
AC_DEFINE(GETFEM_HAVE_METIS,,[defined if the Metis library was found and is working])
AC_CHECK_LIB(metis, METIS_SetDefaultOptions, [usemetisnew="yes"],
[AC_DEFINE(GETFEM_HAVE_METIS_OLD_API,,
[defined if the Metis library found is older than version 4])
])
echo "Building with METIS (use --enable-metis=no to disable it)"
if test "x$usemetisnew" = "xyes"; then
AC_CHECK_HEADERS(metis.h,
[usemetis="yes"],
[usemetis="no";
AC_MSG_ERROR([metis.h header required for parallel getfem was not found])
])
fi;
fi;
fi;
AM_CONDITIONAL(METIS, test x$usemetis = xyes)
AC_SUBST([METIS_LIBS])
dnl ---------------------------END OF METIS--------------------------
AC_CHECK_HEADERS(sys/times.h)
AC_CHECK_HEADERS(cxxabi.h,
AC_DEFINE(GETFEM_HAVE_CXXABI_H,,[defined if the cxxabi.h header file is available]))
dnl ---------------------------- CHECK FOR __PRETTY_FUNCTION__ MACRO --------
AC_CACHE_CHECK([for __PRETTY_FUNCTION__], ac_cv_have_pretty_function, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [
[ const char *s = __PRETTY_FUNCTION__; ]])],
[ ac_cv_have_pretty_function="yes" ],
[ ac_cv_have_pretty_function=="no" ])])
if test "x$ac_cv_have_pretty_function" = "xyes"; then
AC_DEFINE(GMM_HAVE_PRETTY_FUNCTION,,[gcc style __PRETTY_FUNCTION__ macro])
fi;
dnl ---------------------------- CHECK FOR GLIBC BACKTRACE availability -----
AC_CACHE_CHECK([for execinfo.h and backtrace], ac_cv_have_backtrace, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[ #include <execinfo.h> ]],
[[ void* trace[256]; int n = backtrace(trace, 256); ]])],
[ ac_cv_have_backtrace="yes" ],
[ ac_cv_have_backtrace="no" ])])
if test "x$ac_cv_have_backtrace" = "xyes"; then
AC_DEFINE(GETFEM_HAVE_BACKTRACE,,[glibc backtrace function])
fi;
dnl ---------------------------- CHECK FOR feenableexcept -----
AC_CACHE_CHECK([for fenv.h and feenableexcept], ac_cv_have_feenableexcept, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[ #include <fenv.h> ]],
[[ feenableexcept(FE_DIVBYZERO | FE_INVALID); ]])],
[ ac_cv_have_feenableexcept="yes" ],
[ ac_cv_have_feenableexcept="no" ])])
if test "x$ac_cv_have_feenableexcept" = "xyes"; then
AC_DEFINE(GETFEM_HAVE_FEENABLEEXCEPT,,[glibc floating point exceptions control])
fi;
BUILDER=`whoami`
AC_SUBST(BUILDER)
BUILDDATE=`date +%D,%H:%M:%S`
AC_SUBST(BUILDDATE)
CONFIGURE_ARGS=$ac_configure_args
AC_SUBST(CONFIGURE_ARGS)
LIBTOOL_VERSION_INFO="-version-info $((${MAJOR_VERSION} + ${MINOR_VERSION})):${PATCH_VERSION}:${MINOR_VERSION}"
AC_SUBST(LIBTOOL_VERSION_INFO)
dnl AC_CHECK_PROGS(RANLIB, ranlib)
dnl ------------ for distclean of meshes ---------------------
j="tests/meshes/disc_P2_h4.mesh"
if test -L $j || test ! -f $j; then
DISTCLEANMESH="";
else
DISTCLEANMESH="#";
fi;
AC_SUBST(DISTCLEANMESH)
dnl -----------------------------------------------
dnl Outputs
dnl -----------------------------------------------
IM_METHODS=`$srcdir/bin/extract_doc $srcdir/interface/src cubature`
IM_METHODS_LOC=`$srcdir/bin/extract_doc $srcdir/interface/src cubature_loc`
AC_SUBST(IM_METHODS)
AC_SUBST(IM_METHODS_LOC)
AC_CONFIG_FILES( \
Makefile \
m4/Makefile \
cubature/Makefile \
doc/Makefile \
doc/sphinx/Makefile \
src/Makefile \
tests/Makefile \
contrib/Makefile \
contrib/icare/Makefile \
contrib/delaminated_crack/Makefile \
contrib/bimaterial_crack_test/Makefile \
contrib/xfem_stab_unilat_contact/Makefile \
contrib/mixed_elastostatic/Makefile \
contrib/xfem_contact/Makefile \
contrib/crack_plate/Makefile \
contrib/aposteriori/Makefile \
contrib/level_set_contact/Makefile \
contrib/static_contact_gears/Makefile \
contrib/test_plasticity/Makefile \
contrib/opt_assembly/Makefile \
contrib/continuum_mechanics/Makefile \
bin/Makefile \
interface/Makefile \
interface/src/Makefile \
interface/src/matlab/Makefile \
interface/src/matlab/private/Makefile \
interface/src/octave/Makefile \
interface/src/octave/private/Makefile \
interface/src/python/Makefile \
interface/src/python/setup.py \
interface/tests/Makefile \
interface/tests/meshes/Makefile \
interface/tests/matlab-octave/Makefile \
interface/tests/matlab-octave/private/Makefile \
interface/tests/python/Makefile \
getfem-config \
getfem-config-notinstalled \
gmm-config)
AC_OUTPUT
chmod a+x getfem-config-notinstalled
chmod a+x getfem-config
chmod a+x gmm-config
dnl -----------------------------------------------
dnl Symbolic links for the meshes in tests/meshes
dnl -----------------------------------------------
if test -z ""`echo $srcdir | grep "^/"`; then
addpathm="../"
else
addpathm=""
fi
if test ! -d tests/meshes; then
ln -s $addpathm$srcdir/tests/meshes tests/meshes
fi;
dnl configuration sum-up
echo
echo "------------------------------------------------------------------------------"
echo
echo "Libraries Used:"
echo "---------------"
echo
if test "x$useQDlib" = "xyes" ; then
echo "- QD library found. High precision (${QD_PREC}-double precision) polynomials"
echo " and integration methods are enabled.";
else
echo "- QD library not found (don't worry, this library is only recommended for very specific uses)."
fi;
if test "x$useQHULL" = "xyes"; then
echo "- Qhull found. Using the Qhull library for delaunay triangulations."
else
echo "- Qhull not found. Mesh generation will be disabled."
fi;
if test "x$found_superlu" = "xyes"; then
echo "- SuperLU found. A direct solver for large sparse linear systems."
else
if test "x$require_superlu" = "xno"; then
echo "- Not using the SuperLU library for large sparse linear systems."
else
echo "- SuperLU not found. Not using the SuperLU library for large sparse linear systems."
fi
fi;
if test "x$found_mumps" = "xyes"; then
echo "- Mumps found. A direct solver for large sparse linear systems."
else
if test "x$require_mumps" = "xno"; then
echo "- Not using the MUMPS library for large sparse linear systems."
else
echo "- Mumps not found. Not using the MUMPS library for large sparse linear systems."
fi
fi;
if test x"$acx_lapack_ok" = xyes; then
echo "- Lapack library found: $LAPACK_LIBS"
else
echo "- Lapack library not found: generic (less efficient) algorithms will be used"
fi
if test x"$acx_blas_ok" = xyes; then
echo "- BLAS library found. Link options: $BLAS_LIBS"
else
echo "- *** No usable blas library was found ***"
echo " A generic BLAS implementation will be used, however you should "
echo " consider installing a faster BLAS, such as ATLAS"
fi;
echo " You can give the location of your prefered blas library with either"
echo " the --with-blas=<lib> option, or the BLAS_LIBS environment variable"
echo ' for example: ./configure BLAS_LIBS="-L/usr/lib/sse2/atlas/ -lblas"'
if test x$useblas64support = xYES; then
echo " Use blas with 64 bits integers or 32/64 bits compatibility mode"
else
echo " Use blas with 32 bits integers"
fi
echo -e "\n\n"
echo "-----------------------------------------------------------------------"
echo "Ready to build getfem"
echo " building MATLAB interface: $usematlab"
echo " building OCTAVE interface: $useoctave"
echo " building PYTHON interface: $usepython (requires numpy, scipy and also mpi4py for the parallel version)"
echo " building SCILAB interface: $usescilab"
echo " If you want to build the shared library of GetFEM, use --enable-shared"
echo " (by default, only the static one will be built)"
echo "-----------------------------------------------------------------------"
case $host in
x86_64-*)
if test $usematlab = "YES" -o $usepython = "YES"; then
if test $pic_mode != "yes"; then
echo "!!!!!"
echo "!!!!! Your build will fail because you did not use the --with-pic option"
echo "!!!!! This is required for the getfem interfaces on x86_64"
echo ""
fi
fi
;;
esac
if test "x$MSG" != "x"; then
echo -e "\n\nWARNINGS during the configure:\n$MSG\n\n"
fi
|