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

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

work around some warnings from autoconf

  • Property svn:keywords set to Author Date Id Revision
File size: 150.2 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 2579 2012-07-03 20:03:05Z 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
1652if test "x$LIBTOOL" = x; then
1653# AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).])
1654  # Stuff for libtool
1655  AC_COIN_PROG_LIBTOOL
1656# AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.])
1657  # set RPATH_FLAGS to the compiler link flags required to hardcode location
1658  # of the shared objects
1659  AC_COIN_RPATH_FLAGS([$abs_lib_dir])
1660
1661else
1662
1663  AC_MSG_NOTICE([Using libtool script in directory $coin_config_dir])
1664  # get all missing information from the config.log file
1665
1666  # output variables and defines
1667  as_save_IFS=$IFS
1668  IFS='
1669'
1670  for oneline in `cat $coin_config_dir/config.status`; do
1671    case "$oneline" in
1672         # First some automake conditionals
1673      s,@am__fastdep* | s,@AR@* | s,@CPP@*  | s,@CPPFLAGS@* | s,@CXXCPP@*  | \
1674      s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \
1675      s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \
1676      s,@ac_c_preproc_warn_flag@* |  s,@ac_cxx_preproc_warn_flag@* )
1677        command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'`
1678#        echo "$command"
1679        eval "$command"
1680        ;;
1681      s,@DEFS@* )
1682        command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'`
1683#        echo "$command"
1684        eval "$command"
1685        ;;
1686    esac
1687  done
1688  IFS=$as_save_IFS
1689
1690  # And some defines (assuming here that the packages base dir
1691  # doesn't have a config.h file
1692  for word in $defsline; do
1693#    echo word $word
1694    case $word in
1695      -DHAVE_@<:@A-Z_@:>@*_H=1 | -DSTDC_HEADERS=1 )
1696        i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'`
1697#        echo dd $i
1698        echo $i >>confdefs.h
1699        ;;
1700    esac
1701  done
1702fi
1703
1704# AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.])
1705
1706# ToDo
1707# For now, don't use the -no-undefined flag, since the Makefiles are
1708# not yet set up that way.  But we need to fix this, when we want
1709# to comile DLLs under Windows.
1710LT_LDFLAGS=
1711
1712# Check if we want to set the library version
1713AC_MSG_CHECKING([if library version is set])
1714if test x"$coin_libversion" != x; then
1715  LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion"
1716  AC_MSG_RESULT([$coin_libversion])
1717else
1718  AC_MSG_RESULT([no])
1719fi
1720
1721AC_SUBST(LT_LDFLAGS)
1722
1723#END
1724}])
1725
1726###########################################################################
1727#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
1728###########################################################################
1729
1730# Patches to libtool for cygwin. Lots for cl, a few for GCC.
1731# For cl:
1732# - cygpath is not correctly quoted in fix_srcfile_path
1733# - paths generated for .lib files is not run through cygpath -w
1734
1735
1736AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
1737[ case "$CXX" in
1738    clang* )
1739      # we assume that libtool patches for CLANG are the same as for GNU compiler - correct???
1740      AC_MSG_NOTICE(Applying patches to libtool for CLANG compiler)
1741      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1742          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
1743          -e 's|libext="lib"|libext="a"|' \
1744      libtool > conftest.bla
1745      ;;
1746    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1747      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
1748      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1749          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1750          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1751          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1752          -e 's%lib /OUT:%lib -OUT:%' \
1753          -e "s%cygpath -w%$CYGPATH_W%" \
1754          -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%' \
1755          -e 's/$AR t/lib -nologo -list/' \
1756          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
1757          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
1758          -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"%' \
1759      libtool > conftest.bla
1760      ;;
1761    *)
1762      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
1763      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1764          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
1765          -e 's|libext="lib"|libext="a"|' \
1766      libtool > conftest.bla
1767      ;;
1768  esac
1769  mv conftest.bla libtool
1770  chmod 755 libtool
1771]) # COIN_PATCH_LIBTOOL_CYGWIN
1772
1773###########################################################################
1774#                    COIN_PATCH_LIBTOOL_SOLARIS                           #
1775###########################################################################
1776# If we want to do a 64-bit build with GCC on Solaris, the system search
1777# libraries need to point to 64-bit subdirectories. If they do not already do
1778# that, fix them. This patch is evolving, as are GCC compilers.  GCC 4.2.1
1779# reports the correct search list, given the correct call. GCC 4.1.1 does not.
1780# `Correct call' means -m64 is specified. `Correct search list' seems to amount
1781# to prepending the list of 64-bit subdirectories to the 32-bit directories.
1782# Both SPARC and x86 have this issue, but a different hardware id string is
1783# required depending on the underlying CPU. The macro executes isainfo to get
1784# the string. This will fail, of course, if we're cross-compiling. The
1785# alternative is to fail on a regular basis each time a new CPU identifier is
1786# needed. This macro will also fail if the search list reported with
1787# -print-search-dirs differs between the C, C++, and Fortran compilers; each
1788# have their own setting in libtool.  If GCC reports the correct search list
1789# given the -m64 flag, the best solution is to define CC='gcc -m64', and
1790# similarly for CXX, F77, so that libtool will make the correct call.
1791###########################################################################
1792AC_DEFUN([AC_COIN_PATCH_LIBTOOL_SOLARIS],
1793[ if test "$GCC" = yes && \
1794     (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then
1795    hdwisa=`isainfo | sed -e 's/\(@<:@^ @:>@*\) .*$/\1/'`
1796    if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then
1797      AC_MSG_NOTICE([Applying patches to libtool for 64-bit GCC compilation])
1798      fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'`
1799      fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'`
1800      if `echo "$fixlibtmp" | $EGREP -v $hdwisa  >/dev/null 2>&1` ; then
1801        # AC_MSG_NOTICE(Compensating for broken gcc)
1802        for lib in $fixlibtmp ; do
1803          if test -d "${lib}${hdwisa}" ; then
1804            syslibpath64="$syslibpath64 ${lib}${hdwisa}/"
1805          fi
1806        done
1807        syslibpath64="${syslibpath64} ${fixlibtmp}"
1808      else
1809        syslibpath64="$fixlibtmp"
1810      fi
1811      sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla
1812      mv conftest.bla libtool
1813      chmod 755 libtool 
1814    fi
1815    # AC_MSG_NOTICE(Result is )
1816    # $EGREP 'sys_lib_search_path_spec=' libtool
1817  fi ]) # COIN_PATCH_LIBTOOL_SOLARIS
1818
1819###########################################################################
1820#                           COIN_PROG_LIBTOOL                             #
1821###########################################################################
1822
1823# Setup the libtool stuff together with any modifications to make it
1824# work on additional platforms
1825
1826AC_DEFUN([AC_COIN_PROG_LIBTOOL],
1827[# No longer needed now that CPPFLAGS is correctly set -- lh, 061214 --
1828 # AC_REQUIRE([AC_COIN_DLFCN_H])
1829
1830# NEW: If libtool exists in the directory higher up, we use that one
1831#      instead of creating a new one
1832
1833# It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED
1834# out in front of this macro body. You'll notice that LIBTOOL is already
1835# defined here.  We'll have to count on this macro not being called if libtool
1836# already exists, or at least move the libtool fixes outside the conditional.
1837# AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".])
1838# This test is therefore removed.  -- lh, 061214 --
1839# if test "x$LIBTOOL" = x; then
1840
1841# AC_MSG_NOTICE([Calling PROG_LIBTOOL.])
1842  AC_PROG_LIBTOOL
1843# AC_MSG_NOTICE([Finished PROG_LIBTOOL.])
1844  AC_SUBST(ac_c_preproc_warn_flag)
1845  AC_SUBST(ac_cxx_preproc_warn_flag)
1846
1847  AC_MSG_NOTICE([Build is "$build".])
1848  mydos2unix='| dos2unix'
1849  case $build in
1850    *-mingw*)
1851      CYGPATH_W=echo
1852      mydos2unix=
1853      ;;
1854  esac
1855
1856  case $build in
1857    # Here we need to check if -m32 is specified.  If so, we need to correct
1858    # sys_lib_search_path_spec
1859    *x86_64-*)
1860      if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then
1861        AC_MSG_NOTICE(Applying patches to libtool for 32bit compilation)
1862        sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla
1863        mv conftest.bla libtool
1864        chmod 755 libtool 
1865      fi
1866      ;;
1867
1868    *-solaris*)
1869      AC_COIN_PATCH_LIBTOOL_SOLARIS
1870      ;;
1871    # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro.
1872    *-cygwin* | *-mingw*)
1873      AC_COIN_PATCH_LIBTOOL_CYGWIN
1874      ;;
1875    *-darwin*)
1876      AC_MSG_NOTICE(Applying patches to libtool for Darwin)
1877      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"/' \
1878        -e 's/ -dynamiclib / -dynamiclib -single_module /g' \
1879      libtool > conftest.bla
1880
1881      mv conftest.bla libtool
1882      chmod 755 libtool
1883      ;;
1884  esac
1885# This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of
1886# the macro. -- lh, 061214 --
1887# fi
1888
1889# AC_MSG_NOTICE([End libtool initialisation.])
1890]) # AC_COIN_PROG_LIBTOOL
1891
1892# This is a trick to force the check for the dlfcn header to be done before
1893# the checks for libtool
1894# No longer needed now that CPPFLAGS is correctly set.  -- lh, 061214 --
1895# ACDEFUN([AC_COIN_DLFCN_H],
1896# [AC_LANG_PUSH(C)
1897# AC_COIN_CHECK_HEADER([dlfcn.h])
1898# AC_LANG_POP(C)
1899# ]) # AC_COIN_DLFCN_H
1900
1901###########################################################################
1902#                            COIN_RPATH_FLAGS                             #
1903###########################################################################
1904
1905# This macro, in case shared objects are used, defines a variable
1906# RPATH_FLAGS that can be used by the linker to hardwire the library
1907# search path for the given directories.  This is useful for example
1908# Makefiles
1909
1910AC_DEFUN([AC_COIN_RPATH_FLAGS],
1911[RPATH_FLAGS=
1912
1913if test $enable_shared = yes; then
1914  case $build in
1915    *-linux-*)
1916      if test "$GXX" = "yes"; then
1917        RPATH_FLAGS=
1918        for dir in $1; do
1919          RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir"
1920        done
1921      fi ;;
1922    *-darwin*)
1923        RPATH_FLAGS=nothing ;;
1924    *-ibm-*)
1925      case "$CXX" in
1926      xlC* | */xlC* | mpxlC* | */mpxlC*)
1927        RPATH_FLAGS=nothing ;;
1928      esac ;;
1929    *-hp-*)
1930        RPATH_FLAGS=nothing ;;
1931    *-mingw32)
1932        RPATH_FLAGS=nothing ;;
1933    *-*-solaris*)
1934        RPATH_FLAGS=
1935        for dir in $1; do
1936          RPATH_FLAGS="$RPATH_FLAGS -R$dir"
1937        done
1938  esac
1939
1940  if test "$RPATH_FLAGS" = ""; then
1941    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.])
1942  fi
1943  if test "$RPATH_FLAGS" = "nothing"; then
1944    RPATH_FLAGS=
1945  fi
1946fi
1947
1948AC_SUBST(RPATH_FLAGS)
1949]) # AC_COIN_RPATH_FLAGS
1950
1951###########################################################################
1952#                        COIN_LINK_INPUT_CMD                              #
1953###########################################################################
1954
1955# This macro determines which command should be used to "link" files
1956# that are input to the generated executables.  On Windows, the codes
1957# using the native Windows system libraries, cannot understand symbolic
1958# links, and a copy should be used instead of 'ln -s'.
1959# The result is stored in coin_link_input_cmd
1960
1961AC_DEFUN([AC_COIN_LINK_INPUT_CMD],
1962[AC_REQUIRE([AC_PROG_LN_S])
1963AC_BEFORE([AC_COIN_PROG_CC], [$0])
1964AC_BEFORE([AC_COIN_ENABLE_DOSCOMPILE], [$0])
1965
1966AC_MSG_CHECKING([which command should be used to link input files])
1967coin_link_input_cmd="$LN_S"
1968if test "$enable_doscompile" = mingw; then
1969  coin_link_input_cmd=cp
1970fi
1971case "$CC" in
1972  clang* ) ;;
1973  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1974    coin_link_input_cmd=cp ;;
1975esac
1976AC_MSG_RESULT($coin_link_input_cmd)
1977])
1978
1979###########################################################################
1980#                              COIN_FINALIZE                              #
1981###########################################################################
1982
1983# This macro should be called at the very end of the configure.ac file.
1984# It creates the output files (by using AC_OUTPUT), and might do some other
1985# things (such as generating links to data files in a VPATH configuration).
1986# It also prints the "success" message.
1987# Note: If the variable coin_skip_ac_output is set to yes, then no output
1988# files are written.
1989
1990AC_DEFUN([AC_COIN_FINALIZE],
1991[
1992AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
1993if test x$coin_skip_ac_output != xyes; then
1994
1995  # library extension
1996  AC_SUBST(LIBEXT)
1997  case "$CC" in
1998    clang* )
1999         LIBEXT=a ;;
2000    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2001         LIBEXT=lib ;;
2002      *) LIBEXT=a ;;
2003  esac
2004
2005  # Define VPATH_DISTCLEANFILES to be everything that needs to be
2006  # cleaned for distclean in a vpath configuration
2007  AC_SUBST(VPATH_DISTCLEANFILES)
2008  VPATH_DISTCLEANFILES="$coin_vpath_link_files"
2009
2010  # Take out subdirectories if their configuration concluded that they
2011  # don't need to be compiled
2012  if test x"$coin_ac_skip_subdirs" != x; then
2013    new_subdirs=
2014    for i in $subdirs; do
2015      skipme=no
2016      for j in $coin_ac_skip_subdirs; do
2017        if test $i = $j; then
2018          skipme=yes;
2019        fi
2020      done
2021      if test $skipme = no; then
2022        new_subdirs="$new_subdirs $i"
2023      fi
2024    done
2025    subdirs="$new_subdirs"
2026  fi
2027
2028  # need to come before AC_OUTPUT
2029  if test x$coin_projectdir != xyes; then
2030    # write coin_subdirs to a file so that project configuration knows where to find uninstalled projects
2031    echo $coin_subdirs > coin_subdirs.txt
2032  else
2033    # substitute for OBJDIR, needed to setup .pc file for uninstalled project
2034    ABSBUILDDIR="`pwd`"
2035    AC_SUBST(ABSBUILDDIR)
2036  fi
2037 
2038  AC_OUTPUT
2039
2040  if test x"$coin_vpath_link_files" = x; then : ; else
2041    lnkcmd="$coin_link_input_cmd"
2042    if test "$lnkcmd" = cp; then
2043      AC_MSG_NOTICE(Copying data files for VPATH configuration)
2044    else
2045      AC_MSG_NOTICE(Creating VPATH links for data files)
2046    fi
2047    for file in $coin_vpath_link_files; do
2048      dir=`AS_DIRNAME(["./$file"])`
2049      if test -d $dir; then : ; else
2050        AS_MKDIR_P($dir)
2051      fi
2052      rm -f $file
2053      $lnkcmd $abs_source_dir/$file $file
2054    done
2055  fi
2056
2057  AC_MSG_NOTICE([In case of trouble, first consult the troubleshooting page at https://projects.coin-or.org/BuildTools/wiki/user-troubleshooting])
2058  if test x$coin_projectdir = xyes; then
2059    AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful])
2060  else
2061    AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful])
2062  fi
2063else
2064  AC_MSG_NOTICE([No configuration of $PACKAGE_NAME necessary])
2065fi
2066
2067]) #AC_COIN_FINALIZE
2068
2069###########################################################################
2070#                             COIN_VPATH_LINK                             #
2071###########################################################################
2072
2073# This macro queues source files that need to be available in the build
2074# directory. In a VPATH configuration, the files will be made available by
2075# symbolic link or copy (when the platform does not support links). The list
2076# is processed by COIN_FINALIZE. The parameter is a whitespace-separated
2077# list of files.
2078
2079AC_DEFUN([AC_COIN_VPATH_LINK],
2080[
2081AC_REQUIRE([AC_COIN_CHECK_VPATH])
2082# Allow for newlines in the parameter
2083if test $coin_vpath_config = yes; then
2084  cvl_tmp="$1"
2085  for file in $cvl_tmp ; do
2086    coin_vpath_link_files="$coin_vpath_link_files $file"
2087  done
2088fi
2089]) #AC_COIN_VPATH_LINK
2090
2091###########################################################################
2092#                       COIN_ENABLE_GNU_PACKAGES                          #
2093###########################################################################
2094
2095# This macro defined the --enable-gnu-packages flag.  This can be used
2096# to check if a user wants to compile GNU packges (such as readline)
2097# into the executable.  By default, GNU packages are disabled.
2098# This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES
2099
2100AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES],
2101[AC_ARG_ENABLE([gnu-packages],
2102               [AC_HELP_STRING([--enable-gnu-packages],
2103                               [compile with GNU packages (disabled by default)])],
2104               [coin_enable_gnu=$enableval],
2105               [coin_enable_gnu=no])
2106]) # AC_COIN_ENABLE_GNU_PACKAGES
2107
2108#######################################################################
2109#                           COIN_CHECK_LIBM                           #
2110#######################################################################
2111
2112# For a (space separated) list of arguments X, this macro adds the flags
2113# for linking against the math library to a X_LIBS and X_PCLIBS.
2114
2115AC_DEFUN([AC_COIN_CHECK_LIBM],
2116[AC_BEFORE([AC_COIN_PROG_CC],[$0])
2117
2118if test $coin_cc_is_cl != true ; then
2119  coin_foreach_w([myvar], [$1], [
2120    m4_toupper(myvar)_LIBS="-lm $m4_toupper(myvar)_LIBS"
2121    m4_toupper(myvar)_PCLIBS="-lm $m4_toupper(myvar)_PCLIBS"
2122    m4_toupper(myvar)_LIBS_INSTALLED="-lm $m4_toupper(myvar)_LIBS_INSTALLED"
2123  ])
2124fi
2125
2126]) # AC_COIN_CHECK_LIBM
2127
2128###########################################################################
2129#                           COIN_CHECK_GNU_ZLIB                           #
2130###########################################################################
2131
2132# This macro checks for the libz library.  If found, it sets the automake
2133# conditional COIN_HAS_ZLIB and defines the C preprocessor variable
2134# COIN_HAS_ZLIB.  Further, for a (space separated) list of arguments X,
2135# it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2136
2137# TODO the macro name should be changed to AC_COIN_CHECK_ZLIB
2138
2139AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB],
2140[
2141AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2142AC_BEFORE([AC_COIN_PROG_CC],[$0])
2143AC_BEFORE([AC_COIN_PROG_F77],[$0])
2144AC_BEFORE([$0],[AC_COIN_FINALIZE])
2145
2146coin_has_zlib=no
2147
2148AC_ARG_ENABLE([zlib],
2149              [AC_HELP_STRING([--disable-zlib],[do not compile with compression library zlib])],
2150              [coin_enable_zlib=$enableval],
2151              [coin_enable_zlib=yes])
2152
2153if test $coin_enable_zlib = yes; then
2154  AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
2155
2156  if test $coin_has_zlib = yes; then
2157    AC_CHECK_LIB([z],[gzopen],[:],[coin_has_zlib=no])
2158  fi
2159
2160  if test $coin_has_zlib = yes; then
2161    coin_foreach_w([myvar], [$1], [
2162                    m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS"
2163                    m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS"
2164                    m4_toupper(myvar)_LIBS_INSTALLED="-lz $m4_toupper(myvar)_LIBS_INSTALLED"
2165                   ])
2166    AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
2167  fi
2168fi
2169
2170AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes)
2171]) # AC_COIN_CHECK_GNU_ZLIB
2172
2173
2174###########################################################################
2175#                          COIN_CHECK_GNU_BZLIB                           #
2176###########################################################################
2177
2178# This macro checks for the libbz2 library.  If found, it defines the C
2179# preprocessor variable COIN_HAS_BZLIB.  Further, for a (space separated) list
2180# of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2181
2182# TODO the macro name should be changed to AC_COIN_CHECK_BZLIB
2183
2184AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB],
2185[
2186AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2187AC_BEFORE([AC_COIN_PROG_CC],[$0])
2188AC_BEFORE([AC_COIN_PROG_F77],[$0])
2189AC_BEFORE([$0],[AC_COIN_FINALIZE])
2190
2191AC_ARG_ENABLE([bzlib],
2192              [AC_HELP_STRING([--disable-bzlib],[do not compile with compression library bzlib])],
2193              [coin_enable_bzlib=$enableval],
2194              [coin_enable_bzlib=yes])
2195
2196coin_has_bzlib=no
2197if test $coin_enable_bzlib = yes; then
2198  AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
2199
2200  if test $coin_has_bzlib = yes; then
2201    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],[:],[coin_has_bzlib=no])
2202  fi
2203
2204  if test $coin_has_bzlib = yes; then
2205    coin_foreach_w([myvar], [$1], [
2206                    m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS"
2207                    m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS"
2208                    m4_toupper(myvar)_LIBS_INSTALLED="-lbz2 $m4_toupper(myvar)_LIBS_INSTALLED"
2209                  ])
2210    AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
2211  fi
2212fi
2213]) # AC_COIN_CHECK_GNU_BZLIB
2214
2215
2216###########################################################################
2217#                         COIN_CHECK_GNU_READLINE                         #
2218###########################################################################
2219
2220# This macro checks for GNU's readline.  It verifies that the header
2221# readline/readline.h is available, and that the -lreadline library
2222# contains "readline".  It is assumed that #include <stdio.h> is included
2223# in the source file before the #include<readline/readline.h>
2224# If found, it defines the C preprocessor variable COIN_HAS_READLINE.
2225# Further, for a (space separated) list of arguments X, it adds the
2226# linker flag to the variable X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2227
2228AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
2229[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2230AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2231AC_BEFORE([AC_COIN_PROG_CC],[$0])
2232AC_BEFORE([AC_COIN_PROG_F77],[$0])
2233AC_BEFORE([$0],[AC_COIN_FINALIZE])
2234
2235coin_has_readline=no
2236if test $coin_enable_gnu = yes; then
2237  AC_COIN_CHECK_HEADER([readline/readline.h],
2238                       [coin_has_readline=yes],[],
2239                       [#include <stdio.h>])
2240
2241  coin_save_LIBS="$LIBS"
2242  LIBS=
2243  # First we check if tputs and friends are available
2244  if test $coin_has_readline = yes; then
2245    AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
2246                   [coin_has_readline=no])
2247  fi
2248
2249  # Now we check for readline
2250  if test $coin_has_readline = yes; then
2251    AC_CHECK_LIB([readline],[readline],[:],[coin_has_readline=no])
2252  fi
2253
2254  if test $coin_has_readline = yes; then
2255    coin_foreach_w([myvar], [$1], [
2256                    m4_toupper(myvar)_LIBS="-lreadline $LIBS $m4_toupper(myvar)_LIBS"
2257                    m4_toupper(myvar)_PCLIBS="-lreadline $LIBS $m4_toupper(myvar)_PCLIBS"
2258                    m4_toupper(myvar)_LIBS_INSTALLED="-lreadline $LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
2259                   ])
2260    AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
2261  fi
2262
2263  LIBS="$coin_save_LIBS"
2264fi
2265]) # AC_COIN_CHECK_GNU_READLINE
2266
2267###########################################################################
2268#                              COIN_CHECK_GMP                             #
2269###########################################################################
2270
2271# This macro checks for the gmp library.  If found, it defines the C
2272# preprocessor variable COIN_HAS_GMP.  Further, for a (space separated) list
2273# of arguments X, it adds the linker flag to the variables X_LIBS, X_PCLIBS, and X_LIBS_INSTALLED.
2274
2275AC_DEFUN([AC_COIN_CHECK_GMP],
2276[
2277AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2278AC_BEFORE([AC_COIN_PROG_CC],[$0])
2279AC_BEFORE([AC_COIN_PROG_F77],[$0])
2280AC_BEFORE([$0],[AC_COIN_FINALIZE])
2281
2282AC_ARG_ENABLE([gmp],
2283              [AC_HELP_STRING([--disable-gmp],[do not compile with GNU multiple precision library])],
2284              [coin_enable_gmp=$enableval],
2285              [coin_enable_gmp=yes])
2286
2287coin_has_gmp=no
2288if test $coin_enable_gmp = yes; then
2289  AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])])
2290 
2291  if test $coin_has_gmp = yes ; then
2292    coin_foreach_w([myvar], [$1], [
2293                    m4_toupper(myvar)_LIBS="-lgmp $m4_toupper(myvar)_LIBS"
2294                    m4_toupper(myvar)_PCLIBS="-lgmp $m4_toupper(myvar)_PCLIBS"
2295                    m4_toupper(myvar)_LIBS_INSTALLED="-lgmp $m4_toupper(myvar)_LIBS_INSTALLED"
2296                   ])
2297    AC_DEFINE([COIN_HAS_GMP],[1],[Define to 1 if GMP is available])
2298  fi
2299fi
2300]) # AC_COIN_CHECK_GMP
2301
2302###########################################################################
2303#                            COIN_CHECK_ISFINITE                          #
2304###########################################################################
2305
2306# This macro checks for a usable implementation of a function to check
2307# whether a given floating point number is finite.
2308# If a function is found, then the macro defines the symbol
2309# toupper($1)_C_FINITE to the name of this function.
2310
2311AC_DEFUN([AC_COIN_CHECK_ISFINITE],[
2312
2313AC_LANG_PUSH(C++)
2314
2315AC_COIN_CHECK_CXX_CHEADER(math)
2316AC_COIN_CHECK_CXX_CHEADER(float)
2317AC_COIN_CHECK_CXX_CHEADER(ieeefp)
2318
2319COIN_C_FINITE=
2320AC_CHECK_DECL([isfinite],[COIN_C_FINITE=isfinite],,[
2321#ifdef HAVE_CMATH
2322# include <cmath>
2323#else
2324# ifdef HAVE_MATH_H
2325#  include <math.h>
2326# endif
2327#endif
2328#ifdef HAVE_CFLOAT
2329# include <cfloat>
2330#else
2331# ifdef HAVE_FLOAT_H
2332#  include <float.h>
2333# endif
2334#endif
2335#ifdef HAVE_CIEEEFP
2336# include <cieeefp>
2337#else
2338# ifdef HAVE_IEEEFP_H
2339#  include <ieeefp.h>
2340# endif
2341#endif])
2342if test -z "$COIN_C_FINITE"; then
2343  AC_CHECK_DECL([finite],[COIN_C_FINITE=finite],,[
2344#ifdef HAVE_CMATH
2345# include <cmath>
2346#else
2347# ifdef HAVE_MATH_H
2348#  include <math.h>
2349# endif
2350#endif
2351#ifdef HAVE_CFLOAT
2352# include <cfloat>
2353#else
2354# ifdef HAVE_FLOAT_H
2355#  include <float.h>
2356# endif
2357#endif
2358#ifdef HAVE_CIEEEFP
2359# include <cieeefp>
2360#else
2361# ifdef HAVE_IEEEFP_H
2362#  include <ieeefp.h>
2363# endif
2364#endif])
2365  if test -z "$COIN_C_FINITE"; then
2366    AC_CHECK_DECL([_finite],[COIN_C_FINITE=_finite],,[
2367#ifdef HAVE_CMATH
2368# include <cmath>
2369#else
2370# ifdef HAVE_MATH_H
2371#  include <math.h>
2372# endif
2373#endif
2374#ifdef HAVE_CFLOAT
2375# include <cfloat>
2376#else
2377# ifdef HAVE_FLOAT_H
2378#  include <float.h>
2379# endif
2380#endif
2381#ifdef HAVE_CIEEEFP
2382# include <cieeefp>
2383#else
2384# ifdef HAVE_IEEEFP_H
2385#  include <ieeefp.h>
2386# endif
2387#endif])
2388  fi
2389fi
2390if test -z "$COIN_C_FINITE"; then
2391  AC_MSG_WARN(Cannot find C-function for checking Inf.)
2392else
2393  AC_DEFINE_UNQUOTED(COIN_C_FINITE,[$COIN_C_FINITE],
2394                     [Define to be the name of C-function for Inf check])
2395fi
2396
2397AC_LANG_POP(C++)
2398])
2399
2400###########################################################################
2401#                              COIN_CHECK_ISNAN                           #
2402###########################################################################
2403
2404# This macro checks for a usable implementation of a function to check
2405# whether a given floating point number represents NaN.
2406# If a function is found, then the macro defines the symbol COIN_C_ISNAN
2407# to the name of this function.
2408
2409AC_DEFUN([AC_COIN_CHECK_ISNAN],[
2410
2411AC_LANG_PUSH(C++)
2412
2413AC_COIN_CHECK_CXX_CHEADER(math)
2414AC_COIN_CHECK_CXX_CHEADER(float)
2415AC_COIN_CHECK_CXX_CHEADER(ieeefp)
2416
2417COIN_C_ISNAN=
2418AC_CHECK_DECL([isnan],[COIN_C_ISNAN=isnan],,[
2419#ifdef HAVE_CMATH
2420# include <cmath>
2421#else
2422# ifdef HAVE_MATH_H
2423#  include <math.h>
2424# endif
2425#endif
2426#ifdef HAVE_CFLOAT
2427# include <cfloat>
2428#else
2429# ifdef HAVE_FLOAT_H
2430#  include <float.h>
2431# endif
2432#endif
2433#ifdef HAVE_CIEEEFP
2434# include <cieeefp>
2435#else
2436# ifdef HAVE_IEEEFP_H
2437#  include <ieeefp.h>
2438# endif
2439#endif])
2440
2441# It appears that for some systems (e.g., Mac OSX), cmath will provide only
2442# std::isnan, and bare isnan will be unavailable. Typically we need a parameter
2443# in the test to allow C++ to do overload resolution.
2444
2445if test -z "$COIN_C_ISNAN"; then
2446  AC_CHECK_DECL([std::isnan(42.42)],[COIN_C_ISNAN=std::isnan],,[
2447#ifdef HAVE_CMATH
2448# include <cmath>
2449#else
2450# ifdef HAVE_MATH_H
2451#  include <math.h>
2452# endif
2453#endif
2454#ifdef HAVE_CFLOAT
2455# include <cfloat>
2456#else
2457# ifdef HAVE_FLOAT_H
2458#  include <float.h>
2459# endif
2460#endif
2461#ifdef HAVE_CIEEEFP
2462# include <cieeefp>
2463#else
2464# ifdef HAVE_IEEEFP_H
2465#  include <ieeefp.h>
2466# endif
2467#endif])
2468fi
2469
2470if test -z "$COIN_C_ISNAN"; then
2471  AC_CHECK_DECL([_isnan],[COIN_C_ISNAN=_isnan],,[
2472#ifdef HAVE_CMATH
2473# include <cmath>
2474#else
2475# ifdef HAVE_MATH_H
2476#  include <math.h>
2477# endif
2478#endif
2479#ifdef HAVE_CFLOAT
2480# include <cfloat>
2481#else
2482# ifdef HAVE_FLOAT_H
2483#  include <float.h>
2484# endif
2485#endif
2486#ifdef HAVE_CIEEEFP
2487# include <cieeefp>
2488#else
2489# ifdef HAVE_IEEEFP_H
2490#  include <ieeefp.h>
2491# endif
2492#endif])
2493fi
2494if test -z "$COIN_C_ISNAN"; then
2495  AC_CHECK_DECL([isnand],[COIN_C_ISNAN=isnand],,[
2496#ifdef HAVE_CMATH
2497# include <cmath>
2498#else
2499# ifdef HAVE_MATH_H
2500#  include <math.h>
2501# endif
2502#endif
2503#ifdef HAVE_CFLOAT
2504# include <cfloat>
2505#else
2506# ifdef HAVE_FLOAT_H
2507#  include <float.h>
2508# endif
2509#endif
2510#ifdef HAVE_CIEEEFP
2511# include <cieeefp>
2512#else
2513# ifdef HAVE_IEEEFP_H
2514#  include <ieeefp.h>
2515# endif
2516#endif])
2517fi
2518if test -z "$COIN_C_ISNAN"; then
2519  AC_MSG_WARN(Cannot find C-function for checking NaN.)
2520else
2521  AC_DEFINE_UNQUOTED(COIN_C_ISNAN,[$COIN_C_ISNAN],
2522                     [Define to be the name of C-function for NaN check])
2523fi
2524
2525AC_LANG_POP(C++)
2526])
2527
2528###########################################################################
2529#                             COIN_DATA_PATH                              #
2530###########################################################################
2531
2532# This macro defines a preprocessor macro with the absolute path to a
2533# subdirectory of Data.  The argument of this macro is the name of the
2534# subdirectory (in correct case), and the name of the macro is
2535# COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of
2536# the directory.  The path ends with a separator ("/" for linux and
2537# '\\' for Windows).  The default value for this path can be
2538# overwritten with the input variable with the same name
2539# (COIN_DATA_DIR_PATH).  At this point we chech only for the
2540# $srcdir/../Data subdirectory.
2541
2542AC_DEFUN([AC_COIN_DATA_PATH],
2543[AC_MSG_CHECKING([absolute path to data directory $1])
2544
2545AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory])
2546
2547if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then
2548  m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd`
2549fi
2550
2551# Under Cygwin, use Windows path.  Add separator
2552case $build in
2553  *-cygwin*)
2554    m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\
2555    ;;
2556  *)
2557    m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/"
2558    ;;
2559esac
2560
2561if test -r $m4_toupper(COIN_DATA_$1_PATH); then
2562  AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"],
2563            [Define to absolute path for Data subdirectory $1])
2564  AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH))
2565else
2566  AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist)
2567fi
2568]) # AC_COIN_DATA_PATH
2569
2570###########################################################################
2571#                       COIN_LINK_FROM_FILELIST                           #
2572###########################################################################
2573
2574# This macro creates links (or copies, if necessary) to files listed
2575# as content in a text file (second argument) into a target directory
2576# (first argument), which is created if it doesn't exist yet.  If s link
2577# already exists, nothing happens.
2578
2579AC_DEFUN([AC_COIN_LINKCOPY_FROM_FILELIST],
2580[cmd="$3"
2581if test -e $srcdir/$2 ; then
2582  my_target_dir="$1"
2583  my_link_files=`cat $srcdir/$2`
2584  my_dirname=`AS_DIRNAME($2)`
2585#  if test -e $my_target_dir; then : ; else
2586#    AS_MKDIR_P($my_target_dir)
2587#  fi
2588  for i in $my_link_files; do
2589    #rm -rf $my_target_dir/$i
2590    if test -e $my_target_dir/$i; then : ; else
2591      dirn2=`AS_DIRNAME($my_target_dir/$i)`
2592      if test -e $dirn2; then : ; else
2593        AS_MKDIR_P($dirn2)
2594      fi
2595      $cmd $abs_source_dir/$my_dirname/$i $my_target_dir/$i
2596    fi
2597  done
2598else
2599  AC_MSG_WARN([File list file $2 missing!])
2600fi
2601])
2602
2603AC_DEFUN([AC_COIN_LINK_FROM_FILELIST],
2604[
2605AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
2606echo Creating links in $1 ...
2607AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, $coin_link_input_cmd)
2608])
2609
2610###########################################################################
2611#                       COIN_COPY_FROM_FILELIST                           #
2612###########################################################################
2613
2614# Like COIN_LINK_FROM_FILELIST, but copies the files.
2615
2616AC_DEFUN([AC_COIN_COPY_FROM_FILELIST],
2617[
2618echo Creating copies in $1 ...
2619AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, [cp])
2620])
2621
2622###########################################################################
2623#                          COIN_EXAMPLE_FILES                             #
2624###########################################################################
2625
2626# This macro determines the names of the example files (using the
2627# argument in an "ls" command) and sets up the variables EXAMPLE_FILES
2628# and EXAMPLE_CLEAN_FILES.  If this is a VPATH configuration, it also
2629# creates soft links to the example files.
2630
2631AC_DEFUN([AC_COIN_EXAMPLE_FILES],
2632[AC_REQUIRE([AC_COIN_CHECK_VPATH])
2633AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
2634AC_REQUIRE([AC_PROG_LN_S])
2635
2636files=`cd $srcdir; ls $1`
2637# We need to do the following loop to make sure that are no newlines
2638# in the variable
2639for file in $files; do
2640  EXAMPLE_FILES="$EXAMPLE_FILES $file"
2641done
2642if test $coin_vpath_config = yes; then
2643  lnkcmd=
2644  if test "$enable_doscompile" != no; then
2645    lnkcmd=cp
2646  fi
2647  case "$CC" in
2648    clang* ) ;;
2649    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2650      lnkcmd=cp ;;
2651  esac
2652  if test "x$lnkcmd" = xcp; then
2653    AC_MSG_NOTICE([Copying example files ($1)])
2654  else
2655    AC_MSG_NOTICE([Creating links to the example files ($1)])
2656    lnkcmd="$LN_S"
2657  fi
2658  for file in $EXAMPLE_FILES; do
2659    rm -f $file
2660    $lnkcmd $srcdir/$file $file
2661  done
2662  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES $1"
2663else
2664  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES"
2665fi
2666
2667# In case there are compressed files, we create a variable with the
2668# uncompressed names
2669EXAMPLE_UNCOMPRESSED_FILES=
2670for file in $EXAMPLE_FILES; do
2671  case $file in
2672    *.gz)
2673      EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`"
2674      ;;
2675  esac
2676done
2677
2678AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES)
2679AC_SUBST(EXAMPLE_FILES)
2680AC_SUBST(EXAMPLE_CLEAN_FILES)
2681]) #AC_COIN_EXAMPLE_FILES
2682
2683###########################################################################
2684#                      COIN_CHECK_USER_LIBRARY                            #
2685###########################################################################
2686# This macro sets up usage of a user library with header files. The assumption
2687# is that the header file(s) and library do not reside in standard system
2688# directories, hence both the include directory and link flags must be
2689# specified. There are two mandatory arguments and two optional arguments.
2690#
2691# The first argument (mandatory) should be a name (LibraryName) for the
2692# library.  The second argument (mandatory) should be an abbreviation in
2693# upper case letters (LBRY) for the library. Ultimately, the macro will
2694# specify two variables, LBRYINCDIR and LBRYLIB, to be substituted in files
2695# generated during configuration; a preprocessor symbol COIN_HAS_LBRY; and a
2696# matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the
2697# directory containing include files for the library. LBRYLIB should specify
2698# the flags necessary to link to the library. A variable coin_has_lbry will
2699# be set to true or false, as appropriate. A variable lbry_libcheck will be
2700# be set to yes or no; no indicates link checks should not be attempted.
2701#
2702# The macro defines three configure arguments, --with-libraryname-incdir,
2703# --with-libraryname-lib, and --disable-libraryname-libcheck, by converting
2704# LibraryName to lower case.
2705#
2706# LBRYINCDIR and LBRYLIB can be specified as environment variables or as
2707# part of the configure command using --with-libraryname-incdir and
2708# --with-libraryname-lib, respectively. Command line arguments override
2709# environment variables.
2710#
2711# If a third argument is given, it should specify a file in LBRYINCDIR.  The
2712# macro will check for the presence of the file. If a fourth argument is given,
2713# it should specify a function name, `fname'.  The macro will attempt to link a
2714# trivial program containing a parameterless call to the function, `fname()',
2715# using the LBRYLIB flags. The link check uses C as the language; this has been
2716# adequate to date but has limitations. It is possible to disable the link
2717# check by specifying --disable-libraryname-libcheck. This is a workaround for
2718# instances where the link check does not work properly, for whatever reason.
2719# If you're trying to link to a Fortran library, consider using F77_FUNC or
2720# FC_FUNC to obtain a mangled fname appropriate for use from C code. For a C++
2721# library, you're on your own unless the library declares some function with
2722# extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++
2723# name.
2724# A fifth argument can be specified to include linker flags that may be required
2725# to sucessfully perform the linking check.
2726#
2727# An optional sixth argument can be given to specify a list of targets.
2728# For each target X, the variables X_LIBS and X_PCLIBS will be extended by $LBRYLIB,
2729# if the library has been found and seems to work.
2730
2731AC_DEFUN([AC_COIN_CHECK_USER_LIBRARY],
2732[ AC_REQUIRE([AC_COIN_PROJECTDIR_INIT])
2733  AC_MSG_CHECKING(if user provides library for $1)
2734
2735# Check for header file directory
2736
2737  AC_ARG_WITH(m4_tolower($1)-incdir,
2738      AS_HELP_STRING([--with-m4_tolower($1)-incdir],
2739                     [specify the header file directory for library $1]),
2740      [$2INCDIR=`cd $withval; pwd`])
2741
2742# Check for library directory
2743
2744  AC_ARG_WITH(m4_tolower($1)-lib,
2745      AS_HELP_STRING([--with-m4_tolower($1)-lib],
2746                     [specify the flags used to link with the library $1]),
2747      [$2LIB=$withval])
2748
2749# Switch to disable library check if requested
2750
2751  AC_ARG_ENABLE(m4_tolower($1)-libcheck,
2752      AS_HELP_STRING([--disable-m4_tolower($1)-libcheck],
2753                     [skip the link check at configuration time]),
2754      [m4_tolower($1)_libcheck=$enableval],
2755      [m4_tolower($1)_libcheck=yes])
2756
2757# At this point, if we're going to use the library, both LBRYINCDIR and
2758# LBRYLIB must be defined and not empty.
2759
2760  if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then
2761    if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then
2762      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.])
2763    fi
2764    m4_tolower(coin_has_$2)=true
2765    AC_MSG_RESULT(yes)
2766  else
2767    m4_tolower(coin_has_$2)=false
2768    AC_MSG_RESULT(no)
2769  fi
2770
2771# If we have instructions for use, consider header and link checks.
2772
2773  if test $m4_tolower(coin_has_$2) = true; then
2774
2775# If argument 3 (file) is given, check for the file. Typically this will be a
2776# header file, but that's not assumed.
2777
2778    m4_ifval([$3],
2779        [AC_COIN_CHECK_FILE([$$2INCDIR/$3],[],
2780             [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])])
2781
2782# Now see if we can link the function. There are arguments for and against
2783# assuming argument 3 is a header file declaring the function. A correct
2784# function declaration is the main argument in favour. Having to cope with
2785# possible dependencies or other oddities are the main arguments against.
2786# Force the use of C as the best single choice amongst C++, C, and Fortran.
2787# Obviously, this has limits.
2788
2789    m4_ifvaln([$4],
2790        [if test x"$m4_tolower($1)_libcheck" != xno; then
2791           coin_save_LIBS="$LIBS"
2792           LIBS="$$2LIB $5"
2793           coin_$2_link=no
2794           AC_LANG_PUSH(C)
2795           for fnm in $4 ; do
2796             AC_MSG_CHECKING([whether symbol $fnm is available with $2])
2797             AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$fnm()]])],
2798                 [AC_MSG_RESULT(yes)
2799                  coin_$2_link=yes
2800                  break],
2801                 [AC_MSG_RESULT(no)])
2802           done
2803           AC_LANG_POP(C)
2804           LIBS="$coin_save_LIBS"
2805           if test x"$coin_$2_link" != xyes ; then
2806             AC_MSG_ERROR([Cannot find symbol(s) $4 with $2])
2807           fi
2808         fi])
2809
2810# If we make it this far, we've verified the file and linked the function. Add
2811# the necessary link flags to $6_{PC}LIBS and define the preprocessor symbol
2812# COIN_HAS_LBRY.
2813
2814    coin_foreach_w([myvar], [$6], [
2815      m4_toupper(myvar)_LIBS="$$2LIB $m4_toupper(myvar)_LIBS"
2816      m4_toupper(myvar)_PCLIBS="$$2LIB $m4_toupper(myvar)_PCLIBS"
2817      m4_toupper(myvar)_LIBS_INSTALLED="$$2LIB $m4_toupper(myvar)_LIBS_INSTALLED"
2818    ])
2819   
2820    AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available])
2821  fi
2822
2823# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
2824# automake conditional. These actions must occur unconditionally.
2825
2826  AC_SUBST($2INCDIR)
2827  AC_SUBST($2LIB)
2828  AM_CONDITIONAL(COIN_HAS_$2, test $m4_tolower(coin_has_$2) = true)
2829]) #AC_COIN_CHECK_USER_LIBRARY
2830
2831###########################################################################
2832#                            COIN_TRY_FLINK                               #
2833###########################################################################
2834
2835# Auxilliary macro to test if a Fortran function name can be linked,
2836# given the current settings of LIBS.  We determine from the context, what
2837# the currently active programming language is, and cast the name accordingly.
2838# The first argument is the name of the function/subroutine, in small letters,
2839# the second argument are the actions taken when the test works, and the
2840# third argument are the actions taken if the test fails.
2841
2842AC_DEFUN([AC_COIN_TRY_FLINK],
2843[case $ac_ext in
2844  f)
2845    AC_TRY_LINK(,[      call $1],[$2],[$3])
2846    ;;
2847  c)
2848    AC_F77_FUNC($1,cfunc$1)
2849    if test x"$coin_need_flibs" = xyes; then
2850      flink_try=no;
2851    else
2852      AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2853                  [flink_try=yes],[flink_try=no])
2854    fi
2855    if test $flink_try = yes; then
2856      $2
2857    else
2858      if test x"$FLIBS" != x; then
2859        flink_save_libs="$LIBS"
2860        LIBS="$LIBS $FLIBS"
2861        AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2862                    [LIBS="$flink_save_libs"
2863                     coin_need_flibs=yes
2864                     $2
2865                    ],
2866                    [LIBS="$flink_save_libs"
2867                     $3])
2868      else
2869        $3
2870      fi
2871    fi
2872    ;;
2873  cc|cpp)
2874    AC_F77_FUNC($1,cfunc$1)
2875    if test x"$coin_need_flibs" = xyes; then
2876      flink_try=no;
2877    else
2878      AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2879                  [flink_try=yes],[flink_try=no])
2880    fi
2881    if test $flink_try = yes; then
2882      $2
2883    else
2884      if test x"$FLIBS" != x; then
2885        flink_save_libs="$LIBS"
2886        LIBS="$LIBS $FLIBS"
2887        AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2888                    [LIBS="$flink_save_libs"
2889                     coin_need_flibs=yes
2890                     $2
2891                    ],
2892                    [LIBS="$flink_save_libs"
2893                     $3])
2894      else
2895        $3
2896      fi
2897    fi
2898    ;;
2899esac
2900]) # AC_COIN_TRY_FLINK
2901
2902###########################################################################
2903#                           COIN_DOXYGEN                                  #
2904###########################################################################
2905#
2906# This macro determines the configuration information for doxygen, the tool
2907# used to generate online documentation of COIN code. It takes one parameter,
2908# a list of projects (mixed-case, to match the directory names) that should
2909# be processed as external tag files. E.g., COIN_DOXYGEN([Clp Osi]).
2910#
2911# This macro will define the following variables:
2912#  coin_have_doxygen    Yes if doxygen is found, no otherwise
2913#  coin_doxy_usedot     Defaults to `yes'; --with-dot will still check to see
2914#                       if dot is available
2915#  coin_doxy_tagname    Name of doxygen tag file (placed in doxydoc directory)
2916#  coin_doxy_logname    Name of doxygen log file (placed in doxydoc directory)
2917#  coin_doxy_tagfiles   List of doxygen tag files used to reference other
2918#                       doxygen documentation
2919#  coin_doxy_excludes   Directories to exclude from doxygen processing
2920
2921AC_DEFUN([AC_COIN_DOXYGEN],
2922[
2923
2924AC_MSG_NOTICE([configuring doxygen documentation options])
2925
2926# Check to see if doxygen is available.
2927
2928AC_CHECK_PROG([coin_have_doxygen],[doxygen],[yes],[no])
2929
2930# Look for the dot tool from the graphviz package, unless the user has
2931# disabled it.
2932
2933AC_ARG_WITH([dot],
2934  AS_HELP_STRING([--with-dot],
2935                 [use dot (from graphviz) when creating documentation with
2936                  doxygen if available; --without-dot to disable]),
2937  [],[withval=yes])
2938if test x"$withval" = xno ; then
2939  coin_doxy_usedot=NO
2940  AC_MSG_CHECKING([for dot ])
2941  AC_MSG_RESULT([disabled])
2942else
2943  AC_CHECK_PROG([coin_doxy_usedot],[dot],[YES],[NO])
2944fi
2945
2946# Generate a tag file name and a log file name
2947
2948AC_SUBST([coin_doxy_tagname],[doxydoc/${PACKAGE}_doxy.tag])
2949AC_SUBST([coin_doxy_logname],[doxydoc/${PACKAGE}_doxy.log])
2950
2951# Process the list of project names and massage them into possible doxygen
2952# doc'n directories. Prefer 1) classic external, source processed using
2953# a project-specific doxygen.conf, we use the tag file; 2) classic
2954# external, source processed using package doxygen.conf; 3) installed
2955# doxydoc. Alternatives 1) and 2) are only possible if the directory will be
2956# configured, which we can't know unless this is the package base configure,
2957# since coin_subdirs is only set there. Hence it's sufficient to check for
2958# membership. If we use a tag file from a classic external, exclude the
2959# source from doxygen processing when doxygen runs in the base directory.
2960
2961coin_doxy_tagfiles=
2962coin_doxy_excludes=
2963tmp="$1"
2964for proj in $tmp ; do
2965  lc_proj=`echo $proj | [tr [A-Z] [a-z]]`
2966  AC_MSG_CHECKING([for doxygen doc'n for $proj ])
2967  doxytag=${lc_proj}_doxy.tag
2968  doxyfound=no
2969  for chkProj in $coin_subdirs ; do
2970    if test "$chkProj" = "$proj" ; then
2971      # proj will be configured, hence doxydoc present in build tree
2972      doxysrcdir="${srcdir}/${proj}"
2973      # AC_MSG_NOTICE([Considering $doxysrcdir (base)])
2974      if test -d "$doxysrcdir" ; then
2975        # with a doxydoc directory?
2976        doxydir="$doxysrcdir/doxydoc"
2977        # AC_MSG_NOTICE([Considering $doxydir (base)])
2978        # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
2979        if test -d "$doxydir" ; then
2980          # use tag file; don't process source
2981          eval doxydir="`pwd`/${proj}/doxydoc"
2982          coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
2983          AC_MSG_RESULT([$doxydir (tag)])
2984          coin_doxy_excludes="$coin_doxy_excludes */${proj}"
2985        else
2986          # will process the source -- nothing further to be done here
2987          AC_MSG_RESULT([$doxysrcdir (src)])
2988        fi
2989        doxyfound=yes
2990      fi
2991    fi
2992  done
2993  # Not built, fall back to installed tag file
2994  if test $doxyfound = no ; then
2995    eval doxydir="${datadir}/coin/doc/${proj}/doxydoc"
2996    # AC_MSG_NOTICE([Considering $doxydir (install)])
2997    # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
2998    coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
2999    AC_MSG_RESULT([$doxydir (tag)])
3000  fi
3001done
3002AC_SUBST([coin_doxy_tagfiles])
3003AC_SUBST([coin_doxy_excludes])
3004
3005]) # AC_COIN_DOXYGEN
3006
3007
3008###########################################################################
3009#                           COIN_HAS_PKGCONFIG                            #
3010###########################################################################
3011
3012# This macro checks whether a pkg-config tool with a minimal version number
3013# is available.  If so, then the variable PKGCONFIG is set to its path.
3014# If not, PKGCONFIG is set to "".  The minimal version number can be given
3015# as first parameter, by default it is 0.16.0, since COIN-OR .pc files now
3016# include an URL field, which breaks pkg-config version <= 0.15.
3017# This macro is a modified version of PKG_PROG_PKG_CONFIG in pkg.m4.
3018# Further, the AM_CONDITIONAL COIN_HAS_PKGCONFIG is set and PKGCONFIG is
3019# AC_SUBST'ed.  Finally, if this setup belongs to a project directory, then
3020# the search path for .pc files is assembled from the value of
3021# $PKG_CONFIG_PATH, the values of --prefix, --coin-instdir, and the directories
3022# named in a file ../coin_subdirs.txt or ../../coin_subdirs.txt in a variable
3023# COIN_PKG_CONFIG_PATH, which is also AC_SUBST'ed. For a path xxx given in the
3024# coin-subdirs.txt, also the directory xxx/pkgconfig is added, if existing.
3025
3026AC_DEFUN([AC_COIN_HAS_PKGCONFIG],
3027[AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
3028
3029AC_ARG_ENABLE([pkg-config],
3030  [AC_HELP_STRING([--disable-pkg-config],[disable use of pkg-config (if available)])],
3031  [use_pkgconfig="$enableval"],
3032  [use_pkgconfig=yes])
3033
3034if test $use_pkgconfig = yes ; then
3035  if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
3036    AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
3037  fi
3038  if test -n "$PKG_CONFIG"; then
3039    _pkg_min_version=m4_default([$1], [0.16.0])
3040    AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
3041    if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
3042      AC_MSG_RESULT([yes])
3043    else
3044      AC_MSG_RESULT([no])
3045      PKG_CONFIG=""
3046    fi
3047  fi
3048
3049  # check if pkg-config supports the short-errors flag
3050  if test -n "$PKG_CONFIG" && \
3051    $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
3052    pkg_short_errors=" --short-errors "
3053  else
3054    pkg_short_errors=""
3055  fi
3056fi
3057
3058AM_CONDITIONAL([COIN_HAS_PKGCONFIG], [test -n "$PKG_CONFIG"])
3059AC_SUBST(PKG_CONFIG)
3060
3061# assemble pkg-config search path for installed projects
3062COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
3063
3064# 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
3065# best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig,
3066# unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}...
3067if test "x${prefix}" = xNONE ; then
3068  COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib/pkgconfig:${ac_default_prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3069else
3070  COIN_PKG_CONFIG_PATH="${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3071fi
3072
3073AC_ARG_WITH([coin-instdir],
3074  AC_HELP_STRING([--with-coin-instdir],
3075                 [prefix of installation directory for precompiled COIN packages]),
3076  [if test -d "$withval"; then : ; else
3077     AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
3078   fi
3079   COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3080  ],[])
3081
3082AC_SUBST(COIN_PKG_CONFIG_PATH)
3083
3084# assemble additional pkg-config search paths for uninstalled projects
3085if test x$coin_projectdir = xyes ; then
3086  # if we are in a project setup, then in a classic setup, we want to find uninstalled projects
3087  # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory
3088  # unfortunately, if the user set prefix, then we do not know where the project base directory is located
3089  # 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)
3090  COIN_PKG_CONFIG_PATH_UNINSTALLED=
3091  if test -e ../coin_subdirs.txt ; then
3092    for i in `cat ../coin_subdirs.txt` ; do
3093      if test -d ../$i ; then
3094        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3095      fi
3096      if test -d ../$i/pkgconfig ; then
3097        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3098      fi
3099    done
3100  fi
3101
3102  if test -e ../../coin_subdirs.txt ; then
3103    for i in `cat ../../coin_subdirs.txt` ; do
3104      if test -d ../../$i ; then
3105        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3106      fi
3107      if test -d ../../$i/pkgconfig ; then
3108        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i/pkgconfig; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3109      fi
3110    done
3111  fi
3112
3113  AC_SUBST(COIN_PKG_CONFIG_PATH_UNINSTALLED)
3114fi
3115
3116if test -n "$PKG_CONFIG" && test x$coin_cc_is_cl = xtrue; then
3117  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.])
3118fi
3119
3120])
3121
3122###########################################################################
3123#                           COIN_PKG_CHECK_PROJECT_EXISTS                 #
3124###########################################################################
3125
3126# COIN_PKG_CHECK_PROJECT_EXISTS(PROJECT, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3127#
3128# Check to see whether a particular project exists.  Similar
3129# to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables
3130#
3131AC_DEFUN([AC_COIN_PKG_CHECK_PROJECT_EXISTS],
3132[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3133if test -n "$PKG_CONFIG" ; then
3134  if $PKG_CONFIG --exists "m4_tolower($1)"; then
3135    m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null`
3136    m4_ifval([$2], [$2], [:])
3137  else
3138    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"`
3139    $3
3140  fi
3141else
3142  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
3143fi
3144])
3145
3146###########################################################################
3147#                           COIN_PKG_CHECK_MODULE_EXISTS                  #
3148###########################################################################
3149
3150# COIN_PKG_CHECK_MODULES_EXISTS(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3151#
3152# Check to see whether a particular set of packages exists.
3153# Similar to PKG_CHECK_MODULES(), but set only the variable $1_VERSIONS and $1_PKG_ERRORS
3154#
3155AC_DEFUN([AC_COIN_PKG_CHECK_MODULE_EXISTS],
3156[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3157if test -n "$PKG_CONFIG" ; then
3158  if $PKG_CONFIG --exists "$2"; then
3159    m4_toupper($1)[]_VERSIONS=`$PKG_CONFIG --modversion "$2" 2>/dev/null | tr '\n' ' '`
3160    $3
3161  else
3162    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$2"`
3163    $4
3164  fi
3165else
3166  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
3167fi
3168])
3169
3170###########################################################################
3171#                           COIN_PKG_HAS_MODULE                           #
3172###########################################################################
3173
3174# COIN_PKG_HAS_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3175#
3176# Checks whether pkg-config files for a given set of packages is available.
3177# If so, sets MODULE_CFLAGS, MODULE_LIBS, and MODULES_DATA and executes ACTION-IF-FOUND.
3178# If not, then ACTION-IF-NOT-FOUND is executed.
3179# A reason for not finding a package is stored in MODULE_PKG_ERRORS
3180#
3181# --------------------------------------------------------------
3182AC_DEFUN([AC_COIN_PKG_HAS_MODULE],
3183[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3184
3185AC_COIN_PKG_CHECK_MODULE_EXISTS([$1],[$2],
3186  [ cflags=`$PKG_CONFIG --cflags "$2" 2>/dev/null`
3187    # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files
3188        # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's
3189        # but only do this if is not trivial
3190    if test "$CYGPATH_W" != "echo" ; then
3191      # need to put into brackets since otherwise autoconf replaces the brackets in the sed command
3192      [cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
3193    fi
3194    m4_toupper($1)[]_CFLAGS="$cflags"
3195    m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "$2" 2>/dev/null`
3196    m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "$2" 2>/dev/null`
3197    $3
3198  ],
3199  [ $4 ])
3200
3201])# PKG_CHECK_MODULES
3202
3203###########################################################################
3204#                           COIN_MAIN_PACKAGEDIR                          #
3205###########################################################################
3206
3207# This macro substitutes COIN_MAIN_SUBDIR.
3208# If $2/$1 or $1 is in COIN_SKIP_PROJECTS, do nothing.
3209# If --with-$1-lib, --with-$1-incdir, or --with-$1-datadir is given, then assume that the package is installed.
3210# Otherwise, if the directory $2/$1 and the file $2/$1/$3 exist, check whether $2/$1/configure exists.
3211#   If so, include this directory into the list of directories where configure and make recourse into.
3212# tolower(coin_has_$1) is set to "no" if the project source is not available or will not be compiled.
3213# Otherwise, it will be set to "yes".
3214
3215AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],[
3216AC_MSG_CHECKING([whether source of project $1 is available and should be compiled])
3217
3218m4_tolower(coin_has_$1)=notGiven
3219coin_reason=
3220
3221# check if user wants to skip project in any case
3222AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
3223if test x"$COIN_SKIP_PROJECTS" != x; then
3224  for dir in $COIN_SKIP_PROJECTS; do
3225    if test $dir = "$1"; then
3226      m4_tolower(coin_has_$1)="no"
3227      coin_reason="$1 has been specified in COIN_SKIP_PROJECTS"
3228    fi
3229    m4_ifval($2,[
3230    if test $dir = "$2/$1"; then
3231      m4_tolower(coin_has_$1)="no"
3232      coin_reason="$2/$1 has been specified in COIN_SKIP_PROJECTS"
3233    fi])
3234  done
3235fi
3236
3237if test "$m4_tolower(coin_has_$1)" != no; then
3238  AC_ARG_WITH([m4_tolower($1)],,
3239    [if test "$withval" = no ; then
3240       m4_tolower(coin_has_$1)="no"
3241       coin_reason="--without-m4_tolower($1) has been specified"
3242     fi
3243    ])
3244fi
3245
3246if test "$m4_tolower(coin_has_$1)" != no; then
3247  AC_ARG_WITH([m4_tolower($1)-lib],
3248    AC_HELP_STRING([--with-m4_tolower($1)-lib],
3249                   [linker flags for using project $1]),
3250    [if test "$withval" = no ; then
3251       m4_tolower(coin_has_$1)="no"
3252       coin_reason="--without-m4_tolower($1)-lib has been specified"
3253     else
3254       m4_tolower(coin_has_$1)="no"
3255       coin_reason="--with-m4_tolower($1)-lib has been specified"
3256     fi],
3257    [])
3258fi
3259
3260if test "$m4_tolower(coin_has_$1)" != no; then
3261  AC_ARG_WITH([m4_tolower($1)-incdir],
3262    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
3263                   [directory with header files for using project $1]),
3264    [if test "$withval" = no ; then
3265       m4_tolower(coin_has_$1)="no"
3266       coin_reason="--without-m4_tolower($1)-incdir has been specified"
3267     else
3268       m4_tolower(coin_has_$1)="no"
3269       coin_reason="--with-m4_tolower($1)-incdir has been specified"
3270     fi],
3271    [])
3272fi
3273
3274if test "$m4_tolower(coin_has_$1)" != no; then
3275  AC_ARG_WITH([m4_tolower($1)-datadir],
3276    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
3277                   [directory with data files for using project $1]),
3278    [if test "$withval" = no ; then
3279       m4_tolower(coin_has_$1)="no"
3280       coin_reason="--without-m4_tolower($1)-datadir has been specified"
3281     else
3282       m4_tolower(coin_has_$1)="no"
3283       coin_reason="--with-m4_tolower($1)-datadir has been specified"
3284     fi],
3285    [])
3286fi
3287
3288m4_if(m4_tolower($1), blas, [
3289  if test $m4_tolower(coin_has_$1) != no; then
3290    #--with-blas can overwrite --with-blas-lib, and can be set to BUILD to enforce building blas
3291    AC_ARG_WITH([blas],
3292      AC_HELP_STRING([--with-blas], [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]),
3293        [if test x"$withval" = "xno" ; then
3294           coin_has_blas="no"
3295           coin_reason="--without-blas has been specified"
3296         elif test x"$withval" != "xBUILD" ; then
3297           coin_has_blas="no"
3298           coin_reason="--with-blas has been specified"
3299         fi],
3300        [])
3301  fi
3302])
3303
3304m4_if(m4_tolower($1), lapack, [
3305  if test $m4_tolower(coin_has_$1) != skipping; then
3306    #--with-lapack can overwrite --with-lapack-lib, and can be set to BUILD to enforce building lapack
3307    AC_ARG_WITH([lapack],
3308      AC_HELP_STRING([--with-lapack], [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]),
3309        [if test x"$withval" = "xno" ; then
3310           coin_has_lapack="no"
3311           coin_reason="--without-lapack has been specified"
3312         elif test x"$withval" != "xBUILD" ; then
3313           coin_has_lapack="no"
3314           coin_reason="--with-lapack has been specified"
3315         fi],
3316        [])
3317  fi
3318])
3319
3320# check if project is available in present directory
3321if test "$m4_tolower(coin_has_$1)" = notGiven; then
3322  m4_tolower(coin_has_$1)=no
3323  if test -d $srcdir/m4_ifval($2,[$2/],)$1; then
3324    coin_reason="source in m4_ifval($2,[$2/],)$1"
3325    # If a third argument is given, then we have to check if one one the files given in that third argument is present.
3326    # If none of the files in the third argument is available, then we consider the project directory as non-existing.
3327    # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient.
3328    m4_ifvaln([$3],
3329      [for i in $srcdir/m4_ifval($2,[$2/],)$1/$3; do
3330         if test -r $i; then
3331           m4_tolower(coin_has_$1)="yes"
3332         else
3333           m4_tolower(coin_has_$1)="no"
3334           coin_reason="source file $i not available"
3335           break
3336         fi
3337       done],
3338      [ m4_tolower(coin_has_$1)="yes" ])
3339  fi
3340fi
3341
3342if test -z "$coin_reason" ; then
3343  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
3344else
3345  AC_MSG_RESULT([$m4_tolower(coin_has_$1), $coin_reason])
3346fi
3347
3348if test "$m4_tolower(coin_has_$1)" = yes ; then
3349  if test -r $srcdir/m4_ifval($2,[$2/],)$1/configure; then
3350    coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1"
3351    AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1)
3352  fi
3353fi
3354])
3355
3356###########################################################################
3357#                            COIN_CHECK_PACKAGE                           #
3358###########################################################################
3359
3360# This macro checks for the existance of a COIN-OR package and provides compiler and linker flags to compile against this package.
3361# A package can consists of one or more COIN-OR or other projects.
3362# It defines the PACKAGE_CFLAGS, PACKAGE_LIBS, PACKAGE_DEPENDENCIES, and PACKAGE_DATA variables, referring to the compiler and linker
3363# flags to use when linking against this module, the libraries the package depends on, and the directories where the module data resists.
3364# The difference between PACKAGE_LIBS and PACKAGE_DEPENDENCIES is that PACKAGE_DEPENDENCIES does not contain arguments starting with '-',
3365# so it can be used to setup the _DEPENDENCIES variable in a Makefile.am.
3366# It also defines a COIN_HAS_PACKAGE preprocessor macro and makefile conditional.
3367# Further, tolower(coin_has_$1) is set to "yes".
3368# If a list of build targets using this projects is given in the third argument,
3369# then the compiler and linker variables and .pc file setup variable corresponding to this build target
3370# are extended with the values for this package.
3371# That is, for each build target X, the variables X_CFLAGS, X_LIBS, X_DEPENDENCIES, X_PCLIBS, X_PCREQUIRES are setup,
3372# whereas the last two specify the values to put into the "Libs:" and "Requires:" fields of the .pc file, resp.
3373#
3374# The first argument should be the name (PACKAGE) of the package (in correct lower
3375# and upper case).
3376# The second argument should be a (space separated) list of projects which this
3377# package consists of. Optionally, required version numbers can be added.
3378# The optional third argument should be a (space separated) list of build targets
3379# which use this package, if available.
3380#
3381# It is also possible to specify a preinstalled version of this package
3382# or to specify only the linker and compiler flags and data directory.
3383#
3384# If the user did not specify --with-$1-... flags and pkg-config is not available,
3385# COIN_CHECK_PACKAGE_FALLBACK($1, $2, $3) is called.
3386
3387AC_DEFUN([AC_COIN_CHECK_PACKAGE],
3388[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3389AC_MSG_CHECKING([for COIN-OR package $1])
3390
3391m4_tolower(coin_has_$1)=notGiven
3392
3393# check if user wants to skip package in any case
3394if test x"$COIN_SKIP_PROJECTS" != x; then
3395  for dir in $COIN_SKIP_PROJECTS; do
3396    if test $dir = "$1"; then
3397      m4_tolower(coin_has_$1)=skipping
3398    fi
3399  done
3400fi
3401
3402if test "$m4_tolower(coin_has_$1)" != skipping; then
3403  AC_ARG_WITH([m4_tolower($1)],,
3404    [if test "$withval" = no ; then
3405       m4_tolower(coin_has_$1)=skipping
3406     fi
3407    ])
3408fi
3409
3410m4_toupper($1_LIBS)=
3411m4_toupper($1_CFLAGS)=
3412m4_toupper($1_DATA)=
3413m4_toupper($1_DEPENDENCIES)=
3414m4_toupper($1_PCLIBS)=
3415m4_toupper($1_PCREQUIRES)=
3416m4_toupper($1_DATA)=
3417AC_SUBST(m4_toupper($1_LIBS))
3418AC_SUBST(m4_toupper($1_CFLAGS))
3419AC_SUBST(m4_toupper($1_DATA))
3420AC_SUBST(m4_toupper($1_DEPENDENCIES))
3421AC_SUBST(m4_toupper($1_LIBS_INSTALLED))
3422AC_SUBST(m4_toupper($1_CFLAGS_INSTALLED))
3423AC_SUBST(m4_toupper($1_DATA_INSTALLED))
3424coin_foreach_w([myvar], [$3], [
3425  AC_SUBST(m4_toupper(myvar)_CFLAGS)
3426  AC_SUBST(m4_toupper(myvar)_LIBS)
3427  AC_SUBST(m4_toupper(myvar)_PCLIBS)
3428  AC_SUBST(m4_toupper(myvar)_PCREQUIRES)
3429  AC_SUBST(m4_toupper(myvar)_DEPENDENCIES)
3430  AC_SUBST(m4_toupper(myvar)_CFLAGS_INSTALLED)
3431  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
3432])
3433
3434#check if user provided LIBS, CFLAGS, or DATA for package or disables use of package
3435if test $m4_tolower(coin_has_$1) != skipping; then
3436  AC_ARG_WITH([m4_tolower($1)-lib],
3437    AC_HELP_STRING([--with-m4_tolower($1)-lib],
3438                   [linker flags for using package $1]),
3439    [if test "$withval" = no ; then
3440       m4_tolower(coin_has_$1)=skipping
3441     else
3442       m4_tolower(coin_has_$1)=yes
3443       m4_toupper($1_LIBS)="$withval"
3444       m4_toupper($1_PCLIBS)="$withval"
3445       coin_foreach_w([myvar], [$3], [
3446         m4_toupper(myvar)_PCLIBS="$withval $m4_toupper(myvar)_PCLIBS"
3447         m4_toupper(myvar)_LIBS="$withval $m4_toupper(myvar)_LIBS"
3448       ])
3449       # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
3450       if test -z "$PKG_CONFIG" ; then
3451         m4_toupper($1_LIBS_INSTALLED)="$withval"
3452         coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_LIBS_INSTALLED="$withval $m4_toupper(myvar)_LIBS_INSTALLED"])
3453       fi
3454     fi
3455    ],
3456    [])
3457fi
3458
3459if test $m4_tolower(coin_has_$1) != skipping; then
3460  AC_ARG_WITH([m4_tolower($1)-incdir],
3461    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
3462                   [directory with header files for using package $1]),
3463    [if test "$withval" = no ; then
3464       m4_tolower(coin_has_$1)=skipping
3465     else
3466       m4_tolower(coin_has_$1)=yes
3467       m4_toupper($1_CFLAGS)="-I`${CYGPATH_W} $withval`"
3468       coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="-I`${CYGPATH_W} $withval` $m4_toupper(myvar)_CFLAGS"])
3469       # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
3470       if test -z "$PKG_CONFIG" ; then
3471         m4_toupper($1_CFLAGS_INSTALLED)="$m4_toupper($1_CFLAGS)"
3472         coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1_CFLAGS) $m4_toupper(myvar)_CFLAGS_INSTALLED"])
3473       fi
3474     fi
3475    ],
3476    [])
3477fi
3478
3479if test $m4_tolower(coin_has_$1) != skipping; then
3480  AC_ARG_WITH([m4_tolower($1)-datadir],
3481    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
3482                   [directory with data files for using package $1]),
3483    [if test "$withval" = no ; then
3484       m4_tolower(coin_has_$1)=skipping
3485     else
3486       m4_tolower(coin_has_$1)=yes
3487       m4_toupper($1_DATA)="$withval"
3488       # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
3489       if test -z "$PKG_CONFIG" ; then
3490         m4_toupper($1_DATA_INSTALLED)="$withval"
3491       fi
3492     fi
3493    ],
3494    [])
3495fi
3496
3497if test $m4_tolower(coin_has_$1) = notGiven; then
3498  if test -n "$PKG_CONFIG" ; then
3499    # set search path for pkg-config
3500    # need to export variable to be sure that the following pkg-config gets these values
3501    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
3502    PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED"
3503    export PKG_CONFIG_PATH
3504   
3505    # let pkg-config do it's magic
3506    AC_COIN_PKG_HAS_MODULE([$1],[$2],
3507      [ m4_tolower(coin_has_$1)=yes
3508        AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
3509
3510        # adjust linker flags for (i)cl compiler
3511        # 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)
3512        if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
3513        then
3514          m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
3515        fi
3516        m4_toupper($1_PCREQUIRES)="$2"
3517   
3518        # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in $3
3519        coin_foreach_w([myvar], [$3], [
3520          m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
3521          m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
3522          m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
3523        ])
3524      ],
3525      [ m4_tolower(coin_has_$1)=notGiven
3526        AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS])
3527      ])
3528
3529    # reset PKG_CONFIG_PATH variable
3530    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
3531    export PKG_CONFIG_PATH
3532
3533  else
3534    AC_MSG_RESULT([skipped check via pkg-config, redirect to fallback])
3535    AC_COIN_CHECK_PACKAGE_FALLBACK([$1], [$2], [$3])
3536  fi
3537
3538else
3539  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
3540fi
3541
3542if test $m4_tolower(coin_has_$1) != skipping &&
3543   test $m4_tolower(coin_has_$1) != notGiven ; then
3544  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
3545
3546  AC_ARG_ENABLE([interpackage-dependencies],
3547    AC_HELP_STRING([--disable-interpackage-dependencies], [disables deduction of Makefile dependencies from package linker flags]),
3548    [], [enable_interpackage_dependencies=yes])
3549   
3550  if test $enable_interpackage_dependencies = yes ; then
3551     # construct dependencies variables from LIBS variables
3552     # we add an extra space in LIBS so we can substitute out everything starting with " -"
3553     # remove everything of the form -framework xxx as used on Mac and mkl* and libiomp5* as used on Windows
3554     # then remove everything of the form -xxx
3555     # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl)
3556     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']`
3557     coin_foreach_w([myvar], [$3], [
3558       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']`
3559     ])
3560  fi
3561
3562  if test 1 = 0 ; then  #change this test to enable a bit of debugging output
3563    if test -n "$m4_toupper($1)_CFLAGS" ; then
3564      AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
3565    fi
3566    if test -n "$m4_toupper($1)_LIBS" ; then
3567      AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
3568    fi
3569    if test -n "$m4_toupper($1)_DEPENDENCIES" ; then
3570      AC_MSG_NOTICE([$1 DEPENDENCIES are $m4_toupper($1)_DEPENDENCIES])
3571    fi
3572    if test -n "$m4_toupper($1)_DATA" ; then
3573      AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
3574    fi
3575    if test -n "$m4_toupper($1)_PCLIBS" ; then
3576      AC_MSG_NOTICE([$1 PCLIBS are $m4_toupper($1)_PCLIBS])
3577    fi
3578    if test -n "$m4_toupper($1)_PCREQUIRES" ; then
3579      AC_MSG_NOTICE([$1 PCREQUIRES are $m4_toupper($1)_PCREQUIRES])
3580    fi
3581    coin_foreach_w([myvar], [$3], [
3582      AC_MSG_NOTICE([myvar CFLAGS are $m4_toupper(myvar)_CFLAGS])
3583      AC_MSG_NOTICE([myvar LIBS   are $m4_toupper(myvar)_LIBS])
3584      AC_MSG_NOTICE([myvar DEPENDENCIES are $m4_toupper(myvar)_DEPENDENCIES])
3585    ])
3586  fi
3587fi
3588
3589# Define the Makefile conditional
3590AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
3591               [test $m4_tolower(coin_has_$1) != notGiven &&
3592                test $m4_tolower(coin_has_$1) != skipping])
3593
3594]) # AC_COIN_CHECK_PACKAGE
3595
3596###########################################################################
3597#                       COIN_CHECK_PACKAGE_FALLBACK                       #
3598###########################################################################
3599
3600# This macro is used by COIN_CHECK_PACKAGE, if it fails to find a package
3601# because pkg-config was disabled or is not available.
3602#
3603# For each project xxx specified in $2, it searches for a xxx-uninstalled.pc
3604# file in the directories specified in $COIN_PKG_CONFIG_PATH_UNINSTALLED. The
3605# latter variable is setup by COIN_HAS_PKGCONFIG and consists of the content
3606# of the coin_subdirs.txt file which has been created by configure in the
3607# base directory.  The content of xxx-uninstalled.pc is parsed in order
3608# to defines the variables PACKAGE_CFLAGS, PACKAGE_LIBS, and PACKAGE_DATA,
3609# referring to the compiler and linker flags to use when linking against this
3610# package and the directory where the package data resists.  Further, for each
3611# build target X specified in the third argument, the variables X_CFLAGS and
3612# X_LIBS are extended with the compiler and linker flags of this package and
3613# the variables X_PCLIBS and X_PCREQUIRES are extended by the list of linker
3614# flags and dependent projects as needed to setup a .pc file.  The macros
3615# checks also dependencies of $2.  Note that the PACKAGE_DATA variable is
3616# set to the content of datadir of the first .pc file that is parsed.
3617# Finally, for each X in the third argument, also variables
3618# X_CFLAGS_INSTALLED and X_LIBS_INSTALLED are setup. They contain the compiler
3619# and linker flags for X when all projects have been installed. Their content
3620# is assembled from the .pc files that correspond to installed projects. I.e.,
3621# whenever a file proj-uninstalled.pc is parsed, then also a corresponding
3622# proj.pc file is parsed for compiler and linker flags, if available in the
3623# same directory.
3624# Similar, a variable PACKAGE_DATA_INSTALLED is setup to the content of datadir
3625# of the first .pc file that is parsed.
3626#
3627# If .pc files for all projects in $2 and their dependencies is found,
3628# tolower(coin_has_$1) is set to "yes".  Otherwise, if some dependency
3629# is not found, tolower(coin_has_$1) is set to "notGiven".  Further, a
3630# COIN_HAS_PACKAGE preprocessor macro and a makefile conditional are defined.
3631#
3632# The first argument should be the name (PACKAGE) of the package (in correct
3633# lower and upper case).  The second argument should be the base names of the
3634# projects .pc file which define this package.  The optional third argument
3635# should be a (space separated) list of build targets which use this package,
3636# if available.
3637#
3638# $1 is not checked for $COIN_SKIP_PROJECTS, since we only look into
3639# $COIN_PKG_CONFIG_PATH_UNINSTALLED.  When the content of this variable was
3640# setup in the base directory, $COIN_SKIP_PROJECTS has already been considered.
3641
3642AC_DEFUN([AC_COIN_CHECK_PACKAGE_FALLBACK],
3643[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3644AC_MSG_CHECKING([for COIN-OR package $1 (fallback)])
3645
3646m4_tolower(coin_has_$1)=notGiven
3647m4_toupper($1_LIBS)=
3648m4_toupper($1_LIBS_INSTALLED)=
3649m4_toupper($1_CFLAGS)=
3650m4_toupper($1_CFLAGS_INSTALLED)=
3651m4_toupper($1_DATA)=
3652m4_toupper($1_DATA_INSTALLED)=
3653m4_toupper($1_PCLIBS)=
3654m4_toupper($1_PCREQUIRES)=
3655
3656# initial list of dependencies is "$2", but we need to filter out version number specifications (= x, <= x, >= x, != x)
3657projtoprocess="m4_bpatsubsts([$2], [<?>?!?=[    ]*[^    ]+])"
3658
3659# we first expand the list of projects to process by adding all dependencies just behind the project which depends on it
3660# further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards
3661# the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples
3662# also, we setup the DATA variable
3663allproj=""
3664allpcfiles=""
3665allpcifiles=""
3666while test "x$projtoprocess" != x ; do
3667
3668  for proj in $projtoprocess ; do
3669    # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it
3670    pcfile=""
3671    save_IFS="$IFS"
3672    IFS=":"
3673    for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do
3674      # 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
3675      if test -r "$dir/${proj}-uninstalled.pc" ; then
3676        pcfile="$dir/$proj-uninstalled.pc"
3677        if test -r "$dir/${proj}.pc" ; then
3678          pcifile="$dir/${proj}.pc"
3679        else
3680          AC_MSG_WARN([Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples.])
3681          pcifile=
3682        fi
3683        break
3684      fi
3685    done
3686    IFS="$save_IFS"
3687
3688    if test "x$pcfile" != x ; then
3689      # read dependencies from $pcfile and filter it
3690      projrequires=[`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[       ]\{0,\}[^       ]\{1,\}//g'`]
3691
3692      # add projrequires to the front of the list of projects that have to be processed next
3693      # at the same time, remove $proj from this list
3694      projtoprocess=[`echo $projtoprocess | sed -e "s/$proj/$projrequires/"`]
3695
3696      # read DATA from $pcfile, if _DATA is still empty
3697      if test "x$m4_toupper($1_DATA)" = x ; then
3698        projdatadir=
3699        [pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile`]
3700        eval `sh -c "$pcfilemod"`
3701        m4_toupper($1_DATA)="$projdatadir"
3702      fi
3703
3704      allproj="$allproj $proj"
3705      allpcfiles="$pcfile:$allpcfiles"
3706
3707    else
3708      AC_MSG_RESULT([no, dependency $proj not available])
3709      allproj=fail
3710      break 2
3711    fi
3712   
3713    if test "x$pcifile" != x ; then
3714      allpcifiles="$pcifile:$allpcifiles"
3715     
3716      # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty
3717      if test "x$m4_toupper($1_DATA_INSTALLED)" = x ; then
3718        projdatadir=
3719        [pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile`]
3720        eval `sh -c "$pcifilemod"`
3721        if test "${CYGPATH_W}" != "echo"; then
3722          projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`"
3723        fi
3724        m4_toupper($1_DATA_INSTALLED)="$projdatadir"
3725      fi
3726     
3727    fi
3728
3729    break
3730  done
3731
3732  # remove spaces on begin of $projtoprocess
3733  projtoprocess=`echo $projtoprocess | sed -e 's/^[ ]*//'`
3734
3735done
3736
3737if test "$allproj" != fail ; then
3738
3739  # now go through the list of .pc files and assemble compiler and linker flags
3740  # important is here to obey the reverse order that has been setup before,
3741  # since then libraries that are required by several others should be after these other libraries
3742  pcfilesprocessed=""
3743
3744  save_IFS="$IFS"
3745  IFS=":"
3746  for pcfile in $allpcfiles ; do
3747
3748    # if $pcfile has been processed already, skip this round
3749    if test "x$pcfilesprocessed" != x ; then
3750      for pcfiledone in $pcfilesprocessed ; do
3751        if test "$pcfiledone" = "$pcfile" ; then
3752          continue 2
3753        fi
3754      done
3755    fi
3756
3757    # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
3758    #   replace "Libs:" by "echo projlibs="
3759    #   replace "Cflags:" by "echo projcflags="
3760    #   remove every line starting with <some word>:
3761    [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
3762
3763    # set projcflags and projlibs variables by running $pcfilemod
3764    # 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
3765    projcflags=
3766    projlibs=
3767    IFS="$save_IFS"
3768    eval `sh -c "$pcfilemod"`
3769    IFS=":"
3770
3771    # add CYGPATH_W cludge into include flags and set CFLAGS variable
3772    if test "${CYGPATH_W}" != "echo"; then
3773      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
3774    fi
3775    m4_toupper($1_CFLAGS)="$projcflags $m4_toupper($1_CFLAGS)"
3776
3777    # set LIBS variable
3778    m4_toupper($1_LIBS)="$projlibs $m4_toupper($1_LIBS)"
3779
3780    # remember that we have processed $pcfile
3781    pcfilesprocessed="$pcfilesprocessed:$pcfile"
3782
3783  done
3784  IFS="$save_IFS"
3785
3786
3787  # now go through the list of .pc files for installed projects and assemble compiler and linker flags
3788  # important is here again to obey the reverse order that has been setup before,
3789  # since then libraries that are required by several others should be after these other libraries
3790  pcfilesprocessed=""
3791
3792  save_IFS="$IFS"
3793  IFS=":"
3794  for pcfile in $allpcifiles ; do
3795
3796    # if $pcfile has been processed already, skip this round
3797    if test "x$pcfilesprocessed" != x ; then
3798      for pcfiledone in $pcfilesprocessed ; do
3799        if test "$pcfiledone" = "$pcfile" ; then
3800          continue 2
3801        fi
3802      done
3803    fi
3804
3805    # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
3806    #   replace "Libs:" by "echo projlibs="
3807    #   replace "Cflags:" by "echo projcflags="
3808    #   remove every line starting with <some word>:
3809    [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
3810
3811    # set projcflags and projlibs variables by running $pcfilemod
3812    # 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
3813    projcflags=
3814    projlibs=
3815    IFS="$save_IFS"
3816    eval `sh -c "$pcfilemod"`
3817    IFS=":"
3818
3819    # add CYGPATH_W cludge into include flags and set CFLAGS variable
3820    if test "${CYGPATH_W}" != "echo"; then
3821      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
3822    fi
3823    m4_toupper($1_CFLAGS_INSTALLED)="$projcflags $m4_toupper($1_CFLAGS_INSTALLED)"
3824
3825    # set LIBS variable
3826    m4_toupper($1_LIBS_INSTALLED)="$projlibs $m4_toupper($1_LIBS_INSTALLED)"
3827   
3828    # remember that we have processed $pcfile
3829    pcfilesprocessed="$pcfilesprocessed:$pcfile"
3830
3831  done
3832  IFS="$save_IFS"
3833
3834
3835  # finish up
3836  m4_tolower(coin_has_$1)=yes
3837  AC_MSG_RESULT([yes])
3838  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
3839
3840  # adjust linker flags for (i)cl compiler
3841  # 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),
3842  # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`",
3843  #    everything of the form "-lname" by "libname.lib", and
3844  #    everything of the form "-Lpath" by "-libpath:`$(CYGPATH_W) path`
3845  if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
3846  then
3847    m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
3848    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']`
3849  fi
3850
3851  m4_toupper($1_PCREQUIRES)="$2"
3852  coin_foreach_w([myvar], [$3], [
3853    m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
3854    m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
3855    m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
3856    m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1)_CFLAGS_INSTALLED $m4_toupper(myvar)_CFLAGS_INSTALLED"
3857    m4_toupper(myvar)_LIBS_INSTALLED="$m4_toupper($1)_LIBS_INSTALLED $m4_toupper(myvar)_LIBS_INSTALLED"
3858  ])
3859
3860fi
3861
3862AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
3863               [test $m4_tolower(coin_has_$1) != notGiven &&
3864                test $m4_tolower(coin_has_$1) != skipping])
3865
3866]) # AC_COIN_CHECK_PACKAGE_FALLBACK
3867
3868###########################################################################
3869#                         COIN_CHECK_PACKAGE_BLAS                         #
3870###########################################################################
3871
3872# This macro checks for a library containing the BLAS library.  It
3873# 1. checks the --with-blas argument
3874# 2. if --with-blas=BUILD has been specified goes to point 5
3875# 3. if --with-blas has been specified to a working library, sets BLAS_LIBS
3876#    to its value
3877# 4. tries standard libraries
3878# 5. calls COIN_CHECK_PACKAGE(Blas, [coinblas], [$1]) to check for
3879#    ThirdParty/Blas
3880# The makefile conditional and preprocessor macro COIN_HAS_BLAS is defined.
3881# BLAS_LIBS is set to the flags required to link with a Blas library.
3882# For each build target X in $1, X_LIBS is extended with $BLAS_LIBS.
3883# In case 3 and 4, the flags to link to Blas are added to X_PCLIBS too.
3884# In case 5, Blas is added to X_PCREQUIRES.
3885
3886AC_DEFUN([AC_COIN_CHECK_PACKAGE_BLAS],
3887[
3888AC_ARG_WITH([blas],
3889            AC_HELP_STRING([--with-blas],
3890                           [specify BLAS library (or BUILD to enforce use of ThirdParty/Blas)]),
3891            [use_blas="$withval"], [use_blas=])
3892
3893# if user specified --with-blas-lib, then we should give COIN_CHECK_PACKAGE
3894# preference
3895AC_ARG_WITH([blas-lib],,[use_blas=BUILD])
3896
3897# Check if user supplied option makes sense
3898if test x"$use_blas" != x; then
3899  if test "$use_blas" = "BUILD"; then
3900    # we come to this later
3901    :
3902  elif test "$use_blas" != "no"; then
3903    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
3904    coin_need_flibs=no
3905    coin_save_LIBS="$LIBS"
3906    LIBS="$use_blas $LIBS"
3907    AC_COIN_TRY_FLINK([daxpy],
3908                      [if test $coin_need_flibs = yes ; then
3909                         use_blas="$use_blas $FLIBS"
3910                       fi
3911                       AC_MSG_RESULT([yes: $use_blas])],
3912                      [AC_MSG_RESULT([no])
3913                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
3914    LIBS="$coin_save_LIBS"
3915  fi
3916else
3917# Try to autodetect the library for blas based on build system
3918  #AC_MSG_CHECKING([default locations for BLAS])
3919  skip_lblas_check=no
3920  case $build in
3921    *-sgi-*)
3922      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
3923      coin_need_flibs=no
3924      coin_save_LIBS="$LIBS"
3925      LIBS="-lcomplib.sgimath $LIBS"
3926      AC_COIN_TRY_FLINK([daxpy],
3927                        [use_blas="-lcomplib.sgimath"
3928                         if test $coin_need_flibs = yes ; then
3929                           use_blas="$use_blas $FLIBS"
3930                         fi
3931                         AC_MSG_RESULT([yes: $use_blas])
3932                        ],
3933                        [AC_MSG_RESULT([no])])
3934      LIBS="$coin_save_LIBS"
3935      ;;
3936
3937# Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
3938# cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
3939# recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
3940# that CC and cc will understand -library in Studio 13. The main extra
3941# function of -xlic_lib and -library is to arrange for the Fortran run-time
3942# libraries to be linked for C++ and C. We can arrange that explicitly.
3943    *-*-solaris*)
3944      AC_MSG_CHECKING([for BLAS in libsunperf])
3945      coin_need_flibs=no
3946      coin_save_LIBS="$LIBS"
3947      LIBS="-lsunperf $FLIBS $LIBS"
3948      AC_COIN_TRY_FLINK([daxpy],
3949                        [use_blas='-lsunperf'
3950                         if test $coin_need_flibs = yes ; then
3951                           use_blas="$use_blas $FLIBS"
3952                         fi
3953                         AC_MSG_RESULT([yes: $use_blas])
3954                        ],
3955                        [AC_MSG_RESULT([no])])
3956      LIBS="$coin_save_LIBS"
3957      ;;
3958     
3959    *-cygwin* | *-mingw*)
3960# On cygwin, consider -lblas only if doscompile is disabled. The prebuilt
3961# library will want to link with cygwin, hence won't run standalone in DOS.
3962      if test "$enable_doscompile" = mingw; then
3963        skip_lblas_check=yes
3964      fi
3965      case "$CC" in
3966        clang* ) ;;
3967        cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
3968          coin_save_LIBS="$LIBS"
3969          AC_MSG_CHECKING([for BLAS in MKL (32bit)])
3970          LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
3971          AC_COIN_TRY_FLINK([daxpy],
3972                            [use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'
3973                             AC_MSG_RESULT([yes: $use_blas])
3974                            ],
3975                            [AC_MSG_RESULT([no])])
3976          LIBS="$coin_save_LIBS"
3977         
3978          if test "x$use_blas" = x ; then
3979            AC_MSG_CHECKING([for BLAS in MKL (64bit)])
3980            LIBS="mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib $LIBS"
3981            AC_COIN_TRY_FLINK([daxpy],
3982                              [use_blas='mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib'
3983                               AC_MSG_RESULT([yes: $use_blas])
3984                              ],
3985                              [AC_MSG_RESULT([no])])
3986            LIBS="$coin_save_LIBS"
3987          fi
3988          ;;
3989      esac
3990      ;;
3991     
3992     *-darwin*)
3993      AC_MSG_CHECKING([for BLAS in Veclib])
3994      coin_need_flibs=no
3995      coin_save_LIBS="$LIBS"
3996      LIBS="-framework vecLib $LIBS"
3997      AC_COIN_TRY_FLINK([daxpy],
3998                        [use_blas='-framework vecLib'
3999                         if test $coin_need_flibs = yes ; then
4000                           use_blas="$use_blas $FLIBS"
4001                         fi
4002                         AC_MSG_RESULT([yes: $use_blas])
4003                        ],
4004                        [AC_MSG_RESULT([no])])
4005      LIBS="$coin_save_LIBS"
4006      ;;
4007  esac
4008
4009  if test -z "$use_blas" && test $skip_lblas_check = no; then
4010    AC_MSG_CHECKING([whether -lblas has BLAS])
4011    coin_need_flibs=no
4012    coin_save_LIBS="$LIBS"
4013    LIBS="-lblas $LIBS"
4014    AC_COIN_TRY_FLINK([daxpy],
4015                      [use_blas='-lblas'
4016                       if test $coin_need_flibs = yes ; then
4017                         use_blas="$use_blas $FLIBS"
4018                       fi
4019                       AC_MSG_RESULT([yes: $use_blas])
4020                      ],
4021                      [AC_MSG_RESULT([no])])
4022    LIBS="$coin_save_LIBS"
4023  fi
4024
4025  # If we have no other ideas, consider building BLAS.
4026  if test -z "$use_blas" ; then
4027    use_blas=BUILD
4028  fi
4029fi
4030
4031if test "x$use_blas" = xBUILD ; then
4032  AC_COIN_CHECK_PACKAGE(Blas, [coinblas], [$1])
4033 
4034elif test "x$use_blas" != x && test "$use_blas" != no; then
4035  coin_has_blas=yes
4036  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 0])
4037  AC_DEFINE([COIN_HAS_BLAS],[1], [If defined, the BLAS Library is available.])
4038  BLAS_LIBS="$use_blas"
4039  BLAS_CFLAGS=
4040  BLAS_DATA=
4041  AC_SUBST(BLAS_LIBS)
4042  AC_SUBST(BLAS_CFLAGS)
4043  AC_SUBST(BLAS_DATA)
4044  coin_foreach_w([myvar], [$1], [
4045    m4_toupper(myvar)_PCLIBS="$BLAS_LIBS $m4_toupper(myvar)_PCLIBS"
4046    m4_toupper(myvar)_LIBS="$BLAS_LIBS $m4_toupper(myvar)_LIBS"
4047    m4_toupper(myvar)_LIBS_INSTALLED="$BLAS_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
4048  ])
4049 
4050else
4051  coin_has_blas=no
4052  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 1])
4053fi
4054
4055coin_foreach_w([myvar], [$1], [
4056  AC_SUBST(m4_toupper(myvar)_PCLIBS)
4057  AC_SUBST(m4_toupper(myvar)_LIBS)
4058  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
4059])
4060
4061]) # AC_COIN_CHECK_PACKAGE_BLAS
4062
4063###########################################################################
4064#                       COIN_CHECK_PACKAGE_LAPACK                         #
4065###########################################################################
4066
4067# This macro checks for a library containing the LAPACK library.  It
4068# 1. checks the --with-lapack argument
4069# 2. if --with-lapack=BUILD has been specified goes to point 5
4070# 3. if --with-lapack has been specified to a working library, sets
4071#    LAPACK_LIBS to its value
4072# 4. tries standard libraries
4073# 5. calls COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]) to check for
4074#    ThirdParty/Lapack
4075# The makefile conditional and preprocessor macro COIN_HAS_LAPACK is defined.
4076# LAPACK_LIBS is set to the flags required to link with a Lapack library.
4077# For each build target X in $1, X_LIBS is extended with $LAPACK_LIBS.
4078# In case 3 and 4, the flags to link to Lapack are added to X_PCLIBS too.
4079# In case 5, Lapack is added to X_PCREQUIRES.
4080#
4081# TODO: Lapack usually depends on Blas, so if we check for a system lapack library,
4082#   shouldn't we include AC_COIN_CHECK_PACKAGE_BLAS first?
4083#   However, if we look for coinlapack via AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1]),
4084#   then we will get Blas as dependency of coinlapack.
4085
4086AC_DEFUN([AC_COIN_CHECK_PACKAGE_LAPACK],
4087[
4088AC_ARG_WITH([lapack],
4089            AC_HELP_STRING([--with-lapack],
4090                           [specify LAPACK library (or BUILD to enforce use of ThirdParty/Lapack)]),
4091            [use_lapack=$withval], [use_lapack=])
4092
4093#if user specified --with-lapack-lib, then we should give COIN_HAS_PACKAGE preference
4094AC_ARG_WITH([lapack-lib],,[use_lapack=BUILD])
4095
4096# Check if user supplied option makes sense
4097if test x"$use_lapack" != x; then
4098  if test "$use_lapack" = "BUILD"; then
4099    # we come to this later
4100    :
4101  elif test "$use_lapack" != no; then
4102    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
4103    coin_need_flibs=no
4104    use_lapack="$use_lapack $BLAS_LIBS"
4105    coin_save_LIBS="$LIBS"
4106    LIBS="$use_lapack $LIBS"
4107    AC_COIN_TRY_FLINK([dsyev],
4108                      [if test $coin_need_flibs = yes ; then
4109                         use_lapack="$use_lapack $FLIBS"
4110                       fi
4111                       AC_MSG_RESULT([yes: $use_lapack])
4112                      ],
4113                      [AC_MSG_RESULT([no])
4114                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
4115    LIBS="$coin_save_LIBS"
4116  fi
4117else
4118  if test x$coin_has_blas = xyes; then
4119    # First try to see if LAPACK is already available with BLAS library
4120    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
4121    coin_save_LIBS="$LIBS"
4122    coin_need_flibs=no
4123    LIBS="$BLAS_LIBS $LIBS"
4124    AC_COIN_TRY_FLINK([dsyev],
4125                      [use_lapack="$BLAS_LIBS"
4126                       if test $coin_need_flibs = yes ; then
4127                         use_lapack="$use_lapack $FLIBS"
4128                       fi
4129                       AC_MSG_RESULT([yes: $use_lapack])
4130                      ],
4131                      [AC_MSG_RESULT([no])])
4132    LIBS="$coin_save_LIBS"
4133  fi
4134  skip_llapack_check=no
4135  if test -z "$use_lapack"; then
4136    # Try to autodetect the library for lapack based on build system
4137    case $build in
4138      # TODO: Is this check actually needed here, since -lcomplib.sigmath should have been recognized as Blas library,
4139      #       and above it is checked whether the Blas library already contains Lapack
4140      *-sgi-*)
4141        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
4142        coin_save_LIBS="$LIBS"
4143        coin_need_flibs=no
4144        LIBS="-lcomplib.sgimath $BLAS_LIBS $LIBS"
4145        AC_COIN_TRY_FLINK([dsyev],
4146                          [use_lapack="-lcomplib.sgimath $BLAS_LIBS"
4147                           if test $coin_need_flibs = yes ; then
4148                             use_lapack="$use_lapack $FLIBS"
4149                           fi
4150                           AC_MSG_RESULT([yes: $use_lapack])
4151                          ],
4152                          [AC_MSG_RESULT([no])])
4153        LIBS="$coin_save_LIBS"
4154        ;;
4155
4156      # See comments in COIN_CHECK_PACKAGE_BLAS.
4157      # TODO: Is this check actually needed here, since -lsunperf should have been recognized as Blas library,
4158      #       and above it is checked whether the Blas library already contains Lapack
4159      *-*-solaris*)
4160        AC_MSG_CHECKING([for LAPACK in libsunperf])
4161        coin_need_flibs=no
4162        coin_save_LIBS="$LIBS"
4163        LIBS="-lsunperf $BLAS_LIBS $FLIBS $LIBS"
4164        AC_COIN_TRY_FLINK([dsyev],
4165                          [use_lapack='-lsunperf $BLAS_LIBS'
4166                           if test $coin_need_flibs = yes ; then
4167                             use_lapack="$use_lapack $FLIBS"
4168                           fi
4169                           AC_MSG_RESULT([yes: $use_lapack])
4170                          ],
4171                          [AC_MSG_RESULT([no])])
4172        LIBS="$coin_save_LIBS"
4173        ;;
4174        # On cygwin, do this check only if doscompile is disabled. The prebuilt library
4175        # will want to link with cygwin, hence won't run standalone in DOS.
4176       
4177      *-cygwin*)
4178        if test "$enable_doscompile" = mingw; then
4179          skip_llapack_check=yes
4180        fi
4181        ;;
4182       
4183    esac
4184  fi
4185
4186  if test -z "$use_lapack" && test $skip_llapack_check = no; then
4187    AC_MSG_CHECKING([whether -llapack has LAPACK])
4188    coin_need_flibs=no
4189    coin_save_LIBS="$LIBS"
4190    LIBS="-llapack $BLAS_LIBS $LIBS"
4191    AC_COIN_TRY_FLINK([dsyev],
4192                      [use_lapack='-llapack'
4193                       if test $coin_need_flibs = yes ; then
4194                         use_lapack="$use_lapack $FLIBS"
4195                       fi
4196                       AC_MSG_RESULT([yes: $use_lapack])
4197                      ],
4198                      [AC_MSG_RESULT([no])])
4199    LIBS="$coin_save_LIBS"
4200  fi
4201
4202  # If we have no other ideas, consider building LAPACK.
4203  if test -z "$use_lapack" ; then
4204    use_lapack=BUILD
4205  fi
4206fi
4207
4208if test "x$use_lapack" = xBUILD ; then
4209  AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1])
4210
4211elif test "x$use_lapack" != x && test "$use_lapack" != no; then
4212  coin_has_lapack=yes
4213  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 0])
4214  AC_DEFINE([COIN_HAS_LAPACK],[1], [If defined, the LAPACK Library is available.])
4215  LAPACK_LIBS="$use_lapack"
4216  LAPACK_CFLAGS=
4217  LAPACK_DATA=
4218  AC_SUBST(LAPACK_LIBS)
4219  AC_SUBST(LAPACK_CFLAGS)
4220  AC_SUBST(LAPACK_DATA)
4221  coin_foreach_w([myvar], [$1], [
4222    m4_toupper(myvar)_PCLIBS="$LAPACK_LIBS $m4_toupper(myvar)_PCLIBS"
4223    m4_toupper(myvar)_LIBS="$LAPACK_LIBS $m4_toupper(myvar)_LIBS"
4224    m4_toupper(myvar)_LIBS_INSTALLED="$LAPACK_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
4225  ])
4226 
4227else
4228  coin_has_lapack=no
4229  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 1])
4230fi
4231
4232coin_foreach_w([myvar], [$1], [
4233  AC_SUBST(m4_toupper(myvar)_PCLIBS)
4234  AC_SUBST(m4_toupper(myvar)_LIBS)
4235  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
4236])
4237
4238]) # AC_COIN_CHECK_PACKAGE_LAPACK
Note: See TracBrowser for help on using the repository browser.