source: releases/0.7.8/coin.m4 @ 2974

Last change on this file since 2974 was 2974, checked in by tkr, 7 years ago

Merging r2961:2963 from trunk

  • Property svn:keywords set to Author Date Id Revision
File size: 150.7 KB
Line 
1# Copyright (C) 2006, 2009 International Business Machines.
2# All Rights Reserved.
3# This file is distributed under the Eclipse Public License.
4#
5## $Id: coin.m4 2974 2013-10-15 15:11:01Z tkr $
6#
7# Author: Andreas Wachter    IBM      2006-04-14
8
9# This file defines the common autoconf macros for COIN
10#
11
12# Check requirements
13AC_PREREQ(2.59)
14
15###########################################################################
16#                           coin_foreach_w                                #
17###########################################################################
18
19# the autoconf version used by COIN-OR is so old that it does not have the M4 macro foreach_w.
20# thus, we define our own one which applies the foreach macro to the same arguments but with
21# all spaces replaced by ',' in the second argument.
22# further, we run the loop only if the second argument is not empty
23AC_DEFUN([coin_foreach_w], [m4_ifval([$2], [m4_foreach([$1], [m4_bpatsubsts([$2],[[     ]+],[, ])], [$3])])])
24
25###########################################################################
26#                            COIN_CHECK_FILE                              #
27###########################################################################
28
29# A simple replacement for AC_CHECK_FILE that works for cross compilation
30
31AC_DEFUN([AC_COIN_CHECK_FILE],
32[if test -r $1; then
33  $2
34  :
35else
36  $3
37  :
38fi
39])
40
41###########################################################################
42#                           COIN_CHECK_VPATH                              #
43###########################################################################
44
45# This macro sets the variable coin_vpath_config to true if this is a
46# VPATH configuration, otherwise it sets it to false.
47
48AC_DEFUN([AC_COIN_CHECK_VPATH],
49[
50AC_MSG_CHECKING(whether this is a VPATH configuration)
51if test `cd $srcdir; pwd` != `pwd`; then
52  coin_vpath_config=yes;
53else
54  coin_vpath_config=no;
55fi
56AC_MSG_RESULT($coin_vpath_config)
57]) # AC_COIN_CHECK_VPATH
58
59
60###########################################################################
61#                          COIN_PROJECTVERSION                            #
62###########################################################################
63
64# This macro is used by COIN_PROJECTDIR_INIT and sets up variables related
65# to versioning numbers of the project.
66
67AC_DEFUN([AC_COIN_PROJECTVERSION],
68[m4_ifvaln([$1],[
69  AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION), ["$PACKAGE_VERSION"],[Version number of project])
70 
71  [coin_majorver=`echo $PACKAGE_VERSION | sed -n -e 's/^\([0-9]*\).*/\1/gp'`]
72  [coin_minorver=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.\([0-9]*\).*/\1/gp'`]
73  [coin_releasever=`echo $PACKAGE_VERSION | sed -n -e 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/gp'`]
74  if test "x$coin_majorver" = x ; then coin_majorver=9999 ; fi
75  if test "x$coin_minorver" = x ; then coin_minorver=9999 ; fi
76  if test "x$coin_releasever" = x ; then coin_releasever=9999 ; fi
77  AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION_MAJOR),   [$coin_majorver],   [Major Version number of project])
78  AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION_MINOR),   [$coin_minorver],   [Minor Version number of project])
79  AC_DEFINE_UNQUOTED(m4_toupper($1_VERSION_RELEASE), [$coin_releasever], [Release Version number of project])
80
81  # We use the following variable to have a string with the upper case
82  # version of the project name
83  COIN_PRJCT=m4_toupper($1)
84
85  # Set the project's SVN revision number. The complicated sed expression
86  # (made worse by quadrigraphs) ensures that things like 4123:4168MS end up
87  # as a single number.
88  AC_CHECK_PROG([have_svnversion],[svnversion],[yes],[no])
89  if test "x$have_svnversion" = xyes; then
90    AC_SUBST(m4_toupper($1_SVN_REV))
91    svn_rev_tmp=`LANG=en_EN svnversion $srcdir 2>/dev/null`
92    if test "x$svn_rev_tmp" != xexported -a "x$svn_rev_tmp" != x -a "x$svn_rev_tmp" != "xUnversioned directory"; then
93      m4_toupper($1_SVN_REV)=`echo $svn_rev_tmp | sed -n -e 's/^@<:@0-9@:>@*://' -e 's/\(@<:@0-9@:>@\)@<:@^0-9@:>@*$/\1/p'`
94      AC_DEFINE_UNQUOTED(m4_toupper($1_SVN_REV), $m4_toupper($1_SVN_REV), [SVN revision number of project])
95    fi
96  fi
97 ])
98 
99# Capture libtool library version, if given.
100 m4_ifvaln([$2],[coin_libversion=$2],[])
101])
102
103###########################################################################
104#                         COIN_PROJECTDIR_INIT                            #
105###########################################################################
106
107# This macro does everything that is required in the early part in the
108# configure script, such as defining a few variables.  This should only be used
109# in the main directory of a project directory (the one which holds the src
110# directory for the project). The first parameter is the project name. The
111# second (optional) is the libtool library version (important for releases,
112# less so for stable or trunk).
113
114AC_DEFUN([AC_COIN_PROJECTDIR_INIT],
115[
116# As backup, we make sure we don't loose an FLIBS if it has been set
117# by the user
118save_FLIBS="$FLIBS"
119
120# A useful makefile conditional that is always false
121AM_CONDITIONAL(ALWAYS_FALSE, false)
122
123# We set the following variable so that we know later in AC_COIN_FINALIZE
124# that we are in a project main directory
125coin_projectdir=yes
126
127# Set the project's version numbers
128AC_COIN_PROJECTVERSION($1, $2)
129]) # AC_COIN_PROJECTDIR_INIT
130
131###########################################################################
132#                          COIN_DEBUG_COMPILE                             #
133###########################################################################
134
135# enable the configure flags --enable-debug and --enable-debug-prjct
136# (where prcjt is the name of the project in lower case) and set the
137# variable coin_debug_compile to true or false This is used by
138# COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the
139# compilation flags.  This macro also makes the switches
140# --with-prjct-verbosity and --with-prjct-checklevel available, which
141# define the preprocessor macros COIN_PRJCT_VERBOSITY and
142# COIN_PRJCT_CHECKLEVEL to the specified value (default is 0).
143#
144# The project specific flags are only made available, if one gives the
145# name of the project as first argument to this macro.
146
147AC_DEFUN([AC_COIN_DEBUG_COMPILE],
148[AC_BEFORE([$0],[AC_COIN_PROG_CXX])dnl
149AC_BEFORE([$0],[AC_COIN_PROG_CC])dnl
150AC_BEFORE([$0],[AC_COIN_PROG_F77])dnl
151
152AC_MSG_CHECKING([whether we want to compile in debug mode])
153
154AC_ARG_ENABLE([debug],
155[AC_HELP_STRING([--enable-debug],
156                [compile all projects with debug options tests (implies --disable-shared)])],
157[case "${enableval}" in
158   yes) coin_debug_compile=true
159        if test "${enable_shared+set}" = set; then :; else
160          enable_shared=no
161        fi
162        ;;
163   no)  coin_debug_compile=false
164        ;;
165   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
166        ;;
167esac],
168[coin_debug_compile=false])
169
170m4_ifvaln([$1],
171[AC_ARG_ENABLE(debug-m4_tolower($1),
172 [AC_HELP_STRING([--enable-debug-m4_tolower($1)],
173                 [compile project $1 with debug compiler flags])],
174 [case "${enableval}" in
175    yes) coin_debug_compile=true
176         ;;
177    no)  coin_debug_compile=false
178         ;;
179    *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1))
180         ;;
181 esac],[:])
182]) # m4_ifvaln([$1],
183
184if test $coin_debug_compile = true; then
185  AC_MSG_RESULT([yes])
186else
187  AC_MSG_RESULT([no])
188fi
189
190m4_ifvaln([$1],
191[AC_ARG_WITH(m4_tolower($1)-verbosity,
192             AC_HELP_STRING([--with-m4_tolower($1)-verbosity],
193                            [specify the debug verbosity level for project $1]),
194             [if test "$withval" = yes; then
195                withval=1
196              fi
197              m4_tolower(coin_$1_verbosity)=$withval],
198             [m4_tolower(coin_$1_verbosity)=0])
199 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY),
200                    m4_tolower($coin_$1_verbosity),
201                    [Define to the debug verbosity level (0 is no output)])
202
203 AC_ARG_WITH(m4_tolower($1)-checklevel,
204             AC_HELP_STRING([--with-m4_tolower($1)-checklevel],
205                            [specify the sanity check level for project $1]),
206             [if test "$withval" = yes; then
207                withval=1
208              fi
209              m4_tolower(coin_$1_checklevel)=$withval],
210             [m4_tolower(coin_$1_checklevel)=0])
211 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL),
212                    m4_tolower($coin_$1_checklevel),
213                    [Define to the debug sanity check level (0 is no test)])
214]) # m4_ifvaln([$1],
215 
216]) # AC_COIN_DEBUG_COMPILE
217
218###########################################################################
219#                          COIN_MINGW_LD_FIX                              #
220###########################################################################
221
222# This macro is included by any PROG_compiler macro, to set the LD
223# environment variable on MinGW to the correct value (link). But note that
224# if we're building in cygwin with -mno-cygwin, we still want ld! If we're
225# building from cygwin with MSVC tools (cl/link), then we do want link and
226# you'd better have your PATH variable straight, else you'll be doing file
227# links instead of code links! Arguably, LDFLAGS should include -mno-cygwin
228# but in practice all linking seems to be handled through the compilers, so
229# CFLAGS and CXXFLAGS suffice.
230
231AC_DEFUN([AC_COIN_MINGW_LD_FIX],
232[AC_REQUIRE([AC_COIN_ENABLE_MSVC])
233 case $build in
234  *-mingw*)
235    if test "${LD+set}" = set; then :; else
236      LD=link
237    fi
238    ;;
239 esac
240 if test $enable_msvc = yes ; then
241   if test "x${LD+set}" = xset; then :; else
242     LD=link
243   fi
244 fi
245])
246
247###########################################################################
248#                          COIN_ENABLE_MSVC                               #
249###########################################################################
250
251# This macro is invoked by any PROG_compiler macro to establish the
252# --enable-msvc option.
253# The job of this macro is to make sure the option is correct and
254# to set enable_msvc. Legal values are yes and no (disabled).
255# If set, assume the presence of cl/link. It's the user's responsibility to
256# make sure their PATH is correct. In particular, that MSVC link is found
257# and not cygwin link (we want to do code linking, not file linking).
258# It's the responsibility of individual PROG_compiler macros to ensure that
259# they correctly set the compiler search list and preprocess, compile, and
260# link flags. This is tied to compiler setup because in practice invocations
261# of the preprocessor and linker are made through the compiler.
262# For backward compatibility, we also check for --enable-doscompile=msvc.
263
264AC_DEFUN([AC_COIN_ENABLE_MSVC],
265[AC_REQUIRE([AC_CANONICAL_BUILD])
266
267  # for backward compatibility
268  AC_ARG_ENABLE([doscompile],,[enable_doscompile=$enableval],[enable_doscompile=no])
269 
270  AC_ARG_ENABLE([msvc],
271    [AC_HELP_STRING([--enable-msvc],
272                    [Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin.])],
273    [enable_msvc=$enableval],
274    [enable_msvc=no
275     if test "$enable_doscompile" = msvc ; then
276       enable_msvc=yes
277     elif test "$enable_doscompile" != no ; then
278       AC_MSG_ERROR([--enable-doscompile=$enable_doscompile not supported anymore.])
279     fi
280    ])
281
282  if test "$enable_msvc" = yes; then
283    case $build in
284      *-cygwin* | *-mingw*) ;;
285      *) AC_MSG_ERROR([--enable-msvc option makes sense only under Cygwin or MinGW]) ;;
286    esac
287  fi
288])
289
290###########################################################################
291#                             COIN_PROG_CXX                               #
292###########################################################################
293
294# Find the compile command by running AC_PROG_CXX (with compiler names for
295# different operating systems) and put it into CXX (unless it was given by the
296# user). Then find an appropriate value for CXXFLAGS. If either of CXXFLAGS or
297# PRJCT_CXXFLAGS is defined, that value is used (replace PRJCT with the upper
298# case name of this project).  It is possible to provide additional -D flags
299# in the variable CXXDEFS, and additional compilation flags with ADD_CXXFLAGS.
300
301AC_DEFUN([AC_COIN_PROG_CXX],
302[AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0
303AC_REQUIRE([AC_COIN_ENABLE_MSVC])
304AC_LANG_PUSH(C++)
305
306AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.])
307AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options])
308AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options])
309AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options])
310
311coin_has_cxx=yes
312
313save_cxxflags="$CXXFLAGS"
314# For *-*-solaris*, promote Studio/Workshop compiler to front of list.
315case $build in
316  *-cygwin* | *-mingw*)
317      if test "$enable_msvc" = yes ; then
318         comps="icl cl g++"
319      else
320         comps="g++ icl cl"
321      fi ;;
322  *-*-solaris*)
323             comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
324  *-darwin*) comps="g++ c++ CC" ;;
325  *-linux-gnu*)
326             comps="g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC xlC_r aCC CC" ;;
327          *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
328esac
329
330# We delete the cached value, since the test might not have been
331# performed with our choice of compilers earlier
332$as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; }
333# AC_MSG_NOTICE([C++ compiler candidates: $comps])
334AC_PROG_CXX([$comps])
335
336#AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler
337#thus, we test here whether $CXX is actually working
338AC_LANG_PUSH(C++)
339AC_MSG_CHECKING([whether C++ compiler $CXX works]);
340AC_COMPILE_IFELSE(
341  [AC_LANG_PROGRAM(, [int i=0;])],
342  [AC_MSG_RESULT(yes)],
343  [AC_MSG_RESULT(no)
344   AC_MSG_ERROR(failed to find a C++ compiler or C++ compiler $CXX does not work)]
345)
346AC_LANG_POP(C++)
347
348coin_cxx_is_cl=false
349# It seems that we need to cleanup something here for the Windows
350case "$CXX" in
351  clang* ) ;;
352  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
353    sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh
354    mv confdefs.hh confdefs.h
355    coin_cxx_is_cl=true
356    ;;
357esac
358
359# add automake conditional so we can recognize cl compiler in makefile
360AM_CONDITIONAL(COIN_CXX_IS_CL, [test $coin_cxx_is_cl = true])
361
362# Autoconf incorrectly concludes that cl recognises -g. It doesn't.
363case "$CXX" in
364  clang* ) ;;
365  cl* | */cl* | CL* | */CL* )
366    if test "$ac_cv_prog_cxx_g" = yes ; then
367      ac_cv_prog_cxx_g=no
368      AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.])
369    fi ;;
370  * )
371    CYGPATH_W=echo
372    ;;
373esac
374CXXFLAGS="$save_cxxflags"
375
376# Check if a project specific CXXFLAGS variable has been set
377if test x$COIN_PRJCT != x; then
378  eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set}
379  if test x$coin_tmp = xset; then
380    eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS}
381  fi
382fi
383
384if test x"$CXXFLAGS" = x; then
385
386# ToDo decide whether we want -DNDEBUG for optimization
387  coin_add_cxxflags=
388  coin_opt_cxxflags=
389  coin_dbg_cxxflags=
390  coin_warn_cxxflags=
391
392  if test "$GXX" = "yes"; then
393    case "$CXX" in
394      icpc* | */icpc*)
395        ;;
396      *)
397# ToDo decide about unroll-loops
398        coin_opt_cxxflags="-O3"
399        coin_add_cxxflags="-pipe"
400        coin_dbg_cxxflags="-g -O0"
401        coin_warn_cxxflags="-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long"
402        case $build in
403          *-darwin*)
404            ;;
405          *)
406            coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags"
407            ;;
408        esac
409    esac
410  fi
411
412# Note that we do not need to cover GCC in the following tests.
413
414  if test -z "$coin_opt_cxxflags"; then
415    case $build in
416      *-cygwin* | *-mingw*)
417        case "$CXX" in
418          clang* ) ;;
419          cl* | */cl* | CL* | */CL*)
420            # The MT and MTd options are mutually exclusive
421            if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
422               coin_opt_cxxflags='-MD -O2'
423               coin_dbg_cxxflags='-MDd'
424            else
425               coin_opt_cxxflags='-MT -O2'
426               coin_dbg_cxxflags='-MTd'
427            fi
428            coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE'
429            ;;
430          icl* | */icl* | ICL* | */ICL*)
431          # The MT and MTd options are mutually exclusive
432            if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
433              coin_opt_cxxflags='-MD -Ox'
434              coin_dbg_cxxflags='-MDd -debug'
435            else
436              coin_opt_cxxflags='-MT -Ox'
437              coin_dbg_cxxflags='-MTd -debug'
438            fi
439            coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE'
440            ;;
441        esac
442        ;;
443      *-linux-*)
444        case "$CXX" in
445          icpc* | */icpc*)
446            coin_opt_cxxflags="-O3 -ip -mp1"
447            coin_add_cxxflags=""
448            coin_dbg_cxxflags="-g"
449            # Check if -i_dynamic is necessary (for new glibc library)
450            CXXFLAGS=
451            AC_TRY_LINK(,[int i=0; i++;],[],
452                        [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"])
453            ;;
454          pgCC* | */pgCC*)
455            coin_opt_cxxflags="-fast"
456            coin_add_cxxflags="-Kieee -pc 64"
457            coin_dbg_cxxflags="-g"
458            ;;
459        esac
460        ;;
461      *-ibm-*)
462        case "$CXX" in
463          xlC* | */xlC* | mpxlC* | */mpxlC*)
464            coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
465            coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++"
466            coin_dbg_cxxflags="-g"
467            ;;
468        esac
469        ;;
470      *-hp-*)
471        case "$CXX" in
472          aCC* | */aCC* )
473            coin_opt_cxxflags="-O"
474            coin_add_cxxflags="-AA"
475            coin_dbg_cxxflags="-g"
476            ;;
477        esac
478        ;;
479      *-*-solaris*)
480          coin_opt_cxxflags="-O4"
481          coin_dbg_cxxflags="-g"
482        ;;
483    esac
484  fi
485
486# Generic flag settings. If these don't work, add a case above.
487
488  if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then
489    coin_dbg_cxxflags="-g"
490  fi
491
492  if test -z "$coin_opt_cxxflags"; then
493    # Try if -O option works if nothing else is set
494    CXXFLAGS=-O
495    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"])
496  fi
497
498  # if PM doesn't want the warning messages, take them out
499  if test x"$coin_skip_warn_cxxflags" = xyes; then
500    coin_warn_cxxflags=
501  fi
502
503# Do final setup of flags based on values determined above.
504
505  if test x${DBG_CXXFLAGS+set} != xset; then
506    DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags"
507  fi
508  if test x${OPT_CXXFLAGS+set} != xset; then
509    OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags"
510  fi
511
512  DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
513  OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
514
515  if test "$coin_debug_compile" = "true"; then
516    CXXFLAGS="$DBG_CXXFLAGS"
517  else
518    CXXFLAGS="$OPT_CXXFLAGS"
519  fi
520
521# Handle the case where CXXFLAGS was set externally.
522else
523  CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
524  if test x${DBG_CXXFLAGS+set} != xset; then
525    DBG_CXXFLAGS="$CXXFLAGS"
526  fi
527  if test x${OPT_CXXFLAGS+set} != xset; then
528    OPT_CXXFLAGS="$CXXFLAGS"
529  fi
530fi
531
532# If CXXFLAGS contains -mno-cygwin, CPPFLAGS must also have it.
533
534case "$CXXFLAGS" in
535  *-mno-cygwin*)
536    if test x${CPPFLAGS+set} != xset ; then
537      CPPFLAGS="-mno-cygwin"
538    else
539      case "$CPPFLAGS" in
540        *-mno-cygwin*)
541          ;;
542        *)
543          CPPFLAGS="$CPPFLAGS -mno-cygwin"
544          ;;
545      esac
546    fi ;;
547esac
548
549# add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include
550if test x$COIN_PRJCT != x; then
551  CXXFLAGS="$CXXFLAGS -D${COIN_PRJCT}_BUILD"
552fi
553
554# Try if CXXFLAGS works
555save_CXXFLAGS="$CXXFLAGS"
556AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
557if test -z "$CXXFLAGS"; then
558  AC_MSG_WARN([The flags CXXFLAGS="$save_CXXFLAGS" do not work.  I will now just try '-O', but you might want to set CXXFLAGS manually.])
559  CXXFLAGS='-O'
560  AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
561  if test -z "$CXXFLAGS"; then
562    AC_MSG_WARN([This value for CXXFLAGS does not work.  I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.])
563  fi
564fi
565
566AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS])
567
568AC_ARG_VAR(MPICXX,[C++ MPI Compiler])
569if test x"$MPICXX" = x; then :; else
570  AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX])
571  CXX="$MPICXX"
572fi
573
574# correct the LD variable in a mingw build with MS or intel compiler
575case "$CXX" in
576  clang* ) ;;
577  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
578    AC_COIN_MINGW_LD_FIX
579    ;;
580esac
581
582AC_LANG_POP(C++)
583]) # AC_COIN_PROG_CXX
584
585
586###########################################################################
587#                             COIN_CXXLIBS                                #
588###########################################################################
589
590# Determine the C++ runtime libraries required for linking a C++ library
591# with a Fortran or C compiler.  The result is available in CXXLIBS.
592
593AC_DEFUN([AC_COIN_CXXLIBS],
594[AC_REQUIRE([AC_PROG_CXX])dnl
595AC_LANG_PUSH(C++)
596AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler])
597if test -z "$CXXLIBS"; then
598  if test "$GXX" = "yes"; then
599    case "$CXX" in
600      icpc* | */icpc*)
601        CXXLIBS="-lstdc++"
602        ;;
603      *)
604        CXXLIBS="-lstdc++ -lm" # -lgcc"
605        ;;
606    esac
607  else
608    case $build in
609     *-mingw32 | *-cygwin* )
610      case "$CXX" in
611      clang* ) ;;
612      cl* | */cl* | CL* | */CL*)
613        CXXLIBS=nothing;;
614      esac;;
615     *-linux-*)
616      case "$CXX" in
617      icpc* | */icpc*)
618        CXXLIBS="-lstdc++"
619             ;;
620      pgCC* | */pgCC*)
621        CXXLIBS="-lstd -lC -lc"
622             ;;
623      esac;;
624    *-ibm-*)
625      CXXLIBS="-lC -lc"
626      ;;
627    *-hp-*)
628      CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc"
629      ;;
630    *-*-solaris*)
631      CXXLIBS="-lCstd -lCrun"
632    esac
633  fi
634fi
635if test -z "$CXXLIBS"; then
636  AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C).])
637else
638  AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".])
639fi
640if test x"$CXXLIBS" = xnothing; then
641  CXXLIBS=
642fi
643AC_LANG_POP(C++)
644]) # AC_COIN_CXXLIBS
645
646###########################################################################
647#                           COIN_CHECK_HEADER                             #
648###########################################################################
649
650# This macro checks for a header file, but it does so without the
651# standard header.  This avoids warning messages like:
652#
653# configure: WARNING: dlfcn.h: present but cannot be compiled
654# configure: WARNING: dlfcn.h:     check for missing prerequisite headers?
655# configure: WARNING: dlfcn.h: see the Autoconf documentation
656# configure: WARNING: dlfcn.h:     section "Present But Cannot Be Compiled"
657# configure: WARNING: dlfcn.h: proceeding with the preprocessor's result
658# configure: WARNING: dlfcn.h: in the future, the compiler will take precedence
659
660# My guess that the problem lay with CPPFLAGS seems to be correct. With this
661# macro reduced to a direct call to AC_CHECK_HEADERS, there are no warnings
662# now that CPPFLAGS contains -mno-cygwin when it needs it. -- lh, 061214 --
663
664# AW 070609: I restored the previous version, since otherwise the warnings
665# still pop up for the cl compiler
666
667AC_DEFUN([AC_COIN_CHECK_HEADER],
668[#if test x"$4" = x; then
669#  hdr="#include <$1>"
670#else
671#  hdr="$4"
672#fi
673#AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr])
674AC_CHECK_HEADERS([$1],[$2],[$3],[$4])
675]) # AC_COIN_CHECK_HEADER
676
677###########################################################################
678#                       COIN_CHECK_CXX_CHEADER                             #
679###########################################################################
680
681# This macro checks for C header files that are used from C++.  For a give
682# stub (e.g., math), it first checks if the C++ library (cmath) is available.
683# If it is, it defines HAVE_CMATH (or whatever the stub is).  If it is not
684# available, it checks for the old C head (math.h) and defines HAVE_MATH_H
685# if that one exists.
686
687AC_DEFUN([AC_COIN_CHECK_CXX_CHEADER],
688[AC_LANG_PUSH(C++)
689AC_COIN_CHECK_HEADER([c$1],[$2],[$3],[$4])
690if test "$ac_cv_header_c$1" != "yes"; then
691  AC_COIN_CHECK_HEADER([$1.h],[$2],[$3],[$4])
692fi
693AC_LANG_POP(C++)
694]) # AC_COIN_CHECK_CXX_CHEADER
695
696###########################################################################
697#                             COIN_PROG_CC                                #
698###########################################################################
699
700# Find the compile command by running AC_PROG_CC (with compiler names
701# for different operating systems) and put it into CC (unless it was
702# given my the user), and find an appropriate value for CFLAGS.  It is
703# possible to provide additional -D flags in the variable CDEFS.
704
705AC_DEFUN([AC_COIN_PROG_CC],
706[AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
707AC_REQUIRE([AC_COIN_ENABLE_MSVC])
708AC_LANG_PUSH(C)
709
710# For consistency, we set the C compiler to the same value of the C++
711# compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl)
712if test x"$CXX" != x; then
713  case "$CXX" in
714    clang* ) ;;
715    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
716      if test x"$CC" = x; then
717        CC="$CXX"
718        AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX])
719      fi
720      ;;
721  esac
722fi
723
724AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.])
725AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options])
726AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options])
727AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options])
728
729coin_has_cc=yes
730
731save_cflags="$CFLAGS"
732
733# For *-*-solaris*, promote Studio/Workshop cc compiler to front of list.
734# Depending on the user's PATH, when Studio/Workshop cc is not present we may
735# find /usr/ucb/cc, which is almost certainly not a good choice for the C
736# compiler. In this case, put cc after gcc.
737
738case $build in
739  *-cygwin* | *-mingw*)
740             if test "$enable_msvc" = yes ; then
741               comps="icl cl gcc"
742             else
743               comps="gcc icl cl"
744             fi ;;
745  *-*-solaris*)
746             AC_CHECK_PROG(sol_cc_compiler,cc,cc,[],[],/usr/ucb/cc)
747             if test "$sol_cc_compiler" = "cc" ; then
748               comps="cc xlc gcc pgcc icc"
749             else
750               comps="xlc gcc pgcc icc cc"
751             fi
752             ;;
753  *-linux-gnu*) comps="gcc cc pgcc icc xlc" ;;
754  *-linux-*) comps="xlc gcc cc pgcc icc" ;;
755  *)         comps="xlc_r xlc cc gcc pgcc icc" ;;
756esac
757
758# We delete the cached value, since the test might not have been
759# performed with our choice of compilers earlier
760$as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; }
761# AC_MSG_NOTICE([C compiler candidates: $comps])
762AC_PROG_CC([$comps])
763if test -z "$CC" ; then
764  AC_MSG_ERROR([Failed to find a C compiler!])
765fi
766# Autoconf incorrectly concludes that cl recognises -g. It doesn't.
767case "$CC" in
768  clang* ) ;;
769  cl* | */cl* | CL* | */CL* )
770    if test "$ac_cv_prog_cc_g" = yes ; then
771      ac_cv_prog_cc_g=no
772      AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.])
773    fi ;;
774  * )
775    CYGPATH_W=echo
776    ;;
777esac
778CFLAGS="$save_cflags"
779
780# add automake conditional so we can recognize cl compiler in makefile
781coin_cc_is_cl=false
782case "$CC" in
783  clang* ) ;;
784  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
785    coin_cc_is_cl=true
786    ;;
787esac
788AM_CONDITIONAL(COIN_CC_IS_CL, [test $coin_cc_is_cl = true])
789
790# Check if a project specific CFLAGS variable has been set
791if test x$COIN_PRJCT != x; then
792  eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set}
793  if test x$coin_tmp = xset; then
794    eval CFLAGS=\${${COIN_PRJCT}_CFLAGS}
795  fi
796fi
797
798if test x"$CFLAGS" = x; then
799
800  coin_add_cflags=
801  coin_opt_cflags=
802  coin_dbg_cflags=
803  coin_warn_cflags=
804
805  if test "$GCC" = "yes"; then
806    case "$CC" in
807      icc* | */icc*)
808        ;;
809      *)
810        coin_opt_cflags="-O3"
811        coin_add_cflags="-pipe"
812        coin_dbg_cflags="-g -O0"
813        coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long"
814        case $build in
815          *-darwin*)
816            ;;
817          *)
818            coin_warn_cflags="-pedantic-errors $coin_warn_cflags"
819            ;;
820        esac
821    esac
822  fi
823  if test -z "$coin_opt_cflags"; then
824    case $build in
825      *-cygwin* | *-mingw*)
826        case "$CC" in
827          clang* ) ;;
828          cl* | */cl* | CL* | */CL*)
829            if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
830              coin_opt_cflags='-MD -O2'
831              coin_dbg_cflags='-MDd'
832            else
833              coin_opt_cflags='-MT -O2'
834              coin_dbg_cflags='-MTd'
835            fi
836            coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE'
837            ;;
838          icl* | */icl* | ICL* | */ICL*)
839            if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
840              coin_opt_cflags='-MD -Ox'
841              coin_dbg_cflags='-MDd -debug'
842            else
843              coin_opt_cflags='-MT -Ox'
844              coin_dbg_cflags='-MTd -debug'
845            fi
846            coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE'
847            ;;
848        esac
849        ;;
850      *-linux-*)
851        case "$CC" in
852          icc* | */icc*)
853            coin_opt_cflags="-O3 -ip -mp1"
854            coin_add_cflags=""
855            coin_dbg_cflags="-g"
856            # Check if -i_dynamic is necessary (for new glibc library)
857            CFLAGS=
858            AC_TRY_LINK([],[int i=0; i++;],[],
859                        [coin_add_cflags="-i_dynamic $coin_add_cflags"])
860            ;;
861          pgcc* | */pgcc*)
862            coin_opt_cflags="-fast"
863            coin_add_cflags="-Kieee -pc 64"
864            coin_dbg_cflags="-g"
865            ;;
866        esac
867        ;;
868      *-ibm-*)
869        case "$CC" in
870          xlc* | */xlc* | mpxlc* | */mpxlc*)
871            coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
872            coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029"
873            coin_dbg_cflags="-g"
874          ;;
875        esac
876        ;;
877      *-hp-*)
878        coin_opt_cflags="-O"
879        coin_add_cflags="-Ae"
880        coin_dbg_cflags="-g"
881        ;;
882      *-*-solaris*)
883        coin_opt_cflags="-xO4"
884        coin_dbg_cflags="-g"
885        ;;
886      *-sgi-*)
887        coin_opt_cflags="-O -OPT:Olimit=0"
888        coin_dbg_cflags="-g"
889        ;;
890    esac
891  fi
892
893  if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then
894    coin_dbg_cflags="-g"
895  fi
896
897  if test -z "$coin_opt_cflags"; then
898    # Try if -O option works if nothing else is set
899    CFLAGS="-O"
900    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"])
901  fi
902
903  # if PM doesn't want the warning messages, take them out
904  if test x"$coin_skip_warn_cflags" = xyes; then
905    coin_warn_cflags=
906  fi
907
908  if test x${DBG_CFLAGS+set} != xset; then
909    DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags"
910  fi
911  if test x${OPT_CFLAGS+set} != xset; then
912    OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags"
913  fi
914
915  DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS"
916  OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS"
917
918  if test "$coin_debug_compile" = "true"; then
919    CFLAGS="$DBG_CFLAGS"
920  else
921    CFLAGS="$OPT_CFLAGS"
922  fi
923else
924  CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS"
925  if test x${DBG_CFLAGS+set} != xset; then
926    DBG_CFLAGS="$CFLAGS"
927  fi
928  if test x${OPT_CFLAGS+set} != xset; then
929    OPT_CFLAGS="$CFLAGS"
930  fi
931fi
932
933# If CFLAGS contains -mno-cygwin, CPPFLAGS must also have it.
934
935case "$CFLAGS" in
936  *-mno-cygwin*)
937    if test x${CPPFLAGS+set} != xset ; then
938      CPPFLAGS="-mno-cygwin"
939    else
940      case "$CPPFLAGS" in
941        *-mno-cygwin*)
942          ;;
943        *)
944          CPPFLAGS="$CPPFLAGS -mno-cygwin"
945          ;;
946      esac
947    fi ;;
948esac
949
950# add -DPROJECT_BUILD to signal compiler preprocessor which config header file to include
951if test x$COIN_PRJCT != x; then
952  CFLAGS="$CFLAGS -D${COIN_PRJCT}_BUILD"
953fi
954
955# Try if CFLAGS works
956save_CFLAGS="$CFLAGS"
957AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
958if test -z "$CFLAGS"; then
959  AC_MSG_WARN([The value CFLAGS="$save_CFLAGS" do not work.  I will now just try '-O', but you might want to set CFLAGS manually.])
960  CFLAGS='-O'
961  AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
962  if test -z "$CFLAGS"; then
963    AC_MSG_WARN([This value for CFLAGS does not work.  I will continue with empty CFLAGS, but you might want to set CFLAGS manually.])
964  fi
965fi
966
967AC_MSG_NOTICE([C compiler options are: $CFLAGS])
968
969AC_ARG_VAR(MPICC,[C MPI Compiler])
970if test x"$MPICC" = x; then :; else
971  AC_MSG_NOTICE([Will use MPI C compiler $MPICC])
972  CC="$MPICC"
973fi
974
975# Correct the LD variable if we are using the MS or Intel-windows compiler
976case "$CC" in
977  clang* ) ;;
978  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
979    AC_COIN_MINGW_LD_FIX
980    ;;
981esac
982
983AC_LANG_POP(C)
984]) # AC_COIN_PROG_CC
985
986###########################################################################
987#                             COIN_PROG_F77                               #
988###########################################################################
989
990# Find the compile command by running AC_PROG_F77 (with compiler names
991# for different operating systems) and put it into F77 (unless it was
992# given by the user), and find an appropriate value for FFLAGS
993
994AC_DEFUN([AC_COIN_PROG_F77],
995[AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
996AC_REQUIRE([AC_COIN_ENABLE_MSVC])
997AC_REQUIRE([AC_COIN_PROG_CC])
998AC_REQUIRE([AC_COIN_F77_COMPS])
999AC_LANG_PUSH([Fortran 77])
1000
1001AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options])
1002AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options])
1003AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options])
1004
1005coin_has_f77=yes
1006
1007save_fflags="$FFLAGS"
1008
1009# We delete the cached value, since the test might not have been
1010# performed with our choice of compilers earlier
1011$as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; }
1012
1013# This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use
1014# coin_f77_comps to see if there's a program that matches one of the names.
1015# If there's no such program, F77 = unavailable. If we match the name,
1016# feed AC_PROG_F77 the same search list, just to be sure it's a functioning
1017# compiler.
1018# AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps])
1019AC_COIN_FIND_F77
1020if test "$F77" != "unavailable" ; then
1021  AC_PROG_F77($coin_f77_comps)
1022else
1023  AC_MSG_WARN([Failed to find a Fortran compiler!])
1024fi
1025
1026FFLAGS="$save_fflags"
1027
1028# Check if a project specific FFLAGS variable has been set
1029if test x$COIN_PRJCT != x; then
1030  eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set}
1031  if test x$coin_tmp = xset; then
1032    eval FFLAGS=\${${COIN_PRJCT}_FFLAGS}
1033  fi
1034fi
1035
1036if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then
1037
1038  coin_add_fflags=
1039  coin_opt_fflags=
1040  coin_dbg_fflags=
1041  coin_warn_fflags=
1042
1043  if test "$G77" = "yes"; then
1044    coin_opt_fflags="-O3"
1045    coin_add_fflags="-pipe"
1046    coin_dbg_fflags="-g -O0"
1047  else
1048    case $build in
1049      *-cygwin* | *-mingw*)
1050        case $F77 in
1051          ifort* | */ifort* | IFORT* | */IFORT* )
1052            if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
1053              coin_opt_fflags='-MD -O3'
1054              coin_dbg_fflags='-MDd -debug'
1055            else
1056              coin_opt_fflags='-MT -O3'
1057              coin_dbg_fflags='-MTd -debug'
1058            fi
1059            coin_add_fflags='-fpp -nologo'
1060          ;;
1061          compile_f2c*)
1062            if test "$coin_disable_shared" = yes || test "$enable_shared" = yes ; then
1063              coin_opt_fflags='-MD -O2'
1064              coin_dbg_fflags='-MDd'
1065            else
1066              coin_opt_fflags='-MT -O2'
1067              coin_dbg_fflags='-MTd'
1068            fi
1069            coin_add_fflags='-nologo -wd4996'
1070          ;;
1071        esac
1072        ;;
1073      *-linux-*)
1074        case $F77 in
1075          ifc* | */ifc* | ifort* | */ifort*)
1076            coin_opt_fflags="-O3 -ip"
1077            coin_add_fflags="-cm -w90 -w95"
1078            coin_dbg_fflags="-g -CA -CB -CS"
1079            # Check if -i_dynamic is necessary (for new glibc library)
1080            FFLAGS=
1081            AC_TRY_LINK(,[      write(*,*) 'Hello world'],[],
1082                        [coin_add_fflags="-i_dynamic $coin_add_fflags"])
1083            ;;
1084          pgf77* | */pgf77* | pgf90* | */pgf90*)
1085            coin_opt_fflags="-fast"
1086            coin_add_fflags="-Kieee -pc 64"
1087            coin_dbg_fflags="-g"
1088          ;;
1089        esac
1090        ;;
1091      *-ibm-*)
1092        case "$F77" in
1093          xlf* | */xlf* | mpxlf* | */mpxlf* )
1094            coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
1095            coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029"
1096            coin_dbg_fflags="-g -C"
1097            ;;
1098        esac
1099        ;;
1100      *-hp-*)
1101        coin_opt_fflags="+O3"
1102        coin_add_fflags="+U77"
1103        coin_dbg_fflags="-C -g"
1104        ;;
1105      *-*-solaris*)
1106        coin_opt_fflags="-O4"
1107        coin_dbg_fflags="-g"
1108        ;;
1109      *-sgi-*)
1110        coin_opt_fflags="-O5 -OPT:Olimit=0"
1111        coin_dbg_fflags="-g"
1112        ;;
1113    esac
1114  fi
1115
1116  if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then
1117    coin_dbg_fflags="-g"
1118  fi
1119
1120  if test -z "$coin_opt_fflags"; then
1121    # Try if -O option works if nothing else is set
1122    FFLAGS=-O
1123    AC_TRY_LINK(,[      integer i], [coin_opt_fflags="-O"])
1124  fi
1125
1126  # if PM doesn't want the warning messages, take them out
1127  if test x"$coin_skip_warn_fflags" = xyes; then
1128    coin_warn_fflags=
1129  fi
1130
1131  if test x${DBG_FFLAGS+set} != xset; then
1132    DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags"
1133  fi
1134  if test x${OPT_FFLAGS+set} != xset; then
1135    OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags"
1136  fi
1137
1138  DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS"
1139  OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS"
1140
1141  if test "$coin_debug_compile" = "true"; then
1142    FFLAGS="$DBG_FFLAGS"
1143  else
1144    FFLAGS="$OPT_FFLAGS"
1145  fi
1146else
1147  FFLAGS="$FFLAGS $ADD_FFLAGS"
1148  if test x${DBG_FFLAGS+set} != xset; then
1149    DBG_FFLAGS="$FFLAGS"
1150  fi
1151  if test x${OPT_FFLAGS+set} != xset; then
1152    OPT_FFLAGS="$FFLAGS"
1153  fi
1154fi
1155
1156# If FFLAGS contains -mno-cygwin, CPPFLAGS must have it.
1157case "$FFLAGS" in
1158  *-mno-cygwin*)
1159    if test x${CPPFLAGS+set} != xset ; then
1160      CPPFLAGS="-mno-cygwin"
1161    else
1162      case "$CPPFLAGS" in
1163        *-mno-cygwin*)
1164          ;;
1165        *)
1166          CPPFLAGS="$CPPFLAGS -mno-cygwin"
1167          ;;
1168      esac
1169    fi ;;
1170esac
1171
1172# Try if FFLAGS works
1173if test "$F77" != "unavailable" ; then
1174  AC_TRY_LINK(,[      integer i],[],[FFLAGS=])
1175  if test -z "$FFLAGS"; then
1176    AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work.  I will now just try '-O', but you might want to set FFLAGS manually.])
1177    FFLAGS='-O'
1178    AC_TRY_LINK(,[      integer i],[],[FFLAGS=])
1179    if test -z "$FFLAGS"; then
1180      AC_MSG_WARN([This value for FFLAGS does not work.  I will continue with empty FFLAGS, but you might want to set FFLAGS manually.])
1181    fi
1182  fi
1183fi
1184
1185AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS])
1186
1187AC_ARG_VAR(MPIF77,[Fortran MPI Compiler])
1188if test x"$MPIF77" = x; then :; else
1189  AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77])
1190  F77="$MPIF77"
1191fi
1192
1193# correct the LD variable if we use the intel fortran compiler in windows
1194case "$F77" in
1195  ifort* | */ifort* | IFORT* | */IFORT*)
1196    AC_COIN_MINGW_LD_FIX
1197    ;;
1198esac
1199
1200AC_LANG_POP([Fortran 77])
1201]) # AC_COIN_PROG_F77
1202
1203###########################################################################
1204#                           COIN_F77_WRAPPERS                             #
1205###########################################################################
1206
1207# Calls autoconfs AC_F77_LIBRARY_LDFLAGS and does additional corrections to FLIBS.
1208# Then calls AC_F77_WRAPPERS to get Fortran namemangling scheme.
1209#
1210# To ensure that the FLIBS are determined and corrected before linking against
1211# Fortran compilers is attempted by other macros, we put it into an extra macro
1212# and call it via AC_REQUIRE. This way it seems to be called before the macros
1213# required by AC_F77_WRAPPERS.
1214
1215AC_DEFUN([_AC_COIN_F77_LIBRARY_LDFLAGS],
1216[AC_BEFORE([AC_PROG_F77],[$0])dnl
1217
1218# get FLIBS
1219AC_F77_LIBRARY_LDFLAGS
1220orig_FLIBS="$FLIBS"
1221
1222# If FLIBS has been set by the user, we just restore its value here
1223if test x"$save_FLIBS" != x; then
1224  FLIBS="$save_FLIBS"
1225else
1226  # This is to correct a missing exclusion in autoconf 2.59
1227  if test x"$FLIBS" != x; then
1228    my_flibs=
1229    for flag in $FLIBS; do
1230      case $flag in
1231        -lcrt*.o) ;;
1232        -lcygwin) ;;
1233               *) my_flibs="$my_flibs $flag" ;;
1234      esac
1235    done
1236    FLIBS="$my_flibs"
1237  fi
1238
1239  case $build in
1240  # The following is a fix to define FLIBS for ifort on Windows
1241  # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly.
1242  # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables.
1243  # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line.
1244  # Further, excluding libc.lib from the default libs seemed to be necessary only for VS < 8.
1245  # Since the corresponding flag seems to make more trouble than it avoids, it has been removed now.
1246     *-cygwin* | *-mingw*)
1247       case "$F77" in
1248#         ifort* | */ifort* | IFORT* | */IFORT*)
1249#           FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib"
1250#           if "$coin_debug_compile" = true ; then
1251#             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib"
1252#           else
1253#             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib"
1254#           fi
1255#           ;;
1256         compile_f2c*)
1257           FLIBS=`$F77 -FLIBS` ;;
1258       esac;;
1259     *-hp-*)
1260         FLIBS="$FLIBS -lm";;
1261     *-ibm-*)
1262         FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;;
1263     *-linux-*)
1264       case "$F77" in
1265         pgf77* | */pgf77* | pgf90* | */pgf90*)
1266# ask linker to go through the archives multiple times
1267# (the Fortran compiler seems to do that automatically...)
1268           FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;;
1269       esac
1270  esac
1271  ac_cv_f77_libs="$FLIBS"
1272fi
1273
1274if test "x$orig_FLIBS" != "x$FLIBS" ; then
1275  AC_MSG_NOTICE([Corrected Fortran libraries: $FLIBS])
1276fi
1277]) # _AC_COIN_F77_LIBRARY_LDFLAGS
1278
1279AC_DEFUN([AC_COIN_F77_WRAPPERS],
1280[AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl
1281AC_REQUIRE([_AC_COIN_F77_LIBRARY_LDFLAGS])dnl
1282
1283AC_LANG_PUSH([Fortran 77])
1284AC_F77_WRAPPERS
1285AC_LANG_POP([Fortran 77])
1286
1287]) # AC_COIN_F77_WRAPPERS
1288
1289###########################################################################
1290#                             COIN_FIND_F77                               #
1291###########################################################################
1292
1293# Attempt to preempt autoconf by locating an appropriate F77 program. This
1294# macro will not trigger a fatal error if a suitable compiler cannot be
1295# found. It should be called before COIN_PROG_F77 or COIN_TRY_FLINK.
1296
1297AC_DEFUN([AC_COIN_FIND_F77],
1298[AC_REQUIRE([AC_COIN_ENABLE_MSVC])
1299AC_REQUIRE([AC_COIN_F77_COMPS])
1300AC_MSG_NOTICE([Trying to determine Fortran compiler name])
1301AC_CHECK_TOOLS([F77],[$coin_f77_comps],[unavailable])
1302])
1303
1304# Auxilliary macro to make sure both COIN_PROG_F77 and COIN_FIND_F77 use
1305# the same search lists for compiler names.
1306# For *-*-solaris*, promote Studio/Workshop compilers to front of list.
1307AC_DEFUN([AC_COIN_F77_COMPS],
1308[case $build in
1309  *-cygwin* | *-mingw*)
1310     if test "$enable_msvc" = yes ; then
1311       coin_f77_comps="ifort fl32 compile_f2c gfortran g95 g77"
1312     else
1313       coin_f77_comps="gfortran ifort g95 g77 fl32 compile_f2c"
1314     fi ;;
1315  *-*-solaris*)
1316     coin_f77_comps="f95 f90 g95 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;;
1317  *-linux-gnu*)
1318     coin_f77_comps="gfortran ifort g95 fort77 f77 g77 pgf90 pgf77 ifc frt af77 xlf_r" ;;
1319  *) coin_f77_comps="xlf_r fort77 gfortran ifort g95 f77 g77 pgf90 pgf77 ifc frt af77" ;;
1320 esac
1321])
1322
1323###########################################################################
1324#                          COIN_INIT_AUTOMAKE                             #
1325###########################################################################
1326
1327# This macro calls the regular INIT_AUTOMAKE and MAINTAINER_MODE
1328# macros, and defines additional variables and makefile conditionals,
1329# that are used in the maintainer parts of the makfile.  It also
1330# checks if the correct versions of the autotools are used.
1331#
1332# This also defines the AC_SUBST variables:
1333# abs_source_dir     absolute path to source code for this package
1334# abs_bin_dir        absolute path to the directory where binaries are
1335#                    going to be installed (prefix/bin)
1336# abs_lib_dir        absolute path to the directory where libraries are
1337#                    going to be installed (prefix/lib)
1338# abs_include_dir    absolute path to the directory where the header files
1339#                    are installed (prefix/include)
1340
1341AC_DEFUN([AC_COIN_INIT_AUTOMAKE],
1342[AC_REQUIRE([AC_PROG_EGREP])
1343AC_REQUIRE([AC_PROG_LN_S])
1344
1345# AC_MSG_NOTICE([Beginning automake initialisation.])
1346# Stuff for automake
1347AM_INIT_AUTOMAKE
1348AM_MAINTAINER_MODE
1349
1350coin_have_externals=no
1351if test "$enable_maintainer_mode" = yes; then
1352
1353  # If maintainer mode is chosen, we make sure that the correct versions
1354  # of the tools are used, and that we know where libtool.m4 is (to
1355  # recreate acinclude.m4)
1356
1357  AC_SUBST(LIBTOOLM4)
1358  LIBTOOLM4=
1359  # Normally, $HOME
1360  AUTOTOOLS_DFLT=$HOME
1361
1362  AC_CACHE_CHECK([whether we are using the correct autotools],
1363                 [ac_cv_use_correct_autotools],
1364                 [ac_cv_use_correct_autotools=check])
1365
1366  if test $ac_cv_use_correct_autotools = check; then
1367    ac_cv_use_correct_autotools=yes
1368    # Check if we have autoconf
1369    AC_CHECK_PROG([have_autoconf],[autoconf],[yes],[no])
1370    if test $have_autoconf = no; then
1371      AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find autoconf in your path.])
1372    fi
1373
1374    # Check whether autoconf is the correct version
1375    correct_version='2.59'
1376    grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1377    AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf])
1378    autoconf --version > confauto.out 2>&1
1379    if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
1380      AC_MSG_RESULT([yes])
1381    else
1382      rm -f confauto.out
1383      AC_MSG_RESULT([no])
1384      AC_MSG_ERROR([You don't have the correct version of autoconf as the first one in your path.])
1385    fi
1386    rm -f confauto.out
1387
1388    # Check if the executable autoconf is picked up from the correct location
1389    AC_MSG_CHECKING([whether autoconf is coming from the correct location])
1390    autoconf_dir=`which autoconf | sed -e 's=/autoconf=='`
1391    autoconf_dir=`cd $autoconf_dir; pwd`
1392    if test x$AUTOTOOLS_DIR = x; then
1393      want_dir=$AUTOTOOLS_DFLT/bin
1394    else
1395      want_dir=$AUTOTOOLS_DIR/bin
1396    fi
1397    if test $autoconf_dir = `cd $want_dir; pwd`; then
1398      AC_MSG_RESULT([yes])
1399    else
1400      rm -f confauto.out
1401      AC_MSG_RESULT([no])
1402      AC_MSG_ERROR([The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.])
1403    fi
1404
1405    # Check if we have automake
1406    AC_CHECK_PROG([have_automake],[automake],[yes],[no])
1407    if test $have_automake = no; then
1408      AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find automake in your path.])
1409    fi
1410 
1411    # Check whether automake is the correct version
1412    correct_version='1.9.6'
1413    grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1414    AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake])
1415    automake --version > confauto.out 2>&1
1416    if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
1417      AC_MSG_RESULT([yes])
1418    else
1419      rm -f confauto.out
1420      AC_MSG_RESULT([no])
1421      AC_MSG_ERROR([You don't have the correct version of automake as the first one in your path.])
1422    fi
1423    rm -f confauto.out
1424
1425    # Check if the executable automake is picked up from the correct location
1426    AC_MSG_CHECKING([whether automake is coming from the correct location])
1427    automake_dir=`which automake | sed -e 's=/automake=='`
1428    automake_dir=`cd $automake_dir; pwd`
1429    if test x$AUTOTOOLS_DIR = x; then
1430      want_dir=$AUTOTOOLS_DFLT/bin
1431    else
1432      want_dir=$AUTOTOOLS_DIR/bin
1433    fi
1434    if test $automake_dir = `cd $want_dir; pwd`; then
1435      AC_MSG_RESULT([yes])
1436    else
1437      rm -f confauto.out
1438      AC_MSG_RESULT([no])
1439      AC_MSG_ERROR([The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.])
1440    fi
1441
1442    # Check if this is the correct version of libtool (with escaped dots)
1443    if test x$AUTOTOOLS_DIR = x; then
1444      want_dir=$AUTOTOOLS_DFLT/share
1445    else
1446      want_dir=$AUTOTOOLS_DIR/share
1447    fi
1448    correct_version='1.5.22'
1449    grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1450    AC_COIN_CHECK_FILE([$want_dir/libtool/ltmain.sh],
1451                       [have_ltmain=yes],
1452                       [have_ltmain=no])
1453    AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.])
1454    if test $have_ltmain = yes; then
1455    if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then
1456        AC_MSG_RESULT([yes])
1457      else
1458        AC_MSG_RESULT([no])
1459        AC_MSG_ERROR([You don't have the correct version of libtool.])
1460      fi
1461    else
1462      AC_MSG_RESULT([no])
1463      AC_MSG_ERROR([I cannot find the ltmain.sh file.])
1464    fi
1465  fi
1466
1467  # Check if we can find the libtool file
1468  if test x$AUTOTOOLS_DIR = x; then
1469    want_dir=$AUTOTOOLS_DFLT/share
1470  else
1471    want_dir=$AUTOTOOLS_DIR/share
1472  fi
1473  AC_COIN_CHECK_FILE([$want_dir/aclocal/libtool.m4],
1474                     [LIBTOOLM4="$want_dir/aclocal/libtool.m4"],
1475                     [AC_MSG_ERROR([I cannot find the libtool.m4 file.])])
1476
1477  # Check if we have an Dependencies file
1478  if test -r $srcdir/Dependencies; then
1479    coin_have_externals=yes
1480  fi
1481  # Check if subversion is installed and understands https
1482  AC_CHECK_PROG([have_svn],[svn],[yes],[no])
1483  if test x$have_svn = xyes; then
1484    AC_CACHE_CHECK([whether svn understands https],
1485                   [ac_cv_svn_understands_https],
1486                   [svn --version > confauto.out 2>&1
1487                    if $EGREP https confauto.out >/dev/null 2>&1; then
1488                      ac_cv_svn_understands_https=yes
1489                    else
1490                      ac_cv_svn_understands_https=no
1491                      have_svn=no
1492                      ac_cv_prog_have_svn=no
1493                    fi
1494                    rm -f confauto.out])
1495  fi
1496
1497  # Find the location of the BuildTools directory
1498  BUILDTOOLSDIR=
1499  if test -r $srcdir/BuildTools/coin.m4; then
1500    BUILDTOOLSDIR=$srcdir/BuildTools
1501  else
1502    if test -r $srcdir/../BuildTools/coin.m4; then
1503      BUILDTOOLSDIR=$srcdir/../BuildTools
1504    else
1505      if test -r $srcdir/../../BuildTools/coin.m4; then
1506        BUILDTOOLSDIR=$srcdir/../../BuildTools
1507      else
1508        AC_MSG_ERROR(Cannot find the BuildTools directory, better disable maintainer mode.)
1509      fi
1510    fi
1511  fi
1512  AC_SUBST(BUILDTOOLSDIR)
1513 
1514  # for running automake by make, we need to have Makemain.inc available at the place where it usually can be found during run_autotools
1515  if test "$BUILDTOOLSDIR" != "$srcdir/BuildTools" ; then
1516    $LN_S `cd $BUILDTOOLSDIR; pwd` "$srcdir/BuildTools"
1517  fi
1518
1519  # The following variable is set to the name of the directory where
1520  # the autotool scripts are located
1521  AC_SUBST(AUX_DIR)
1522  AUX_DIR=$ac_aux_dir
1523fi
1524
1525# helpful variable for the base directory of this package
1526abs_source_dir=`cd $srcdir; pwd`
1527AC_SUBST(abs_source_dir)
1528
1529# Stuff for example Makefiles
1530if test x$prefix = xNONE; then
1531  full_prefix=$ac_default_prefix
1532else
1533  full_prefix=$prefix
1534fi
1535full_prefix=`cd $full_prefix ; pwd`
1536AC_SUBST(abs_lib_dir)
1537abs_lib_dir=$full_prefix/lib
1538AC_SUBST(abs_include_dir)
1539abs_include_dir=$full_prefix/include
1540AC_SUBST(abs_bin_dir)
1541abs_bin_dir=$full_prefix/bin
1542
1543AM_CONDITIONAL(HAVE_EXTERNALS,
1544               test $coin_have_externals = yes && test x$have_svn = xyes)
1545
1546# AC_MSG_NOTICE([End automake initialisation.])
1547
1548]) # AC_COIN_INIT_AUTOMAKE
1549
1550###########################################################################
1551#                          COIN_CREATE_LIBTOOL                            #
1552###########################################################################
1553
1554# This does all the tests necessary to create the libtool script in the
1555# package base directory.  If this is used, then the COIN_INIT_AUTO_TOOLS
1556# test in the subdirectories will be able to skip the libtool tests and
1557# just use the one in the package base directory.
1558
1559m4_define([AC_COIN_CREATE_LIBTOOL],
1560[AC_CANONICAL_BUILD
1561
1562# Check if user wants to produce debugging code
1563AC_COIN_DEBUG_COMPILE
1564
1565# Get the name of the C compiler and appropriate compiler options
1566AC_COIN_PROG_CC
1567
1568# Get the name of the C++ compiler and appropriate compiler options
1569AC_COIN_PROG_CXX
1570
1571# Get the name of the Fortran compiler and appropriate compiler options
1572AC_COIN_PROG_F77
1573
1574# Initialize automake and libtool
1575# AC_MSG_NOTICE([Calling INIT_AUTO_TOOLS from CREATE_LIBTOOL.])
1576AC_COIN_INIT_AUTO_TOOLS
1577# AC_MSG_NOTICE([Finished INIT_AUTO_TOOLS from CREATE_LIBTOOL.])
1578])
1579
1580###########################################################################
1581#                         COIN_INIT_AUTO_TOOLS                            #
1582###########################################################################
1583
1584# Initialize the auto tools automake and libtool, with all
1585# modifications we want for COIN packages.
1586#
1587# RPATH_FLAGS        link flags for hardcoding path to shared objects
1588
1589# This is a trick to have this code before AC_COIN_PROG_LIBTOOL
1590AC_DEFUN([AC_COIN_DISABLE_STATIC],
1591[
1592coin_disable_shared=no
1593# Test if force_shared has been set
1594if test "x$1" = xforce_shared; then
1595  if test x$enable_shared = xno; then
1596    AC_MSG_ERROR([Shared libraries are disabled by user, but this is not feasible with the given options])
1597  fi
1598  enable_shared=yes;
1599else
1600  # On Cygwin and AIX, building DLLs doesn't work
1601  case $build in
1602    *-cygwin* | *-mingw*)
1603      coin_disable_shared=yes
1604      if test x"$enable_shared" = xyes; then
1605        case "$CXX" in
1606          clang* )
1607            AC_MSG_WARN([DLL building not supported. I'm disabling your choice.])
1608            ;;
1609          cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1610            AC_MSG_WARN([DLL building not supported. I'm disabling your choice, but will build with -MD(d) instead of -MT(d).])
1611            ;;
1612          *)
1613            AC_MSG_WARN([DLL building not supported. I'm disabling your choice.])
1614            ;;
1615        esac
1616      fi
1617    ;;
1618    *-aix*)
1619      coin_disable_shared=yes
1620      platform=AIX
1621      if test x"$enable_shared" = xyes; then
1622        AC_MSG_WARN([Shared objects are not supported. I'm disabling your choice.])
1623      fi
1624    ;;
1625  esac
1626fi
1627if test x"$coin_disable_shared" = xyes; then
1628  if test x"$enable_shared" = xyes; then
1629    :
1630  else
1631    # we don't disable shared, because it was not selected anyway
1632    coin_disable_shared=no
1633  fi
1634  enable_shared=no
1635fi
1636# By default, we only want the shared objects to be compiled
1637AC_DISABLE_STATIC
1638])
1639
1640m4_define([AC_COIN_INIT_AUTO_TOOLS],
1641[{AC_BEFORE([AC_COIN_PROG_CXX],[$0])
1642AC_BEFORE([AC_COIN_PROG_CC],[$0])
1643AC_BEFORE([AC_COIN_PROG_F77],[$0])
1644
1645# START
1646AC_COIN_DISABLE_STATIC([$1])
1647
1648# Initialize automake
1649AC_COIN_INIT_AUTOMAKE
1650
1651LIBTOOL=
1652if test -r ../libtool; then
1653  coin_config_dir=..
1654  LIBTOOL='$(SHELL) $(top_builddir)/../libtool'
1655fi
1656if test "x$LIBTOOL" = x; then
1657  if test -r ../../libtool; then
1658    coin_config_dir=../..
1659    LIBTOOL='$(SHELL) $(top_builddir)/../../libtool'
1660  fi
1661fi
1662
1663if test "x$LIBTOOL" = x; then
1664# AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).])
1665  # Stuff for libtool
1666  AC_COIN_PROG_LIBTOOL
1667# AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.])
1668  # set RPATH_FLAGS to the compiler link flags required to hardcode location
1669  # of the shared objects
1670  AC_COIN_RPATH_FLAGS([$abs_lib_dir])
1671
1672else
1673
1674  AC_MSG_NOTICE([Using libtool script in directory $coin_config_dir])
1675  # get all missing information from the config.log file
1676
1677  # output variables and defines
1678  as_save_IFS=$IFS
1679  IFS='
1680'
1681  for oneline in `cat $coin_config_dir/config.status`; do
1682    case "$oneline" in
1683         # First some automake conditionals
1684      s,@am__fastdep* | s,@AR@* | s,@CPP@*  | s,@CPPFLAGS@* | s,@CXXCPP@*  | \
1685      s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \
1686      s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \
1687      s,@ac_c_preproc_warn_flag@* |  s,@ac_cxx_preproc_warn_flag@* )
1688        command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'`
1689#        echo "$command"
1690        eval "$command"
1691        ;;
1692      s,@DEFS@* )
1693        command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'`
1694#        echo "$command"
1695        eval "$command"
1696        ;;
1697    esac
1698  done
1699  IFS=$as_save_IFS
1700
1701  # And some defines (assuming here that the packages base dir
1702  # doesn't have a config.h file
1703  for word in $defsline; do
1704#    echo word $word
1705    case $word in
1706      -DHAVE_@<:@A-Z_@:>@*_H=1 | -DSTDC_HEADERS=1 )
1707        i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'`
1708#        echo dd $i
1709        echo $i >>confdefs.h
1710        ;;
1711    esac
1712  done
1713fi
1714
1715# AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.])
1716
1717# ToDo
1718# For now, don't use the -no-undefined flag, since the Makefiles are
1719# not yet set up that way.  But we need to fix this, when we want
1720# to comile DLLs under Windows.
1721LT_LDFLAGS=
1722
1723# Check if we want to set the library version
1724AC_MSG_CHECKING([if library version is set])
1725if test x"$coin_libversion" != x; then
1726  LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion"
1727  AC_MSG_RESULT([$coin_libversion])
1728else
1729  AC_MSG_RESULT([no])
1730fi
1731
1732AC_SUBST(LT_LDFLAGS)
1733
1734#END
1735}])
1736
1737###########################################################################
1738#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
1739###########################################################################
1740
1741# Patches to libtool for cygwin. Lots for cl, a few for GCC.
1742# For cl:
1743# - cygpath is not correctly quoted in fix_srcfile_path
1744# - paths generated for .lib files is not run through cygpath -w
1745
1746
1747AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
1748[ case "$CXX" in
1749    clang* )
1750      # we assume that libtool patches for CLANG are the same as for GNU compiler - correct???
1751      AC_MSG_NOTICE(Applying patches to libtool for CLANG compiler)
1752      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1753          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
1754          -e 's|libext="lib"|libext="a"|' \
1755      libtool > conftest.bla
1756      ;;
1757    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1758      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
1759      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1760          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1761          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1762          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1763          -e 's%lib /OUT:%lib -OUT:%' \
1764          -e "s%cygpath -w%$CYGPATH_W%" \
1765          -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\$(lib -nologo -list \\$('"$CYGPATH_W \$[]1"') '"$mydos2unix"' | xargs echo); echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$('"$CYGPATH_W \$[]1"'); done%' \
1766          -e 's%$AR t "$f_ex_an_ar_oldlib"%lib -nologo -list \$('"$CYGPATH_W \$[]1"') '"$mydos2unix"'%' \
1767          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
1768          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
1769          -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \
1770      libtool > conftest.bla
1771      ;;
1772    *)
1773      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
1774      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1775          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
1776          -e 's|libext="lib"|libext="a"|' \
1777      libtool > conftest.bla
1778      ;;
1779  esac
1780  mv conftest.bla libtool
1781  chmod 755 libtool
1782]) # COIN_PATCH_LIBTOOL_CYGWIN
1783
1784###########################################################################
1785#                    COIN_PATCH_LIBTOOL_SOLARIS                           #
1786###########################################################################
1787# If we want to do a 64-bit build with GCC on Solaris, the system search
1788# libraries need to point to 64-bit subdirectories. If they do not already do
1789# that, fix them. This patch is evolving, as are GCC compilers.  GCC 4.2.1
1790# reports the correct search list, given the correct call. GCC 4.1.1 does not.
1791# `Correct call' means -m64 is specified. `Correct search list' seems to amount
1792# to prepending the list of 64-bit subdirectories to the 32-bit directories.
1793# Both SPARC and x86 have this issue, but a different hardware id string is
1794# required depending on the underlying CPU. The macro executes isainfo to get
1795# the string. This will fail, of course, if we're cross-compiling. The
1796# alternative is to fail on a regular basis each time a new CPU identifier is
1797# needed. This macro will also fail if the search list reported with
1798# -print-search-dirs differs between the C, C++, and Fortran compilers; each
1799# have their own setting in libtool.  If GCC reports the correct search list
1800# given the -m64 flag, the best solution is to define CC='gcc -m64', and
1801# similarly for CXX, F77, so that libtool will make the correct call.
1802###########################################################################
1803AC_DEFUN([AC_COIN_PATCH_LIBTOOL_SOLARIS],
1804[ if test "$GCC" = yes && \
1805     (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then
1806    hdwisa=`isainfo | sed -e 's/\(@<:@^ @:>@*\) .*$/\1/'`
1807    if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then
1808      AC_MSG_NOTICE([Applying patches to libtool for 64-bit GCC compilation])
1809      fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'`
1810      fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'`
1811      if `echo "$fixlibtmp" | $EGREP -v $hdwisa  >/dev/null 2>&1` ; then
1812        # AC_MSG_NOTICE(Compensating for broken gcc)
1813        for lib in $fixlibtmp ; do
1814          if test -d "${lib}${hdwisa}" ; then
1815            syslibpath64="$syslibpath64 ${lib}${hdwisa}/"
1816          fi
1817        done
1818        syslibpath64="${syslibpath64} ${fixlibtmp}"
1819      else
1820        syslibpath64="$fixlibtmp"
1821      fi
1822      sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla
1823      mv conftest.bla libtool
1824      chmod 755 libtool 
1825    fi
1826    # AC_MSG_NOTICE(Result is )
1827    # $EGREP 'sys_lib_search_path_spec=' libtool
1828  fi ]) # COIN_PATCH_LIBTOOL_SOLARIS
1829
1830###########################################################################
1831#                           COIN_PROG_LIBTOOL                             #
1832###########################################################################
1833
1834# Setup the libtool stuff together with any modifications to make it
1835# work on additional platforms
1836
1837AC_DEFUN([AC_COIN_PROG_LIBTOOL],
1838[# No longer needed now that CPPFLAGS is correctly set -- lh, 061214 --
1839 # AC_REQUIRE([AC_COIN_DLFCN_H])
1840
1841# NEW: If libtool exists in the directory higher up, we use that one
1842#      instead of creating a new one
1843
1844# It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED
1845# out in front of this macro body. You'll notice that LIBTOOL is already
1846# defined here.  We'll have to count on this macro not being called if libtool
1847# already exists, or at least move the libtool fixes outside the conditional.
1848# AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".])
1849# This test is therefore removed.  -- lh, 061214 --
1850# if test "x$LIBTOOL" = x; then
1851
1852# AC_MSG_NOTICE([Calling PROG_LIBTOOL.])
1853  AC_PROG_LIBTOOL
1854# AC_MSG_NOTICE([Finished PROG_LIBTOOL.])
1855  AC_SUBST(ac_c_preproc_warn_flag)
1856  AC_SUBST(ac_cxx_preproc_warn_flag)
1857
1858  AC_MSG_NOTICE([Build is "$build".])
1859  mydos2unix='| dos2unix'
1860  case $build in
1861    *-mingw*)
1862      CYGPATH_W=echo
1863      mydos2unix=
1864      ;;
1865  esac
1866
1867  case $build in
1868    # Here we need to check if -m32 is specified.  If so, we need to correct
1869    # sys_lib_search_path_spec
1870    *x86_64-*)
1871      if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then
1872        AC_MSG_NOTICE(Applying patches to libtool for 32bit compilation)
1873        sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla
1874        mv conftest.bla libtool
1875        chmod 755 libtool 
1876      fi
1877      ;;
1878
1879    *-solaris*)
1880      AC_COIN_PATCH_LIBTOOL_SOLARIS
1881      ;;
1882    # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro.
1883    *-cygwin* | *-mingw*)
1884      AC_COIN_PATCH_LIBTOOL_CYGWIN
1885      ;;
1886    *-darwin*)
1887      AC_MSG_NOTICE(Applying patches to libtool for Darwin)
1888      sed -e 's/verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"/verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"/' \
1889        -e 's/ -dynamiclib / -dynamiclib -single_module /g' \
1890      libtool > conftest.bla
1891
1892      mv conftest.bla libtool
1893      chmod 755 libtool
1894      ;;
1895  esac
1896# This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of
1897# the macro. -- lh, 061214 --
1898# fi
1899
1900# AC_MSG_NOTICE([End libtool initialisation.])
1901]) # AC_COIN_PROG_LIBTOOL
1902
1903# This is a trick to force the check for the dlfcn header to be done before
1904# the checks for libtool
1905# No longer needed now that CPPFLAGS is correctly set.  -- lh, 061214 --
1906# ACDEFUN([AC_COIN_DLFCN_H],
1907# [AC_LANG_PUSH(C)
1908# AC_COIN_CHECK_HEADER([dlfcn.h])
1909# AC_LANG_POP(C)
1910# ]) # AC_COIN_DLFCN_H
1911
1912###########################################################################
1913#                            COIN_RPATH_FLAGS                             #
1914###########################################################################
1915
1916# This macro, in case shared objects are used, defines a variable
1917# RPATH_FLAGS that can be used by the linker to hardwire the library
1918# search path for the given directories.  This is useful for example
1919# Makefiles
1920
1921AC_DEFUN([AC_COIN_RPATH_FLAGS],
1922[RPATH_FLAGS=
1923
1924if test $enable_shared = yes; then
1925  case $build in
1926    *-linux-*)
1927      if test "$GXX" = "yes"; then
1928        RPATH_FLAGS=
1929        for dir in $1; do
1930          RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir"
1931        done
1932      fi ;;
1933    *-darwin*)
1934        RPATH_FLAGS=nothing ;;
1935    *-ibm-*)
1936      case "$CXX" in
1937      xlC* | */xlC* | mpxlC* | */mpxlC*)
1938        RPATH_FLAGS=nothing ;;
1939      esac ;;
1940    *-hp-*)
1941        RPATH_FLAGS=nothing ;;
1942    *-mingw32)
1943        RPATH_FLAGS=nothing ;;
1944    *-*-solaris*)
1945        RPATH_FLAGS=
1946        for dir in $1; do
1947          RPATH_FLAGS="$RPATH_FLAGS -R$dir"
1948        done
1949  esac
1950
1951  if test "$RPATH_FLAGS" = ""; then
1952    AC_MSG_WARN([Could not automatically determine how to tell the linker about automatic inclusion of the path for shared libraries.  The test examples might not work if you link against shared objects.  You will need to set the LD_LIBRARY_PATH, DYLP_LIBRARY_PATH, or LIBDIR variable manually.])
1953  fi
1954  if test "$RPATH_FLAGS" = "nothing"; then
1955    RPATH_FLAGS=
1956  fi
1957fi
1958
1959AC_SUBST(RPATH_FLAGS)
1960]) # AC_COIN_RPATH_FLAGS
1961
1962###########################################################################
1963#                        COIN_LINK_INPUT_CMD                              #
1964###########################################################################
1965
1966# This macro determines which command should be used to "link" files
1967# that are input to the generated executables.  On Windows, the codes
1968# using the native Windows system libraries, cannot understand symbolic
1969# links, and a copy should be used instead of 'ln -s'.
1970# The result is stored in coin_link_input_cmd
1971
1972AC_DEFUN([AC_COIN_LINK_INPUT_CMD],
1973[AC_REQUIRE([AC_PROG_LN_S])
1974AC_BEFORE([AC_COIN_PROG_CC], [$0])
1975AC_BEFORE([AC_COIN_ENABLE_MSVC], [$0])
1976
1977AC_MSG_CHECKING([which command should be used to link input files])
1978coin_link_input_cmd="$LN_S"
1979case "$CC" in
1980  clang* ) ;;
1981  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1982    coin_link_input_cmd=cp ;;
1983esac
1984AC_MSG_RESULT($coin_link_input_cmd)
1985])
1986
1987###########################################################################
1988#                              COIN_FINALIZE                              #
1989###########################################################################
1990
1991# This macro should be called at the very end of the configure.ac file.
1992# It creates the output files (by using AC_OUTPUT), and might do some other
1993# things (such as generating links to data files in a VPATH configuration).
1994# It also prints the "success" message.
1995# Note: If the variable coin_skip_ac_output is set to yes, then no output
1996# files are written.
1997
1998AC_DEFUN([AC_COIN_FINALIZE],
1999[
2000AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
2001if test x$coin_skip_ac_output != xyes; then
2002
2003  # library extension
2004  AC_SUBST(LIBEXT)
2005  case "$CC" in
2006    clang* )
2007         LIBEXT=a ;;
2008    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2009         LIBEXT=lib ;;
2010      *) LIBEXT=a ;;
2011  esac
2012
2013  # Define VPATH_DISTCLEANFILES to be everything that needs to be
2014  # cleaned for distclean in a vpath configuration
2015  AC_SUBST(VPATH_DISTCLEANFILES)
2016  VPATH_DISTCLEANFILES="$coin_vpath_link_files"
2017
2018  # Take out subdirectories if their configuration concluded that they
2019  # don't need to be compiled
2020  if test x"$coin_ac_skip_subdirs" != x; then
2021    new_subdirs=
2022    for i in $subdirs; do
2023      skipme=no
2024      for j in $coin_ac_skip_subdirs; do
2025        if test $i = $j; then
2026          skipme=yes;
2027        fi
2028      done
2029      if test $skipme = no; then
2030        new_subdirs="$new_subdirs $i"
2031      fi
2032    done
2033    subdirs="$new_subdirs"
2034  fi
2035
2036  # need to come before AC_OUTPUT
2037  if test x$coin_projectdir != xyes; then
2038    # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects
2039    echo $coin_subdirs > coin_subdirs.txt
2040  else
2041    # substitute for OBJDIR, needed to setup .pc file for uninstalled project
2042    ABSBUILDDIR="`pwd`"
2043    AC_SUBST(ABSBUILDDIR)
2044  fi
2045 
2046  AC_OUTPUT
2047
2048  if test x"$coin_vpath_link_files" = x; then : ; else
2049    lnkcmd="$coin_link_input_cmd"
2050    if test "$lnkcmd" = cp; then
2051      AC_MSG_NOTICE(Copying data files for VPATH configuration)
2052    else
2053      AC_MSG_NOTICE(Creating VPATH links for data files)
2054    fi
2055    for file in $coin_vpath_link_files; do
2056      dir=`AS_DIRNAME(["./$file"])`
2057      if test -d $dir; then : ; else
2058        AS_MKDIR_P($dir)
2059      fi
2060      rm -f $file
2061      $lnkcmd $abs_source_dir/$file $file
2062    done
2063  fi
2064
2065  AC_MSG_NOTICE([In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting])
2066  if test x$coin_projectdir = xyes; then
2067    AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful])
2068  else
2069    AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful])
2070  fi
2071else
2072  AC_MSG_NOTICE([No configuration of $PACKAGE_NAME necessary])
2073fi
2074
2075]) #AC_COIN_FINALIZE
2076
2077###########################################################################
2078#                             COIN_VPATH_LINK                             #
2079###########################################################################
2080
2081# This macro queues source files that need to be available in the build
2082# directory. In a VPATH configuration, the files will be made available by
2083# symbolic link or copy (when the platform does not support links). The list
2084# is processed by COIN_FINALIZE. The parameter is a whitespace-separated
2085# list of files.
2086
2087AC_DEFUN([AC_COIN_VPATH_LINK],
2088[
2089AC_REQUIRE([AC_COIN_CHECK_VPATH])
2090# Allow for newlines in the parameter
2091if test $coin_vpath_config = yes; then
2092  cvl_tmp="$1"
2093  for file in $cvl_tmp ; do
2094    coin_vpath_link_files="$coin_vpath_link_files $file"
2095  done
2096fi
2097]) #AC_COIN_VPATH_LINK
2098
2099###########################################################################
2100#                       COIN_ENABLE_GNU_PACKAGES                          #
2101###########################################################################
2102
2103# This macro defined the --enable-gnu-packages flag.  This can be used
2104# to check if a user wants to compile GNU packges (such as readline)
2105# into the executable.  By default, GNU packages are disabled.
2106# This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES
2107
2108AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES],
2109[AC_ARG_ENABLE([gnu-packages],
2110               [AC_HELP_STRING([--enable-gnu-packages],
2111                               [compile with GNU packages (disabled by default)])],
2112               [coin_enable_gnu=$enableval],
2113               [coin_enable_gnu=no])
2114]) # AC_COIN_ENABLE_GNU_PACKAGES
2115
2116#######################################################################
2117#                           COIN_CHECK_LIBM                           #
2118#######################################################################
2119
2120# For a (space separated) list of arguments X, this macro adds the flags
2121# for linking against the math library to a X_LIBS and X_PCLIBS.
2122
2123AC_DEFUN([AC_COIN_CHECK_LIBM],
2124[AC_BEFORE([AC_COIN_PROG_CC],[$0])
2125
2126if test $coin_cc_is_cl != true ; then
2127  coin_foreach_w([myvar], [$1], [
2128    m4_toupper(myvar)_LIBS="-lm $m4_toupper(myvar)_LIBS"
2129    m4_toupper(myvar)_PCLIBS="-lm $m4_toupper(myvar)_PCLIBS"
2130    m4_toupper(myvar)_LIBS_INSTALLED="-lm $m4_toupper(myvar)_LIBS_INSTALLED"
2131  ])
2132fi
2133
2134]) # AC_COIN_CHECK_LIBM
2135
2136###########################################################################
2137#                           COIN_CHECK_GNU_ZLIB                           #
2138###########################################################################
2139
2140# This macro checks for the libz library.  If found, it sets the automake
2141# conditional COIN_HAS_ZLIB and defines the C preprocessor variable
2142# COIN_HAS_ZLIB.  Further, for a (space separated) list of arguments X,
2143# it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2144
2145# TODO the macro name should be changed to AC_COIN_CHECK_ZLIB
2146
2147AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB],
2148[
2149AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2150AC_BEFORE([AC_COIN_PROG_CC],[$0])
2151AC_BEFORE([AC_COIN_PROG_F77],[$0])
2152AC_BEFORE([$0],[AC_COIN_FINALIZE])
2153
2154coin_has_zlib=no
2155
2156AC_ARG_ENABLE([zlib],
2157              [AC_HELP_STRING([--disable-zlib],[do not compile with compression library zlib])],
2158              [coin_enable_zlib=$enableval],
2159              [coin_enable_zlib=yes])
2160
2161if test $coin_enable_zlib = yes; then
2162  AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
2163
2164  if test $coin_has_zlib = yes; then
2165    AC_CHECK_LIB([z],[gzopen],[:],[coin_has_zlib=no])
2166  fi
2167
2168  if test $coin_has_zlib = yes; then
2169    coin_foreach_w([myvar], [$1], [
2170                    m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS"
2171                    m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS"
2172                    m4_toupper(myvar)_LIBS_INSTALLED="-lz $m4_toupper(myvar)_LIBS_INSTALLED"
2173                   ])
2174    AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
2175  fi
2176fi
2177
2178AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes)
2179]) # AC_COIN_CHECK_GNU_ZLIB
2180
2181
2182###########################################################################
2183#                          COIN_CHECK_GNU_BZLIB                           #
2184###########################################################################
2185
2186# This macro checks for the libbz2 library.  If found, it defines the C
2187# preprocessor variable COIN_HAS_BZLIB.  Further, for a (space separated) list
2188# of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2189
2190# TODO the macro name should be changed to AC_COIN_CHECK_BZLIB
2191
2192AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB],
2193[
2194AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2195AC_BEFORE([AC_COIN_PROG_CC],[$0])
2196AC_BEFORE([AC_COIN_PROG_F77],[$0])
2197AC_BEFORE([$0],[AC_COIN_FINALIZE])
2198
2199AC_ARG_ENABLE([bzlib],
2200              [AC_HELP_STRING([--disable-bzlib],[do not compile with compression library bzlib])],
2201              [coin_enable_bzlib=$enableval],
2202              [coin_enable_bzlib=yes])
2203
2204coin_has_bzlib=no
2205if test $coin_enable_bzlib = yes; then
2206  AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
2207
2208  if test $coin_has_bzlib = yes; then
2209    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],[:],[coin_has_bzlib=no])
2210  fi
2211
2212  if test $coin_has_bzlib = yes; then
2213    coin_foreach_w([myvar], [$1], [
2214                    m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS"
2215                    m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS"
2216                    m4_toupper(myvar)_LIBS_INSTALLED="-lbz2 $m4_toupper(myvar)_LIBS_INSTALLED"
2217                  ])
2218    AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
2219  fi
2220fi
2221]) # AC_COIN_CHECK_GNU_BZLIB
2222
2223
2224###########################################################################
2225#                         COIN_CHECK_GNU_READLINE                         #
2226###########################################################################
2227
2228# This macro checks for GNU's readline.  It verifies that the header
2229# readline/readline.h is available, and that the -lreadline library
2230# contains "readline".  It is assumed that #include <stdio.h> is included
2231# in the source file before the #include<readline/readline.h>
2232# If found, it defines the C preprocessor variable COIN_HAS_READLINE.
2233# Further, for a (space separated) list of arguments X, it adds the
2234# linker flag to the variable X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2235
2236AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
2237[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2238AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2239AC_BEFORE([AC_COIN_PROG_CC],[$0])
2240AC_BEFORE([AC_COIN_PROG_F77],[$0])
2241AC_BEFORE([$0],[AC_COIN_FINALIZE])
2242
2243coin_has_readline=no
2244if test $coin_enable_gnu = yes; then
2245  AC_COIN_CHECK_HEADER([readline/readline.h],
2246                       [coin_has_readline=yes],[],
2247                       [#include <stdio.h>])
2248
2249  coin_save_LIBS="$LIBS"
2250  LIBS=
2251  # First we check if tputs and friends are available
2252  if test $coin_has_readline = yes; then
2253    AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
2254                   [coin_has_readline=no])
2255  fi
2256
2257  # Now we check for readline
2258  if test $coin_has_readline = yes; then
2259    AC_CHECK_LIB([readline],[readline],[:],[coin_has_readline=no])
2260  fi
2261
2262  if test $coin_has_readline = yes; then
2263    coin_foreach_w([myvar], [$1], [
2264                    m4_toupper(myvar)_LIBS="-lreadline $LIBS $m4_toupper(myvar)_LIBS"
2265                    m4_toupper(myvar)_PCLIBS="-lreadline $LIBS $m4_toupper(myvar)_PCLIBS"
2266                    m4_toupper(myvar)_LIBS_INSTALLED="-lreadline $LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
2267                   ])
2268    AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
2269  fi
2270
2271  LIBS="$coin_save_LIBS"
2272fi
2273]) # AC_COIN_CHECK_GNU_READLINE
2274
2275###########################################################################
2276#                              COIN_CHECK_GMP                             #
2277###########################################################################
2278
2279# This macro checks for the gmp library.  If found, it defines the C
2280# preprocessor variable COIN_HAS_GMP.  Further, for a (space separated) list
2281# of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2282
2283AC_DEFUN([AC_COIN_CHECK_GMP],
2284[
2285AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2286AC_BEFORE([AC_COIN_PROG_CC],[$0])
2287AC_BEFORE([AC_COIN_PROG_F77],[$0])
2288AC_BEFORE([$0],[AC_COIN_FINALIZE])
2289
2290AC_ARG_ENABLE([gmp],
2291              [AC_HELP_STRING([--disable-gmp],[do not compile with GNU multiple precision library])],
2292              [coin_enable_gmp=$enableval],
2293              [coin_enable_gmp=yes])
2294
2295coin_has_gmp=no
2296if test $coin_enable_gmp = yes; then
2297  AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])])
2298 
2299  if test $coin_has_gmp = yes ; then
2300    coin_foreach_w([myvar], [$1], [
2301                    m4_toupper(myvar)_LIBS="-lgmp $m4_toupper(myvar)_LIBS"
2302                    m4_toupper(myvar)_PCLIBS="-lgmp $m4_toupper(myvar)_PCLIBS"
2303                    m4_toupper(myvar)_LIBS_INSTALLED="-lgmp $m4_toupper(myvar)_LIBS_INSTALLED"
2304                   ])
2305    AC_DEFINE([COIN_HAS_GMP],[1],[Define to 1 if GMP is available])
2306  fi
2307fi
2308]) # AC_COIN_CHECK_GMP
2309
2310###########################################################################
2311#                            COIN_CHECK_ISFINITE                          #
2312###########################################################################
2313
2314# This macro checks for a usable implementation of a function to check
2315# whether a given floating point number is finite.
2316# If a function is found, then the macro defines the symbol
2317# toupper($1)_C_FINITE to the name of this function.
2318
2319AC_DEFUN([AC_COIN_CHECK_ISFINITE],[
2320
2321AC_LANG_PUSH(C++)
2322
2323AC_COIN_CHECK_CXX_CHEADER(math)
2324AC_COIN_CHECK_CXX_CHEADER(float)
2325AC_COIN_CHECK_CXX_CHEADER(ieeefp)
2326
2327COIN_C_FINITE=
2328AC_CHECK_DECL([isfinite],[COIN_C_FINITE=isfinite],,[
2329#ifdef HAVE_CMATH
2330# include <cmath>
2331#else
2332# ifdef HAVE_MATH_H
2333#  include <math.h>
2334# endif
2335#endif
2336#ifdef HAVE_CFLOAT
2337# include <cfloat>
2338#else
2339# ifdef HAVE_FLOAT_H
2340#  include <float.h>
2341# endif
2342#endif
2343#ifdef HAVE_CIEEEFP
2344# include <cieeefp>
2345#else
2346# ifdef HAVE_IEEEFP_H
2347#  include <ieeefp.h>
2348# endif
2349#endif])
2350if test -z "$COIN_C_FINITE"; then
2351  AC_CHECK_DECL([finite],[COIN_C_FINITE=finite],,[
2352#ifdef HAVE_CMATH
2353# include <cmath>
2354#else
2355# ifdef HAVE_MATH_H
2356#  include <math.h>
2357# endif
2358#endif
2359#ifdef HAVE_CFLOAT
2360# include <cfloat>
2361#else
2362# ifdef HAVE_FLOAT_H
2363#  include <float.h>
2364# endif
2365#endif
2366#ifdef HAVE_CIEEEFP
2367# include <cieeefp>
2368#else
2369# ifdef HAVE_IEEEFP_H
2370#  include <ieeefp.h>
2371# endif
2372#endif])
2373  if test -z "$COIN_C_FINITE"; then
2374    AC_CHECK_DECL([_finite],[COIN_C_FINITE=_finite],,[
2375#ifdef HAVE_CMATH
2376# include <cmath>
2377#else
2378# ifdef HAVE_MATH_H
2379#  include <math.h>
2380# endif
2381#endif
2382#ifdef HAVE_CFLOAT
2383# include <cfloat>
2384#else
2385# ifdef HAVE_FLOAT_H
2386#  include <float.h>
2387# endif
2388#endif
2389#ifdef HAVE_CIEEEFP
2390# include <cieeefp>
2391#else
2392# ifdef HAVE_IEEEFP_H
2393#  include <ieeefp.h>
2394# endif
2395#endif])
2396  fi
2397fi
2398if test -z "$COIN_C_FINITE"; then
2399  AC_MSG_WARN(Cannot find C-function for checking Inf.)
2400else
2401  AC_DEFINE_UNQUOTED(COIN_C_FINITE,[$COIN_C_FINITE],
2402                     [Define to be the name of C-function for Inf check])
2403fi
2404
2405AC_LANG_POP(C++)
2406])
2407
2408###########################################################################
2409#                              COIN_CHECK_ISNAN                           #
2410###########################################################################
2411
2412# This macro checks for a usable implementation of a function to check
2413# whether a given floating point number represents NaN.
2414# If a function is found, then the macro defines the symbol COIN_C_ISNAN
2415# to the name of this function.
2416
2417AC_DEFUN([AC_COIN_CHECK_ISNAN],[
2418
2419AC_LANG_PUSH(C++)
2420
2421AC_COIN_CHECK_CXX_CHEADER(math)
2422AC_COIN_CHECK_CXX_CHEADER(float)
2423AC_COIN_CHECK_CXX_CHEADER(ieeefp)
2424
2425COIN_C_ISNAN=
2426AC_CHECK_DECL([isnan],[COIN_C_ISNAN=isnan],,[
2427#ifdef HAVE_CMATH
2428# include <cmath>
2429#else
2430# ifdef HAVE_MATH_H
2431#  include <math.h>
2432# endif
2433#endif
2434#ifdef HAVE_CFLOAT
2435# include <cfloat>
2436#else
2437# ifdef HAVE_FLOAT_H
2438#  include <float.h>
2439# endif
2440#endif
2441#ifdef HAVE_CIEEEFP
2442# include <cieeefp>
2443#else
2444# ifdef HAVE_IEEEFP_H
2445#  include <ieeefp.h>
2446# endif
2447#endif])
2448
2449# It appears that for some systems (e.g., Mac OSX), cmath will provide only
2450# std::isnan, and bare isnan will be unavailable. Typically we need a parameter
2451# in the test to allow C++ to do overload resolution.
2452
2453if test -z "$COIN_C_ISNAN"; then
2454  AC_CHECK_DECL([std::isnan(42.42)],[COIN_C_ISNAN=std::isnan],,[
2455#ifdef HAVE_CMATH
2456# include <cmath>
2457#else
2458# ifdef HAVE_MATH_H
2459#  include <math.h>
2460# endif
2461#endif
2462#ifdef HAVE_CFLOAT
2463# include <cfloat>
2464#else
2465# ifdef HAVE_FLOAT_H
2466#  include <float.h>
2467# endif
2468#endif
2469#ifdef HAVE_CIEEEFP
2470# include <cieeefp>
2471#else
2472# ifdef HAVE_IEEEFP_H
2473#  include <ieeefp.h>
2474# endif
2475#endif])
2476fi
2477
2478if test -z "$COIN_C_ISNAN"; then
2479  AC_CHECK_DECL([_isnan],[COIN_C_ISNAN=_isnan],,[
2480#ifdef HAVE_CMATH
2481# include <cmath>
2482#else
2483# ifdef HAVE_MATH_H
2484#  include <math.h>
2485# endif
2486#endif
2487#ifdef HAVE_CFLOAT
2488# include <cfloat>
2489#else
2490# ifdef HAVE_FLOAT_H
2491#  include <float.h>
2492# endif
2493#endif
2494#ifdef HAVE_CIEEEFP
2495# include <cieeefp>
2496#else
2497# ifdef HAVE_IEEEFP_H
2498#  include <ieeefp.h>
2499# endif
2500#endif])
2501fi
2502if test -z "$COIN_C_ISNAN"; then
2503  AC_CHECK_DECL([isnand],[COIN_C_ISNAN=isnand],,[
2504#ifdef HAVE_CMATH
2505# include <cmath>
2506#else
2507# ifdef HAVE_MATH_H
2508#  include <math.h>
2509# endif
2510#endif
2511#ifdef HAVE_CFLOAT
2512# include <cfloat>
2513#else
2514# ifdef HAVE_FLOAT_H
2515#  include <float.h>
2516# endif
2517#endif
2518#ifdef HAVE_CIEEEFP
2519# include <cieeefp>
2520#else
2521# ifdef HAVE_IEEEFP_H
2522#  include <ieeefp.h>
2523# endif
2524#endif])
2525fi
2526if test -z "$COIN_C_ISNAN"; then
2527  AC_MSG_WARN(Cannot find C-function for checking NaN.)
2528else
2529  AC_DEFINE_UNQUOTED(COIN_C_ISNAN,[$COIN_C_ISNAN],
2530                     [Define to be the name of C-function for NaN check])
2531fi
2532
2533AC_LANG_POP(C++)
2534])
2535
2536###########################################################################
2537#                             COIN_DATA_PATH                              #
2538###########################################################################
2539
2540# This macro defines a preprocessor macro with the absolute path to a
2541# subdirectory of Data.  The argument of this macro is the name of the
2542# subdirectory (in correct case), and the name of the macro is
2543# COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of
2544# the directory.  The path ends with a separator ("/" for linux and
2545# '\\' for Windows).  The default value for this path can be
2546# overwritten with the input variable with the same name
2547# (COIN_DATA_DIR_PATH).  At this point we chech only for the
2548# $srcdir/../Data subdirectory.
2549
2550AC_DEFUN([AC_COIN_DATA_PATH],
2551[AC_MSG_CHECKING([absolute path to data directory $1])
2552
2553AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory])
2554
2555if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then
2556  m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd`
2557fi
2558
2559# Under Cygwin, use Windows path.  Add separator
2560case $build in
2561  *-cygwin*)
2562    m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\
2563    ;;
2564  *)
2565    m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/"
2566    ;;
2567esac
2568
2569if test -r $m4_toupper(COIN_DATA_$1_PATH); then
2570  AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"],
2571            [Define to absolute path for Data subdirectory $1])
2572  AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH))
2573else
2574  AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist)
2575fi
2576]) # AC_COIN_DATA_PATH
2577
2578###########################################################################
2579#                       COIN_LINK_FROM_FILELIST                           #
2580###########################################################################
2581
2582# This macro creates links (or copies, if necessary) to files listed
2583# as content in a text file (second argument) into a target directory
2584# (first argument), which is created if it doesn't exist yet.  If s link
2585# already exists, nothing happens.
2586
2587AC_DEFUN([AC_COIN_LINKCOPY_FROM_FILELIST],
2588[cmd="$3"
2589if test -e $srcdir/$2 ; then
2590  my_target_dir="$1"
2591  my_link_files=`cat $srcdir/$2`
2592  my_dirname=`AS_DIRNAME($2)`
2593#  if test -e $my_target_dir; then : ; else
2594#    AS_MKDIR_P($my_target_dir)
2595#  fi
2596  for i in $my_link_files; do
2597    #rm -rf $my_target_dir/$i
2598    if test -e $my_target_dir/$i; then : ; else
2599      dirn2=`AS_DIRNAME($my_target_dir/$i)`
2600      if test -e $dirn2; then : ; else
2601        AS_MKDIR_P($dirn2)
2602      fi
2603      $cmd $abs_source_dir/$my_dirname/$i $my_target_dir/$i
2604    fi
2605  done
2606else
2607  AC_MSG_WARN([File list file $2 missing!])
2608fi
2609])
2610
2611AC_DEFUN([AC_COIN_LINK_FROM_FILELIST],
2612[
2613AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
2614echo Creating links in $1 ...
2615AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, $coin_link_input_cmd)
2616])
2617
2618###########################################################################
2619#                       COIN_COPY_FROM_FILELIST                           #
2620###########################################################################
2621
2622# Like COIN_LINK_FROM_FILELIST, but copies the files.
2623
2624AC_DEFUN([AC_COIN_COPY_FROM_FILELIST],
2625[
2626echo Creating copies in $1 ...
2627AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, [cp])
2628])
2629
2630###########################################################################
2631#                          COIN_EXAMPLE_FILES                             #
2632###########################################################################
2633
2634# This macro determines the names of the example files (using the
2635# argument in an "ls" command) and sets up the variables EXAMPLE_FILES
2636# and EXAMPLE_CLEAN_FILES.  If this is a VPATH configuration, it also
2637# creates soft links to the example files.
2638
2639AC_DEFUN([AC_COIN_EXAMPLE_FILES],
2640[AC_REQUIRE([AC_COIN_CHECK_VPATH])
2641AC_REQUIRE([AC_COIN_ENABLE_MSVC])
2642AC_REQUIRE([AC_PROG_LN_S])
2643
2644files=`cd $srcdir; ls $1`
2645# We need to do the following loop to make sure that are no newlines
2646# in the variable
2647for file in $files; do
2648  EXAMPLE_FILES="$EXAMPLE_FILES $file"
2649done
2650if test $coin_vpath_config = yes; then
2651  lnkcmd=
2652  if test "$enable_msvc" = yes; then
2653    lnkcmd=cp
2654  fi
2655  case "$CC" in
2656    clang* ) ;;
2657    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2658      lnkcmd=cp ;;
2659  esac
2660  if test "x$lnkcmd" = xcp; then
2661    AC_MSG_NOTICE([Copying example files ($1)])
2662  else
2663    AC_MSG_NOTICE([Creating links to the example files ($1)])
2664    lnkcmd="$LN_S"
2665  fi
2666  for file in $EXAMPLE_FILES; do
2667    rm -f $file
2668    $lnkcmd $srcdir/$file $file
2669  done
2670  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES $1"
2671else
2672  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES"
2673fi
2674
2675# In case there are compressed files, we create a variable with the
2676# uncompressed names
2677EXAMPLE_UNCOMPRESSED_FILES=
2678for file in $EXAMPLE_FILES; do
2679  case $file in
2680    *.gz)
2681      EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`"
2682      ;;
2683  esac
2684done
2685
2686AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES)
2687AC_SUBST(EXAMPLE_FILES)
2688AC_SUBST(EXAMPLE_CLEAN_FILES)
2689]) #AC_COIN_EXAMPLE_FILES
2690
2691###########################################################################
2692#                      COIN_CHECK_USER_LIBRARY                            #
2693###########################################################################
2694# This macro sets up usage of a user library with header files. The assumption
2695# is that the header file(s) and library do not reside in standard system
2696# directories, hence both the include directory and link flags must be
2697# specified. There are two mandatory arguments and two optional arguments.
2698#
2699# The first argument (mandatory) should be a name (LibraryName) for the
2700# library.  The second argument (mandatory) should be an abbreviation in
2701# upper case letters (LBRY) for the library. Ultimately, the macro will
2702# specify two variables, LBRYINCDIR and LBRYLIB, to be substituted in files
2703# generated during configuration; a preprocessor symbol COIN_HAS_LBRY; and a
2704# matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the
2705# directory containing include files for the library. LBRYLIB should specify
2706# the flags necessary to link to the library. A variable coin_has_lbry will
2707# be set to true or false, as appropriate. A variable lbry_libcheck will be
2708# be set to yes or no; no indicates link checks should not be attempted.
2709#
2710# The macro defines three configure arguments, --with-libraryname-incdir,
2711# --with-libraryname-lib, and --disable-libraryname-libcheck, by converting
2712# LibraryName to lower case.
2713#
2714# LBRYINCDIR and LBRYLIB can be specified as environment variables or as
2715# part of the configure command using --with-libraryname-incdir and
2716# --with-libraryname-lib, respectively. Command line arguments override
2717# environment variables.
2718#
2719# If a third argument is given, it should specify a file in LBRYINCDIR.  The
2720# macro will check for the presence of the file. If a fourth argument is given,
2721# it should specify a function name, `fname'.  The macro will attempt to link a
2722# trivial program containing a parameterless call to the function, `fname()',
2723# using the LBRYLIB flags. The link check uses C as the language; this has been
2724# adequate to date but has limitations. It is possible to disable the link
2725# check by specifying --disable-libraryname-libcheck. This is a workaround for
2726# instances where the link check does not work properly, for whatever reason.
2727# If you're trying to link to a Fortran library, consider using F77_FUNC or
2728# FC_FUNC to obtain a mangled fname appropriate for use from C code. For a C++
2729# library, you're on your own unless the library declares some function with
2730# extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++
2731# name.
2732# A fifth argument can be specified to include linker flags that may be required
2733# to sucessfully perform the linking check.
2734#
2735# An optional sixth argument can be given to specify a list of targets.
2736# For each target X, the variables X_LIBS and X_PCLIBS will be extended by $LBRYLIB,
2737# if the library has been found and seems to work.
2738
2739AC_DEFUN([AC_COIN_CHECK_USER_LIBRARY],
2740[ AC_REQUIRE([AC_COIN_PROJECTDIR_INIT])
2741  AC_MSG_CHECKING(if user provides library for $1)
2742
2743# Check for header file directory
2744
2745  AC_ARG_WITH(m4_tolower($1)-incdir,
2746      AS_HELP_STRING([--with-m4_tolower($1)-incdir],
2747                     [specify the header file directory for library $1]),
2748      [$2INCDIR=`cd $withval; pwd`])
2749
2750# Check for library directory
2751
2752  AC_ARG_WITH(m4_tolower($1)-lib,
2753      AS_HELP_STRING([--with-m4_tolower($1)-lib],
2754                     [specify the flags used to link with the library $1]),
2755      [$2LIB=$withval])
2756
2757# Switch to disable library check if requested
2758
2759  AC_ARG_ENABLE(m4_tolower($1)-libcheck,
2760      AS_HELP_STRING([--disable-m4_tolower($1)-libcheck],
2761                     [skip the link check at configuration time]),
2762      [m4_tolower($1)_libcheck=$enableval],
2763      [m4_tolower($1)_libcheck=yes])
2764
2765# At this point, if we're going to use the library, both LBRYINCDIR and
2766# LBRYLIB must be defined and not empty.
2767
2768  if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then
2769    if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then
2770      AC_MSG_ERROR([You need to specify both an include directory and link flags to use library $1. Use --with-m4_tolower($1)-incdir of environment variable $$2INCDIR to specify the include directory. Use --with-m4_tolower($1)-lib or environment variable $$2LIB to specify link flags.])
2771    fi
2772    m4_tolower(coin_has_$2)=true
2773    AC_MSG_RESULT(yes)
2774  else
2775    m4_tolower(coin_has_$2)=false
2776    AC_MSG_RESULT(no)
2777  fi
2778
2779# If we have instructions for use, consider header and link checks.
2780
2781  if test $m4_tolower(coin_has_$2) = true; then
2782
2783# If argument 3 (file) is given, check for the file. Typically this will be a
2784# header file, but that's not assumed.
2785
2786    m4_ifval([$3],
2787        [AC_COIN_CHECK_FILE([$$2INCDIR/$3],[],
2788             [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])])
2789
2790# Now see if we can link the function. There are arguments for and against
2791# assuming argument 3 is a header file declaring the function. A correct
2792# function declaration is the main argument in favour. Having to cope with
2793# possible dependencies or other oddities are the main arguments against.
2794# Force the use of C as the best single choice amongst C++, C, and Fortran.
2795# Obviously, this has limits.
2796
2797    m4_ifvaln([$4],
2798        [if test x"$m4_tolower($1)_libcheck" != xno; then
2799           coin_save_LIBS="$LIBS"
2800           LIBS="$$2LIB $5"
2801           coin_$2_link=no
2802           AC_LANG_PUSH(C)
2803           for fnm in $4 ; do
2804             AC_MSG_CHECKING([whether symbol $fnm is available with $2])
2805             AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$fnm()]])],
2806                 [AC_MSG_RESULT(yes)
2807                  coin_$2_link=yes
2808                  break],
2809                 [AC_MSG_RESULT(no)])
2810           done
2811           AC_LANG_POP(C)
2812           LIBS="$coin_save_LIBS"
2813           if test x"$coin_$2_link" != xyes ; then
2814             AC_MSG_ERROR([Cannot find symbol(s) $4 with $2])
2815           fi
2816         fi])
2817
2818# If we make it this far, we've verified the file and linked the function. Add
2819# the necessary link flags to $6_{PC}LIBS and define the preprocessor symbol
2820# COIN_HAS_LBRY.
2821
2822    coin_foreach_w([myvar], [$6], [
2823      m4_toupper(myvar)_LIBS="$$2LIB $m4_toupper(myvar)_LIBS"
2824      m4_toupper(myvar)_PCLIBS="$$2LIB $m4_toupper(myvar)_PCLIBS"
2825      m4_toupper(myvar)_LIBS_INSTALLED="$$2LIB $m4_toupper(myvar)_LIBS_INSTALLED"
2826    ])
2827   
2828    AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available])
2829  fi
2830
2831# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
2832# automake conditional. These actions must occur unconditionally.
2833
2834  AC_SUBST($2INCDIR)
2835  AC_SUBST($2LIB)
2836  AM_CONDITIONAL(COIN_HAS_$2, test $m4_tolower(coin_has_$2) = true)
2837]) #AC_COIN_CHECK_USER_LIBRARY
2838
2839###########################################################################
2840#                            COIN_TRY_FLINK                               #
2841###########################################################################
2842
2843# Auxilliary macro to test if a Fortran function name can be linked,
2844# given the current settings of LIBS.  We determine from the context, what
2845# the currently active programming language is, and cast the name accordingly.
2846# The first argument is the name of the function/subroutine, in small letters,
2847# the second argument are the actions taken when the test works, and the
2848# third argument are the actions taken if the test fails.
2849
2850AC_DEFUN([AC_COIN_TRY_FLINK],
2851[case $ac_ext in
2852  f)
2853    AC_TRY_LINK(,[      call $1],[$2],[$3])
2854    ;;
2855  c)
2856    AC_F77_FUNC($1,cfunc$1)
2857    if test x"$coin_need_flibs" = xyes; then
2858      flink_try=no;
2859    else
2860      AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2861                  [flink_try=yes],[flink_try=no])
2862    fi
2863    if test $flink_try = yes; then
2864      $2
2865    else
2866      if test x"$FLIBS" != x; then
2867        flink_save_libs="$LIBS"
2868        LIBS="$LIBS $FLIBS"
2869        AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2870                    [LIBS="$flink_save_libs"
2871                     coin_need_flibs=yes
2872                     $2
2873                    ],
2874                    [LIBS="$flink_save_libs"
2875                     $3])
2876      else
2877        $3
2878      fi
2879    fi
2880    ;;
2881  cc|cpp)
2882    AC_F77_FUNC($1,cfunc$1)
2883    if test x"$coin_need_flibs" = xyes; then
2884      flink_try=no;
2885    else
2886      AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2887                  [flink_try=yes],[flink_try=no])
2888    fi
2889    if test $flink_try = yes; then
2890      $2
2891    else
2892      if test x"$FLIBS" != x; then
2893        flink_save_libs="$LIBS"
2894        LIBS="$LIBS $FLIBS"
2895        AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2896                    [LIBS="$flink_save_libs"
2897                     coin_need_flibs=yes
2898                     $2
2899                    ],
2900                    [LIBS="$flink_save_libs"
2901                     $3])
2902      else
2903        $3
2904      fi
2905    fi
2906    ;;
2907esac
2908]) # AC_COIN_TRY_FLINK
2909
2910###########################################################################
2911#                           COIN_DOXYGEN                                  #
2912###########################################################################
2913#
2914# This macro determines the configuration information for doxygen, the tool
2915# used to generate online documentation of COIN code. It takes one parameter,
2916# a list of projects (mixed-case, to match the directory names) that should
2917# be processed as external tag files. E.g., COIN_DOXYGEN([Clp Osi]).
2918#
2919# This macro will define the following variables:
2920#  coin_have_doxygen    Yes if doxygen is found, no otherwise
2921#  coin_doxy_usedot     Defaults to `yes'; --with-dot will still check to see
2922#                       if dot is available
2923#  coin_doxy_tagname    Name of doxygen tag file (placed in doxydoc directory)
2924#  coin_doxy_logname    Name of doxygen log file (placed in doxydoc directory)
2925#  coin_doxy_tagfiles   List of doxygen tag files used to reference other
2926#                       doxygen documentation
2927#  coin_doxy_excludes   Directories to exclude from doxygen processing
2928
2929AC_DEFUN([AC_COIN_DOXYGEN],
2930[
2931
2932AC_MSG_NOTICE([configuring doxygen documentation options])
2933
2934# Check to see if doxygen is available.
2935
2936AC_CHECK_PROG([coin_have_doxygen],[doxygen],[yes],[no])
2937
2938# Look for the dot tool from the graphviz package, unless the user has
2939# disabled it.
2940
2941AC_ARG_WITH([dot],
2942  AS_HELP_STRING([--with-dot],
2943                 [use dot (from graphviz) when creating documentation with
2944                  doxygen if available; --without-dot to disable]),
2945  [],[withval=yes])
2946if test x"$withval" = xno ; then
2947  coin_doxy_usedot=NO
2948  AC_MSG_CHECKING([for dot ])
2949  AC_MSG_RESULT([disabled])
2950else
2951  AC_CHECK_PROG([coin_doxy_usedot],[dot],[YES],[NO])
2952fi
2953
2954# Generate a tag file name and a log file name
2955
2956AC_SUBST([coin_doxy_tagname],[doxydoc/${PACKAGE}_doxy.tag])
2957AC_SUBST([coin_doxy_logname],[doxydoc/${PACKAGE}_doxy.log])
2958
2959# Process the list of project names and massage them into possible doxygen
2960# doc'n directories. Prefer 1) classic external, source processed using
2961# a project-specific doxygen.conf, we use the tag file; 2) classic
2962# external, source processed using package doxygen.conf; 3) installed
2963# doxydoc. Alternatives 1) and 2) are only possible if the directory will be
2964# configured, which we can't know unless this is the package base configure,
2965# since coin_subdirs is only set there. Hence it's sufficient to check for
2966# membership. If we use a tag file from a classic external, exclude the
2967# source from doxygen processing when doxygen runs in the base directory.
2968
2969coin_doxy_tagfiles=
2970coin_doxy_excludes=
2971tmp="$1"
2972for proj in $tmp ; do
2973  lc_proj=`echo $proj | [tr [A-Z] [a-z]]`
2974  AC_MSG_CHECKING([for doxygen doc'n for $proj ])
2975  doxytag=${lc_proj}_doxy.tag
2976  doxyfound=no
2977  for chkProj in $coin_subdirs ; do
2978    if test "$chkProj" = "$proj" ; then
2979      # proj will be configured, hence doxydoc present in build tree
2980      doxysrcdir="${srcdir}/${proj}"
2981      # AC_MSG_NOTICE([Considering $doxysrcdir (base)])
2982      if test -d "$doxysrcdir" ; then
2983        # with a doxydoc directory?
2984        doxydir="$doxysrcdir/doxydoc"
2985        # AC_MSG_NOTICE([Considering $doxydir (base)])
2986        # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
2987        if test -d "$doxydir" ; then
2988          # use tag file; don't process source
2989          eval doxydir="`pwd`/${proj}/doxydoc"
2990          coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
2991          AC_MSG_RESULT([$doxydir (tag)])
2992          coin_doxy_excludes="$coin_doxy_excludes */${proj}"
2993        else
2994          # will process the source -- nothing further to be done here
2995          AC_MSG_RESULT([$doxysrcdir (src)])
2996        fi
2997        doxyfound=yes
2998      fi
2999    fi
3000  done
3001  # Not built, fall back to installed tag file
3002  if test $doxyfound = no ; then
3003    eval doxydir="${datadir}/coin/doc/${proj}/doxydoc"
3004    # AC_MSG_NOTICE([Considering $doxydir (install)])
3005    # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
3006    coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
3007    AC_MSG_RESULT([$doxydir (tag)])
3008  fi
3009done
3010AC_SUBST([coin_doxy_tagfiles])
3011AC_SUBST([coin_doxy_excludes])
3012
3013]) # AC_COIN_DOXYGEN
3014
3015
3016###########################################################################
3017#                           COIN_HAS_PKGCONFIG                            #
3018###########################################################################
3019
3020# This macro checks whether a pkg-config tool with a minimal version number
3021# is available.  If so, then the variable PKGCONFIG is set to its path.
3022# If not, PKGCONFIG is set to "".  The minimal version number can be given
3023# as first parameter, by default it is 0.16.0, since COIN-OR .pc files now
3024# include an URL field, which breaks pkg-config version <= 0.15.
3025# This macro is a modified version of PKG_PROG_PKG_CONFIG in pkg.m4.
3026# Further, the AM_CONDITIONAL COIN_HAS_PKGCONFIG is set and PKGCONFIG is
3027# AC_SUBST'ed.  Finally, if this setup belongs to a project directory, then
3028# the search path for .pc files is assembled from the value of
3029# $PKG_CONFIG_PATH, the values of --prefix, --coin-instdir, and the directories
3030# named in a file ../coin_subdirs.txt or ../../coin_subdirs.txt in a variable
3031# COIN_PKG_CONFIG_PATH, which is also AC_SUBST'ed. For a path xxx given in the
3032# coin-subdirs.txt, also the directory xxx/pkgconfig is added, if existing.
3033
3034AC_DEFUN([AC_COIN_HAS_PKGCONFIG],
3035[AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
3036
3037AC_ARG_ENABLE([pkg-config],
3038  [AC_HELP_STRING([--disable-pkg-config],[disable use of pkg-config (if available)])],
3039  [use_pkgconfig="$enableval"],
3040  [if test x$coin_cc_is_cl = xtrue; then
3041     use_pkgconfig=no
3042   else
3043     use_pkgconfig=yes
3044   fi])
3045
3046if test $use_pkgconfig = yes ; then
3047  if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
3048    AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
3049  fi
3050  if test -n "$PKG_CONFIG"; then
3051    _pkg_min_version=m4_default([$1], [0.16.0])
3052    AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
3053    if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
3054      AC_MSG_RESULT([yes])
3055    else
3056      AC_MSG_RESULT([no])
3057      PKG_CONFIG=""
3058    fi
3059  fi
3060
3061  # check if pkg-config supports the short-errors flag
3062  if test -n "$PKG_CONFIG" && \
3063    $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
3064    pkg_short_errors=" --short-errors "
3065  else
3066    pkg_short_errors=""
3067  fi
3068fi
3069
3070AM_CONDITIONAL([COIN_HAS_PKGCONFIG], [test -n "$PKG_CONFIG"])
3071AC_SUBST(PKG_CONFIG)
3072
3073# assemble pkg-config search path for installed projects
3074COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
3075
3076# let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there
3077# best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig,
3078# unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}...
3079if test "x${prefix}" = xNONE ; then
3080  COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib64/pkgconfig:${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3081else
3082  COIN_PKG_CONFIG_PATH="${prefix}/lib64/pkgconfig:${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3083fi
3084
3085AC_ARG_WITH([coin-instdir],
3086  AC_HELP_STRING([--with-coin-instdir],
3087                 [prefix of installation directory for precompiled COIN packages]),
3088  [if test -d "$withval"; then : ; else
3089     AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
3090   fi
3091   COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3092  ],[])
3093
3094AC_SUBST(COIN_PKG_CONFIG_PATH)
3095
3096# assemble additional pkg-config search paths for uninstalled projects
3097if test x$coin_projectdir = xyes ; then
3098  # if we are in a project setup, then in a classic setup, we want to find uninstalled projects
3099  # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory
3100  # unfortunately, if the user set prefix, then we do not know where the project base directory is located
3101  # but it is likely to be either .. (if we are a usual coin project) or ../.. (if we are a unusual coin project like ThirdParty or Data)
3102  COIN_PKG_CONFIG_PATH_UNINSTALLED=
3103  if test -e ../coin_subdirs.txt ; then
3104    for i in `cat ../coin_subdirs.txt` ; do
3105      if test -d ../$i ; then
3106        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3107      fi
3108      if test -d ../$i/pkgconfig ; then
3109        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3110      fi
3111    done
3112  fi
3113
3114  if test -e ../../coin_subdirs.txt ; then
3115    for i in `cat ../../coin_subdirs.txt` ; do
3116      if test -d ../../$i ; then
3117        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3118      fi
3119      if test -d ../../$i/pkgconfig ; then
3120        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3121      fi
3122    done
3123  fi
3124
3125  AC_SUBST(COIN_PKG_CONFIG_PATH_UNINSTALLED)
3126fi
3127
3128if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then
3129  AC_MSG_WARN([Using pkg-config together with MS or Intel Compiler on Windows is not support by example Makefiles. Consider using --disable-pkg-config.])
3130fi
3131
3132])
3133
3134###########################################################################
3135#                           COIN_PKG_CHECK_PROJECT_EXISTS                 #
3136###########################################################################
3137
3138# COIN_PKG_CHECK_PROJECT_EXISTS(PROJECT, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3139#
3140# Check to see whether a particular project exists.  Similar
3141# to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables
3142#
3143AC_DEFUN([AC_COIN_PKG_CHECK_PROJECT_EXISTS],
3144[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3145if test -n "$PKG_CONFIG" ; then
3146  if $PKG_CONFIG --exists "m4_tolower($1)"; then
3147    m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null`
3148    m4_ifval([$2], [$2], [:])
3149  else
3150    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"`
3151    $3
3152  fi
3153else
3154  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
3155fi
3156])
3157
3158###########################################################################
3159#                           COIN_PKG_CHECK_MODULE_EXISTS                  #
3160###########################################################################
3161
3162# COIN_PKG_CHECK_MODULES_EXISTS(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3163#
3164# Check to see whether a particular set of packages exists.
3165# Similar to PKG_CHECK_MODULES(), but set only the variable $1_VERSIONS and $1_PKG_ERRORS
3166#
3167AC_DEFUN([AC_COIN_PKG_CHECK_MODULE_EXISTS],
3168[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3169if test -n "$PKG_CONFIG" ; then
3170  if $PKG_CONFIG --exists "$2"; then
3171    m4_toupper($1)[]_VERSIONS=`$PKG_CONFIG --modversion "$2" 2>/dev/null | tr '\n' ' '`
3172    $3
3173  else
3174    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$2"`
3175    $4
3176  fi
3177else
3178  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
3179fi
3180])
3181
3182###########################################################################
3183#                           COIN_PKG_HAS_MODULE                           #
3184###########################################################################
3185
3186# COIN_PKG_HAS_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3187#
3188# Checks whether pkg-config files for a given set of packages is available.
3189# If so, sets MODULE_CFLAGS, MODULE_LIBS, and MODULES_DATA and executes ACTION-IF-FOUND.
3190# If not, then ACTION-IF-NOT-FOUND is executed.
3191# A reason for not finding a package is stored in MODULE_PKG_ERRORS
3192#
3193# --------------------------------------------------------------
3194AC_DEFUN([AC_COIN_PKG_HAS_MODULE],
3195[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3196
3197AC_COIN_PKG_CHECK_MODULE_EXISTS([$1],[$2],
3198  [ cflags=`$PKG_CONFIG --cflags "$2" 2>/dev/null`
3199    # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files
3200        # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's
3201        # but only do this if is not trivial
3202    if test "$CYGPATH_W" != "echo" ; then
3203      # need to put into brackets since otherwise autoconf replaces the brackets in the sed command
3204      [cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
3205    fi
3206    m4_toupper($1)[]_CFLAGS="$cflags"
3207    m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "$2" 2>/dev/null`
3208    m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "$2" 2>/dev/null`
3209    $3
3210  ],
3211  [ $4 ])
3212
3213])# PKG_CHECK_MODULES
3214
3215###########################################################################
3216#                           COIN_MAIN_PACKAGEDIR                          #
3217###########################################################################
3218
3219# This macro substitutes COIN_MAIN_SUBDIR.
3220# If $2/$1 or $1 is in COIN_SKIP_PROJECTS, do nothing.
3221# If --with-$1-lib, --with-$1-incdir, or --with-$1-datadir is given, then assume that the package is installed.
3222# Otherwise, if the directory $2/$1 and the file $2/$1/$3 exist, check whether $2/$1/configure exists.
3223#   If so, include this directory into the list of directories where configure and make recourse into.
3224# tolower(coin_has_$1) is set to "no" if the project source is not available or will not be compiled.
3225# Otherwise, it will be set to "yes".
3226
3227AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],[
3228AC_MSG_CHECKING([whether source of project $1 is available and should be compiled])
3229
3230m4_tolower(coin_has_$1)=notGiven
3231coin_reason=
3232
3233# check if user wants to skip project in any case
3234AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
3235if test x"$COIN_SKIP_PROJECTS" != x; then
3236  for dir in $COIN_SKIP_PROJECTS; do
3237    if test $dir = "$1"; then
3238      m4_tolower(coin_has_$1)="no"
3239      coin_reason="$1 has been specified in COIN_SKIP_PROJECTS"
3240    fi
3241    m4_ifval($2,[
3242    if test $dir = "$2/$1"; then
3243      m4_tolower(coin_has_$1)="no"
3244      coin_reason="$2/$1 has been specified in COIN_SKIP_PROJECTS"
3245    fi])
3246  done
3247fi
3248
3249if test "$m4_tolower(coin_has_$1)" != no; then
3250  AC_ARG_WITH([m4_tolower($1)],,
3251    [if test "$withval" = no ; then
3252       m4_tolower(coin_has_$1)="no"
3253       coin_reason="--without-m4_tolower($1) has been specified"
3254     fi
3255    ])
3256fi
3257
3258if test "$m4_tolower(coin_has_$1)" != no; then
3259  AC_ARG_WITH([m4_tolower($1)-lib],
3260    AC_HELP_STRING([--with-m4_tolower($1)-lib],
3261                   [linker flags for using project $1]),
3262    [if test "$withval" = no ; then
3263       m4_tolower(coin_has_$1)="no"
3264       coin_reason="--without-m4_tolower($1)-lib has been specified"
3265     else
3266       m4_tolower(coin_has_$1)="no"
3267       coin_reason="--with-m4_tolower($1)-lib has been specified"
3268     fi],
3269    [])
3270fi
3271
3272if test "$m4_tolower(coin_has_$1)" != no; then
3273  AC_ARG_WITH([m4_tolower($1)-incdir],
3274    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
3275                   [directory with header files for using project $1]),
3276    [if test "$withval" = no ; then
3277       m4_tolower(coin_has_$1)="no"
3278       coin_reason="--without-m4_tolower($1)-incdir has been specified"
3279     else
3280       m4_tolower(coin_has_$1)="no"
3281       coin_reason="--with-m4_tolower($1)-incdir has been specified"
3282     fi],
3283    [])
3284fi
3285
3286if test "$m4_tolower(coin_has_$1)" != no; then
3287  AC_ARG_WITH([m4_tolower($1)-datadir],
3288    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
3289                   [directory with data files for using project $1]),
3290    [if test "$withval" = no ; then
3291       m4_tolower(coin_has_$1)="no"
3292       coin_reason="--without-m4_tolower($1)-datadir has been specified"
3293     else
3294       m4_tolower(coin_has_$1)="no"
3295       coin_reason="--with-m4_tolower($1)-datadir has been specified"
3296     fi],
3297    [])
3298fi
3299
3300m4_if(m4_tolower($1), blas, [
3301  if test $m4_tolower(coin_has_$1) != no; then
3302    #--with-blas can overwrite --with-blas-lib, and can be set to BUILD to enforce building blas
3303    AC_ARG_WITH([blas],
3304      AC_HELP_STRING([--with-blas], [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]),
3305        [if test x"$withval" = "xno" ; then
3306           coin_has_blas="no"
3307           coin_reason="--without-blas has been specified"
3308         elif test x"$withval" != "xBUILD" ; then
3309           coin_has_blas="no"
3310           coin_reason="--with-blas has been specified"
3311         fi],
3312        [])
3313  fi
3314])
3315
3316m4_if(m4_tolower($1), lapack, [
3317  if test $m4_tolower(coin_has_$1) != skipping; then
3318    #--with-lapack can overwrite --with-lapack-lib, and can be set to BUILD to enforce building lapack
3319    AC_ARG_WITH([lapack],
3320      AC_HELP_STRING([--with-lapack], [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]),
3321        [if test x"$withval" = "xno" ; then
3322           coin_has_lapack="no"
3323           coin_reason="--without-lapack has been specified"
3324         elif test x"$withval" != "xBUILD" ; then
3325           coin_has_lapack="no"
3326           coin_reason="--with-lapack has been specified"
3327         fi],
3328        [])
3329  fi
3330])
3331
3332# check if project is available in present directory
3333if test "$m4_tolower(coin_has_$1)" = notGiven; then
3334  m4_tolower(coin_has_$1)=no
3335  if test -d $srcdir/m4_ifval($2,[$2/],)$1; then
3336    coin_reason="source in m4_ifval($2,[$2/],)$1"
3337    # If a third argument is given, then we have to check if one one the files given in that third argument is present.
3338    # If none of the files in the third argument is available, then we consider the project directory as non-existing.
3339    # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient.
3340    m4_ifvaln([$3],
3341      [for i in $srcdir/m4_ifval($2,[$2/],)$1/$3; do
3342         if test -r $i; then
3343           m4_tolower(coin_has_$1)="yes"
3344         else
3345           m4_tolower(coin_has_$1)="no"
3346           coin_reason="source file $i not available"
3347           break
3348         fi
3349       done],
3350      [ m4_tolower(coin_has_$1)="yes" ])
3351  fi
3352fi
3353
3354if test -z "$coin_reason" ; then
3355  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
3356else
3357  AC_MSG_RESULT([$m4_tolower(coin_has_$1), $coin_reason])
3358fi
3359
3360if test "$m4_tolower(coin_has_$1)" = yes ; then
3361  if test -r $srcdir/m4_ifval($2,[$2/],)$1/configure; then
3362    coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1"
3363    AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1)
3364  fi
3365fi
3366])
3367
3368###########################################################################
3369#                            COIN_CHECK_PACKAGE                           #
3370###########################################################################
3371
3372# This macro checks for the existance of a COIN-OR package and provides compiler and linker flags to compile against this package.
3373# A package can consists of one or more COIN-OR or other projects.
3374# It defines the PACKAGE_CFLAGS, PACKAGE_LIBS, PACKAGE_DEPENDENCIES, and PACKAGE_DATA variables, referring to the compiler and linker
3375# flags to use when linking against this module, the libraries the package depends on, and the directories where the module data resists.
3376# The difference between PACKAGE_LIBS and PACKAGE_DEPENDENCIES is that PACKAGE_DEPENDENCIES does not contain arguments starting with '-',
3377# so it can be used to setup the _DEPENDENCIES variable in a Makefile.am.
3378# It also defines a COIN_HAS_PACKAGE preprocessor macro and makefile conditional.
3379# Further, tolower(coin_has_$1) is set to "yes".
3380# If a list of build targets using this projects is given in the third argument,
3381# then the compiler and linker variables and .pc file setup variable corresponding to this build target
3382# are extended with the values for this package.
3383# That is, for each build target X, the variables X_CFLAGS, X_LIBS, X_DEPENDENCIES, X_PCLIBS, X_PCREQUIRES are setup,
3384# whereas the last two specify the values to put into the "Libs:" and "Requires:" fields of the .pc file, resp.
3385#
3386# The first argument should be the name (PACKAGE) of the package (in correct lower
3387# and upper case).
3388# The second argument should be a (space separated) list of projects which this
3389# package consists of. Optionally, required version numbers can be added.
3390# The optional third argument should be a (space separated) list of build targets
3391# which use this package, if available.
3392#
3393# It is also possible to specify a preinstalled version of this package
3394# or to specify only the linker and compiler flags and data directory.
3395#
3396# If the user did not specify --with-$1-... flags and pkg-config is not available,
3397# COIN_CHECK_PACKAGE_FALLBACK($1, $2, $3) is called.
3398
3399AC_DEFUN([AC_COIN_CHECK_PACKAGE],
3400[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3401AC_MSG_CHECKING([for COIN-OR package $1])
3402
3403m4_tolower(coin_has_$1)=notGiven
3404
3405# check if user wants to skip package in any case
3406if test x"$COIN_SKIP_PROJECTS" != x; then
3407  for dir in $COIN_SKIP_PROJECTS; do
3408    if test $dir = "$1"; then
3409      m4_tolower(coin_has_$1)=skipping
3410    fi
3411  done
3412fi
3413
3414if test "$m4_tolower(coin_has_$1)" != skipping; then
3415  AC_ARG_WITH([m4_tolower($1)],,
3416    [if test "$withval" = no ; then
3417       m4_tolower(coin_has_$1)=skipping
3418     fi
3419    ])
3420fi
3421
3422m4_toupper($1_LIBS)=
3423m4_toupper($1_CFLAGS)=
3424m4_toupper($1_DATA)=
3425m4_toupper($1_DEPENDENCIES)=
3426m4_toupper($1_PCLIBS)=
3427m4_toupper($1_PCREQUIRES)=
3428m4_toupper($1_DATA)=
3429AC_SUBST(m4_toupper($1_LIBS))
3430AC_SUBST(m4_toupper($1_CFLAGS))
3431AC_SUBST(m4_toupper($1_DATA))
3432AC_SUBST(m4_toupper($1_DEPENDENCIES))
3433AC_SUBST(m4_toupper($1_LIBS_INSTALLED))
3434AC_SUBST(m4_toupper($1_CFLAGS_INSTALLED))
3435AC_SUBST(m4_toupper($1_DATA_INSTALLED))
3436coin_foreach_w([myvar], [$3], [
3437  AC_SUBST(m4_toupper(myvar)_CFLAGS)
3438  AC_SUBST(m4_toupper(myvar)_LIBS)
3439  AC_SUBST(m4_toupper(myvar)_PCLIBS)
3440  AC_SUBST(m4_toupper(myvar)_PCREQUIRES)
3441  AC_SUBST(m4_toupper(myvar)_DEPENDENCIES)
3442  AC_SUBST(m4_toupper(myvar)_CFLAGS_INSTALLED)
3443  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
3444])
3445
3446#check if user provided LIBS, CFLAGS, or DATA for package or disables use of package
3447if test $m4_tolower(coin_has_$1) != skipping; then
3448  AC_ARG_WITH([m4_tolower($1)-lib],
3449    AC_HELP_STRING([--with-m4_tolower($1)-lib],
3450                   [linker flags for using package $1]),
3451    [if test "$withval" = no ; then
3452       m4_tolower(coin_has_$1)=skipping
3453     else
3454       m4_tolower(coin_has_$1)=yes
3455       m4_toupper($1_LIBS)="$withval"
3456       m4_toupper($1_PCLIBS)="$withval"
3457       coin_foreach_w([myvar], [$3], [
3458         m4_toupper(myvar)_PCLIBS="$withval $m4_toupper(myvar)_PCLIBS"
3459         m4_toupper(myvar)_LIBS="$withval $m4_toupper(myvar)_LIBS"
3460       ])
3461       # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
3462       if test -z "$PKG_CONFIG" ; then
3463         m4_toupper($1_LIBS_INSTALLED)="$withval"
3464         coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_LIBS_INSTALLED="$withval $m4_toupper(myvar)_LIBS_INSTALLED"])
3465       fi
3466     fi
3467    ],
3468    [])
3469fi
3470
3471if test $m4_tolower(coin_has_$1) != skipping; then
3472  AC_ARG_WITH([m4_tolower($1)-incdir],
3473    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
3474                   [directory with header files for using package $1]),
3475    [if test "$withval" = no ; then
3476       m4_tolower(coin_has_$1)=skipping
3477     else
3478       m4_tolower(coin_has_$1)=yes
3479       m4_toupper($1_CFLAGS)="-I`${CYGPATH_W} $withval`"
3480       coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="-I`${CYGPATH_W} $withval` $m4_toupper(myvar)_CFLAGS"])
3481       # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
3482       if test -z "$PKG_CONFIG" ; then
3483         m4_toupper($1_CFLAGS_INSTALLED)="$m4_toupper($1_CFLAGS)"
3484         coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1_CFLAGS) $m4_toupper(myvar)_CFLAGS_INSTALLED"])
3485       fi
3486     fi
3487    ],
3488    [])
3489fi
3490
3491if test $m4_tolower(coin_has_$1) != skipping; then
3492  AC_ARG_WITH([m4_tolower($1)-datadir],
3493    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
3494                   [directory with data files for using package $1]),
3495    [if test "$withval" = no ; then
3496       m4_tolower(coin_has_$1)=skipping
3497     else
3498       m4_tolower(coin_has_$1)=yes
3499       m4_toupper($1_DATA)="$withval"
3500       # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
3501       if test -z "$PKG_CONFIG" ; then
3502         m4_toupper($1_DATA_INSTALLED)="$withval"
3503       fi
3504     fi
3505    ],
3506    [])
3507fi
3508
3509if test $m4_tolower(coin_has_$1) = notGiven; then
3510  if test -n "$PKG_CONFIG" ; then
3511    # set search path for pkg-config
3512    # need to export variable to be sure that the following pkg-config gets these values
3513    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
3514    PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED"
3515    export PKG_CONFIG_PATH
3516   
3517    # let pkg-config do it's magic
3518    AC_COIN_PKG_HAS_MODULE([$1],[$2],
3519      [ m4_tolower(coin_has_$1)=yes
3520        AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
3521
3522        # adjust linker flags for (i)cl compiler
3523        # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl)
3524        if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
3525        then
3526          m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
3527        fi
3528        m4_toupper($1_PCREQUIRES)="$2"
3529   
3530        # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in $3
3531        coin_foreach_w([myvar], [$3], [
3532          m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
3533          m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
3534          m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
3535        ])
3536      ],
3537      [ m4_tolower(coin_has_$1)=notGiven
3538        AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS])
3539      ])
3540
3541    # reset PKG_CONFIG_PATH variable
3542    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
3543    export PKG_CONFIG_PATH
3544
3545  else
3546    AC_MSG_RESULT([skipped check via pkg-config, redirect to fallback])
3547    AC_COIN_CHECK_PACKAGE_FALLBACK([$1], [$2], [$3])
3548  fi
3549
3550else
3551  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
3552fi
3553
3554if test $m4_tolower(coin_has_$1) != skipping &&
3555   test $m4_tolower(coin_has_$1) != notGiven ; then
3556  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
3557
3558  AC_ARG_ENABLE([interpackage-dependencies],
3559    AC_HELP_STRING([--disable-interpackage-dependencies], [disables deduction of Makefile dependencies from package linker flags]),
3560    [], [enable_interpackage_dependencies=yes])
3561   
3562  if test $enable_interpackage_dependencies = yes ; then
3563     # construct dependencies variables from LIBS variables
3564     # we add an extra space in LIBS so we can substitute out everything starting with " -"
3565     # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* and wsock32.lib as used on Windows
3566     # then remove everything of the form -xxx
3567     # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl)
3568     m4_toupper($1)_DEPENDENCIES=`echo " $m4_toupper($1)_LIBS" | [sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework  *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']`
3569     coin_foreach_w([myvar], [$3], [
3570       m4_toupper(myvar)_DEPENDENCIES=`echo " $m4_toupper(myvar)_LIBS " | [sed -e 's/ mkl[^ ]*//g' -e 's/ libiomp5[^ ]*//g' -e 's/ wsock32[^ ]*//g' -e 's/ -framework  *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']`
3571     ])
3572  fi
3573
3574  if test 1 = 0 ; then  #change this test to enable a bit of debugging output
3575    if test -n "$m4_toupper($1)_CFLAGS" ; then
3576      AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
3577    fi
3578    if test -n "$m4_toupper($1)_LIBS" ; then
3579      AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
3580    fi
3581    if test -n "$m4_toupper($1)_DEPENDENCIES" ; then
3582      AC_MSG_NOTICE([$1 DEPENDENCIES are $m4_toupper($1)_DEPENDENCIES])
3583    fi
3584    if test -n "$m4_toupper($1)_DATA" ; then
3585      AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
3586    fi
3587    if test -n "$m4_toupper($1)_PCLIBS" ; then
3588      AC_MSG_NOTICE([$1 PCLIBS are $m4_toupper($1)_PCLIBS])
3589    fi
3590    if test -n "$m4_toupper($1)_PCREQUIRES" ; then
3591      AC_MSG_NOTICE([$1 PCREQUIRES are $m4_toupper($1)_PCREQUIRES])
3592    fi
3593    coin_foreach_w([myvar], [$3], [
3594      AC_MSG_NOTICE([myvar CFLAGS are $m4_toupper(myvar)_CFLAGS])
3595      AC_MSG_NOTICE([myvar LIBS   are $m4_toupper(myvar)_LIBS])
3596      AC_MSG_NOTICE([myvar DEPENDENCIES are $m4_toupper(myvar)_DEPENDENCIES])
3597    ])
3598  fi
3599fi
3600
3601# Define the Makefile conditional
3602AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
3603               [test $m4_tolower(coin_has_$1) != notGiven &&
3604                test $m4_tolower(coin_has_$1) != skipping])
3605
3606]) # AC_COIN_CHECK_PACKAGE
3607
3608###########################################################################
3609#                       COIN_CHECK_PACKAGE_FALLBACK                       #
3610###########################################################################
3611
3612# This macro is used by COIN_CHECK_PACKAGE, if it fails to find a package
3613# because pkg-config was disabled or is not available.
3614#
3615# For each project xxx specified in $2, it searches for a xxx-uninstalled.pc
3616# file in the directories specified in $COIN_PKG_CONFIG_PATH_UNINSTALLED. The
3617# latter variable is setup by COIN_HAS_PKGCONFIG and consists of the content
3618# of the coin_subdirs.txt file which has been created by configure in the
3619# base directory.  The content of xxx-uninstalled.pc is parsed in order
3620# to defines the variables PACKAGE_CFLAGS, PACKAGE_LIBS, and PACKAGE_DATA,
3621# referring to the compiler and linker flags to use when linking against this
3622# package and the directory where the package data resists.  Further, for each
3623# build target X specified in the third argument, the variables X_CFLAGS and
3624# X_LIBS are extended with the compiler and linker flags of this package and
3625# the variables X_PCLIBS and X_PCREQUIRES are extended by the list of linker
3626# flags and dependent projects as needed to setup a .pc file.  The macros
3627# checks also dependencies of $2.  Note that the PACKAGE_DATA variable is
3628# set to the content of datadir of the first .pc file that is parsed.
3629# Finally, for each X in the third argument, also variables
3630# X_CFLAGS_INSTALLED and X_LIBS_INSTALLED are setup. They contain the compiler
3631# and linker flags for X when all projects have been installed. Their content
3632# is assembled from the .pc files that correspond to installed projects. I.e.,
3633# whenever a file proj-uninstalled.pc is parsed, then also a corresponding
3634# proj.pc file is parsed for compiler and linker flags, if available in the
3635# same directory.
3636# Similar, a variable PACKAGE_DATA_INSTALLED is setup to the content of datadir
3637# of the first .pc file that is parsed.
3638#
3639# If .pc files for all projects in $2 and their dependencies is found,
3640# tolower(coin_has_$1) is set to "yes".  Otherwise, if some dependency
3641# is not found, tolower(coin_has_$1) is set to "notGiven".  Further, a
3642# COIN_HAS_PACKAGE preprocessor macro and a makefile conditional are defined.
3643#
3644# The first argument should be the name (PACKAGE) of the package (in correct
3645# lower and upper case).  The second argument should be the base names of the
3646# projects .pc file which define this package.  The optional third argument
3647# should be a (space separated) list of build targets which use this package,
3648# if available.
3649#
3650# $1 is not checked for $COIN_SKIP_PROJECTS, since we only look into
3651# $COIN_PKG_CONFIG_PATH_UNINSTALLED.  When the content of this variable was
3652# setup in the base directory, $COIN_SKIP_PROJECTS has already been considered.
3653
3654AC_DEFUN([AC_COIN_CHECK_PACKAGE_FALLBACK],
3655[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3656AC_MSG_CHECKING([for COIN-OR package $1 (fallback)])
3657
3658m4_tolower(coin_has_$1)=notGiven
3659m4_toupper($1_LIBS)=
3660m4_toupper($1_LIBS_INSTALLED)=
3661m4_toupper($1_CFLAGS)=
3662m4_toupper($1_CFLAGS_INSTALLED)=
3663m4_toupper($1_DATA)=
3664m4_toupper($1_DATA_INSTALLED)=
3665m4_toupper($1_PCLIBS)=
3666m4_toupper($1_PCREQUIRES)=
3667
3668# initial list of dependencies is "$2", but we need to filter out version number specifications (= x, <= x, >= x, != x)
3669projtoprocess="m4_bpatsubsts([$2], [<?>?!?=[    ]*[^    ]+])"
3670
3671# we first expand the list of projects to process by adding all dependencies just behind the project which depends on it
3672# further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards
3673# the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples
3674# also, we setup the DATA variable
3675allproj=""
3676allpcfiles=""
3677allpcifiles=""
3678while test "x$projtoprocess" != x ; do
3679
3680  for proj in $projtoprocess ; do
3681    # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it
3682    pcfile=""
3683    save_IFS="$IFS"
3684    IFS=":"
3685    for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do
3686      # the base directory configure should have setup coin_subdirs.txt in a way that it does not contain projects that should be skipped, so we do not need to test this here again
3687      if test -r "$dir/${proj}-uninstalled.pc" ; then
3688        pcfile="$dir/$proj-uninstalled.pc"
3689        if test -r "$dir/${proj}.pc" ; then
3690          pcifile="$dir/${proj}.pc"
3691        else
3692          AC_MSG_WARN([Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples.])
3693          pcifile=
3694        fi
3695        break
3696      fi
3697    done
3698    IFS="$save_IFS"
3699
3700    if test "x$pcfile" != x ; then
3701      # read dependencies from $pcfile and filter it
3702      projrequires=[`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[       ]\{0,\}[^       ]\{1,\}//g'`]
3703
3704      # add projrequires to the front of the list of projects that have to be processed next
3705      # at the same time, remove $proj from this list
3706      projtoprocess=[`echo $projtoprocess | sed -e "s/$proj/$projrequires/"`]
3707
3708      # read DATA from $pcfile, if _DATA is still empty
3709      if test "x$m4_toupper($1_DATA)" = x ; then
3710        projdatadir=
3711        [pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile`]
3712        eval `sh -c "$pcfilemod"`
3713        m4_toupper($1_DATA)="$projdatadir"
3714      fi
3715
3716      allproj="$allproj $proj"
3717      allpcfiles="$pcfile:$allpcfiles"
3718
3719    else
3720      AC_MSG_RESULT([no, dependency $proj not available])
3721      allproj=fail
3722      break 2
3723    fi
3724   
3725    if test "x$pcifile" != x ; then
3726      allpcifiles="$pcifile:$allpcifiles"
3727     
3728      # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty
3729      if test "x$m4_toupper($1_DATA_INSTALLED)" = x ; then
3730        projdatadir=
3731        [pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile`]
3732        eval `sh -c "$pcifilemod"`
3733        if test "${CYGPATH_W}" != "echo"; then
3734          projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`"
3735        fi
3736        m4_toupper($1_DATA_INSTALLED)="$projdatadir"
3737      fi
3738     
3739    fi
3740
3741    break
3742  done
3743
3744  # remove spaces on begin of $projtoprocess
3745  projtoprocess=`echo $projtoprocess | sed -e 's/^[ ]*//'`
3746
3747done
3748
3749if test "$allproj" != fail ; then
3750
3751  # now go through the list of .pc files and assemble compiler and linker flags
3752  # important is here to obey the reverse order that has been setup before,
3753  # since then libraries that are required by several others should be after these other libraries
3754  pcfilesprocessed=""
3755
3756  save_IFS="$IFS"
3757  IFS=":"
3758  for pcfile in $allpcfiles ; do
3759
3760    # if $pcfile has been processed already, skip this round
3761    if test "x$pcfilesprocessed" != x ; then
3762      for pcfiledone in $pcfilesprocessed ; do
3763        if test "$pcfiledone" = "$pcfile" ; then
3764          continue 2
3765        fi
3766      done
3767    fi
3768
3769    # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
3770    #   replace "Libs:" by "echo projlibs="
3771    #   replace "Cflags:" by "echo projcflags="
3772    #   remove every line starting with <some word>:
3773    [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
3774
3775    # set projcflags and projlibs variables by running $pcfilemod
3776    # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default
3777    projcflags=
3778    projlibs=
3779    IFS="$save_IFS"
3780    eval `sh -c "$pcfilemod"`
3781    IFS=":"
3782
3783    # add CYGPATH_W cludge into include flags and set CFLAGS variable
3784    if test "${CYGPATH_W}" != "echo"; then
3785      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
3786    fi
3787    m4_toupper($1_CFLAGS)="$projcflags $m4_toupper($1_CFLAGS)"
3788
3789    # set LIBS variable
3790    m4_toupper($1_LIBS)="$projlibs $m4_toupper($1_LIBS)"
3791
3792    # remember that we have processed $pcfile
3793    pcfilesprocessed="$pcfilesprocessed:$pcfile"
3794
3795  done
3796  IFS="$save_IFS"
3797
3798
3799  # now go through the list of .pc files for installed projects and assemble compiler and linker flags
3800  # important is here again to obey the reverse order that has been setup before,
3801  # since then libraries that are required by several others should be after these other libraries
3802  pcfilesprocessed=""
3803
3804  save_IFS="$IFS"
3805  IFS=":"
3806  for pcfile in $allpcifiles ; do
3807
3808    # if $pcfile has been processed already, skip this round
3809    if test "x$pcfilesprocessed" != x ; then
3810      for pcfiledone in $pcfilesprocessed ; do
3811        if test "$pcfiledone" = "$pcfile" ; then
3812          continue 2
3813        fi
3814      done
3815    fi
3816
3817    # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
3818    #   replace "Libs:" by "echo projlibs="
3819    #   replace "Cflags:" by "echo projcflags="
3820    #   remove every line starting with <some word>:
3821    [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
3822
3823    # set projcflags and projlibs variables by running $pcfilemod
3824    # under mingw, the current IFS seem to make the : in the paths of the gfortran libs go away, so we temporarily set IFS back to its default
3825    projcflags=
3826    projlibs=
3827    IFS="$save_IFS"
3828    eval `sh -c "$pcfilemod"`
3829    IFS=":"
3830
3831    # add CYGPATH_W cludge into include flags and set CFLAGS variable
3832    if test "${CYGPATH_W}" != "echo"; then
3833      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
3834    fi
3835    m4_toupper($1_CFLAGS_INSTALLED)="$projcflags $m4_toupper($1_CFLAGS_INSTALLED)"
3836
3837    # set LIBS variable
3838    m4_toupper($1_LIBS_INSTALLED)="$projlibs $m4_toupper($1_LIBS_INSTALLED)"
3839   
3840    # remember that we have processed $pcfile
3841    pcfilesprocessed="$pcfilesprocessed:$pcfile"
3842
3843  done
3844  IFS="$save_IFS"
3845
3846
3847  # finish up
3848  m4_tolower(coin_has_$1)=yes
3849  AC_MSG_RESULT([yes])
3850  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
3851
3852  # adjust linker flags for (i)cl compiler
3853  # for the LIBS, we replace everything of the form "/somepath/name.lib" by "`$(CYGPATH_W) /somepath/`name.lib | sed -e s|\|/|g" (where we have to use excessive many \ to get the \ into the command line for cl),
3854  # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`",
3855  #    everything of the form "-lname" by "libname.lib", and
3856  #    everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path`
3857  if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
3858  then
3859    m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
3860    m4_toupper($1_LIBS_INSTALLED)=`echo " $m4_toupper($1_LIBS_INSTALLED)" | [sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g' -e 's/ -L\([^ ]*\)/ -libpath:\`$(CYGPATH_W) \1\`/g']`
3861  fi
3862
3863  m4_toupper($1_PCREQUIRES)="$2"
3864  coin_foreach_w([myvar], [$3], [
3865    m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
3866    m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
3867    m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
3868    m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1)_CFLAGS_INSTALLED $m4_toupper(myvar)_CFLAGS_INSTALLED"
3869    m4_toupper(myvar)_LIBS_INSTALLED="$m4_toupper($1)_LIBS_INSTALLED $m4_toupper(myvar)_LIBS_INSTALLED"
3870  ])
3871
3872fi
3873
3874AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
3875               [test $m4_tolower(coin_has_$1) != notGiven &&
3876                test $m4_tolower(coin_has_$1) != skipping])
3877
3878]) # AC_COIN_CHECK_PACKAGE_FALLBACK
3879
3880###########################################################################
3881#                         COIN_CHECK_PACKAGE_BLAS                         #
3882###########################################################################
3883
3884# This macro checks for a library containing the BLAS library.  It
3885# 1. checks the --with-blas argument
3886# 2. if --with-blas=BUILD has been specified goes to point 5
3887# 3. if --with-blas has been specified to a working library, sets BLAS_LIBS
3888#    to its value
3889# 4. tries standard libraries
3890# 5. calls COIN_CHECK_PACKAGE(Blas, [coinblas], [$1]) to check for
3891#    ThirdParty/Blas
3892# The makefile conditional and preprocessor macro COIN_HAS_BLAS is defined.
3893# BLAS_LIBS is set to the flags required to link with a Blas library.
3894# For each build target X in $1, X_LIBS is extended with $BLAS_LIBS.
3895# In case 3 and 4, the flags to link to Blas are added to X_PCLIBS too.
3896# In case 5, Blas is added to X_PCREQUIRES.
3897
3898AC_DEFUN([AC_COIN_CHECK_PACKAGE_BLAS],
3899[
3900AC_ARG_WITH([blas],
3901            AC_HELP_STRING([--with-blas],
3902                           [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]),
3903            [use_blas="$withval"], [use_blas=])
3904
3905# if user specified --with-blas-lib, then we should give COIN_CHECK_PACKAGE
3906# preference
3907AC_ARG_WITH([blas-lib],,[use_blas=BUILD])
3908
3909# Check if user supplied option makes sense
3910if test x"$use_blas" != x; then
3911  if test "$use_blas" = "BUILD"; then
3912    # we come to this later
3913    :
3914  elif test "$use_blas" != "no"; then
3915    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
3916    coin_need_flibs=no
3917    coin_save_LIBS="$LIBS"
3918    LIBS="$use_blas $LIBS"
3919    AC_COIN_TRY_FLINK([daxpy],
3920                      [if test $coin_need_flibs = yes ; then
3921                         use_blas="$use_blas $FLIBS"
3922                       fi
3923                       AC_MSG_RESULT([yes: $use_blas])],
3924                      [AC_MSG_RESULT([no])
3925                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
3926    LIBS="$coin_save_LIBS"
3927  fi
3928else
3929# Try to autodetect the library for blas based on build system
3930  #AC_MSG_CHECKING([default locations for BLAS])
3931  case $build in
3932    *-sgi-*)
3933      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
3934      coin_need_flibs=no
3935      coin_save_LIBS="$LIBS"
3936      LIBS="-lcomplib.sgimath $LIBS"
3937      AC_COIN_TRY_FLINK([daxpy],
3938                        [use_blas="-lcomplib.sgimath"
3939                         if test $coin_need_flibs = yes ; then
3940                           use_blas="$use_blas $FLIBS"
3941                         fi
3942                         AC_MSG_RESULT([yes: $use_blas])
3943                        ],
3944                        [AC_MSG_RESULT([no])])
3945      LIBS="$coin_save_LIBS"
3946      ;;
3947
3948# Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
3949# cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
3950# recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
3951# that CC and cc will understand -library in Studio 13. The main extra
3952# function of -xlic_lib and -library is to arrange for the Fortran run-time
3953# libraries to be linked for C++ and C. We can arrange that explicitly.
3954    *-*-solaris*)
3955      AC_MSG_CHECKING([for BLAS in libsunperf])
3956      coin_need_flibs=no
3957      coin_save_LIBS="$LIBS"
3958      LIBS="-lsunperf $FLIBS $LIBS"
3959      AC_COIN_TRY_FLINK([daxpy],
3960                        [use_blas='-lsunperf'
3961                         if test $coin_need_flibs = yes ; then
3962                           use_blas="$use_blas $FLIBS"
3963                         fi
3964                         AC_MSG_RESULT([yes: $use_blas])
3965                        ],
3966                        [AC_MSG_RESULT([no])])
3967      LIBS="$coin_save_LIBS"
3968      ;;
3969     
3970    *-cygwin* | *-mingw*)
3971      case "$CC" in
3972        clang* ) ;;
3973        cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
3974          coin_save_LIBS="$LIBS"
3975          AC_MSG_CHECKING([for BLAS in MKL (32bit)])
3976          LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
3977          AC_COIN_TRY_FLINK([daxpy],
3978                            [use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'
3979                             AC_MSG_RESULT([yes: $use_blas])
3980                            ],
3981                            [AC_MSG_RESULT([no])])
3982          LIBS="$coin_save_LIBS"
3983         
3984          if test "x$use_blas" = x ; then
3985            AC_MSG_CHECKING([for BLAS in MKL (64bit)])
3986            LIBS="mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib $LIBS"
3987            AC_COIN_TRY_FLINK([daxpy],
3988                              [use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib'
3989                               AC_MSG_RESULT([yes: $use_blas])
3990                              ],
3991                              [AC_MSG_RESULT([no])])
3992            LIBS="$coin_save_LIBS"
3993          fi
3994          ;;
3995      esac
3996      ;;
3997     
3998     *-darwin*)
3999      AC_MSG_CHECKING([for BLAS in Veclib])
4000      coin_need_flibs=no
4001      coin_save_LIBS="$LIBS"
4002      LIBS="-framework vecLib $LIBS"
4003      AC_COIN_TRY_FLINK([daxpy],
4004                        [use_blas='-framework vecLib'
4005                         if test $coin_need_flibs = yes ; then
4006                           use_blas="$use_blas $FLIBS"
4007                         fi
4008                         AC_MSG_RESULT([yes: $use_blas])
4009                        ],
4010                        [AC_MSG_RESULT([no])])
4011      LIBS="$coin_save_LIBS"
4012      ;;
4013  esac
4014
4015  if test -z "$use_blas" ; then
4016    AC_MSG_CHECKING([whether -lblas has BLAS])
4017    coin_need_flibs=no
4018    coin_save_LIBS="$LIBS"
4019    LIBS="-lblas $LIBS"
4020    AC_COIN_TRY_FLINK([daxpy],
4021                      [use_blas='-lblas'
4022                       if test $coin_need_flibs = yes ; then
4023                         use_blas="$use_blas $FLIBS"
4024                       fi
4025                       AC_MSG_RESULT([yes: $use_blas])
4026                      ],
4027                      [AC_MSG_RESULT([no])])
4028    LIBS="$coin_save_LIBS"
4029  fi
4030
4031  # If we have no other ideas, consider building BLAS.
4032  if test -z "$use_blas" ; then
4033    use_blas=BUILD
4034  fi
4035fi
4036
4037if test "x$use_blas" = xBUILD ; then
4038  AC_COIN_CHECK_PACKAGE(Blas, [coinblas], [$1])
4039 
4040elif test "x$use_blas" != x && test "$use_blas" != no; then
4041  coin_has_blas=yes
4042  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 0])
4043  AC_DEFINE([COIN_HAS_BLAS],[1], [If defined, the BLAS Library is available.])
4044  BLAS_LIBS="$use_blas"
4045  BLAS_CFLAGS=
4046  BLAS_DATA=
4047  AC_SUBST(BLAS_LIBS)
4048  AC_SUBST(BLAS_CFLAGS)
4049  AC_SUBST(BLAS_DATA)
4050  coin_foreach_w([myvar], [$1], [
4051    m4_toupper(myvar)_PCLIBS="$BLAS_LIBS $m4_toupper(myvar)_PCLIBS"
4052    m4_toupper(myvar)_LIBS="$BLAS_LIBS $m4_toupper(myvar)_LIBS"
4053    m4_toupper(myvar)_LIBS_INSTALLED="$BLAS_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
4054  ])
4055 
4056else
4057  coin_has_blas=no
4058  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 1])
4059fi
4060
4061coin_foreach_w([myvar], [$1], [
4062  AC_SUBST(m4_toupper(myvar)_PCLIBS)
4063  AC_SUBST(m4_toupper(myvar)_LIBS)
4064  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
4065])
4066
4067]) # AC_COIN_CHECK_PACKAGE_BLAS
4068
4069###########################################################################
4070#                       COIN_CHECK_PACKAGE_LAPACK                         #
4071###########################################################################
4072
4073# This macro checks for a library containing the LAPACK library.  It
4074# 1. checks the --with-lapack argument
4075# 2. if --with-lapack=BUILD has been specified goes to point 5
4076# 3. if --with-lapack has been specified to a working library, sets
4077#    LAPACK_LIBS to its value
4078# 4. tries standard libraries
4079# 5. calls COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]) to check for
4080#    ThirdParty/Lapack
4081# The makefile conditional and preprocessor macro COIN_HAS_LAPACK is defined.
4082# LAPACK_LIBS is set to the flags required to link with a Lapack library.
4083# For each build target X in $1, X_LIBS is extended with $LAPACK_LIBS.
4084# In case 3 and 4, the flags to link to Lapack are added to X_PCLIBS too.
4085# In case 5, Lapack is added to X_PCREQUIRES.
4086#
4087# TODO: Lapack usually depends on Blas, so if we check for a system lapack library,
4088#   shouldn't we include AC_COIN_CHECK_PACKAGE_BLAS first?
4089#   However, if we look for coinlapack via AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]),
4090#   then we will get Blas as dependency of coinlapack.
4091
4092AC_DEFUN([AC_COIN_CHECK_PACKAGE_LAPACK],
4093[
4094AC_ARG_WITH([lapack],
4095            AC_HELP_STRING([--with-lapack],
4096                           [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]),
4097            [use_lapack=$withval], [use_lapack=])
4098
4099#if user specified --with-lapack-lib, then we should give COIN_HAS_PACKAGE preference
4100AC_ARG_WITH([lapack-lib],,[use_lapack=BUILD])
4101
4102# Check if user supplied option makes sense
4103if test x"$use_lapack" != x; then
4104  if test "$use_lapack" = "BUILD"; then
4105    # we come to this later
4106    :
4107  elif test "$use_lapack" != no; then
4108    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
4109    coin_need_flibs=no
4110    use_lapack="$use_lapack $BLAS_LIBS"
4111    coin_save_LIBS="$LIBS"
4112    LIBS="$use_lapack $LIBS"
4113    AC_COIN_TRY_FLINK([dsyev],
4114                      [if test $coin_need_flibs = yes ; then
4115                         use_lapack="$use_lapack $FLIBS"
4116                       fi
4117                       AC_MSG_RESULT([yes: $use_lapack])
4118                      ],
4119                      [AC_MSG_RESULT([no])
4120                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
4121    LIBS="$coin_save_LIBS"
4122  fi
4123else
4124  if test x$coin_has_blas = xyes; then
4125    # First try to see if LAPACK is already available with BLAS library
4126    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
4127    coin_save_LIBS="$LIBS"
4128    coin_need_flibs=no
4129    LIBS="$BLAS_LIBS $LIBS"
4130    AC_COIN_TRY_FLINK([dsyev],
4131                      [use_lapack="$BLAS_LIBS"
4132                       if test $coin_need_flibs = yes ; then
4133                         use_lapack="$use_lapack $FLIBS"
4134                       fi
4135                       AC_MSG_RESULT([yes: $use_lapack])
4136                      ],
4137                      [AC_MSG_RESULT([no])])
4138    LIBS="$coin_save_LIBS"
4139  fi
4140  if test -z "$use_lapack"; then
4141    # Try to autodetect the library for lapack based on build system
4142    case $build in
4143      # TODO: Is this check actually needed here, since -lcomplib.sigmath should have been recognized as Blas library,
4144      #       and above it is checked whether the Blas library already contains Lapack
4145      *-sgi-*)
4146        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
4147        coin_save_LIBS="$LIBS"
4148        coin_need_flibs=no
4149        LIBS="-lcomplib.sgimath $BLAS_LIBS $LIBS"
4150        AC_COIN_TRY_FLINK([dsyev],
4151                          [use_lapack="-lcomplib.sgimath $BLAS_LIBS"
4152                           if test $coin_need_flibs = yes ; then
4153                             use_lapack="$use_lapack $FLIBS"
4154                           fi
4155                           AC_MSG_RESULT([yes: $use_lapack])
4156                          ],
4157                          [AC_MSG_RESULT([no])])
4158        LIBS="$coin_save_LIBS"
4159        ;;
4160
4161      # See comments in COIN_CHECK_PACKAGE_BLAS.
4162      # TODO: Is this check actually needed here, since -lsunperf should have been recognized as Blas library,
4163      #       and above it is checked whether the Blas library already contains Lapack
4164      *-*-solaris*)
4165        AC_MSG_CHECKING([for LAPACK in libsunperf])
4166        coin_need_flibs=no
4167        coin_save_LIBS="$LIBS"
4168        LIBS="-lsunperf $BLAS_LIBS $FLIBS $LIBS"
4169        AC_COIN_TRY_FLINK([dsyev],
4170                          [use_lapack='-lsunperf $BLAS_LIBS'
4171                           if test $coin_need_flibs = yes ; then
4172                             use_lapack="$use_lapack $FLIBS"
4173                           fi
4174                           AC_MSG_RESULT([yes: $use_lapack])
4175                          ],
4176                          [AC_MSG_RESULT([no])])
4177        LIBS="$coin_save_LIBS"
4178        ;;
4179        # On cygwin, do this check only if doscompile is disabled. The prebuilt library
4180        # will want to link with cygwin, hence won't run standalone in DOS.
4181    esac
4182  fi
4183
4184  if test -z "$use_lapack" ; then
4185    AC_MSG_CHECKING([whether -llapack has LAPACK])
4186    coin_need_flibs=no
4187    coin_save_LIBS="$LIBS"
4188    LIBS="-llapack $BLAS_LIBS $LIBS"
4189    AC_COIN_TRY_FLINK([dsyev],
4190                      [use_lapack='-llapack'
4191                       if test $coin_need_flibs = yes ; then
4192                         use_lapack="$use_lapack $FLIBS"
4193                       fi
4194                       AC_MSG_RESULT([yes: $use_lapack])
4195                      ],
4196                      [AC_MSG_RESULT([no])])
4197    LIBS="$coin_save_LIBS"
4198  fi
4199
4200  # If we have no other ideas, consider building LAPACK.
4201  if test -z "$use_lapack" ; then
4202    use_lapack=BUILD
4203  fi
4204fi
4205
4206if test "x$use_lapack" = xBUILD ; then
4207  AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1])
4208
4209elif test "x$use_lapack" != x && test "$use_lapack" != no; then
4210  coin_has_lapack=yes
4211  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 0])
4212  AC_DEFINE([COIN_HAS_LAPACK],[1], [If defined, the LAPACK Library is available.])
4213  LAPACK_LIBS="$use_lapack"
4214  LAPACK_CFLAGS=
4215  LAPACK_DATA=
4216  AC_SUBST(LAPACK_LIBS)
4217  AC_SUBST(LAPACK_CFLAGS)
4218  AC_SUBST(LAPACK_DATA)
4219  coin_foreach_w([myvar], [$1], [
4220    m4_toupper(myvar)_PCLIBS="$LAPACK_LIBS $m4_toupper(myvar)_PCLIBS"
4221    m4_toupper(myvar)_LIBS="$LAPACK_LIBS $m4_toupper(myvar)_LIBS"
4222    m4_toupper(myvar)_LIBS_INSTALLED="$LAPACK_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
4223  ])
4224 
4225else
4226  coin_has_lapack=no
4227  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 1])
4228fi
4229
4230coin_foreach_w([myvar], [$1], [
4231  AC_SUBST(m4_toupper(myvar)_PCLIBS)
4232  AC_SUBST(m4_toupper(myvar)_LIBS)
4233  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
4234])
4235
4236]) # AC_COIN_CHECK_PACKAGE_LAPACK
Note: See TracBrowser for help on using the repository browser.