source: branches/autotools-update/coin.m4 @ 2580

Last change on this file since 2580 was 2580, checked in by stefan, 7 years ago

disable reusing libtool, does not seem to work yet

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