source: stable/0.7/coin.m4 @ 3063

Last change on this file since 3063 was 3063, checked in by stefan, 8 years ago

merge r3062 from trunk

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