The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

1172 lines
40 KiB

2 months ago
  1. #!/bin/bash
  2. # Configure script for CoCoALib
  3. # It accepts a small number of options: run "configure --help" for details.
  4. # Here is what this script does.
  5. # It establishes the location of the GMP library (and the gmp.h file).
  6. # It establishes which C++ compiler to use and the compilation flags;
  7. # both compiler and flags can be user specified.
  8. # After some basic checks, all details are written into a configuration file
  9. # (currently called configuration/autoconf.mk) which is read by make.
  10. # The chosen configuration parameters will be placed in the file CONFIG_FILE:
  11. # we save any prevous CONFIG_FILE by appending suffix ".old",
  12. # the new file is built up in CONFIG_TMP then renamed to CONFIG_FILE at the end.
  13. CONFIG_DIR=configuration
  14. CONFIG_FILE="$CONFIG_DIR/autoconf.mk"
  15. CONFIG_TMP="$CONFIG_FILE.part"
  16. # Auxiliary shell scripts are in this directory; load some useful shell fns.
  17. SCRIPT_DIR=configuration
  18. source "$SCRIPT_DIR/shell-fns.sh"
  19. COCOA_EXTLIB_DIR=`pwd`/configuration/ExternalLibs
  20. export COCOA_EXTLIB_DIR
  21. # Default installation directory and command.
  22. INSTALL_DIR=/usr/local
  23. INSTALL="install -S"
  24. which install > /dev/null
  25. if [ $? -ne 0 ]
  26. then
  27. INSTALL="/bin/cp -f"
  28. fi
  29. ##################################################################
  30. # Special handling for the arg "--again" (recalls args from previous invocation)
  31. # This section puts the script args into ARGS.
  32. if [ $# = 1 -a "XXX$1" = "XXX-again" ]
  33. then
  34. echo "$0: ERROR! type ./configure --again" > /dev/stderr
  35. exit 1
  36. fi
  37. if [ $# = 1 -a "XXX$1" = "XXX--again" ]
  38. then
  39. if [ \! -f "$CONFIG_FILE" ]
  40. then
  41. echo "$0: ERROR no previous configuration file found" > /dev/stderr
  42. exit 1
  43. fi
  44. ARGS=`head -5 "$CONFIG_FILE" | tail -1 | cut -c 3- | cut -f 2- -d " " `
  45. echo
  46. echo "Recalling previous configure command:"
  47. echo "$0 $ARGS"
  48. echo
  49. sleep 2
  50. ./configure $ARGS
  51. exit $?
  52. fi
  53. ##################################################################
  54. # Process command line args.
  55. ORIG_CMD="$0 $@"
  56. MODE=OPT # default optimization/debugging flag
  57. # Below, is there a neater way to do tilde expansion for paths to libraries???
  58. for option in "$@"
  59. do
  60. case $option in
  61. ( --again )
  62. echo "***ERROR*** $0: option '--again' must be used alone"
  63. exit 1;;
  64. ( --recall )
  65. head -5 "$CONFIG_FILE" | tail -1 | cut -c 3-
  66. exit 0;;
  67. ( --recall-from=* )
  68. head -5 "`echo "$option" | cut -f 2- -d=`" | tail -1 | cut -c 3-
  69. exit 0;;
  70. ( --with-libgmp=~* )
  71. GMP_LIB="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  72. ( --with-libgmp=* )
  73. GMP_LIB=`echo "$option" | cut -f 2- -d=` ;;
  74. ( --with-boost=~* )
  75. BOOST_INC_DIR="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  76. ( --with-boost=* )
  77. BOOST_INC_DIR=`echo "$option" | cut -f 2- -d=` ;;
  78. (--no-readline )
  79. AVOID_READLINE=yes ;;
  80. ( --with-readline=~* )
  81. READLINE_LIB="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  82. ( --with-readline=* )
  83. READLINE_LIB=`echo "$option" | cut -f 2- -d=` ;;
  84. ( --with-libreadline=* )
  85. READLINE_LIB=`echo "$option" | cut -f 2- -d=` ;;
  86. ( --with-libcddgmp=system )
  87. CDD_LIB=`$SCRIPT_DIR/find-lib-in-std-dirs.sh libcddgmp`
  88. if [ $? -ne 0 ]
  89. then
  90. echo "$0: Could not find libcddgmp"
  91. exit 1
  92. fi
  93. echo "calling $SCRIPT_DIR/find-hdr-from-lib.sh cdd/cdd.h $CDD_LIB"
  94. CDD_HDR_DIR=`$SCRIPT_DIR/find-hdr-from-lib.sh cdd/cdd.h "$CDD_LIB"`
  95. if [ $? -ne 0 ]
  96. then
  97. echo "$0: $CDD_HDR_DIR"
  98. exit 1
  99. fi
  100. CDD_SYSTEM=yes;;
  101. ( --with-libcddgmp=~* )
  102. CDD_LIB="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  103. ( --with-libcddgmp=* )
  104. CDD_LIB=`echo "$option" | cut -f 2- -d=` ;;
  105. ( --with-libfrobby=~* )
  106. FROBBY_LIB="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  107. ( --with-libfrobby=* )
  108. FROBBY_LIB=`echo "$option" | cut -f 2- -d=` ;;
  109. ( --with-libgsl=~* )
  110. GSL_LIB="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  111. ( --with-libgsl=* )
  112. GSL_LIB=`echo "$option" | cut -f 2- -d=` ;;
  113. ( --with-libgfan=~* )
  114. GFAN_LIB="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  115. ( --with-libgfan=* )
  116. GFAN_LIB=`echo "$option" | cut -f 2- -d=` ;;
  117. ( --with-libnormaliz=~* )
  118. NORMALIZ_LIB="$HOME`echo "$option" | cut -f 2- -d~`" ;;
  119. ( --with-libnormaliz=* )
  120. NORMALIZ_LIB=`echo "$option" | cut -f 2- -d=` ;;
  121. ( --with-cxx=* )
  122. CXX=`echo "$option" | cut -f 2- -d=` ;;
  123. ( --with-cxxflags=* )
  124. CXXFLAGS=`echo "$option" | cut -f 2- -d=` ;;
  125. ( --mode=* )
  126. MODE=`echo "$option" | cut -f 2- -d=` ;;
  127. ( --threadsafe-hack )
  128. THREADSAFE_HACK=yes ;;
  129. ( --prefix=* )
  130. INSTALL_DIR=`echo "$option" | cut -f 2- -d=`
  131. if [ \! -d "$INSTALL_DIR" ]
  132. then
  133. echo "$0: specified installation directory does not exist: \`$INSTALL_DIR\'"
  134. exit 1
  135. fi;;
  136. ( --help* )
  137. echo -e "\nThis script configures CoCoALib. For details please consult the"
  138. echo -e "files INSTALL and README located in the same directory as this script."
  139. echo -e "\nUsage: ./configure [OPTIONS]"
  140. echo -e "\nConfiguration:"
  141. echo -e " --help\t\tdisplay this help and exit"
  142. echo -e " --again\t\trerun configure with the same options as last time"
  143. echo -e " --recall\t\tprint out the configure command given last time"
  144. echo -e " --with-cxx=ARG\tspecify name of compiler [default: g++]"
  145. echo -e "\t\t\t(or specify via environment variable CXX)"
  146. echo -e " --with-cxxflags=ARG\tspecify compilation flags [default: \"-Wall -pedantic\"]"
  147. echo -e "\t\t\t(or specify via environment variable CXXFLAGS)"
  148. echo -e " --with-libgmp=ARG\tspecify location of the file libgmp.a (or libgmp.so)"
  149. echo -e "\t\t\t[default is to search]"
  150. echo -e " --with-boost=ARG\tspecify location of the BOOST header files (without the trailing /boost)"
  151. echo -e "\t\t\t[default is to search]"
  152. echo -e " --threadsafe-hack\tcompile using a hack for threadsafety"
  153. echo -e " --mode=ARG\t\tspecify OPT/DEBUG1/DEBUG2/PROFILE [default: OPT]"
  154. echo -e "\nOptional_libraries:"
  155. echo -e " --no-readline\tdo not look for libreadline.a"
  156. echo -e " --with-libreadline=ARG\tspecify location of the file libreadline.a"
  157. echo -e "\t\t\t[default is to search for libreadline.a]"
  158. echo -e " --with-libcddgmp=ARG\tspecify location of the file libcddgmp.a"
  159. echo -e "\t\t\t[default is no libcddgmp.a]"
  160. echo -e " --with-libfrobby=ARG\tspecify location of the file libfrobby.a"
  161. echo -e "\t\t\t[default is no libfrobby]"
  162. echo -e " --with-libgfan=ARG\tspecify location of the file libgfan.a"
  163. echo -e "\t\t\t[default is no libgfan]"
  164. echo -e " --with-libgsl=ARG\tspecify location of the file libgsl.a"
  165. echo -e "\t\t\t[default is no libgsl]"
  166. echo -e " --with-libnormaliz=ARG\tspecify location of the file libnormaliz.a"
  167. echo -e "\t\t\t[default is no libnormaliz]"
  168. echo -e "\nInstallation:"
  169. echo -e " --prefix=PREFIX\tinstall in PREFIX/include & PREFIX/lib"
  170. echo -e "\t\t\t[default: /usr/local]"
  171. exit;;
  172. ( * )
  173. echobox "ERROR: unrecognized option/parameter \"$option\""
  174. echo
  175. echo "HINT: try \"$0 --help\" for guidance"
  176. exit 1;;
  177. esac
  178. done
  179. if [ "$AVOID_READLINE" = yes -a \! -z "$READLINE_LIB" ]
  180. then
  181. echo "$0: incompatible inputs for readline"
  182. exit 1
  183. fi
  184. ##################################################################
  185. echo "Starting configuration process for CoCoALib..."
  186. echo
  187. ##################################################################
  188. # Rename the old configuration file (if it exists).
  189. # Do this early so that after a failed configure it is not
  190. # not possible to compile
  191. if [ -f "$CONFIG_FILE" ]
  192. then
  193. /bin/rm -rf "$CONFIG_FILE.old"
  194. /bin/mv "$CONFIG_FILE" "$CONFIG_FILE.old"
  195. echo "-------------------------------------------------------"
  196. echo "**NOTE** moved previous config file into $CONFIG_FILE.old"
  197. echo "-------------------------------------------------------"
  198. echo
  199. fi
  200. ##################################################################
  201. # Check the compiler.
  202. # If user didn't specify a compiler, we assume g++.
  203. if [ -z "$CXX" ]
  204. then
  205. CXX=g++
  206. fi
  207. # Check compiler and flags are sane.
  208. # If there's a problem, result is error message & return code is non-zero.
  209. # If all is well, result is either "gnu" or "not gnu" & return code is 0.
  210. CXX_TYPE=`$SCRIPT_DIR/verify-compiler.sh "$CXX" "$CXXFLAGS"`
  211. if [ $? -ne 0 ]
  212. then
  213. echo "ERROR: $CXX_TYPE" > /dev/stderr
  214. echo "ERROR: Check the options --with-cxx=... and --with-cxxflags=..." > /dev/stderr
  215. echo "ERROR: (or the environment variables CXX and CXXFLAGS)." > /dev/stderr
  216. exit 1
  217. fi
  218. # Next line required by the scripts which check GMP (see below).
  219. export CXX
  220. export CXXFLAGS
  221. ##################################################################
  222. # -- EXTERNAL LIBRARIES -- ############################
  223. ##################################################################
  224. # Prepare subtree for symlinks to external libs
  225. EXTLIBS=configuration/ExternalLibs
  226. /bin/rm -rf $EXTLIBS
  227. mkdir $EXTLIBS
  228. mkdir $EXTLIBS/lib
  229. mkdir $EXTLIBS/include
  230. ##################################################################
  231. # external library: GMP
  232. ##################################################################
  233. # Now obtain and check the GMP installation.
  234. # Establish the location of the GMP library.
  235. # Check whether user supplied the location of the GMP library; if not, we search for it.
  236. if [ -n "$GMP_LIB" ]
  237. then
  238. # User supplied a path to the GMP library.
  239. # Check it is at least a readable file.
  240. # Convert the file name into an absolute path (in case it was not).
  241. if [ \! -f "$GMP_LIB" -o \! -r "$GMP_LIB" ]
  242. then
  243. echo "ERROR: Specified GMP library is not a readable file \"$GMP_LIB\""
  244. exit 1
  245. fi
  246. # These two lines should make sure GMP_LIB is an absolute path.
  247. GMP_DIR=`dirname "$GMP_LIB"`
  248. GMP_LIB=`cd "$GMP_DIR"; pwd`/`basename "$GMP_LIB"`
  249. GMP_LIB_EXTN=`$SCRIPT_DIR/extn.sh "$GMP_LIB"`
  250. /bin/ln -s "$GMP_LIB" $EXTLIBS/lib/libgmp-symlink.$GMP_LIB_EXTN
  251. HAVE_DEFAULT_GMP=no
  252. else
  253. # User did not supply path to GMP library, so we try to use defaults.
  254. # That means we do NOT specify any paths just add -lgmp and maybe -lgmpxx.
  255. GMP_TRY_DEFAULT=`$SCRIPT_DIR/gmp-try-default.sh` # uses CXX & CXXFLAGS
  256. if [ $? -eq 0 ]
  257. then
  258. HAVE_DEFAULT_GMP=yes
  259. # System defaults for GMP work fine.
  260. GMP_LIB=
  261. if [ "$GMP_TRY_DEFAULT" = "GMPXX" ]
  262. then
  263. GMPXX_LIB=
  264. HAVE_GMPXX=yes
  265. else
  266. HAVE_GMPXX=no
  267. fi
  268. else
  269. # Default GMP library not found, so we search for it.
  270. HAVE_DEFAULT_GMP=no
  271. GMP_MESG=`$SCRIPT_DIR/gmp-find.sh`
  272. if [ $? -ne 0 ]
  273. then
  274. # Something went wrong; so GMP_MESG contains an error message.
  275. echo "ERROR: Problem with GMP -- abandoning configuration of CoCoALib." > /dev/stderr
  276. echo "ERROR: You can provide the path to libgmp.a (or libgmp.so) using" > /dev/stderr
  277. echo "ERROR: the \"--with-libgmp=\" command line option to $0." > /dev/stderr
  278. echo "ERROR: $GMP_MESG" > /dev/stderr
  279. exit 1
  280. else
  281. # gmp-find.sh script worked, so message is full path of GMP library
  282. /bin/ln -s "$GMP_MESG" $EXTLIBS/lib/libgmp-symlink.a
  283. GMP_LIB="$GMP_MESG"
  284. fi
  285. fi
  286. fi
  287. # If GMP is not a default library, search for the header file
  288. # (and put symlink in $EXTLIBS/include).
  289. if [ $HAVE_DEFAULT_GMP = "no" ]
  290. then
  291. GMP_INC_DIR=`$SCRIPT_DIR/gmp-find-hdr.sh "$GMP_LIB"`
  292. if [ $? -ne 0 ]
  293. then
  294. # Something went wrong; details are in GMP_INC_DIR
  295. echo "ERROR: Unable to locate header for GMP library $GMP_LIB" > /dev/stderr
  296. echo "ERROR: $GMP_INC_DIR" > /dev/stderr
  297. exit 1
  298. fi
  299. GMP_H="$GMP_INC_DIR/gmp.h"
  300. /bin/ln -s "$GMP_H" $EXTLIBS/include/gmp.h
  301. fi
  302. GMP_VERSION=`$SCRIPT_DIR/gmp-version.sh`
  303. if [ $? -ne 0 ]
  304. then
  305. # GMP version script had trouble and printed out an error mesg.
  306. exit 1
  307. fi
  308. if [ "$GMP_VERSION" \< "4.2.3" ]
  309. then
  310. echo "ERROR: Your GMP installation is too old!" > /dev/stderr
  311. echo "ERROR: Please update to a newer version, then reconfigure CoCoALib." > /dev/stderr
  312. exit 1
  313. fi
  314. # 20140901 warn about old GMP; soon we shall REQUIRE a more recent version.
  315. if [ "$GMP_VERSION" \< "5.1.0" ]
  316. then
  317. WARNINGS="old GMP (incompat with C++11); $WARNINGS"
  318. echo ""; sleep 1; echo ""
  319. echo "WARNING: Your GMP installation is rather old (version: $GMP_VERSION)" > /dev/stderr
  320. echo "WARNING: We recommend you update to a newer version." > /dev/stderr
  321. echo ""; sleep 1; echo ""
  322. sleep 1
  323. fi
  324. # See which (-m***) compilation flags GMP used; we shall use the same ones.
  325. CXXFLAGS_FOR_GMP=`$SCRIPT_DIR/gmp-cxx-flags.sh`
  326. if [ $? -ne 0 ]
  327. then
  328. echo "$CXXFLAGS_FOR_GMP"
  329. exit 1
  330. fi
  331. # If user supplied CXXFLAGS, check they are compatible with GMP
  332. if [ -n "$CXXFLAGS" ]
  333. then
  334. ( cd $SCRIPT_DIR; ./gmp-check-cxxflags.sh "$CXXFLAGS_FOR_GMP" )
  335. if [ $? -ne 0 ]
  336. then
  337. echo "ERROR: Supplied value of CXXFLAGS, namely \"$CXXFLAGS\"" > /dev/stderr
  338. echo "ERROR: is not compatible with GMP library" > /dev/stderr
  339. exit 1
  340. fi
  341. fi
  342. if [ $HAVE_DEFAULT_GMP = "no" ]
  343. then
  344. # Now make "intelligent guess" for the full path of libgmpxx.
  345. # For the moment we do NOT CHECK if our guess was good
  346. # (we will check later if we are using Frobby).
  347. GMP_LIB_EXTN=`$SCRIPT_DIR/extn.sh "$GMP_LIB"`
  348. GMPXX_LIB=`dirname "$GMP_LIB"`/libgmpxx.$GMP_LIB_EXTN
  349. GMPXX_H="$GMP_INC_DIR/gmpxx.h"
  350. if [ -f "$GMPXX_LIB" -a -r "$GMPXX_LIB" -a -f "$GMPXX_H" -a -r "$GMPXX_H" ]
  351. then
  352. HAVE_GMPXX=yes
  353. else
  354. HAVE_GMPXX=no
  355. fi
  356. if [ $HAVE_GMPXX = "yes" ]
  357. then
  358. /bin/ln -s "$GMPXX_LIB" $EXTLIBS/lib/libgmpxx-symlink.$GMP_LIB_EXTN
  359. fi
  360. # Tell user which version of GMP we are using.
  361. echo "Using GMP version $GMP_VERSION:"
  362. # echo " library is in \"$GMP_LIB\""
  363. echo " library is in " `readlink $EXTLIBS/lib/libgmp-symlink.a`
  364. echo " header is in " `readlink $EXTLIBS/include/gmp.h`
  365. # echo " header is in \"$GMP_INC_DIR/gmp.h\""
  366. echo
  367. else # $HAVE_DEFAULT_GMP = "yes"
  368. if [ $HAVE_GMPXX = "yes" ]
  369. then
  370. echo "Using system default GMP+GMPXX, version $GMP_VERSION"
  371. else
  372. echo "Using system default GMP, version $GMP_VERSION"
  373. fi
  374. echo
  375. fi
  376. ##################################################################
  377. # external library: READLINE
  378. ##################################################################
  379. # Check whether libreadline is available; if so, we will use it
  380. # for compiling CoCoAInterpreter
  381. HAVE_READLINE=no
  382. if [ -z "$AVOID_READLINE" ]
  383. then
  384. if [ -z "$READLINE_LIB" ]
  385. then
  386. # No libreadline specified, so look for an installed version
  387. $SCRIPT_DIR/readline-try-default.sh > /dev/null 2>& 1
  388. if [ $? = 0 ]
  389. then
  390. HAVE_READLINE=yes
  391. # Note that -lreadline includes also -lncurses or -ltermcap
  392. READLINE_LIB="-lreadline"
  393. else
  394. WARNINGS="libreadline not installed; $WARNINGS"
  395. echo "WARNING: readline is not installed"
  396. fi
  397. else
  398. # user specified a libreadline
  399. if [ \! "/$READLINE_LIB" -ef "$READLINE_LIB" ]
  400. then
  401. echo "ERROR: supplied libreadline path is not absolute: $READLINE_LIB"
  402. exit 1
  403. fi
  404. if [ \! -f "$READLINE_LIB" -o \! -r "$READLINE_LIB" ]
  405. then
  406. echo "ERROR: cannot read supplied libreadline: $READLINE_LIB"
  407. exit 1
  408. fi
  409. # User supplied abs path to a readable file.
  410. READLINE_HDR=`$SCRIPT_DIR/readline-find-hdr.sh "$READLINE_LIB"`
  411. if [ $? -ne 0 ]
  412. then
  413. echo "ERROR: cannot find header file for the specified libreadline." > /dev/stderr
  414. exit 1
  415. fi
  416. LIBTERMCAP=`$SCRIPT_DIR/readline-check-cxxflags.sh "$READLINE_HDR" "$READLINE_LIB"`
  417. if [ $? = 0 ]
  418. then
  419. HAVE_READLINE=yes
  420. READLINE_LIB="$READLINE_LIB $LIBTERMCAP"
  421. fi
  422. fi
  423. fi
  424. if [ $HAVE_READLINE = yes ]
  425. then
  426. READLINE_FLAG="-DCoCoA_WITH_READLINE"
  427. fi
  428. ##################################################################
  429. # Check whether "qmake" is available -- needed for building the GUI
  430. # Assume that if "qmake" is available then all of QT is too.
  431. # Also check that "qmake" actually runs (Ubuntu 14.04 can have a broken symlink)
  432. HAVE_QMAKE=no
  433. QMAKE=`which qmake 2>/dev/null`
  434. if [ $? = 0 ]
  435. then
  436. QMAKE=`[ -x "$QMAKE" ] && qmake -help 2>&1 >/dev/null`
  437. if [ $? = 0 ]
  438. then
  439. HAVE_QMAKE=yes
  440. fi
  441. fi
  442. if [ $HAVE_QMAKE = no ]
  443. then
  444. WARNINGS="no qmake (so no CoCoA5 GUI); $WARNINGS"
  445. fi
  446. ##################################################################
  447. # external library: BOOST
  448. ##################################################################
  449. # BOOST installation
  450. # Since BOOST is not (currently) essential for CoCoALib, we do
  451. # not give an error if the boost-find-hdrs.sh script cannot find it.
  452. # If a unique BOOST installation was not found, we set
  453. # BOOST_HDRS_NOT_FOUND to the error mesg (o/w it is left empty).
  454. # Otherwise the full path of the unique dir containing header files
  455. # is put in BOOST_INC_DIR.
  456. if [ -z "$BOOST_INC_DIR" ]
  457. then
  458. BOOST_MESG=`$SCRIPT_DIR/boost-find-hdrs.sh`
  459. BOOST_FIND_HDRS_EXIT_CODE=$?
  460. if [ $BOOST_FIND_HDRS_EXIT_CODE = 2 ] # 2 means terminating error
  461. then
  462. echo "$BOOST_MESG" > /dev/stderr
  463. exit 1
  464. fi
  465. if [ $BOOST_FIND_HDRS_EXIT_CODE = 0 ]
  466. then
  467. BOOST_INC_DIR="$BOOST_MESG"
  468. HAVE_BOOST_HDRS=yes
  469. else
  470. HAVE_BOOST_HDRS=no
  471. echo "CONFIGURATION COMMENT"
  472. echo "$BOOST_MESG"
  473. echo "Proceeding without BOOST"
  474. fi
  475. else
  476. # User supplied a path to the BOOST directory.
  477. # Check it is at least a readable file.
  478. # Convert the file name into an absolute path (in case it was not).
  479. HAVE_BOOST_HDRS=yes
  480. if [ \! -d "$BOOST_INC_DIR" -o \! -r "$BOOST_INC_DIR" ]
  481. then
  482. echo "ERROR: the specified BOOST header directory does not exist or is unreadable" > /dev/stderr
  483. echo "ERROR: path specified was $BOOST_INC_DIR" > /dev/stderr
  484. exit 1
  485. fi
  486. if [ \! -d "$BOOST_INC_DIR/boost" ]
  487. then
  488. echo "ERROR: the specified BOOST header directory does not contain subdirectory \"boost\"" > /dev/stderr
  489. if [ "`basename \"$BOOST_INC_DIR\"`" = "boost" ]
  490. then
  491. echo "ERROR: Perhaps you should simply remove the final path component?" > /dev/stderr
  492. fi
  493. exit 1
  494. fi
  495. fi
  496. # At this point either HAVE_BOOST_HDRS = "yes" (in which case BOOST_INC_DIR contains a plausible path)
  497. # or HAVE_BOOST_HDRS = "no" (and BOOST_MESG might explain why)
  498. if [ "$HAVE_BOOST_HDRS" = "yes" ]
  499. then
  500. BOOST_INC_DIR=`cd "$BOOST_INC_DIR"; pwd`
  501. if [ "$BOOST_INC_DIR" != /usr/local/include -a "$BOOST_INC_DIR" != /usr/include ]
  502. then
  503. /bin/ln -s "$BOOST_INC_DIR/boost" $EXTLIBS/include/
  504. fi
  505. BOOST_MESG=`$SCRIPT_DIR/boost-find-lib.sh "$BOOST_INC_DIR"`
  506. if [ $? -ne 0 ]
  507. then
  508. BOOST_LIB_NOT_FOUND="$BOOST_MESG"
  509. else
  510. eval "$BOOST_MESG" # sets BOOST_LIB_DIR and BOOST_LDLIBS
  511. BOOST_LIB_NOT_FOUND=
  512. # Check that the BOOST libs are compatible with CXX and CXXFLAGS
  513. BOOST_MESG=`$SCRIPT_DIR/boost-check-arch.sh "$CXXFLAGS_FOR_GMP" "$BOOST_LDLIBS"`
  514. if [ $? -ne 0 ]
  515. then
  516. BOOST_LIB_NOT_FOUND="BOOST libs incompatible with GMP lib!"
  517. WARNINGS="BOOST not found; $WARNINGS"
  518. echo "***WARNING*** $BOOST_LIB_NOT_FOUND"
  519. echo "***WARNING*** Proceeding without BOOST"
  520. BOOST_LDLIBS=
  521. fi
  522. fi
  523. fi
  524. # Set HAVE_BOOST "english boolean"
  525. if [ "$HAVE_BOOST_HDRS" = "yes" -a -z "$BOOST_LIB_NOT_FOUND" ]
  526. then
  527. HAVE_BOOST=yes
  528. else
  529. HAVE_BOOST=no
  530. fi
  531. # Tell user which BOOST we are using.
  532. if [ "$HAVE_BOOST" = "yes" ]
  533. then
  534. BOOST_FLAG="-DCoCoA_WITH_BOOST"
  535. echo "Using BOOST:"
  536. echo " header files are in $BOOST_INC_DIR"
  537. echo " library files are in $BOOST_LIB_DIR"
  538. else
  539. echo
  540. echo "Not using BOOST ==> compilation of CoCoA5+GUI disabled"
  541. if [ "$HAVE_BOOST_HDRS" = "yes" ]
  542. then
  543. echo "$BOOST_LIB_NOT_FOUND" | fold -s
  544. fi
  545. fi
  546. echo
  547. if [ $HAVE_BOOST = "yes" -a $HAVE_QMAKE = "no" ]
  548. then
  549. echo "Note: we will build CoCoA5 ***without*** GUI because \"qmake\" is absent"
  550. echo
  551. fi
  552. ##################################################################
  553. # external library: CDD (GMP)
  554. ##################################################################
  555. # Check the file passed as CDD library is at least a readable file.
  556. # Convert the file name into an absolute path (in case it was not).
  557. if [ -n "$CDD_LIB" ]
  558. then
  559. if [ \! -f "$CDD_LIB" -o \! -r "$CDD_LIB" ]
  560. then
  561. echo "ERROR: Specified CDD library is not a readable file \"$CDD_LIB\""
  562. exit 1
  563. fi
  564. HAVE_CDD=yes
  565. # These three lines should make sure CDD_LIB is an absolute path.
  566. CDD_LIB_NAME=`basename "$CDD_LIB"`
  567. CDD_LIB_EXTN=`$SCRIPT_DIR/extn.sh "$CDD_LIB_NAME"`
  568. CDD_LIB_DIR=`dirname "$CDD_LIB"`
  569. CDD_LIB_DIR=`cd "$CDD_LIB_DIR"; pwd`
  570. CDD_LIB="$CDD_LIB_DIR/$CDD_LIB_NAME"
  571. CDD_INC_DIR="$CDD_LIB_DIR"
  572. CDD_FLAG="-DCoCoA_WITH_CDD"
  573. if [ \! -d "$CDD_INC_DIR" ]
  574. then
  575. echo "ERROR: Did not find CDD header file where expected, in dir: \"$CDD_INC_DIR\""
  576. exit 1
  577. fi
  578. /bin/ln -s "$CDD_LIB" $EXTLIBS/lib/libcddgmp-symlink.$CDD_LIB_EXTN
  579. /bin/ln -s "$CDD_INC_DIR" $EXTLIBS/include
  580. else
  581. HAVE_CDD=no
  582. fi
  583. ##################################################################
  584. # external library: FROBBY
  585. ##################################################################
  586. # Check the file passed as libfrobby.a is at least a readable file.
  587. # Convert the file name into an absolute path (in case it was not).
  588. if [ -n "$FROBBY_LIB" ]
  589. then
  590. if [ \! -f "$FROBBY_LIB" -o \! -r "$FROBBY_LIB" ]
  591. then
  592. echo "ERROR: Specified FROBBY library is not a readable file \"$FROBBY_LIB\""
  593. exit 1
  594. fi
  595. if [ $HAVE_GMPXX = "no" ]
  596. then
  597. echo "ERROR: Frobby needs libgmpxx but your GMP installation does not have it." > /dev/stderr
  598. echo "ERROR: Please specify a GMP installation with libgmpxx, or rebuild GMP" > /dev/stderr
  599. echo "specifying that you want the C++ library too (see GMP doc for details)." > /dev/stderr
  600. exit 1
  601. fi
  602. # These lines should put absolute paths in FROBBY_LIB and FROBBY_DIR.
  603. HAVE_FROBBY=yes
  604. FROBBY_LIB_DIR=`dirname "$FROBBY_LIB"`
  605. FROBBY_LIB_DIR=`cd "$FROBBY_LIB_DIR"; pwd`
  606. FROBBY_LIB="$FROBBY_LIB_DIR"/`basename "$FROBBY_LIB"`
  607. FROBBY_LIB_EXTN=`$SCRIPT_DIR/extn.sh "$FROBBY_LIB"`
  608. /bin/ln -s "$FROBBY_LIB" $EXTLIBS/lib/libfrobby-symlink.$FROBBY_LIB_EXTN
  609. /bin/ln -s `dirname "$FROBBY_LIB_DIR"`/src/frobby.h $EXTLIBS/include
  610. if [ $? -ne 0 ]
  611. then
  612. echo "ERROR: frobby.h header file not found in `dirname \"$FROBBY_LIB_DIR\"`"
  613. exit 1
  614. fi
  615. ### FROBBY_DIR=`cd "$FROBBY_LIB_DIR"/..; pwd`
  616. FROBBY_FLAG="-DCoCoA_WITH_FROBBY"
  617. else
  618. HAVE_FROBBY=no
  619. fi
  620. ##################################################################
  621. # external library: GFAN
  622. ##################################################################
  623. # Check the file passed as GFAN library is at least a readable file.
  624. # Convert the file name into an absolute path (in case it was not).
  625. if [ -n "$GFAN_LIB" ]
  626. then
  627. if [ \! -f "$GFAN_LIB" -o \! -r "$GFAN_LIB" ]
  628. then
  629. echo "ERROR: Specified GFAN library is not a readable file \"$GFAN_LIB\""
  630. exit 1
  631. fi
  632. HAVE_GFAN=yes
  633. # These three lines should make sure GFAN_LIB is an absolute path.
  634. GFAN_LIB_NAME=`basename "$GFAN_LIB"`
  635. GFAN_LIB_EXTN=`$SCRIPT_DIR/extn.sh "$GFAN_LIB_NAME"`
  636. GFAN_LIB_DIR=`dirname "$GFAN_LIB"`
  637. GFAN_LIB_DIR=`cd "$GFAN_LIB_DIR"; pwd`
  638. GFAN_LIB="$GFAN_LIB_DIR/$GFAN_LIB_NAME"
  639. GFAN_INC_DIR="$GFAN_LIB_DIR"
  640. GFAN_FLAG="-DCoCoA_WITH_GFAN"
  641. if [ \! -d "$GFAN_INC_DIR" ]
  642. then
  643. echo "ERROR: Did not find GFAN header file where expected, in dir: \"$GFAN_INC_DIR\""
  644. exit 1
  645. fi
  646. /bin/ln -s "$GFAN_LIB" $EXTLIBS/lib/libgfan-symlink.$GFAN_LIB_EXTN
  647. /bin/ln -s "$GFAN_INC_DIR" $EXTLIBS/include
  648. else
  649. HAVE_GFAN=no
  650. fi
  651. ##################################################################
  652. # external library: GSL
  653. ##################################################################
  654. # Check the file passed as GSL library is at least a readable file.
  655. # Convert the file name into an absolute path (in case it was not).
  656. if [ -n "$GSL_LIB" ]
  657. then
  658. if [ \! -f "$GSL_LIB" -o \! -r "$GSL_LIB" ]
  659. then
  660. echo "ERROR: Specified GSL library is not a readable file \"$GSL_LIB\""
  661. exit 1
  662. fi
  663. HAVE_GSL=yes
  664. # These three lines should make sure GSL_LIB is an absolute path.
  665. GSL_LIB_NAME=`basename "$GSL_LIB"`
  666. GSL_LIB_EXTN=`$SCRIPT_DIR/extn.sh "$GSL_LIB_NAME"`
  667. GSL_LIB_DIR=`dirname "$GSL_LIB"`
  668. GSL_LIB_DIR=`cd "$GSL_LIB_DIR"; pwd`
  669. GSL_LIB="$GSL_LIB_DIR/$GSL_LIB_NAME"
  670. if [ "`basename \"$GSL_LIB_DIR\"`" = ".libs" ]
  671. then
  672. GSL_INC_DIR="`dirname \"$GSL_LIB_DIR\"`/gsl"
  673. else
  674. GSL_INC_DIR="`dirname \"$GSL_LIB_DIR\"`/include/gsl"
  675. fi
  676. GSL_FLAG="-DCoCoA_WITH_GSL"
  677. if [ \! -d "$GSL_INC_DIR" ]
  678. then
  679. echo "ERROR: Did not find GSL header file where expected, in dir: \"$GSL_INC_DIR\""
  680. exit 1
  681. fi
  682. /bin/ln -s "$GSL_LIB" $EXTLIBS/lib/libgsl-symlink.$GSL_LIB_EXTN
  683. /bin/ln -s "$GSL_INC_DIR" $EXTLIBS/include
  684. else
  685. HAVE_GSL=no
  686. fi
  687. ##################################################################
  688. # external library: NORMALIZ
  689. ##################################################################
  690. # Check the path passed as libnormaliz is at least a readable file.
  691. # Make the path absolute (in case it was not).
  692. if [ -n "$NORMALIZ_LIB" ]
  693. then
  694. if [ \! -f "$NORMALIZ_LIB" -o \! -r "$NORMALIZ_LIB" ]
  695. then
  696. echo "ERROR: Specified NORMALIZ library is not a readable file \"$NORMALIZ_LIB\""
  697. echo
  698. exit 1
  699. fi
  700. HAVE_NORMALIZ=yes
  701. # These lines should put absolute paths in NORMALIZ_LIB and NORMALIZ_DIR.
  702. NORMALIZ_LIB_NAME=`basename "$NORMALIZ_LIB"`
  703. NORMALIZ_LIB_EXTN=`$SCRIPT_DIR/extn.sh "$NORMALIZ_LIB_NAME"`
  704. NORMALIZ_LIB_DIR=`dirname "$NORMALIZ_LIB"`
  705. NORMALIZ_LIB_DIR=`cd "$NORMALIZ_LIB_DIR"; pwd`
  706. NORMALIZ_LIB="$NORMALIZ_LIB_DIR"/"$NORMALIZ_LIB_NAME"
  707. NORMALIZ_INC_DIR="$NORMALIZ_LIB_DIR/../../source/libnormaliz"
  708. # Hack to handle case of installed libnormaliz...
  709. if [ \! -f "$NORMALIZ_INC_DIR/libnormaliz.h" ]
  710. then
  711. NORMALIZ_INC_DIR="$NORMALIZ_LIB_DIR/../include/libnormaliz"
  712. fi
  713. # End of hack
  714. NORMALIZ_FLAG="-DCoCoA_WITH_NORMALIZ"
  715. if [ $HAVE_BOOST_HDRS = "no" ]
  716. then
  717. echo "ERROR: Normaliz requires BOOST." > /dev/stderr
  718. echo "ERROR: You can provide the path to boost header dir using" > /dev/stderr
  719. echo "ERROR: the \"--with-boost=\" command line option to $0." > /dev/stderr
  720. echo "ERROR: $BOOST_HDRS_NOT_FOUND" > /dev/stderr
  721. exit 1
  722. fi
  723. if [ $HAVE_GMPXX = "no" ]
  724. then
  725. echo "ERROR: Normaliz requires libgmpxx." > /dev/stderr
  726. echo "ERROR: Please use the command line option \"--with-libgmp=\" to specify" > /dev/stderr
  727. echo "ERROR: a GMP installation with libgmpxx, or rebuild GMP specifying that" > /dev/stderr
  728. echo "ERROR: you want the C++ library too (see GMP doc for details)." > /dev/stderr
  729. exit 1
  730. fi
  731. /bin/ln -s "$NORMALIZ_LIB" $EXTLIBS/lib/libnormaliz-symlink.$NORMALIZ_LIB_EXTN
  732. /bin/ln -s "$NORMALIZ_INC_DIR" $EXTLIBS/include/
  733. else
  734. HAVE_NORMALIZ=no
  735. fi
  736. ##################################################################
  737. # Decide which "optimization" flags to use:
  738. # if the compiler is type "gnu" then we use -O2
  739. # otherwise we just use -O
  740. if [ "$CXX_TYPE" = "gnu" ]
  741. then
  742. OPT_FLAG=-O2
  743. if [ -z "$CXXFLAGS" ]
  744. then
  745. FPIC=`$SCRIPT_DIR/fpic-flag.sh "$CXX"`
  746. CXXFLAGS="-Wall -pedantic $FPIC"
  747. LDFPIC=`$SCRIPT_DIR/fpic-ldflag.sh "$CXX"`
  748. fi
  749. else
  750. OPT_FLAG=-O
  751. fi
  752. # Some special handling for Normaliz..
  753. if [ $HAVE_NORMALIZ = "yes" ]
  754. then
  755. # Hack to allow Normaliz to use longlong
  756. # later versions of g++ allow the flag -std=c++11, but I'm
  757. # stuck on a horrible Mac with version 4.2 :-(
  758. if [ "$CXX_TYPE" = "gnu" -a -n "$NORMALIZ_FLAG" ]
  759. then
  760. NORMALIZ_FLAG="$NORMALIZ_FLAG -Wno-long-long"
  761. fi
  762. # Check whether Normaliz was compiled with OpenMP
  763. NORMALIZ_WITH_OPENMP=`$SCRIPT_DIR/normaliz-with-openmp.sh "$NORMALIZ_LIB"`
  764. if [ -n "$NORMALIZ_WITH_OPENMP" ]
  765. then
  766. CXXFLAGS_DEFINES_COMMON="$CXXFLAGS_DEFINES_COMMON -fopenmp"
  767. fi
  768. fi
  769. # Ugly hack to produce a threadsafe compilation:
  770. if [ "$THREADSAFE_HACK" = "yes" ]
  771. then
  772. CXXFLAGS_DEFINES_COMMON="$CXXFLAGS_DEFINES_COMMON -DCoCoA_THREADSAFE_HACK"
  773. fi
  774. CXXFLAGS_COMMON="$CXXFLAGS $CXXFLAGS_FOR_GMP"
  775. CXXFLAGS_DEFINES_COMMON="$CXXFLAGS_DEFINES_COMMON $BOOST_FLAG $CDD_FLAG $FROBBY_FLAG $GFAN_FLAG $GSL_FLAG $NORMALIZ_FLAG $READLINE_FLAG"
  776. CXXFLAGS_OPT="$OPT_FLAG"
  777. CXXFLAGS_DEBUG1="-Wextra -g"; CXXFLAGS_DEFINES_DEBUG1="-DCoCoA_DEBUG"
  778. CXXFLAGS_DEBUG2="-Wextra -g"; CXXFLAGS_DEFINES_DEBUG2="-DCoCoA_DEBUG -DCoCoA_MEMPOOL_DEBUG"
  779. CXXFLAGS_PROFILE="$OPT_FLAG -pg"
  780. ##################################################################
  781. # Determine custom CPP flags (& add them to CXXFLAGS_COMMON)
  782. CXX="$CXX" CXXFLAGS="$CXXFLAGS_COMMON $CXXFLAGS_OPT" UL2L="`$SCRIPT_DIR/cpp-flags.sh`"
  783. if [ $? -ne 0 ]
  784. then
  785. echo "***ERROR*** Customization failed"
  786. echo "***ERROR*** $UL2L"
  787. echo
  788. exit 1
  789. fi
  790. CXXFLAGS_DEFINES_COMMON="$UL2L $CXXFLAGS_DEFINES_COMMON"
  791. # Tell user the compiler and default compilation flags put in the Makefile.
  792. echo "The C++ compiler is $CXX"
  793. echo "The C++ compilation flags are \"$CXXFLAGS_COMMON $CXXFLAGS_DEFAULT\""
  794. echo
  795. ##################################################################
  796. ##################################################################
  797. # We have checked the compiler, GMP library etc., so now create the CONFIG_FILE
  798. ##################################################################
  799. # Place initial message and fixed_part1 in $CONFIG_FILE
  800. echo "# Makefile configuration for CoCoALib." > "$CONFIG_TMP"
  801. echo "# Created automatically by the configure script." >> "$CONFIG_TMP"
  802. echo "# Created on `date \"+%Y-%m-%d at time %H:%M:%S\"`" >> "$CONFIG_TMP"
  803. echo "# Command was: " >> "$CONFIG_TMP"
  804. echo "# $ORIG_CMD" >> "$CONFIG_TMP"
  805. echo >> "$CONFIG_TMP"
  806. /bin/cat "$CONFIG_DIR/fixed_part1" >> "$CONFIG_TMP"
  807. ##################################################################
  808. # Append the CoCoALib version number.
  809. source "$CONFIG_DIR/version"
  810. VERSION=$VER_MAJ.$VER_MIN$VER_PATCH
  811. echo "# Version number of CoCoALib we shall build." >> "$CONFIG_TMP"
  812. echo "VERSION=$VERSION" >> "$CONFIG_TMP"
  813. echo >> "$CONFIG_TMP"
  814. # Installation command and directory (just placeholders, 20140323)
  815. echo "Installation options are:"
  816. echo " directory INSTALL_DIR=$INSTALL_DIR"
  817. echo " command INSTALL=$INSTALL"
  818. echo
  819. echo "INSTALL_DIR=$INSTALL_DIR" >> "$CONFIG_TMP"
  820. echo "INSTALL=$INSTALL" >> "$CONFIG_TMP"
  821. echo >> "$CONFIG_TMP"
  822. echo "EXTLIBS=\$(COCOA_ROOT)/configuration/ExternalLibs" >> "$CONFIG_TMP"
  823. echo >> "$CONFIG_TMP"
  824. echo "# Compilation flags common to all cases:" >> "$CONFIG_TMP"
  825. echo "CXXFLAGS_COMMON=$CXXFLAGS_COMMON" >> "$CONFIG_TMP"
  826. echo "CXXFLAGS_DEFINES_COMMON=$CXXFLAGS_DEFINES_COMMON" >> "$CONFIG_TMP"
  827. echo >> "$CONFIG_TMP"
  828. echo "####################################################" >> "$CONFIG_TMP"
  829. echo "### SPECIFIC compilation flags -- CHOOSE ONE ###" >> "$CONFIG_TMP"
  830. echo "####################################################" >> "$CONFIG_TMP"
  831. #############################################################################
  832. # Output the various compilation cases.
  833. if [ "$MODE" = OPT ]
  834. then
  835. CXXFLAGS_DEFAULT="$CXXFLAGS_OPT"
  836. else
  837. HASH_OPT="#"
  838. fi
  839. if [ "$MODE" = DEBUG1 ]
  840. then
  841. CXXFLAGS_DEFAULT="$CXXFLAGS_DEBUG1 $CXXFLAGS_DEFINES_DEBUG1"
  842. else
  843. HASH_DEBUG1="#"
  844. fi
  845. if [ "$MODE" = DEBUG2 ]
  846. then
  847. CXXFLAGS_DEFAULT="$CXXFLAGS_DEBUG2 $CXXFLAGS_DEFINES_DEBUG2"
  848. else
  849. HASH_DEBUG2="#"
  850. fi
  851. if [ "$MODE" = PROFILE ]
  852. then
  853. CXXFLAGS_DEFAULT="$CXXFLAGS_PROFILE"
  854. else
  855. HASH_PROFILE="#"
  856. fi
  857. echo "### Case (1): compile optimized and without debugging" >> "$CONFIG_TMP"
  858. echo "$HASH_OPT CXXFLAGS_SPECIFIC=$CXXFLAGS_OPT" >> "$CONFIG_TMP"
  859. echo "### Case (2): compile with debugging activated" >> "$CONFIG_TMP"
  860. echo "$HASH_DEBUG1 CXXFLAGS_SPECIFIC=$CXXFLAGS_DEBUG1" >> "$CONFIG_TMP"
  861. echo "$HASH_DEBUG1 CXXFLAGS_DEFINES_SPECIFIC=$CXXFLAGS_DEFINES_DEBUG1" >> "$CONFIG_TMP"
  862. echo "### Case (3): compile with full debugging activated" >> "$CONFIG_TMP"
  863. echo "$HASH_DEBUG2 CXXFLAGS_SPECIFIC=$CXXFLAGS_DEBUG2" >> "$CONFIG_TMP"
  864. echo "$HASH_DEBUG2 CXXFLAGS_DEFINES_SPECIFIC=$CXXFLAGS_DEFINES_DEBUG2" >> "$CONFIG_TMP"
  865. echo "### Case (4): compile with profiling activated" >> "$CONFIG_TMP"
  866. echo "$HASH_PROFILE CXXFLAGS_SPECIFIC=$CXXFLAGS_PROFILE" >> "$CONFIG_TMP"
  867. echo >> "$CONFIG_TMP"
  868. echo >> "$CONFIG_TMP"
  869. echo "# Actual compilation flags:" >> "$CONFIG_TMP"
  870. echo "CXXFLAGS=\$(CXXFLAGS_COMMON) \$(CXXFLAGS_SPECIFIC)" >> "$CONFIG_TMP"
  871. echo "CXXFLAGS_DEFINES=\$(CXXFLAGS_DEFINES_COMMON) \$(CXXFLAGS_DEFINES_SPECIFIC)" >> "$CONFIG_TMP"
  872. echo >> "$CONFIG_TMP"
  873. echo "######################################################" >> "$CONFIG_TMP"
  874. echo "# These variables were set by the configure script." >> "$CONFIG_TMP"
  875. echo >> "$CONFIG_TMP"
  876. echo "CXX=$CXX" >> "$CONFIG_TMP"
  877. echo >> "$CONFIG_TMP"
  878. # Add appropriate definitions to the config file, and version number in a comment.
  879. echo "# We use the following GMP installation:" >> "$CONFIG_TMP"
  880. echo "GMP_VERSION=$GMP_VERSION" >> "$CONFIG_TMP"
  881. if [ $HAVE_DEFAULT_GMP = "no" ]
  882. then
  883. echo "GMP_LIB=\$(EXTLIBS)/lib/libgmp-symlink.a" >> "$CONFIG_TMP"
  884. echo "GMP_LDLIB=-lgmp-symlink" >> "$CONFIG_TMP"
  885. if [ $HAVE_GMPXX = "yes" ]
  886. then
  887. echo "GMPXX_LIB=\$(EXTLIBS)/lib/libgmpxx-symlink.a" >> "$CONFIG_TMP"
  888. echo "GMPXX_LDLIB=-lgmpxx-symlink" >> "$CONFIG_TMP"
  889. fi
  890. else
  891. echo "GMP_LDLIB=-lgmp" >> "$CONFIG_TMP"
  892. if [ $HAVE_GMPXX = "yes" ]
  893. then
  894. echo "GMPXX_LDLIB=-lgmpxx" >> "$CONFIG_TMP"
  895. fi
  896. fi
  897. #### echo "GMP_INC_DIR=\"$GMP_INC_DIR\"" >> "$CONFIG_TMP"
  898. ## Anna-20090515: !!WARNING!! -isystem option did not work on my G4
  899. #### echo "GMP_INCLUDE=-isystem \$(GMP_INC_DIR)" >> "$CONFIG_TMP"
  900. echo >> "$CONFIG_TMP"
  901. echo "HAVE_QMAKE=$HAVE_QMAKE" >> "$CONFIG_TMP"
  902. echo >> "$CONFIG_TMP"
  903. # If BOOST libraries are present, put them in CONFIG file; otherwise
  904. # unset BOOST_INC_DIR & BOOST_LIBS
  905. echo "# BOOST settings:" >> "$CONFIG_TMP"
  906. echo "HAVE_BOOST=$HAVE_BOOST" >> "$CONFIG_TMP"
  907. ####if [ $HAVE_BOOST = "no" ]
  908. ####then
  909. ####else
  910. #### echo "BOOST_INC_DIR=\"$BOOST_INC_DIR\"" >> "$CONFIG_TMP"
  911. #### echo "BOOST_INCLUDE=-isystem \$(BOOST_INC_DIR)" >> "$CONFIG_TMP"
  912. #### echo "BOOST_LIBS=-L\"$BOOST_LIB_DIR\" $BOOST_LIBS" >> "$CONFIG_TMP"
  913. echo "BOOST_LDLIBS=$BOOST_LDLIBS" >> "$CONFIG_TMP"
  914. ####fi
  915. echo >> "$CONFIG_TMP"
  916. ##################################################################
  917. # settings for optional external libs
  918. echo "OPTIONAL external libraries:"
  919. # READLINE
  920. echo "# READLINE settings:" >> "$CONFIG_TMP"
  921. echo "HAVE_READLINE=$HAVE_READLINE" >> "$CONFIG_TMP"
  922. echo "HAVE_READLINE = $HAVE_READLINE $READLINE_LIB"
  923. if [ $HAVE_READLINE = "yes" ]
  924. then
  925. echo "READLINE_LDLIBS=$READLINE_LIB" >> "$CONFIG_TMP"
  926. fi
  927. echo >> "$CONFIG_TMP"
  928. # CDD
  929. echo "# CDD settings:" >> "$CONFIG_TMP"
  930. echo "HAVE_CDD=$HAVE_CDD" >> "$CONFIG_TMP"
  931. echo "HAVE_CDD = $HAVE_CDD $CDD_LIB"
  932. if [ $HAVE_CDD = "yes" ]
  933. then
  934. echo "CDD_LIBS=\$(EXTLIBS)/lib/libcddgmp-symlink.a" >> "$CONFIG_TMP"
  935. echo "CDD_LDLIBS=-lcddgmp-symlink" >> "$CONFIG_TMP"
  936. echo "CDD_VERSION=" >> "$CONFIG_TMP"
  937. fi
  938. echo >> "$CONFIG_TMP"
  939. # FROBBY
  940. echo "# FROBBY settings:" >> "$CONFIG_TMP"
  941. echo "HAVE_FROBBY=$HAVE_FROBBY" >> "$CONFIG_TMP"
  942. echo "HAVE_FROBBY = $HAVE_FROBBY $FROBBY_LIB"
  943. if [ $HAVE_FROBBY = "yes" ]
  944. then
  945. # Recall that GMPXX_LIB is the libgmpxx.a library
  946. echo "FROBBY_LIBS=\$(EXTLIBS)/lib/libfrobby-symlink.a \$(GMPXX_LIB)" >> "$CONFIG_TMP"
  947. echo "FROBBY_LDLIBS=-lfrobby-symlink" >> "$CONFIG_TMP"
  948. echo "FROBBY_VERSION=" >> "$CONFIG_TMP"
  949. fi
  950. echo >> "$CONFIG_TMP"
  951. # GFAN
  952. echo "# GFAN settings:" >> "$CONFIG_TMP"
  953. echo "HAVE_GFAN=$HAVE_GFAN" >> "$CONFIG_TMP"
  954. echo "HAVE_GFAN = $HAVE_GFAN $GFAN_LIB"
  955. if [ $HAVE_GFAN = "yes" ]
  956. then
  957. echo "GFAN_LIBS=\$(EXTLIBS)/lib/libgfan-symlink.a" >> "$CONFIG_TMP"
  958. echo "GFAN_LDLIBS=-lgfan-symlink" >> "$CONFIG_TMP"
  959. echo "GFAN_VERSION=" >> "$CONFIG_TMP"
  960. fi
  961. echo >> "$CONFIG_TMP"
  962. # GSL
  963. echo "# GSL settings:" >> "$CONFIG_TMP"
  964. echo "HAVE_GSL=$HAVE_GSL" >> "$CONFIG_TMP"
  965. echo "HAVE_GSL = $HAVE_GSL $GSL_LIB"
  966. if [ $HAVE_GSL = "yes" ]
  967. then
  968. #### echo "GSL_INC_DIR=\"$GSL_INC_DIR\"" >> "$CONFIG_TMP"
  969. #### echo "GSL_INCLUDE=-I \$(GSL_INC_DIR)" >> "$CONFIG_TMP"
  970. echo "GSL_LIBS=\$(EXTLIBS)/lib/libgsl-symlink.a" >> "$CONFIG_TMP"
  971. echo "GSL_LDLIBS=-lgsl-symlink -lblas -llapack" >> "$CONFIG_TMP"
  972. echo "GSL_VERSION=" >> "$CONFIG_TMP"
  973. fi
  974. echo >> "$CONFIG_TMP"
  975. # NORMALIZ
  976. echo "# Normaliz settings:" >> "$CONFIG_TMP"
  977. echo "HAVE_NORMALIZ=$HAVE_NORMALIZ" >> "$CONFIG_TMP"
  978. echo "HAVE_NORMALIZ = $HAVE_NORMALIZ $NORMALIZ_LIB"
  979. if [ $HAVE_NORMALIZ = "yes" ]
  980. then
  981. # Recall that GMPXX_LIB is the libgmpxx.a library
  982. echo "NORMALIZ_LIBS=\$(EXTLIBS)/lib/libnormaliz-symlink.a \$(GMPXX_LIB)" >> "$CONFIG_TMP"
  983. echo "NORMALIZ_LDLIBS=-lnormaliz-symlink" >> "$CONFIG_TMP"
  984. echo "NORMALIZ_VERSION=" >> "$CONFIG_TMP"
  985. fi
  986. echo >> "$CONFIG_TMP"
  987. # ### list of libraries
  988. # ### moved here from "fixed_part2" AMB 01/09/2015
  989. echo "LDLIBS=$LDFPIC \$(COCOA_LIB) -L\$(EXTLIBS)/lib \$(FROBBY_LDLIBS) \$(GFAN_LDLIBS) \$(CDD_LDLIBS) \$(GSL_LDLIBS) \$(NORMALIZ_LDLIBS) \$(GMPXX_LDLIB) \$(GMP_LDLIB) \$(SOCKET_LIB) \$(BOOST_LDLIBS) \$(READLINE_LDLIBS)" >> "$CONFIG_TMP"
  990. ##################################################################
  991. # Some platforms need a special library to use sockets.
  992. OSNAME=`uname`
  993. if [ "$OSNAME" = "SunOS" ]
  994. then
  995. SOCKET_LIB="-lsocket -lnsl"
  996. fi
  997. if [ -n "$SOCKET_LIB" ]
  998. then
  999. echo "SOCKET_LIB=$SOCKET_LIB" >> "$CONFIG_TMP"
  1000. fi
  1001. ##################################################################
  1002. # Append the second fixed part to $CONFIG_TMP, then rename to $CONFIG_FILE
  1003. /bin/cat "$CONFIG_DIR/fixed_part2" >> "$CONFIG_TMP"
  1004. /bin/mv "$CONFIG_TMP" "$CONFIG_FILE"
  1005. ##################################################################
  1006. # Configuration completed successfully. Print final message.
  1007. # Removing .last-makedepend forces a rebuild of the dependencies files
  1008. # (necessary e.g. if we change versions of external libs)
  1009. /bin/rm -f .last-makedepend
  1010. echo
  1011. echo "-------------------------------------------------------"
  1012. echo "CoCoALib configuration process complete."
  1013. echo "Configuration info saved in file $CONFIG_FILE"
  1014. if [ -n "$WARNINGS" ]
  1015. then
  1016. echo "======================================================="
  1017. echo "**WARNINGS** $WARNINGS"
  1018. fi
  1019. echo "-------------------------------------------------------"