source: stable/BSPsplit/coin.m4 @ 1380

Last change on this file since 1380 was 1380, checked in by stefan, 12 years ago

allow second argument for COIN_MAIN_SUBDIR and COIN_HAS_PROJECT to make recognition of project optionally depend on existence on further file (similar to COIN_THIRDPARTY_SUBDIR)

  • Property svn:keywords set to Author Date Id Revision
File size: 113.1 KB
Line 
1# Copyright (C) 2006, 2009 International Business Machines.
2# All Rights Reserved.
3# This file is distributed under the Common Public License.
4#
5## $Id: coin.m4 1380 2009-07-26 20:03:41Z 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_MAIN_SUBDIRS                             #
17###########################################################################
18
19# This is the macro for AC_COIN_MAIN_SUBDIRS taking care of ONE (or two) argument(s)
20# It calles AC_COIN_HAS_PROJECT for the project given in $1 and adds $1 to the CONFIG_SUBDIRS, if
21# either argument $2 is given and the file $1/$2 is available in $srcdir,
22# or $2 is not given and the file $1/configure is available in $srcdir
23AC_DEFUN([AC_COIN_MAIN_SUBDIR],
24[AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
25
26#replace backslashes by underscore
27m4_define([escape], m4_bpatsubsts([$1],[/],[_]))
28
29# AC_COIN_HAS_PROJECT also checks whether $2 is available in $1, if not it sets coin_has... to notGiven
30AC_COIN_HAS_PROJECT($1,$2)
31AC_MSG_CHECKING(whether directory $1 should be recursed into)
32if test "$m4_tolower(coin_has_[]escape($1))" != skipping &&
33   test "$m4_tolower(coin_has_[]escape($1))" != notGiven &&
34   test "$m4_tolower(coin_has_[]escape($1))" != installed; then
35
36  if test -r $srcdir/$1/configure; then
37    coin_subdirs="$coin_subdirs $1"
38    AC_MSG_RESULT(yes)
39    AC_CONFIG_SUBDIRS($1)
40  else
41    AC_MSG_RESULT(no)
42  fi
43else
44  AC_MSG_RESULT(no)
45fi
46])
47
48# This macro sets up the recursion into configure scripts into
49# subdirectories.  Each possible subdirectory should be provided as a
50# new argument to this macro.  The current limit is 10 subdirectories.
51# This automatically also checks for the Data subdirectory.
52
53AC_DEFUN([AC_COIN_MAIN_SUBDIRS],
54[m4_ifvaln([$1],[AC_COIN_MAIN_SUBDIR($1)])
55m4_ifvaln([$2],[AC_COIN_MAIN_SUBDIR($2)])
56m4_ifvaln([$3],[AC_COIN_MAIN_SUBDIR($3)])
57m4_ifvaln([$4],[AC_COIN_MAIN_SUBDIR($4)])
58m4_ifvaln([$5],[AC_COIN_MAIN_SUBDIR($5)])
59m4_ifvaln([$6],[AC_COIN_MAIN_SUBDIR($6)])
60m4_ifvaln([$7],[AC_COIN_MAIN_SUBDIR($7)])
61m4_ifvaln([$8],[AC_COIN_MAIN_SUBDIR($8)])
62m4_ifvaln([$9],[AC_COIN_MAIN_SUBDIR($9)])
63m4_ifvaln([$10],[AC_COIN_MAIN_SUBDIR($10)])
64
65]) # AC_COIN_MAIN_SUBDIRS
66
67###########################################################################
68#                            COIN_CHECK_FILE                              #
69###########################################################################
70
71# A simple replacement for AC_CHECK_FILE that works for cross compilation
72
73AC_DEFUN([AC_COIN_CHECK_FILE],
74[if test -r $1; then
75  $2
76  :
77else
78  $3
79  :
80fi
81])
82
83###########################################################################
84#                        COIN_THIRDPARTY_SUBDIRS                          #
85###########################################################################
86
87# This macro sets up the recursion into the configure script in a
88# subdirectory for compilation of third party code.  The first
89# argument is just the string that appears in the configure output.
90# The second argument is the directory with the configure script, and
91# the third one is a file that should exists in that directory.  If
92# this file does not exist, we assume that the user has not downloaded
93# the code, and we are not going to compile it
94
95AC_DEFUN([AC_COIN_THIRDPARTY_SUBDIRS],
96[AC_MSG_CHECKING(whether code for third party package $1 is available)
97coin_skip=no
98if test x"$COIN_SKIP_PROJECTS" != x; then
99  for dir in $COIN_SKIP_PROJECTS; do
100    if test $dir = $2; then
101      coin_skip=yes
102    fi
103  done
104fi
105if test $coin_skip = yes; then
106  AC_MSG_RESULT(skipping)
107else
108  coin_tmp=`echo $srcdir/$2/$3`
109  # There is probably a more elegant way to get the first thing out here...
110  for i in $coin_tmp; do
111    coin_tmp2=$i
112    #break 1
113  done
114  if test -r $coin_tmp2; then
115    coin_subdirs="$coin_subdirs $2"
116    AC_MSG_RESULT(yes)
117    AC_CONFIG_SUBDIRS($2)
118  else
119    AC_MSG_RESULT(no)
120  fi
121fi
122]) # AC_COIN_THIRDPARTY_SUBDIRS
123
124###########################################################################
125#                           COIN_CHECK_VPATH                              #
126###########################################################################
127
128# This macro sets the variable coin_vpath_config to true if this is a
129# VPATH configuration, otherwise it sets it to false.
130AC_DEFUN([AC_COIN_CHECK_VPATH],
131[AC_MSG_CHECKING(whether this is a VPATH configuration)
132if test `cd $srcdir; pwd` != `pwd`; then
133  coin_vpath_config=yes;
134else
135  coin_vpath_config=no;
136fi
137AC_MSG_RESULT($coin_vpath_config)
138]) # AC_COIN_CHECK_VPATH
139
140###########################################################################
141#                         COIN_PROJECTDIR_INIT                            #
142###########################################################################
143
144# This macro does everything that is required in the early part in the
145# configure script, such as defining a few variables.  This should only
146# be used in the main directory of a project directory (the one under
147# which src is)
148
149AC_DEFUN([AC_COIN_PROJECTDIR_INIT],
150[# Initialize the ADDLIBS variable
151ADDLIBS="-lm $LIBS"
152AC_SUBST(ADDLIBS)
153
154# Initialize the FADDLIBS variable (which is to be used with a fortran
155# compiler and will not include FLIBS)
156FADDLIBS="$LIBS"
157AC_SUBST(FADDLIBS)
158
159# A useful makefile conditional that is always false
160AM_CONDITIONAL(ALWAYS_FALSE, false)
161
162# We set the following variable so that we know later in AC_COIN_FINALIZE
163# that we are in a project main directory
164coin_projectdir=yes
165
166# Check if a library version is set for libtool
167m4_ifvaln([$1],[coin_libversion=$1],[])
168]) # AC_COIN_PROJECTDIR_INIT
169
170###########################################################################
171#                          COIN_DEBUG_COMPILE                             #
172###########################################################################
173
174# enable the configure flags --enable-debug and --enable-debug-prjct
175# (where prcjt is the name of the project in lower case) and set the
176# variable coin_debug_compile to true or false This is used by
177# COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the
178# compilation flags.  This macro also makes the switches
179# --with-prjct-verbosity and --with-prjct-checklevel available, which
180# define the preprocessor macros COIN_PRJCT_VERBOSITY and
181# COIN_PRJCT_CHECKLEVEL to the specified value (default is 0).
182#
183# The project specific flags are only made available, if one gives the
184# name of the project as first argument to this macro.
185
186AC_DEFUN([AC_COIN_DEBUG_COMPILE],
187[AC_BEFORE([$0],[AC_COIN_PROG_CXX])dnl
188AC_BEFORE([$0],[AC_COIN_PROG_CC])dnl
189AC_BEFORE([$0],[AC_COIN_PROG_F77])dnl
190
191AC_MSG_CHECKING([whether we want to compile in debug mode])
192
193AC_ARG_ENABLE([debug],
194[AC_HELP_STRING([--enable-debug],
195                [compile all projects with debug options tests])],
196[case "${enableval}" in
197   yes) coin_debug_compile=true
198        if test "${enable_shared+set}" = set; then :; else
199          enable_shared=no
200        fi
201        ;;
202   no)  coin_debug_compile=false
203        ;;
204   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
205        ;;
206esac],
207[coin_debug_compile=false])
208
209m4_ifvaln([$1],
210[AC_ARG_ENABLE(debug-m4_tolower($1),
211 [AC_HELP_STRING([--enable-debug-m4_tolower($1)],
212                 [compile this project ($1) with debug options])],
213 [case "${enableval}" in
214    yes) coin_debug_compile=true
215         enable_shared=no
216         ;;
217    no)  coin_debug_compile=false
218         ;;
219    *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1))
220         ;;
221 esac],[:])
222]) # m4_ifvaln([$1],
223
224if test $coin_debug_compile = true; then
225  AC_MSG_RESULT([yes])
226else
227  AC_MSG_RESULT([no])
228fi
229
230m4_ifvaln([$1],
231[AC_ARG_WITH(m4_tolower($1)-verbosity,
232             AC_HELP_STRING([--with-m4_tolower($1)-verbosity],
233                            [specify the debug verbosity level for project $1]),
234             [if test "$withval" = yes; then
235                withval=1
236              fi
237              m4_tolower(coin_$1_verbosity)=$withval],
238             [m4_tolower(coin_$1_verbosity)=0])
239 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY),
240                    m4_tolower($coin_$1_verbosity),
241                    [Define to the debug verbosity level (0 is no output)])
242
243 AC_ARG_WITH(m4_tolower($1)-checklevel,
244             AC_HELP_STRING([--with-m4_tolower($1)-checklevel],
245                            [specify the sanity check level for project $1]),
246             [if test "$withval" = yes; then
247                withval=1
248              fi
249              m4_tolower(coin_$1_checklevel)=$withval],
250             [m4_tolower(coin_$1_checklevel)=0])
251 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL),
252                    m4_tolower($coin_$1_checklevel),
253                    [Define to the debug sanity check level (0 is no test)])
254
255# We use the following variable to have a string with the upper case
256# version of the project name
257COIN_PRJCT=m4_toupper($1)
258
259]) # m4_ifvaln([$1],
260 
261]) # AC_COIN_DEBUG_COMPILE
262
263###########################################################################
264#                          COIN_MINGW_LD_FIX                              #
265###########################################################################
266
267# This macro is included by any PROG_compiler macro, to set the LD
268# environment variable on MinGW to the correct value (link). But note that
269# if we're building in cygwin with -mno-cygwin, we still want ld! If we're
270# building from cygwin with MSVC tools (cl/link), then we do want link and
271# you'd better have your PATH variable straight, else you'll be doing file
272# links instead of code links! Arguably, LDFLAGS should include -mno-cygwin
273# but in practice all linking seems to be handled through the compilers, so
274# CFLAGS and CXXFLAGS suffice.
275
276AC_DEFUN([AC_COIN_MINGW_LD_FIX],
277[case $build in
278  *-mingw*)
279    if test "${LD+set}" = set; then :; else
280      LD=link
281    fi
282    ;;
283 esac
284 case $enable_doscompile in
285   msvc)
286     if test "x${LD+set}" = xset; then :; else
287       LD=link
288     fi
289     ;;
290 esac
291])
292
293###########################################################################
294#                        COIN_ENABLE_DOSCOMPILE                           #
295###########################################################################
296
297# This macro is invoked by any PROG_compiler macro to establish the
298# --enable-doscompile option, used when one wants to compile an executable
299# under Cygwin which also runs directly under DOS (without requiring
300# Cygwin1.dll). The job of this macro is to make sure the option is correct and
301# to set enable_doscompile. Legal values are mingw, msvc, and no (disabled).
302# mingw: Fake mingw under cygwin, using GCC tools and -mno-cygwin. The most
303#        important thing here is that preprocess, compile, and link steps
304#        *all* see -mno-cygwin.
305# msvc:  Assume the presence of cl/link. It's the user's responsibility to
306#        make sure their PATH is correct. In particular, that MSVC link is
307#        found and not cygwin link (we want to do code linking, not file
308#        linking).
309# It's the responsibility of individual PROG_compiler macros to ensure that
310# they correctly set the compiler search list and preprocess, compile, and
311# link flags. This is tied to compiler setup because in practice invocations
312# of the preprocessor and linker are made through the compiler.
313
314AC_DEFUN([AC_COIN_ENABLE_DOSCOMPILE],
315[AC_REQUIRE([AC_CANONICAL_BUILD])
316 AC_ARG_ENABLE([doscompile],
317  [AC_HELP_STRING([--enable-doscompile],
318                  [Under Cygwin, compile so that executables run under DOS.
319                   Set to mingw to use gcc/g++/ld with -mno-cygwin.
320                   Set to msvc to use cl/link (or icl/link).
321                   Default when mentioned: mingw.
322                   Default when not mentioned: disabled.])],
323  [if test "$enable_doscompile" != no; then
324     case $build in
325       *-cygwin* | *-mingw*) ;;
326       *) AC_MSG_ERROR([--enable-doscompile option makes sense only under Cygwin or MinGW]) ;;
327     esac
328   fi],
329  [enable_doscompile=no])
330 case "$enable_doscompile" in
331   mingw)
332     case $build in
333       *-mingw*) enable_doscompile=no ;;
334     esac
335     ;;
336   msvc|no) ;;
337   yes) enable_doscompile=mingw ;;
338   *) AC_MSG_ERROR([Invalid value $enable_doscompile for --enable-doscompile.
339                    Try configure --help=recursive.])
340      ;;
341  esac
342  if test "$enable_doscompile" != no ; then
343    AC_MSG_NOTICE([DOS compile style is: $enable_doscompile])
344  fi
345])
346
347###########################################################################
348#                             COIN_PROG_CXX                               #
349###########################################################################
350
351# Find the compile command by running AC_PROG_CXX (with compiler names for
352# different operating systems) and put it into CXX (unless it was given by the
353# user). Then find an appropriate value for CXXFLAGS. If either of CXXFLAGS or
354# PRJCT_CXXFLAGS is defined, that value is used (replace PRJCT with the upper
355# case name of this project).  It is possible to provide additional -D flags
356# in the variable CXXDEFS, and additional compilation flags with ADD_CXXFLAGS.
357
358AC_DEFUN([AC_COIN_PROG_CXX],
359[AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0
360AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
361AC_LANG_PUSH(C++)
362
363AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.])
364AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options])
365AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options])
366AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options])
367
368coin_has_cxx=yes
369
370save_cxxflags="$CXXFLAGS"
371# For *-*-solaris*, promote Studio/Workshop compiler to front of list.
372case $build in
373  *-cygwin* | *-mingw*)
374             if test "$enable_doscompile" = msvc ; then
375               comps="icl cl"
376             else
377               comps="g++ cl"
378             fi ;;
379  *-*-solaris*)
380             comps="CC xlC_r aCC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
381  *-darwin*) comps="g++ c++ CC" ;;
382          *) comps="xlC_r aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
383esac
384
385# We delete the cached value, since the test might not have been
386# performed with our choice of compilers earlier
387$as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; }
388# AC_MSG_NOTICE([C++ compiler candidates: $comps])
389AC_PROG_CXX([$comps])
390
391#AC_PROG_CXX sets CXX to g++ if it cannot find a working C++ compiler
392#thus, we test here whether $CXX is actually working
393AC_LANG_PUSH(C++)
394AC_MSG_CHECKING([whether C++ compiler $CXX works]);
395AC_COMPILE_IFELSE(
396  [AC_LANG_PROGRAM(, [int i=0;])],
397  [AC_MSG_RESULT(yes)],
398  [AC_MSG_RESULT(no)
399   AC_MSG_ERROR(failed to find a C++ compiler or C++ compiler $CXX does not work)]
400)
401AC_LANG_POP(C++)
402
403# It seems that we need to cleanup something here for the Windows
404case "$CXX" in
405  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
406    sed -e 's/^void exit (int);//' confdefs.h >> confdefs.hh
407    mv confdefs.hh confdefs.h
408    ;;
409esac
410
411# Autoconf incorrectly concludes that cl recognises -g. It doesn't.
412case "$CXX" in
413  cl* | */cl* | CL* | */CL* )
414    if test "$ac_cv_prog_cxx_g" = yes ; then
415      ac_cv_prog_cxx_g=no
416      AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.])
417    fi ;;
418esac
419CXXFLAGS="$save_cxxflags"
420
421# Check if a project specific CXXFLAGS variable has been set
422if test x$COIN_PRJCT != x; then
423  eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set}
424  if test x$coin_tmp = xset; then
425    eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS}
426  fi
427fi
428
429if test x"$CXXFLAGS" = x; then
430
431# ToDo decide whether we want -DNDEBUG for optimization
432  coin_add_cxxflags=
433  coin_opt_cxxflags=
434  coin_dbg_cxxflags=
435  coin_warn_cxxflags=
436
437  if test "$GXX" = "yes"; then
438    case "$CXX" in
439      icpc* | */icpc*)
440        ;;
441      *)
442# ToDo decide about unroll-loops
443        coin_opt_cxxflags="-O3 -fomit-frame-pointer"
444        coin_add_cxxflags="-pipe"
445        coin_dbg_cxxflags="-g"
446        coin_warn_cxxflags="-Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas"
447        case $build in
448          *-darwin*)
449            ;;
450          *)
451            coin_warn_cxxflags="-pedantic-errors $coin_warn_cxxflags"
452            ;;
453        esac
454
455        case $enable_doscompile in
456          mingw)
457            CXXFLAGS="-mno-cygwin"
458            AC_TRY_LINK(,[int i=0; i++;],[coin_add_cxxflags="-mno-cygwin $coin_add_cxxflags"])
459            CXXFLAGS=
460          ;;
461        esac
462    esac
463  fi
464
465# Note that we do not need to cover GCC in the following tests.
466
467  if test -z "$coin_opt_cxxflags"; then
468    case $build in
469      *-cygwin* | *-mingw*)
470        case "$CXX" in
471          cl* | */cl* | CL* | */CL*)
472            # The MT and MTd options are mutually exclusive
473            coin_opt_cxxflags='-MT -O2'
474            coin_add_cxxflags='-nologo -EHsc -GR -wd4996 -D_CRT_SECURE_NO_DEPRECATE'
475            coin_dbg_cxxflags='-MTd'
476            ;;
477          icl* | */icl* | ICL* | */ICL*)
478            # The MT and MTd options are mutually exclusive
479            coin_opt_cxxflags='-MT -Ox'
480            coin_add_cxxflags='-nologo -EHsc -GR -D_CRT_SECURE_NO_DEPRECATE'
481            coin_dbg_cxxflags='-MTd -debug'
482            ;;
483        esac
484        ;;
485      *-linux-*)
486        case "$CXX" in
487          icpc* | */icpc*)
488            coin_opt_cxxflags="-O3 -ip -mp1"
489            coin_add_cxxflags=""
490            coin_dbg_cxxflags="-g"
491            # Check if -i_dynamic is necessary (for new glibc library)
492            CXXFLAGS=
493            AC_TRY_LINK(,[int i=0; i++;],[],
494                        [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"])
495            ;;
496          pgCC* | */pgCC*)
497            coin_opt_cxxflags="-fast"
498            coin_add_cxxflags="-Kieee -pc 64"
499            coin_dbg_cxxflags="-g"
500            ;;
501        esac
502        ;;
503      *-ibm-*)
504        case "$CXX" in
505          xlC* | */xlC* | mpxlC* | */mpxlC*)
506            coin_opt_cxxflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
507            coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna -qsuppress=1500-036 -qsuppress=1500-029 -qsourcetype=c++"
508            coin_dbg_cxxflags="-g"
509            ;;
510        esac
511        ;;
512      *-hp-*)
513        case "$CXX" in
514          aCC* | */aCC* )
515            coin_opt_cxxflags="-O"
516            coin_add_cxxflags="-AA"
517            coin_dbg_cxxflags="-g"
518            ;;
519        esac
520        ;;
521      *-*-solaris*)
522          coin_opt_cxxflags="-O4"
523          coin_dbg_cxxflags="-g"
524        ;;
525    esac
526  fi
527
528# Generic flag settings. If these don't work, add a case above.
529
530  if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then
531    coin_dbg_cxxflags="-g"
532  fi
533
534  if test -z "$coin_opt_cxxflags"; then
535    # Try if -O option works if nothing else is set
536    CXXFLAGS=-O
537    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"])
538  fi
539
540  # if PM doesn't want the warning messages, take them out
541  if test x"$coin_skip_warn_cxxflags" = xyes; then
542    coin_warn_cxxflags=
543  fi
544
545# Do final setup of flags based on values determined above.
546
547  if test x${DBG_CXXFLAGS+set} != xset; then
548    DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags"
549  fi
550  if test x${OPT_CXXFLAGS+set} != xset; then
551    OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags"
552  fi
553
554  DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
555  OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
556
557  if test "$coin_debug_compile" = "true"; then
558    CXXFLAGS="$DBG_CXXFLAGS"
559  else
560    CXXFLAGS="$OPT_CXXFLAGS"
561  fi
562
563# Handle the case where CXXFLAGS was set externally.
564else
565  CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
566  if test x${DBG_CXXFLAGS+set} != xset; then
567    DBG_CXXFLAGS="$CXXFLAGS"
568  fi
569  if test x${OPT_CXXFLAGS+set} != xset; then
570    OPT_CXXFLAGS="$CXXFLAGS"
571  fi
572fi
573
574# If CXXFLAGS contains -mno-cygwin, CPPFLAGS must also have it.
575
576case "$CXXFLAGS" in
577  *-mno-cygwin*)
578    if test x${CPPFLAGS+set} != xset ; then
579      CPPFLAGS="-mno-cygwin"
580    else
581      case "$CPPFLAGS" in
582        *-mno-cygwin*)
583          ;;
584        *)
585          CPPFLAGS="$CPPFLAGS -mno-cygwin"
586          ;;
587      esac
588    fi ;;
589esac
590
591# Try if CXXFLAGS works
592save_CXXFLAGS="$CXXFLAGS"
593AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
594if test -z "$CXXFLAGS"; then
595  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.])
596  CXXFLAGS='-O'
597  AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
598  if test -z "$CXXFLAGS"; then
599    AC_MSG_WARN([This value for CXXFLAGS does not work.  I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.])
600  fi
601fi
602
603AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS])
604
605AC_ARG_VAR(MPICXX,[C++ MPI Compiler])
606if test x"$MPICXX" = x; then :; else
607  AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX])
608  CXX="$MPICXX"
609fi
610
611case "$CXX" in
612  cl* | */cl* | CL* | */CL* )
613    AC_COIN_MINGW_LD_FIX
614    ;;
615esac
616
617AC_LANG_POP(C++)
618]) # AC_COIN_PROG_CXX
619
620
621###########################################################################
622#                             COIN_CXXLIBS                                #
623###########################################################################
624
625# Determine the C++ runtime libraries required for linking a C++ library
626# with a Fortran or C compiler.  The result is available in CXXLIBS.
627
628AC_DEFUN([AC_COIN_CXXLIBS],
629[AC_REQUIRE([AC_PROG_CXX])dnl
630AC_LANG_PUSH(C++)
631AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler])
632if test -z "$CXXLIBS"; then
633  if test "$GXX" = "yes"; then
634    case "$CXX" in
635      icpc* | */icpc*)
636        CXXLIBS="-lstdc++"
637        ;;
638      *)
639        CXXLIBS="-lstdc++ -lm" # -lgcc"
640        ;;
641    esac
642  else
643    case $build in
644     *-mingw32 | *-cygwin* )
645      case "$CXX" in
646      cl* | */cl* | CL* | */CL*)
647        CXXLIBS=nothing;;
648      esac;;
649     *-linux-*)
650      case "$CXX" in
651      icpc* | */icpc*)
652        CXXLIBS="-lstdc++"
653             ;;
654      pgCC* | */pgCC*)
655        CXXLIBS="-lstd -lC -lc"
656             ;;
657      esac;;
658    *-ibm-*)
659      CXXLIBS="-lC -lc"
660      ;;
661    *-hp-*)
662      CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc"
663      ;;
664    *-*-solaris*)
665      CXXLIBS="-lCstd -lCrun"
666    esac
667  fi
668fi
669if test -z "$CXXLIBS"; then
670  AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran or C).])
671else
672  AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".])
673fi
674if test x"$CXXLIBS" = xnothing; then
675  CXXLIBS=
676fi
677AC_LANG_POP(C++)
678]) # AC_COIN_CXXLIBS
679
680###########################################################################
681#                           COIN_CHECK_HEADER                             #
682###########################################################################
683
684# This macro checks for a header file, but it does so without the
685# standard header.  This avoids warning messages like:
686#
687# configure: WARNING: dlfcn.h: present but cannot be compiled
688# configure: WARNING: dlfcn.h:     check for missing prerequisite headers?
689# configure: WARNING: dlfcn.h: see the Autoconf documentation
690# configure: WARNING: dlfcn.h:     section "Present But Cannot Be Compiled"
691# configure: WARNING: dlfcn.h: proceeding with the preprocessor's result
692# configure: WARNING: dlfcn.h: in the future, the compiler will take precedence
693
694# My guess that the problem lay with CPPFLAGS seems to be correct. With this
695# macro reduced to a direct call to AC_CHECK_HEADERS, there are no warnings
696# now that CPPFLAGS contains -mno-cygwin when it needs it. -- lh, 061214 --
697
698# AW 070609: I restored the previous version, since otherwise the warnings
699# still pop up for the cl compiler
700
701AC_DEFUN([AC_COIN_CHECK_HEADER],
702[#if test x"$4" = x; then
703#  hdr="#include <$1>"
704#else
705#  hdr="$4"
706#fi
707#AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr])
708AC_CHECK_HEADERS([$1],[$2],[$3],[$4])
709]) # AC_COIN_CHECK_HEADER
710
711###########################################################################
712#                       COIN_CHECK_CXX_CHEADER                             #
713###########################################################################
714
715# This macro checks for C header files that are used from C++.  For a give
716# stub (e.g., math), it first checks if the C++ library (cmath) is available.
717# If it is, it defines HAVE_CMATH (or whatever the stub is).  If it is not
718# available, it checks for the old C head (math.h) and defines HAVE_MATH_H
719# if that one exists.
720
721AC_DEFUN([AC_COIN_CHECK_CXX_CHEADER],
722[AC_LANG_PUSH(C++)
723AC_COIN_CHECK_HEADER([c$1],[$2],[$3],[$4])
724if test "$ac_cv_header_c$1" != "yes"; then
725  AC_COIN_CHECK_HEADER([$1.h],[$2],[$3],[$4])
726fi
727AC_LANG_POP(C++)
728]) # AC_COIN_CHECK_CXX_CHEADER
729
730###########################################################################
731#                             COIN_PROG_CC                                #
732###########################################################################
733
734# Find the compile command by running AC_PROG_CC (with compiler names
735# for different operating systems) and put it into CC (unless it was
736# given my the user), and find an appropriate value for CFLAGS.  It is
737# possible to provide additional -D flags in the variable CDEFS.
738
739AC_DEFUN([AC_COIN_PROG_CC],
740[AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
741AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
742AC_LANG_PUSH(C)
743
744# For consistency, we set the C compiler to the same value of the C++
745# compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl)
746if test x"$CXX" != x; then
747  case "$CXX" in
748    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
749      if test x"$CC" = x; then
750        CC="$CXX"
751        AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX])
752      fi
753      ;;
754  esac
755fi
756
757AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.])
758AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options])
759AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options])
760AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options])
761
762coin_has_cc=yes
763
764save_cflags="$CFLAGS"
765
766# For *-*-solaris*, promote Studio/Workshop cc compiler to front of list.
767# Depending on the user's PATH, when Studio/Workshop cc is not present we may
768# find /usr/ucb/cc, which is almost certainly not a good choice for the C
769# compiler. In this case, put cc after gcc.
770
771case $build in
772  *-cygwin* | *-mingw*)
773             if test "$enable_doscompile" = msvc ; then
774               comps="icl cl"
775             else
776               comps="gcc cl"
777             fi ;;
778  *-*-solaris*)
779             AC_CHECK_PROG(sol_cc_compiler,cc,cc,[],[],/usr/ucb/cc)
780             if test "$sol_cc_compiler" = "cc" ; then
781               comps="cc xlc gcc pgcc icc"
782             else
783               comps="xlc gcc pgcc icc cc"
784             fi
785             ;;
786  *-linux-*) comps="xlc gcc cc pgcc icc" ;;
787  *)         comps="xlc_r xlc cc gcc pgcc icc" ;;
788esac
789
790# We delete the cached value, since the test might not have been
791# performed with our choice of compilers earlier
792$as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; }
793# AC_MSG_NOTICE([C compiler candidates: $comps])
794AC_PROG_CC([$comps])
795if test -z "$CC" ; then
796  AC_MSG_ERROR([Failed to find a C compiler!])
797fi
798# Autoconf incorrectly concludes that cl recognises -g. It doesn't.
799case "$CC" in
800  cl* | */cl* | CL* | */CL* )
801    if test "$ac_cv_prog_cc_g" = yes ; then
802      ac_cv_prog_cc_g=no
803      AC_MSG_NOTICE([Overruling autoconf; cl does not recognise -g.])
804    fi ;;
805esac
806CFLAGS="$save_cflags"
807
808# Check if a project specific CFLAGS variable has been set
809if test x$COIN_PRJCT != x; then
810  eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set}
811  if test x$coin_tmp = xset; then
812    eval CFLAGS=\${${COIN_PRJCT}_CFLAGS}
813  fi
814fi
815
816if test x"$CFLAGS" = x; then
817
818  coin_add_cflags=
819  coin_opt_cflags=
820  coin_dbg_cflags=
821  coin_warn_cflags=
822
823  if test "$GCC" = "yes"; then
824    case "$CC" in
825      icc* | */icc*)
826        ;;
827      *)
828        coin_opt_cflags="-O3 -fomit-frame-pointer"
829        coin_add_cflags="-pipe"
830        coin_dbg_cflags="-g"
831        coin_warn_cflags="-Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas"
832        case $build in
833          *-darwin*)
834            ;;
835          *)
836            coin_warn_cflags="-pedantic-errors $coin_warn_cflags"
837            ;;
838        esac
839        case $enable_doscompile in
840          mingw)
841            CFLAGS="-mno-cygwin"
842            AC_TRY_LINK([],[int i=0; i++;],
843                        [coin_add_cflags="-mno-cygwin $coin_add_cflags"])
844            CFLAGS=
845          ;;
846        esac
847    esac
848  fi
849  if test -z "$coin_opt_cflags"; then
850    case $build in
851      *-cygwin* | *-mingw*)
852        case "$CC" in
853          cl* | */cl* | CL* | */CL*)
854            coin_opt_cflags='-MT -O2'
855            coin_add_cflags='-nologo -wd4996 -D_CRT_SECURE_NO_DEPRECATE'
856            coin_dbg_cflags='-MTd'
857            ;;
858          icl* | */icl* | ICL* | */ICL*)
859            coin_opt_cflags='-MT -Ox'
860            coin_add_cflags='-nologo -D_CRT_SECURE_NO_DEPRECATE'
861            coin_dbg_cflags='-MTd -debug'
862            ;;
863        esac
864        ;;
865      *-linux-*)
866        case "$CC" in
867          icc* | */icc*)
868            coin_opt_cflags="-O3 -ip -mp1"
869            coin_add_cflags=""
870            coin_dbg_cflags="-g"
871            # Check if -i_dynamic is necessary (for new glibc library)
872            CFLAGS=
873            AC_TRY_LINK([],[int i=0; i++;],[],
874                        [coin_add_cflags="-i_dynamic $coin_add_cflags"])
875            ;;
876          pgcc* | */pgcc*)
877            coin_opt_cflags="-fast"
878            coin_add_cflags="-Kieee -pc 64"
879            coin_dbg_cflags="-g"
880            ;;
881        esac
882        ;;
883      *-ibm-*)
884        case "$CC" in
885          xlc* | */xlc* | mpxlc* | */mpxlc*)
886            coin_opt_cflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
887            coin_add_cflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029"
888            coin_dbg_cflags="-g"
889          ;;
890        esac
891        ;;
892      *-hp-*)
893        coin_opt_cflags="-O"
894        coin_add_cflags="-Ae"
895        coin_dbg_cflags="-g"
896        ;;
897      *-*-solaris*)
898        coin_opt_cflags="-xO4"
899        coin_dbg_cflags="-g"
900        ;;
901      *-sgi-*)
902        coin_opt_cflags="-O -OPT:Olimit=0"
903        coin_dbg_cflags="-g"
904        ;;
905    esac
906  fi
907
908  if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then
909    coin_dbg_cflags="-g"
910  fi
911
912  if test -z "$coin_opt_cflags"; then
913    # Try if -O option works if nothing else is set
914    CFLAGS="-O"
915    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"])
916  fi
917
918  # if PM doesn't want the warning messages, take them out
919  if test x"$coin_skip_warn_cflags" = xyes; then
920    coin_warn_cflags=
921  fi
922
923  if test x${DBG_CFLAGS+set} != xset; then
924    DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags"
925  fi
926  if test x${OPT_CFLAGS+set} != xset; then
927    OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags"
928  fi
929
930  DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS"
931  OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS"
932
933  if test "$coin_debug_compile" = "true"; then
934    CFLAGS="$DBG_CFLAGS"
935  else
936    CFLAGS="$OPT_CFLAGS"
937  fi
938else
939  CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS"
940  if test x${DBG_CFLAGS+set} != xset; then
941    DBG_CFLAGS="$CFLAGS"
942  fi
943  if test x${OPT_CFLAGS+set} != xset; then
944    OPT_CFLAGS="$CFLAGS"
945  fi
946fi
947
948# If CFLAGS contains -mno-cygwin, CPPFLAGS must also have it.
949
950case "$CFLAGS" in
951  *-mno-cygwin*)
952    if test x${CPPFLAGS+set} != xset ; then
953      CPPFLAGS="-mno-cygwin"
954    else
955      case "$CPPFLAGS" in
956        *-mno-cygwin*)
957          ;;
958        *)
959          CPPFLAGS="$CPPFLAGS -mno-cygwin"
960          ;;
961      esac
962    fi ;;
963esac
964
965# Try if CFLAGS works
966save_CFLAGS="$CFLAGS"
967AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
968if test -z "$CFLAGS"; then
969  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.])
970  CFLAGS='-O'
971  AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
972  if test -z "$CFLAGS"; then
973    AC_MSG_WARN([This value for CFLAGS does not work.  I will continue with empty CFLAGS, but you might want to set CFLAGS manually.])
974  fi
975fi
976
977AC_MSG_NOTICE([C compiler options are: $CFLAGS])
978
979AC_ARG_VAR(MPICC,[C MPI Compiler])
980if test x"$MPICC" = x; then :; else
981  AC_MSG_NOTICE([Will use MPI C compiler $MPICC])
982  CC="$MPICC"
983fi
984
985# Correct ADDLIBS initialization if we are using the MS compiler
986case "$CC" in
987  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
988    ADDLIBS=
989    AC_COIN_MINGW_LD_FIX
990    ;;
991esac
992
993AC_LANG_POP(C)
994]) # AC_COIN_PROG_CC
995
996###########################################################################
997#                             COIN_PROG_F77                               #
998###########################################################################
999
1000# Find the compile command by running AC_PROG_F77 (with compiler names
1001# for different operating systems) and put it into F77 (unless it was
1002# given by the user), and find an appropriate value for FFLAGS
1003
1004AC_DEFUN([AC_COIN_PROG_F77],
1005[AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
1006AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
1007AC_REQUIRE([AC_COIN_PROG_CC])
1008AC_REQUIRE([AC_COIN_F77_COMPS])
1009AC_LANG_PUSH([Fortran 77])
1010
1011AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options])
1012AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options])
1013AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options])
1014
1015coin_has_f77=yes
1016
1017save_fflags="$FFLAGS"
1018
1019# We delete the cached value, since the test might not have been
1020# performed with our choice of compilers earlier
1021$as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; }
1022
1023# This is a real belt-and-suspenders approach. AC_COIN_FIND_F77 will use
1024# coin_f77_comps to see if there's a program that matches one of the names.
1025# If there's no such program, F77 = unavailable. If we match the name,
1026# feed AC_PROG_F77 the same search list, just to be sure it's a functioning
1027# compiler.
1028# AC_MSG_NOTICE([Fortran compiler candidates: $coin_f77_comps])
1029AC_COIN_FIND_F77
1030if test "$F77" != "unavailable" ; then
1031  AC_PROG_F77($coin_f77_comps)
1032else
1033  AC_MSG_WARN([Failed to find a Fortran compiler!])
1034fi
1035
1036FFLAGS="$save_fflags"
1037
1038# Check if a project specific FFLAGS variable has been set
1039if test x$COIN_PRJCT != x; then
1040  eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set}
1041  if test x$coin_tmp = xset; then
1042    eval FFLAGS=\${${COIN_PRJCT}_FFLAGS}
1043  fi
1044fi
1045
1046if test "$F77" != "unavailable" && test x"$FFLAGS" = x ; then
1047
1048  coin_add_fflags=
1049  coin_opt_fflags=
1050  coin_dbg_fflags=
1051  coin_warn_fflags=
1052
1053  if test "$G77" = "yes"; then
1054    coin_opt_fflags="-O3 -fomit-frame-pointer"
1055    coin_add_fflags="-pipe"
1056    coin_dbg_fflags="-g"
1057    case $enable_doscompile in
1058      mingw)
1059        FFLAGS="-mno-cygwin"
1060        AC_TRY_LINK(,[      write(*,*) 'Hello world'],
1061                    [coin_add_fflags="-mno-cygwin $coin_add_fflags"])
1062        FFLAGS=
1063      ;;
1064    esac
1065  else
1066    case $build in
1067      *-cygwin* | *-mingw*)
1068        case $F77 in
1069          ifort* | */ifort* | IFORT* | */IFORT* )
1070            coin_opt_fflags='-MT -O3'
1071            coin_add_fflags='-fpp -nologo'
1072            coin_dbg_fflags='-MTd -debug'
1073          ;;
1074          compile_f2c*)
1075            coin_opt_fflags='-MT -O2'
1076            coin_add_fflags='-nologo -wd4996'
1077            coin_dbg_fflags='-MTd'
1078          ;;
1079        esac
1080        ;;
1081      *-linux-*)
1082        case $F77 in
1083          ifc* | */ifc* | ifort* | */ifort*)
1084            coin_opt_fflags="-O3 -ip"
1085            coin_add_fflags="-cm -w90 -w95"
1086            coin_dbg_fflags="-g -CA -CB -CS"
1087            # Check if -i_dynamic is necessary (for new glibc library)
1088            FFLAGS=
1089            AC_TRY_LINK(,[      write(*,*) 'Hello world'],[],
1090                        [coin_add_fflags="-i_dynamic $coin_add_fflags"])
1091            ;;
1092          pgf77* | */pgf77* | pgf90* | */pgf90*)
1093            coin_opt_fflags="-fast"
1094            coin_add_fflags="-Kieee -pc 64"
1095            coin_dbg_fflags="-g"
1096          ;;
1097        esac
1098        ;;
1099      *-ibm-*)
1100        case "$F77" in
1101          xlf* | */xlf* | mpxlf* | */mpxlf* )
1102            coin_opt_fflags="-O -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
1103            coin_add_fflags="-bmaxdata:0x80000000 -qsuppress=1500-036 -qsuppress=1500-029"
1104            coin_dbg_fflags="-g -C"
1105            ;;
1106        esac
1107        ;;
1108      *-hp-*)
1109        coin_opt_fflags="+O3"
1110        coin_add_fflags="+U77"
1111        coin_dbg_fflags="-C -g"
1112        ;;
1113      *-*-solaris*)
1114        coin_opt_fflags="-O4"
1115        coin_dbg_fflags="-g"
1116        ;;
1117      *-sgi-*)
1118        coin_opt_fflags="-O5 -OPT:Olimit=0"
1119        coin_dbg_fflags="-g"
1120        ;;
1121    esac
1122  fi
1123
1124  if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then
1125    coin_dbg_fflags="-g"
1126  fi
1127
1128  if test -z "$coin_opt_fflags"; then
1129    # Try if -O option works if nothing else is set
1130    FFLAGS=-O
1131    AC_TRY_LINK(,[      integer i], [coin_opt_fflags="-O"])
1132  fi
1133
1134  # if PM doesn't want the warning messages, take them out
1135  if test x"$coin_skip_warn_fflags" = xyes; then
1136    coin_warn_fflags=
1137  fi
1138
1139  if test x${DBG_FFLAGS+set} != xset; then
1140    DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags"
1141  fi
1142  if test x${OPT_FFLAGS+set} != xset; then
1143    OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags"
1144  fi
1145
1146  DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS"
1147  OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS"
1148
1149  if test "$coin_debug_compile" = "true"; then
1150    FFLAGS="$DBG_FFLAGS"
1151  else
1152    FFLAGS="$OPT_FFLAGS"
1153  fi
1154else
1155  FFLAGS="$FFLAGS $ADD_FFLAGS"
1156  if test x${DBG_FFLAGS+set} != xset; then
1157    DBG_FFLAGS="$FFLAGS"
1158  fi
1159  if test x${OPT_FFLAGS+set} != xset; then
1160    OPT_FFLAGS="$FFLAGS"
1161  fi
1162fi
1163
1164# If FFLAGS contains -mno-cygwin, CPPFLAGS must have it.
1165case "$FFLAGS" in
1166  *-mno-cygwin*)
1167    if test x${CPPFLAGS+set} != xset ; then
1168      CPPFLAGS="-mno-cygwin"
1169    else
1170      case "$CPPFLAGS" in
1171        *-mno-cygwin*)
1172          ;;
1173        *)
1174          CPPFLAGS="$CPPFLAGS -mno-cygwin"
1175          ;;
1176      esac
1177    fi ;;
1178esac
1179
1180# Try if FFLAGS works
1181if test "$F77" != "unavailable" ; then
1182  AC_TRY_LINK(,[      integer i],[],[FFLAGS=])
1183  if test -z "$FFLAGS"; then
1184    AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work.  I will now just try '-O', but you might want to set FFLAGS manually.])
1185    FFLAGS='-O'
1186    AC_TRY_LINK(,[      integer i],[],[FFLAGS=])
1187    if test -z "$FFLAGS"; then
1188      AC_MSG_WARN([This value for FFLAGS does not work.  I will continue with empty FFLAGS, but you might want to set FFLAGS manually.])
1189    fi
1190  fi
1191fi
1192
1193AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS])
1194
1195AC_ARG_VAR(MPIF77,[Fortran MPI Compiler])
1196if test x"$MPIF77" = x; then :; else
1197  AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77])
1198  F77="$MPIF77"
1199fi
1200
1201case "$F77" in
1202  ifort* | */ifort* | IFORT* | */IFORT*)
1203    AC_COIN_MINGW_LD_FIX
1204    ;;
1205esac
1206
1207AC_LANG_POP([Fortran 77])
1208]) # AC_COIN_PROG_F77
1209
1210###########################################################################
1211#                           COIN_F77_WRAPPERS                             #
1212###########################################################################
1213
1214# Calls autoconfs AC_F77_WRAPPERS and does additional corrections to FLIBS
1215
1216AC_DEFUN([AC_COIN_F77_WRAPPERS],
1217[AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl
1218AC_BEFORE([AC_PROG_F77],[$0])dnl
1219
1220AC_LANG_PUSH([Fortran 77])
1221
1222save_FLIBS="$FLIBS"
1223
1224AC_F77_WRAPPERS
1225
1226if test x"$save_FLIBS" != x; then
1227  FLIBS="$save_FLIBS"
1228else
1229  # This is to correct a missing exclusion in autoconf 2.59
1230  if test x"$FLIBS" != x; then
1231    my_flibs=
1232    for flag in $FLIBS; do
1233      case $flag in
1234        -lcrt*.o) ;;
1235               *) my_flibs="$my_flibs $flag" ;;
1236      esac
1237    done
1238    FLIBS="$my_flibs"
1239  fi
1240
1241  case $build in
1242  # The following is a fix to define FLIBS for ifort on Windows
1243  # In its original version, it linked in libifcorert.lib or libifcorertd.lib on Windows/ifort explicitly.
1244  # However, this seem to create a dependency on libifcorert.dll (or libifcorertd.dll) in the executables.
1245  # This is seem to be unnecessary, libifcorert(d).lib has been removed from the link line.
1246     *-cygwin* | *-mingw*)
1247       case "$F77" in
1248         ifort* | */ifort* | IFORT* | */IFORT*)
1249           FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib"
1250#           if "$coin_debug_compile" = true ; then
1251#             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib"
1252#           else
1253#             FLIBS="-link $LIBS /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmtd.lib"
1254#           fi
1255           ;;
1256         compile_f2c*)
1257           FLIBS=`$F77 -FLIBS` ;;
1258       esac;;
1259     *-hp-*)
1260         FLIBS="$FLIBS -lm";;
1261     *-ibm-*)
1262         FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;;
1263     *-linux-*)
1264       case "$F77" in
1265         pgf77* | */pgf77* | pgf90* | */pgf90*)
1266# ask linker to go through the archives multiple times
1267# (the Fortran compiler seems to do that automatically...
1268           FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;;
1269       esac
1270  esac
1271  ac_cv_f77_libs="$FLIBS"
1272fi
1273
1274AC_LANG_POP([Fortran 77])
1275
1276]) # AC_COIN_F77_WRAPPERS
1277
1278###########################################################################
1279#                             COIN_FIND_F77                               #
1280###########################################################################
1281
1282# Attempt to preempt autoconf by locating an appropriate F77 program. This
1283# macro will not trigger a fatal error if a suitable compiler cannot be
1284# found. It should be called before COIN_PROG_F77 or COIN_TRY_FLINK.
1285
1286AC_DEFUN([AC_COIN_FIND_F77],
1287[AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
1288AC_REQUIRE([AC_COIN_F77_COMPS])
1289AC_MSG_NOTICE([Trying to determine Fortran compiler name])
1290AC_CHECK_PROGS([F77],[$coin_f77_comps],[unavailable])
1291])
1292
1293# Auxilliary macro to make sure both COIN_PROG_F77 and COIN_FIND_F77 use
1294# the same search lists for compiler names.
1295# For *-*-solaris*, promote Studio/Workshop compilers to front of list.
1296AC_DEFUN([AC_COIN_F77_COMPS],
1297[case $build in
1298  *-cygwin* | *-mingw*)
1299     if test "$enable_doscompile" = msvc ; then
1300       coin_f77_comps="ifort fl32 compile_f2c"
1301     else
1302       coin_f77_comps="gfortran g77 ifort fl32 compile_f2c"
1303     fi ;;
1304  *-*-solaris*)
1305     coin_f77_comps="f95 f90 f77 xlf_r fort77 gfortran g77 pgf90 pgf77 ifort ifc frt af77" ;;
1306  *) coin_f77_comps="xlf_r fort77 gfortran f77 g77 pgf90 pgf77 ifort ifc frt af77" ;;
1307 esac
1308])
1309
1310###########################################################################
1311#                          COIN_INIT_AUTOMAKE                             #
1312###########################################################################
1313
1314# This macro calls the regular INIT_AUTOMAKE and MAINTAINER_MODE
1315# macros, and defines additional variables and makefile conditionals,
1316# that are used in the maintainer parts of the makfile.  It also
1317# checks if the correct versions of the autotools are used.
1318#
1319# This also defines the AC_SUBST variables:
1320# abs_source_dir     absolute path to source code for this package
1321# abs_bin_dir        absolute path to the directory where binaries are
1322#                    going to be installed (prefix/bin)
1323# abs_lib_dir        absolute path to the directory where libraries are
1324#                    going to be installed (prefix/lib)
1325# abs_include_dir    absolute path to the directory where the header files
1326#                    are installed (prefix/include)
1327
1328AC_DEFUN([AC_COIN_INIT_AUTOMAKE],
1329[AC_REQUIRE([AC_PROG_EGREP])
1330
1331# AC_MSG_NOTICE([Beginning automake initialisation.])
1332# Stuff for automake
1333AM_INIT_AUTOMAKE
1334AM_MAINTAINER_MODE
1335
1336coin_have_externals=no
1337if test "$enable_maintainer_mode" = yes; then
1338
1339  # If maintainer mode is chosen, we make sure that the correct versions
1340  # of the tools are used, and that we know where libtool.m4 is (to
1341  # recreate acinclude.m4)
1342
1343  AC_SUBST(LIBTOOLM4)
1344  LIBTOOLM4=
1345  # Normally, $HOME
1346  AUTOTOOLS_DFLT=$HOME
1347
1348  AC_CACHE_CHECK([whether we are using the correct autotools],
1349                 [ac_cv_use_correct_autotools],
1350                 [ac_cv_use_correct_autotools=check])
1351
1352  if test $ac_cv_use_correct_autotools = check; then
1353    ac_cv_use_correct_autotools=yes
1354    # Check if we have autoconf
1355    AC_CHECK_PROG([have_autoconf],[autoconf],[yes],[no])
1356    if test $have_autoconf = no; then
1357      AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find autoconf in your path.])
1358    fi
1359
1360    # Check whether autoconf is the correct version
1361    correct_version='2.59'
1362    grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1363    AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf])
1364    autoconf --version > confauto.out 2>&1
1365    if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
1366      AC_MSG_RESULT([yes])
1367    else
1368      rm -f confauto.out
1369      AC_MSG_RESULT([no])
1370      AC_MSG_ERROR([You don't have the correct version of autoconf as the first one in your path.])
1371    fi
1372    rm -f confauto.out
1373
1374    # Check if the executable autoconf is picked up from the correct location
1375    AC_MSG_CHECKING([whether autoconf is coming from the correct location])
1376    autoconf_dir=`which autoconf | sed -e 's=/autoconf=='`
1377    autoconf_dir=`cd $autoconf_dir; pwd`
1378    if test x$AUTOTOOLS_DIR = x; then
1379      want_dir=$AUTOTOOLS_DFLT/bin
1380    else
1381      want_dir=$AUTOTOOLS_DIR/bin
1382    fi
1383    if test $autoconf_dir = `cd $want_dir; pwd`; then
1384      AC_MSG_RESULT([yes])
1385    else
1386      rm -f confauto.out
1387      AC_MSG_RESULT([no])
1388      AC_MSG_ERROR([The autoconf executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.])
1389    fi
1390
1391    # Check if we have automake
1392    AC_CHECK_PROG([have_automake],[automake],[yes],[no])
1393    if test $have_automake = no; then
1394      AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find automake in your path.])
1395    fi
1396 
1397    # Check whether automake is the correct version
1398    correct_version='1.9.6'
1399    grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1400    AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake])
1401    automake --version > confauto.out 2>&1
1402    if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
1403      AC_MSG_RESULT([yes])
1404    else
1405      rm -f confauto.out
1406      AC_MSG_RESULT([no])
1407      AC_MSG_ERROR([You don't have the correct version of automake as the first one in your path.])
1408    fi
1409    rm -f confauto.out
1410
1411    # Check if the executable automake is picked up from the correct location
1412    AC_MSG_CHECKING([whether automake is coming from the correct location])
1413    automake_dir=`which automake | sed -e 's=/automake=='`
1414    automake_dir=`cd $automake_dir; pwd`
1415    if test x$AUTOTOOLS_DIR = x; then
1416      want_dir=$AUTOTOOLS_DFLT/bin
1417    else
1418      want_dir=$AUTOTOOLS_DIR/bin
1419    fi
1420    if test $automake_dir = `cd $want_dir; pwd`; then
1421      AC_MSG_RESULT([yes])
1422    else
1423      rm -f confauto.out
1424      AC_MSG_RESULT([no])
1425      AC_MSG_ERROR([The automake executable should be picked up from \$AUTOTOOLS_DFLT/bin or \$AUTOTOOLS_DIR/bin.])
1426    fi
1427
1428    # Check if this is the correct version of libtool (with escaped dots)
1429    if test x$AUTOTOOLS_DIR = x; then
1430      want_dir=$AUTOTOOLS_DFLT/share
1431    else
1432      want_dir=$AUTOTOOLS_DIR/share
1433    fi
1434    correct_version='1.5.22'
1435    grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1436    AC_COIN_CHECK_FILE([$want_dir/libtool/ltmain.sh],
1437                       [have_ltmain=yes],
1438                       [have_ltmain=no])
1439    AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.])
1440    if test $have_ltmain = yes; then
1441    if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then
1442        AC_MSG_RESULT([yes])
1443      else
1444        AC_MSG_RESULT([no])
1445        AC_MSG_ERROR([You don't have the correct version of libtool.])
1446      fi
1447    else
1448      AC_MSG_RESULT([no])
1449      AC_MSG_ERROR([I cannot find the ltmain.sh file.])
1450    fi
1451  fi
1452
1453  # Check if we can find the libtool file
1454  if test x$AUTOTOOLS_DIR = x; then
1455    want_dir=$AUTOTOOLS_DFLT/share
1456  else
1457    want_dir=$AUTOTOOLS_DIR/share
1458  fi
1459  AC_COIN_CHECK_FILE([$want_dir/aclocal/libtool.m4],
1460                     [LIBTOOLM4="$want_dir/aclocal/libtool.m4"],
1461                     [AC_MSG_ERROR([I cannot find the libtool.m4 file.])])
1462
1463  # Check if we have an Externals file
1464  if test -r $srcdir/Externals; then
1465    coin_have_externals=yes
1466  fi
1467  # Check if subversion is installed and understands https
1468  AC_CHECK_PROG([have_svn],[svn],[yes],[no])
1469  if test x$have_svn = xyes; then
1470    AC_CACHE_CHECK([whether svn understands https],
1471                   [ac_cv_svn_understands_https],
1472                   [svn --version > confauto.out 2>&1
1473                    if $EGREP https confauto.out >/dev/null 2>&1; then
1474                      ac_cv_svn_understands_https=yes
1475                    else
1476                      ac_cv_svn_understands_https=no
1477                      have_svn=no
1478                      ac_cv_prog_have_svn=no
1479                    fi
1480                    rm -f confauto.out])
1481  fi
1482
1483  # Find the location of the BuildTools directory
1484  BUILDTOOLSDIR=
1485  if test -r $srcdir/BuildTools/coin.m4; then
1486    BUILDTOOLSDIR=$srcdir/BuildTools
1487  else
1488    if test -r $srcdir/../BuildTools/coin.m4; then
1489      BUILDTOOLSDIR=$srcdir/../BuildTools
1490    else
1491      if test -r $srcdir/../../BuildTools/coin.m4; then
1492        BUILDTOOLSDIR=$srcdir/../../BuildTools
1493      else
1494        AC_MSG_ERROR(Cannot find the BuildTools directory)
1495      fi
1496    fi
1497  fi
1498  AC_SUBST(BUILDTOOLSDIR)
1499
1500  # The following variable is set to the name of the directory where
1501  # the autotool scripts are located
1502  AC_SUBST(AUX_DIR)
1503  AUX_DIR=$ac_aux_dir
1504fi
1505
1506# helpful variable for the base directory of this package
1507abs_source_dir=`cd $srcdir; pwd`
1508AC_SUBST(abs_source_dir)
1509
1510# Stuff for example Makefiles
1511if test x$prefix = xNONE; then
1512  full_prefix=$ac_default_prefix
1513else
1514  full_prefix=$prefix
1515fi
1516full_prefix=`cd $full_prefix ; pwd`
1517AC_SUBST(abs_lib_dir)
1518abs_lib_dir=$full_prefix/lib
1519AC_SUBST(abs_include_dir)
1520abs_include_dir=$full_prefix/include
1521AC_SUBST(abs_bin_dir)
1522abs_bin_dir=$full_prefix/bin
1523
1524AM_CONDITIONAL(HAVE_EXTERNALS,
1525               test $coin_have_externals = yes && test x$have_svn = xyes)
1526
1527# AC_MSG_NOTICE([End automake initialisation.])
1528
1529]) # AC_COIN_INIT_AUTOMAKE
1530
1531###########################################################################
1532#                          COIN_CREATE_LIBTOOL                            #
1533###########################################################################
1534
1535# This does all the tests necessary to create the libtool script in the
1536# package base directory.  If this is used, then the COIN_INIT_AUTO_TOOLS
1537# test in the subdirectories will be able to skip the libtool tests and
1538# just use the one in the package base directory.
1539
1540m4_define([AC_COIN_CREATE_LIBTOOL],
1541[AC_CANONICAL_BUILD
1542
1543# Check if user wants to produce debugging code
1544AC_COIN_DEBUG_COMPILE
1545
1546# Get the name of the C compiler and appropriate compiler options
1547AC_COIN_PROG_CC
1548
1549# Get the name of the C++ compiler and appropriate compiler options
1550AC_COIN_PROG_CXX
1551
1552# Get the name of the Fortran compiler and appropriate compiler options
1553AC_COIN_PROG_F77
1554
1555# Initialize automake and libtool
1556# AC_MSG_NOTICE([Calling INIT_AUTO_TOOLS from CREATE_LIBTOOL.])
1557AC_COIN_INIT_AUTO_TOOLS
1558# AC_MSG_NOTICE([Finished INIT_AUTO_TOOLS from CREATE_LIBTOOL.])
1559])
1560
1561###########################################################################
1562#                         COIN_INIT_AUTO_TOOLS                            #
1563###########################################################################
1564
1565# Initialize the auto tools automake and libtool, with all
1566# modifications we want for COIN packages.
1567#
1568# RPATH_FLAGS        link flags for hardcoding path to shared objects
1569
1570# This is a trick to have this code before AC_COIN_PROG_LIBTOOL
1571AC_DEFUN([AC_COIN_DISABLE_STATIC],
1572[
1573# Test if force_shared has been set
1574if test "x$1" = xforce_shared; then
1575  if test x$enable_shared = xno; then
1576    AC_MSG_ERROR([Shared libraries are disabled by user, but this is not feasible with the given options])
1577  fi
1578  enable_shared=yes;
1579else
1580  # On Cygwin and AIX, building DLLs doesn't work
1581  case $build in
1582    *-cygwin*)
1583      coin_disable_shared=yes
1584      platform=Cygwin
1585    ;;
1586    *-aix*)
1587      coin_disable_shared=yes
1588      platform=AIX
1589    ;;
1590    *-mingw*)
1591      coin_disable_shared=yes
1592      platform="Msys"
1593#      case "$CXX" in
1594#        cl*)
1595#          coin_disable_shared=yes
1596#          platform="Msys with cl"
1597#      ;;
1598#      esac
1599    ;;
1600  esac
1601fi
1602if test x"$coin_disable_shared" = xyes; then
1603  if test x"$enable_shared" = xyes; then
1604    AC_MSG_WARN([On $platform, shared objects are not supported. I'm disabling your choice.])
1605  fi
1606  enable_shared=no
1607fi
1608# By default, we only want the shared objects to be compiled
1609AC_DISABLE_STATIC
1610])
1611
1612m4_define([AC_COIN_INIT_AUTO_TOOLS],
1613[{AC_BEFORE([AC_COIN_PROG_CXX],[$0])
1614AC_BEFORE([AC_COIN_PROG_CC],[$0])
1615AC_BEFORE([AC_COIN_PROG_F77],[$0])
1616
1617# START
1618AC_COIN_DISABLE_STATIC([$1])
1619
1620# Initialize automake
1621AC_COIN_INIT_AUTOMAKE
1622
1623LIBTOOL=
1624if test -r ../libtool; then
1625  coin_config_dir=..
1626  LIBTOOL='$(SHELL) $(top_builddir)/../libtool'
1627fi
1628if test "x$LIBTOOL" = x; then
1629  if test -r ../../libtool; then
1630    coin_config_dir=../..
1631    LIBTOOL='$(SHELL) $(top_builddir)/../../libtool'
1632  fi
1633fi
1634
1635if test "x$LIBTOOL" = x; then
1636# AC_MSG_NOTICE([Creating libtool script (calling COIN_PROG_LIBTOOL).])
1637  # Stuff for libtool
1638  AC_COIN_PROG_LIBTOOL
1639# AC_MSG_NOTICE([Finished COIN_PROG_LIBTOOL.])
1640  # set RPATH_FLAGS to the compiler link flags required to hardcode location
1641  # of the shared objects
1642  AC_COIN_RPATH_FLAGS($abs_lib_dir)
1643
1644else
1645
1646  AC_MSG_NOTICE([Using libtool script in directory $coin_config_dir])
1647  # get all missing information from the config.log file
1648
1649  # output variables and defines
1650  as_save_IFS=$IFS
1651  IFS='
1652'
1653  for oneline in `cat $coin_config_dir/config.status`; do
1654    case "$oneline" in
1655         # First some automake conditionals
1656      s,@am__fastdep* | s,@AR@* | s,@CPP@*  | s,@CPPFLAGS@* | s,@CXXCPP@*  | \
1657      s,@RANLIB@* | s,@STRIP@* | s,@ac_ct_AR@* | s,@ac_ct_RANLIB@* | \
1658      s,@ac_ct_STRIP@* | s,@host* | s,@LN_S@* | s,@RPATH_FLAGS@* | \
1659      s,@ac_c_preproc_warn_flag@* |  s,@ac_cxx_preproc_warn_flag@* )
1660        command=`echo $oneline | sed -e 's/^s,@//' -e 's/@,/="/' -e 's/,;t t/"/'`
1661#        echo "$command"
1662        eval "$command"
1663        ;;
1664      s,@DEFS@* )
1665        command=`echo $oneline | sed -e 's/^s,@DEFS@,/defsline="/' -e 's/,;t t/"/'`
1666#        echo "$command"
1667        eval "$command"
1668        ;;
1669    esac
1670  done
1671  IFS=$as_save_IFS
1672
1673  # And some defines (assuming here that the packages base dir
1674  # doesn't have a config.h file
1675  for word in $defsline; do
1676#    echo word $word
1677    case $word in
1678      -DHAVE_@<:@A-Z_@:>@*_H=1 | -DSTDC_HEADERS=1 )
1679        i=`echo $word | sed -e 's/-D/#define /' -e 's/=/ /'`
1680#        echo dd $i
1681        echo $i >>confdefs.h
1682        ;;
1683    esac
1684  done
1685fi
1686
1687# AC_MSG_NOTICE([End of INIT_AUTO_TOOLS.])
1688
1689# ToDo
1690# For now, don't use the -no-undefined flag, since the Makefiles are
1691# not yet set up that way.  But we need to fix this, when we want
1692# to comile DLLs under Windows.
1693LT_LDFLAGS=
1694
1695# Check if we want to set the library version
1696AC_MSG_CHECKING([if library version is set])
1697if test x"$coin_libversion" != x; then
1698  LT_LDFLAGS="$LT_LDFLAGS -version-info $coin_libversion"
1699  AC_MSG_RESULT([$coin_libversion])
1700else
1701  AC_MSG_RESULT([no])
1702fi
1703
1704AC_SUBST(LT_LDFLAGS)
1705
1706#END
1707}])
1708
1709
1710###########################################################################
1711#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
1712###########################################################################
1713
1714# Patches to libtool for cygwin. Lots for cl, a few for GCC.
1715# For cl:
1716# - cygpath is not correctly quoted in fix_srcfile_path
1717# - paths generated for .lib files is not run through cygpath -w
1718
1719
1720AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
1721[ case "$CXX" in
1722    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1723      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
1724      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1725          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1726          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1727          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1728          -e 's%lib /OUT:%lib -OUT:%' \
1729          -e "s%cygpath -w%$CYGPATH_W%" \
1730          -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%' \
1731          -e 's/$AR t/lib -nologo -list/' \
1732          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
1733          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
1734          -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"%' \
1735      libtool > conftest.bla
1736
1737      mv conftest.bla libtool
1738      chmod 755 libtool
1739      ;;
1740    *)
1741      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
1742      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1743          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
1744          -e 's|libext="lib"|libext="a"|' \
1745      libtool > conftest.bla
1746
1747      mv conftest.bla libtool
1748      chmod 755 libtool
1749      ;;
1750  esac ]) # COIN_PATCH_LIBTOOL_CYGWIN
1751
1752###########################################################################
1753#                    COIN_PATCH_LIBTOOL_SOLARIS                           #
1754###########################################################################
1755# If we want to do a 64-bit build with GCC on Solaris, the system search
1756# libraries need to point to 64-bit subdirectories. If they do not already do
1757# that, fix them. This patch is evolving, as are GCC compilers.  GCC 4.2.1
1758# reports the correct search list, given the correct call. GCC 4.1.1 does not.
1759# `Correct call' means -m64 is specified. `Correct search list' seems to amount
1760# to prepending the list of 64-bit subdirectories to the 32-bit directories.
1761# Both SPARC and x86 have this issue, but a different hardware id string is
1762# required depending on the underlying CPU. The macro executes isainfo to get
1763# the string. This will fail, of course, if we're cross-compiling. The
1764# alternative is to fail on a regular basis each time a new CPU identifier is
1765# needed. This macro will also fail if the search list reported with
1766# -print-search-dirs differs between the C, C++, and Fortran compilers; each
1767# have their own setting in libtool.  If GCC reports the correct search list
1768# given the -m64 flag, the best solution is to define CC='gcc -m64', and
1769# similarly for CXX, F77, so that libtool will make the correct call.
1770###########################################################################
1771AC_DEFUN([AC_COIN_PATCH_LIBTOOL_SOLARIS],
1772[ if test "$GCC" = yes && \
1773     (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm64' >/dev/null 2>&1) ; then
1774    hdwisa=`isainfo | sed -e 's/\(@<:@^ @:>@*\) .*$/\1/'`
1775    if `$EGREP 'sys_lib_search_path_spec=' libtool | $EGREP -v $hdwisa >/dev/null 2>&1` ; then
1776      AC_MSG_NOTICE([Applying patches to libtool for 64-bit GCC compilation])
1777      fixlibtmp=`$CC -m64 -print-search-dirs | $EGREP '^libraries:'`
1778      fixlibtmp=`echo $fixlibtmp | sed -e 's/libraries: =//' -e 's/:/ /g'`
1779      if `echo "$fixlibtmp" | $EGREP -v $hdwisa  >/dev/null 2>&1` ; then
1780        # AC_MSG_NOTICE(Compensating for broken gcc)
1781        for lib in $fixlibtmp ; do
1782          if test -d "${lib}${hdwisa}" ; then
1783            syslibpath64="$syslibpath64 ${lib}${hdwisa}/"
1784          fi
1785        done
1786        syslibpath64="${syslibpath64} ${fixlibtmp}"
1787      else
1788        syslibpath64="$fixlibtmp"
1789      fi
1790      sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="'"$syslibpath64"'"|' libtool > conftest.bla
1791      mv conftest.bla libtool
1792      chmod 755 libtool 
1793    fi
1794    # AC_MSG_NOTICE(Result is )
1795    # $EGREP 'sys_lib_search_path_spec=' libtool
1796  fi ]) # COIN_PATCH_LIBTOOL_SOLARIS
1797
1798###########################################################################
1799#                           COIN_PROG_LIBTOOL                             #
1800###########################################################################
1801
1802# Setup the libtool stuff together with any modifications to make it
1803# work on additional platforms
1804
1805AC_DEFUN([AC_COIN_LIBTOOL_WRAPPER],
1806[AC_BEFORE([AC_COIN_BLA],[$0])
1807AC_PROG_LIBTOOL])
1808
1809AC_DEFUN([AC_COIN_BLA],[echo bla])
1810
1811AC_DEFUN([AC_COIN_PROG_LIBTOOL],
1812[# No longer needed now that CPPFLAGS is correctly set -- lh, 061214 --
1813 # AC_REQUIRE([AC_COIN_DLFCN_H])
1814
1815# NEW: If libtool exists in the directory higher up, we use that one
1816#      instead of creating a new one
1817
1818# It turns out that the code for AC_PROG_LIBTOOL is somehow AC_REQUIRED
1819# out in front of this macro body. You'll notice that LIBTOOL is already
1820# defined here.  We'll have to count on this macro not being called if libtool
1821# already exists, or at least move the libtool fixes outside the conditional.
1822# AC_MSG_NOTICE([Entering coin_prog_libtool, LIBTOOL = "$LIBTOOL".])
1823# This test is therefore removed.  -- lh, 061214 --
1824# if test "x$LIBTOOL" = x; then
1825
1826# AC_MSG_NOTICE([Calling PROG_LIBTOOL.])
1827  AC_PROG_LIBTOOL
1828# AC_MSG_NOTICE([Finished PROG_LIBTOOL.])
1829  AC_SUBST(ac_c_preproc_warn_flag)
1830  AC_SUBST(ac_cxx_preproc_warn_flag)
1831
1832  AC_MSG_NOTICE([Build is "$build".])
1833  mydos2unix='| dos2unix'
1834  case $build in
1835    *-mingw*)
1836      CYGPATH_W=echo
1837      mydos2unix=
1838      ;;
1839  esac
1840
1841  case $build in
1842    # Here we need to check if -m32 is specified.  If so, we need to correct
1843    # sys_lib_search_path_spec
1844    *x86_64-*)
1845      if test "$GCC" = yes && (echo $CXXFLAGS $CFLAGS $FFLAGS | $EGREP 'm32' >& /dev/null); then
1846        AC_MSG_NOTICE(Applying patches to libtool for 32bit compilation)
1847        sed -e 's|sys_lib_search_path_spec=".*"|sys_lib_search_path_spec="/lib /usr/lib"|' libtool > conftest.bla
1848        mv conftest.bla libtool
1849        chmod 755 libtool 
1850      fi
1851      ;;
1852
1853    *-solaris*)
1854      AC_COIN_PATCH_LIBTOOL_SOLARIS
1855      ;;
1856    # Cygwin. Ah, cygwin. Too big and ugly to inline; see the macro.
1857    *-cygwin* | *-mingw*)
1858      AC_COIN_PATCH_LIBTOOL_CYGWIN
1859      ;;
1860    *-darwin*)
1861      AC_MSG_NOTICE(Applying patches to libtool for Darwin)
1862      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"/' \
1863        -e 's/ -dynamiclib / -dynamiclib -single_module /g' \
1864      libtool > conftest.bla
1865
1866      mv conftest.bla libtool
1867      chmod 755 libtool
1868      ;;
1869  esac
1870# This fi matches the commented `if test "x$LIBTOOL" = x;' up at the head of
1871# the macro. -- lh, 061214 --
1872# fi
1873
1874# AC_MSG_NOTICE([End libtool initialisation.])
1875]) # AC_COIN_PROG_LIBTOOL
1876
1877# This is a trick to force the check for the dlfcn header to be done before
1878# the checks for libtool
1879# No longer needed now that CPPFLAGS is correctly set.  -- lh, 061214 --
1880# ACDEFUN([AC_COIN_DLFCN_H],
1881# [AC_LANG_PUSH(C)
1882# AC_COIN_CHECK_HEADER([dlfcn.h])
1883# AC_LANG_POP(C)
1884# ]) # AC_COIN_DLFCN_H
1885
1886###########################################################################
1887#                            COIN_RPATH_FLAGS                             #
1888###########################################################################
1889
1890# This macro, in case shared objects are used, defines a variable
1891# RPATH_FLAGS that can be used by the linker to hardwire the library
1892# search path for the given directories.  This is useful for example
1893# Makefiles
1894
1895AC_DEFUN([AC_COIN_RPATH_FLAGS],
1896[RPATH_FLAGS=
1897
1898if test $enable_shared = yes; then
1899  case $build in
1900    *-linux-*)
1901      if test "$GXX" = "yes"; then
1902        RPATH_FLAGS=
1903        for dir in $1; do
1904          RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir"
1905        done
1906      fi ;;
1907    *-darwin*)
1908        RPATH_FLAGS=nothing ;;
1909    *-ibm-*)
1910      case "$CXX" in
1911      xlC* | */xlC* | mpxlC* | */mpxlC*)
1912        RPATH_FLAGS=nothing ;;
1913      esac ;;
1914    *-hp-*)
1915        RPATH_FLAGS=nothing ;;
1916    *-mingw32)
1917        RPATH_FLAGS=nothing ;;
1918    *-*-solaris*)
1919        RPATH_FLAGS=
1920        for dir in $1; do
1921          RPATH_FLAGS="$RPATH_FLAGS -R$dir"
1922        done
1923  esac
1924
1925  if test "$RPATH_FLAGS" = ""; then
1926    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.])
1927  fi
1928  if test "$RPATH_FLAGS" = "nothing"; then
1929    RPATH_FLAGS=
1930  fi
1931fi
1932
1933AC_SUBST(RPATH_FLAGS)
1934]) # AC_COIN_RPATH_FLAGS
1935
1936###########################################################################
1937#                        COIN_LINK_INPUT_CMD                              #
1938###########################################################################
1939
1940# This macro determines which command should be used to "link" files
1941# that are input to the generated executables.  On Windows, the codes
1942# using the native Windows system libraries, cannot understand symbolic
1943# links, and a copy should be used instead of 'ln -s'.
1944# The result is stored in coin_link_input_cmd
1945
1946AC_DEFUN([AC_COIN_LINK_INPUT_CMD],
1947[AC_REQUIRE([AC_PROG_LN_S])
1948AC_BEFORE([AC_COIN_PROG_CC], [$0])
1949AC_BEFORE([AC_COIN_ENABLE_DOSCOMPILE], [$0])
1950
1951AC_MSG_CHECKING([which command should be used to link input files])
1952coin_link_input_cmd="$LN_S"
1953if test "$enable_doscompile" = mingw; then
1954  coin_link_input_cmd=cp
1955fi
1956case "$CC" in
1957  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1958    coin_link_input_cmd=cp ;;
1959esac
1960AC_MSG_RESULT($coin_link_input_cmd)
1961])
1962
1963###########################################################################
1964#                              COIN_FINALIZE                              #
1965###########################################################################
1966
1967# This macro should be called at the very end of the configure.ac file.
1968# It creates the output files (by using AC_OUTPUT), and might do some other
1969# things (such as generating links to data files in a VPATH configuration).
1970# It also prints the "success" message.
1971# Note: If the variable coin_skip_ac_output is set to yes, then no output
1972# files are written.
1973
1974AC_DEFUN([AC_COIN_FINALIZE],
1975[
1976AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
1977if test x$coin_skip_ac_output != xyes; then
1978
1979  FADDLIBS="$ADDLIBS"
1980  if test x"$coin_need_flibs" = xyes; then
1981    ADDLIBS="$ADDLIBS $FLIBS"
1982  fi
1983
1984  # library extension
1985  AC_SUBST(LIBEXT)
1986  case "$CC" in
1987    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
1988         LIBEXT=lib ;;
1989      *) LIBEXT=a ;;
1990  esac
1991
1992  # Define VPATH_DISTCLEANFILES to be everything that needs to be
1993  # cleaned for distclean in a vpath configuration
1994  AC_SUBST(VPATH_DISTCLEANFILES)
1995  VPATH_DISTCLEANFILES="$coin_vpath_link_files"
1996
1997  # Take out subdirectories if their configuration concluded that they
1998  # don't need to be compiled
1999  if test x"$coin_ac_skip_subdirs" != x; then
2000    new_subdirs=
2001    for i in $subdirs; do
2002      skipme=no
2003      for j in $coin_ac_skip_subdirs; do
2004        if test $i = $j; then
2005          skipme=yes;
2006        fi
2007      done
2008      if test $skipme = no; then
2009        new_subdirs="$new_subdirs $i"
2010      fi
2011    done
2012    subdirs="$new_subdirs"
2013  fi
2014
2015  AC_OUTPUT
2016
2017  if test x"$coin_vpath_link_files" = x; then : ; else
2018    lnkcmd="$coin_link_input_cmd"
2019    if test "$lnkcmd" = cp; then
2020      AC_MSG_NOTICE(Copying data files for VPATH configuration)
2021    else
2022      AC_MSG_NOTICE(Creating VPATH links for data files)
2023    fi
2024    for file in $coin_vpath_link_files; do
2025      dir=`AS_DIRNAME(["./$file"])`
2026      if test -d $dir; then : ; else
2027        AS_MKDIR_P($dir)
2028      fi
2029      rm -f $file
2030      $lnkcmd $abs_source_dir/$file $file
2031    done
2032  fi
2033
2034  if test x$coin_projectdir = xyes; then
2035    AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful])
2036  else
2037    AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful])
2038  fi
2039else
2040  AC_MSG_NOTICE([No configuration of $PACKAGE_NAME necessary])
2041fi
2042
2043]) #AC_COIN_FINALIZE
2044
2045###########################################################################
2046#                             COIN_VPATH_LINK                             #
2047###########################################################################
2048
2049# This macro makes sure that a symbolic link is created to a file in
2050# the source code directory tree if we are in a VPATH compilation, and
2051# if this package is the main package to be installed
2052
2053AC_DEFUN([AC_COIN_VPATH_LINK],
2054[AC_REQUIRE([AC_COIN_CHECK_VPATH])
2055if test $coin_vpath_config = yes; then
2056  coin_vpath_link_files="$coin_vpath_link_files $1"
2057fi
2058]) #AC_COIN_VPATH_LINK
2059
2060###########################################################################
2061#                       COIN_ENABLE_GNU_PACKAGES                          #
2062###########################################################################
2063
2064# This macro defined the --enable-gnu-packages flag.  This can be used
2065# to check if a user wants to compile GNU packges (such as readline or
2066# zlib) into the executable.  By default, GNU packages are disabled.
2067# This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES
2068
2069AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES],
2070[AC_ARG_ENABLE([gnu-packages],
2071               [AC_HELP_STRING([--enable-gnu-packages],
2072                               [compile with GNU packages (disabled by default)])],
2073               [coin_enable_gnu=$enableval],
2074               [coin_enable_gnu=no])
2075]) # AC_COIN_ENABLE_GNU_PACKAGES
2076
2077###########################################################################
2078#                           COIN_CHECK_GNU_ZLIB                           #
2079###########################################################################
2080
2081# This macro checks for the libz library.
2082
2083AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB],
2084[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2085AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2086AC_BEFORE([AC_COIN_PROG_CC],[$0])
2087AC_BEFORE([AC_COIN_PROG_F77],[$0])
2088AC_BEFORE([$0],[AC_COIN_FINALIZE])
2089
2090coin_has_zlib=no
2091if test $coin_enable_gnu = yes; then
2092  AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
2093
2094  if test $coin_has_zlib = yes; then
2095    AC_CHECK_LIB([z],[gzopen],
2096                 [ADDLIBS="-lz $ADDLIBS"],
2097                 [coin_has_zlib=no])
2098  fi
2099
2100  if test $coin_has_zlib = yes; then
2101    AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
2102  fi
2103fi
2104
2105AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes)
2106]) # AC_COIN_CHECK_GNU_ZLIB
2107
2108
2109###########################################################################
2110#                          COIN_CHECK_GNU_BZLIB                           #
2111###########################################################################
2112
2113# This macro checks for the libbz2 library.
2114
2115AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB],
2116[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2117AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2118AC_BEFORE([AC_COIN_PROG_CC],[$0])
2119AC_BEFORE([AC_COIN_PROG_F77],[$0])
2120AC_BEFORE([$0],[AC_COIN_FINALIZE])
2121
2122coin_has_bzlib=no
2123if test $coin_enable_gnu = yes; then
2124  AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
2125
2126  if test $coin_has_bzlib = yes; then
2127    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
2128                 [ADDLIBS="-lbz2 $ADDLIBS"],
2129                 [coin_has_bzlib=no])
2130  fi
2131
2132  if test $coin_has_bzlib = yes; then
2133    AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
2134  fi
2135fi
2136]) # AC_COIN_CHECK_GNU_BZLIB
2137
2138
2139###########################################################################
2140#                         COIN_CHECK_GNU_READLINE                         #
2141###########################################################################
2142
2143# This macro checks for GNU's readline.  It verifies that the header
2144# readline/readline.h is available, and that the -lreadline library
2145# contains "readline".  It is assumed that #include <stdio.h> is included
2146# in the source file before the #include<readline/readline.h>
2147
2148AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
2149[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2150AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2151AC_BEFORE([AC_COIN_PROG_CC],[$0])
2152AC_BEFORE([AC_COIN_PROG_F77],[$0])
2153AC_BEFORE([$0],[AC_COIN_FINALIZE])
2154
2155coin_has_readline=no
2156if test $coin_enable_gnu = yes; then
2157  AC_COIN_CHECK_HEADER([readline/readline.h],
2158                       [coin_has_readline=yes],[],
2159                       [#include <stdio.h>])
2160
2161  coin_save_LIBS="$LIBS"
2162  LIBS=
2163  # First we check if tputs and friends are available
2164  if test $coin_has_readline = yes; then
2165    AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
2166                   [coin_has_readline=no])
2167  fi
2168
2169  # Now we check for readline
2170  if test $coin_has_readline = yes; then
2171    AC_CHECK_LIB([readline],[readline],
2172                 [ADDLIBS="-lreadline $LIBS $ADDLIBS"],
2173                 [coin_has_readline=no])
2174  fi
2175
2176  if test $coin_has_readline = yes; then
2177    AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
2178  fi
2179
2180  LIBS="$coin_save_LIBS"
2181fi
2182]) # AC_COIN_CHECK_GNU_READLINE
2183
2184###########################################################################
2185#                             COIN_DATA_PATH                              #
2186###########################################################################
2187
2188# This macro defines a preprocessor macro with the absolute path to a
2189# subdirectory of Data.  The argument of this macro is the name of the
2190# subdirectory (in correct case), and the name of the macro is
2191# COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of
2192# the directory.  The path ends with a separator ("/" for linux and
2193# '\\' for Windows).  The default value for this path can be
2194# overwritten with the input variable with the same name
2195# (COIN_DATA_DIR_PATH).  At this point we chech only for the
2196# $srcdir/../Data subdirectory.
2197
2198AC_DEFUN([AC_COIN_DATA_PATH],
2199[AC_MSG_CHECKING([absolute path to data directory $1])
2200
2201AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory])
2202
2203if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then
2204  m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd`
2205fi
2206
2207# Under Cygwin, use Windows path.  Add separator
2208case $build in
2209  *-cygwin*)
2210    m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\
2211    ;;
2212  *)
2213    m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/"
2214    ;;
2215esac
2216
2217if test -r $m4_toupper(COIN_DATA_$1_PATH); then
2218  AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"],
2219            [Define to absolute path for Data subdirectory $1])
2220  AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH))
2221else
2222  AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist)
2223fi
2224]) # AC_COIN_HAS_DATA
2225
2226###########################################################################
2227#                       COIN_LINK_FROM_FILELIST                           #
2228###########################################################################
2229
2230# This macro creates links (or copies, if necessary) to files listed
2231# as content in a text file (second argument) into a target directory
2232# (first argument), which is created if it doesn't exist yet.  If s link
2233# already exists, nothing happens.
2234
2235AC_DEFUN([AC_COIN_LINKCOPY_FROM_FILELIST],
2236[cmd="$3"
2237if test -e $srcdir/$2 ; then
2238  my_target_dir="$1"
2239  my_link_files=`cat $srcdir/$2`
2240  my_dirname=`AS_DIRNAME($2)`
2241#  if test -e $my_target_dir; then : ; else
2242#    AS_MKDIR_P($my_target_dir)
2243#  fi
2244  for i in $my_link_files; do
2245    #rm -rf $my_target_dir/$i
2246    if test -e $my_target_dir/$i; then : ; else
2247      dirn2=`AS_DIRNAME($my_target_dir/$i)`
2248      if test -e $dirn2; then : ; else
2249        AS_MKDIR_P($dirn2)
2250      fi
2251      $cmd $abs_source_dir/$my_dirname/$i $my_target_dir/$i
2252    fi
2253  done
2254else
2255  AC_MSG_WARN([File list file $2 missing!])
2256fi
2257])
2258
2259AC_DEFUN([AC_COIN_LINK_FROM_FILELIST],
2260[
2261AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
2262echo Creating links in $1 ...
2263AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, $coin_link_input_cmd)
2264])
2265
2266###########################################################################
2267#                       COIN_COPY_FROM_FILELIST                           #
2268###########################################################################
2269
2270# Like COIN_LINK_FROM_FILELIST, but copies the files.
2271
2272AC_DEFUN([AC_COIN_COPY_FROM_FILELIST],
2273[
2274echo Creating copies in $1 ...
2275AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, [cp])
2276])
2277
2278###########################################################################
2279#                          COIN_EXAMPLE_FILES                             #
2280###########################################################################
2281
2282# This macro determines the names of the example files (using the
2283# argument in an "ls" command) and sets up the variables EXAMPLE_FILES
2284# and EXAMPLE_CLEAN_FILES.  If this is a VPATH configuration, it also
2285# creates soft links to the example files.
2286
2287AC_DEFUN([AC_COIN_EXAMPLE_FILES],
2288[AC_REQUIRE([AC_COIN_CHECK_GNU_ZLIB])
2289AC_REQUIRE([AC_COIN_CHECK_VPATH])
2290AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
2291AC_REQUIRE([AC_PROG_LN_S])
2292
2293files=`cd $srcdir; ls $1`
2294# We need to do the following loop to make sure that are no newlines
2295# in the variable
2296for file in $files; do
2297  EXAMPLE_FILES="$EXAMPLE_FILES $file"
2298done
2299if test $coin_vpath_config = yes; then
2300  lnkcmd=
2301  if test "$enable_doscompile" != no; then
2302    lnkcmd=cp
2303  fi
2304  case "$CC" in
2305    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2306      lnkcmd=cp ;;
2307  esac
2308  if test "x$lnkcmd" = xcp; then
2309    AC_MSG_NOTICE([Copying example files ($1)])
2310  else
2311    AC_MSG_NOTICE([Creating links to the example files ($1)])
2312    lnkcmd="$LN_S"
2313  fi
2314  for file in $EXAMPLE_FILES; do
2315    rm -f $file
2316    $lnkcmd $srcdir/$file $file
2317  done
2318  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES $1"
2319else
2320  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES"
2321fi
2322
2323# In case there are compressed files, we create a variable with the
2324# uncompressed names
2325EXAMPLE_UNCOMPRESSED_FILES=
2326for file in $EXAMPLE_FILES; do
2327  case $file in
2328    *.gz)
2329      EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`"
2330      ;;
2331  esac
2332done
2333
2334AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES)
2335AC_SUBST(EXAMPLE_FILES)
2336AC_SUBST(EXAMPLE_CLEAN_FILES)
2337]) #AC_COIN_EXAMPLE_FILES
2338
2339###########################################################################
2340#                            COIN_HAS_PROJECT                             #
2341###########################################################################
2342
2343# This macro sets up usage of a Coin package.  It defines the
2344# PKGSRCDIR and PKGOBJDIR variables, refering to the main source and
2345# object directory of the package, respectively.  It also defines
2346# a COIN_HAS_PKG preprocessor macro and makefile conditional.  The
2347# argument should be the name (Pkg) of the project (in correct lower
2348# and upper case).
2349#
2350# It is also possible to specify a preinstalled version of this Coin
2351# package.  In this case, only PKGINSTDIR is set to the prefix of that
2352# installation.  If the user is providing such a preinstalled version,
2353# this macro checks for a header (second argument) and the existance
2354# of a library file (third argument - only the stub without extension
2355# is to be given, e.g., "libCoinUtils").
2356
2357AC_DEFUN([AC_COIN_HAS_PROJECT],
2358[AC_MSG_CHECKING([for COIN project $1])
2359# First check, if the sub-project is actually available (ToDo: allow
2360# other locations)
2361
2362#replace backslashes by underscore
2363m4_define([escape], m4_bpatsubsts([$1],[/],[_]))
2364
2365m4_tolower(coin_has_[]escape($1))=notGiven
2366if test x"$COIN_SKIP_PROJECTS" != x; then
2367  for dir in $COIN_SKIP_PROJECTS; do
2368    if test $dir = $1; then
2369      m4_tolower(coin_has_[]escape($1))=skipping
2370    fi
2371  done
2372fi
2373
2374AC_SUBST(m4_toupper(escape($1)SRCDIR))
2375AC_SUBST(m4_toupper(escape($1)OBJDIR))
2376AC_SUBST(m4_toupper(escape($1)DOCDIR))
2377AC_SUBST(m4_toupper(escape($1)DATADIR))
2378AC_SUBST(m4_toupper(escape($1)INSTDIR))
2379m4_toupper(escape($1)SRCDIR)=This_Variable_Is_Not_Set
2380m4_toupper(escape($1)OBJDIR)=This_Variable_Is_Not_Set
2381m4_toupper(escape($1)DOCDIR)=This_Variable_Is_Not_Set
2382m4_toupper(escape($1)DATADIR)=This_Variable_Is_Not_Set
2383m4_toupper(escape($1)INSTDIR)=This_Variable_Is_Not_Set
2384
2385if test $m4_tolower(coin_has_[]escape($1)) != skipping; then
2386  if test $PACKAGE_TARNAME = m4_tolower(escape($1)); then
2387    m4_tolower(coin_has_[]escape($1))=.
2388  else
2389    AC_ARG_WITH([m4_tolower(escape($1))-instdir],
2390                AC_HELP_STRING([--with-m4_tolower(escape($1))-instdir],
2391                               [prefix of installation directory for precompiled $1 package]),
2392                [m4_tolower(coin_has_[]escape($1))=installed
2393                 if test -d "$withval"; then : ; else
2394                   AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-instdir not a directory])
2395                 fi
2396                 m4_toupper(escape($1)INSTDIR)=`cd $withval; pwd`], [])
2397
2398    AC_ARG_WITH([m4_tolower(escape($1))-srcdir],
2399                AC_HELP_STRING([--with-m4_tolower(escape($1))-srcdir],
2400                               [source directory for $1 package]),
2401                [if test "$m4_tolower(coin_has_[]escape($1))" = installed; then
2402                   AC_MSG_ERROR([--with-$m4_tolower(escape($1))-srcdir cannot be given together with --with-m4_tolower(escape($1))-instdir])
2403                 fi
2404                 if test -d "$withval"; then : ; else
2405                   AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-srcdir not a directory])
2406                 fi
2407                 m4_tolower(coin_has_[]escape($1))=$withval
2408                 m4_toupper(escape($1)SRCDIR)=`cd $withval; pwd`], [])
2409
2410    AC_ARG_WITH([m4_tolower(escape($1))-objdir],
2411                AC_HELP_STRING([--with-m4_tolower(escape($1))-objdir],
2412                               [object directory for $1 package (if different from source directory in VPATH compilation)]),
2413                [if test "$m4_tolower(coin_has_[]escape($1))" = installed; then
2414                   AC_MSG_ERROR([--with-m4_tolower(escape($1))-objdir cannot be given together with --with-m4_tolower(escape($1))-instdir])
2415                 fi
2416                 if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
2417                   AC_MSG_ERROR([--with-m4_tolower(escape($1))-objdir must be accompanied by --with-m4_tolower(escape($1))-srcdir])
2418                 fi
2419                 if test -d "$withval"; then : ; else
2420                   AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-objdir not a directory])
2421                 fi
2422                 m4_toupper(escape($1)OBJDIR)=`cd $withval; pwd`], [m4_toupper(escape($1)OBJDIR)="$m4_toupper(escape($1)SRCDIR)"])
2423
2424    # if we still don't have a location, check for generic flag
2425    if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
2426      AC_ARG_WITH([coin-instdir],
2427                  AC_HELP_STRING([--with-coin-instdir],
2428                                 [prefix of installation directory for precompiled COIN packages]),
2429                  [if test -d "$withval"; then : ; else
2430                     AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
2431                   fi
2432                   if test -r $withval/share/doc/coin/$1/README; then
2433                     m4_tolower(coin_has_[]escape($1))=installed
2434                     m4_toupper(escape($1)INSTDIR)=`cd $withval; pwd`
2435                   fi],
2436                   [])
2437    fi
2438
2439    if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
2440      if test -d $srcdir/../$1; then
2441        m4_ifvaln([$2],
2442          [if test -r $srcdir/$1/$2; then
2443            m4_tolower(coin_has_[]escape($1))=../$1
2444          fi],
2445          [ m4_tolower(coin_has_[]escape($1))=../$1 ]
2446        )
2447      fi
2448    fi
2449  fi
2450fi
2451
2452if test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
2453   test $m4_tolower(coin_has_[]escape($1)) != skipping; then
2454  # Set the #define if the component is available
2455  AC_DEFINE(m4_toupper(COIN_HAS_[]escape($1)),[1],[Define to 1 if the $1 package is used])
2456
2457  if test $m4_tolower(coin_has_[]escape($1)) = installed; then
2458    m4_toupper(escape($1)DOCDIR)=$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1
2459    m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)INSTDIR)/share/coin/$1
2460  else
2461    if test "$m4_toupper(escape($1)OBJDIR)" = This_Variable_Is_Not_Set; then
2462      # Set the variables for source and object code location
2463      m4_toupper(escape($1)SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_[]escape($1)); pwd`
2464      m4_toupper(escape($1)OBJDIR)=`pwd`/$m4_tolower(coin_has_[]escape($1))
2465      m4_toupper(escape($1)DOCDIR)=$abs_lib_dir/../share/doc/coin/$1
2466      m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)OBJDIR)
2467    else
2468      # This is just a guess:
2469      m4_toupper(escape($1)DOCDIR)=$m4_toupper(escape($1)OBJDIR)/../share/doc/coin/$1
2470      m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)OBJDIR)/../share/coin/$1
2471    fi
2472  fi
2473fi
2474
2475  # Define the Makefile conditional
2476AM_CONDITIONAL(m4_toupper(COIN_HAS_[]escape($1)),
2477               [test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
2478                test $m4_tolower(coin_has_[]escape($1)) != skipping])
2479AM_CONDITIONAL(m4_toupper(COIN_HAS_[]escape($1)_PREINSTALLED),
2480               [test $m4_tolower(coin_has_[]escape($1)) = installed])
2481
2482if test $m4_tolower(coin_has_[]escape($1)) = installed; then
2483  AC_MSG_RESULT([installed in $m4_toupper(escape($1)INSTDIR)])
2484  AC_COIN_CHECK_FILE([$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1/README],
2485                     [],[AC_MSG_ERROR([$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1/README should be available if $1 is installed])])
2486else
2487  AC_MSG_RESULT([$m4_tolower(coin_has_[]escape($1))])
2488  if test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
2489     test $m4_tolower(coin_has_[]escape($1)) != skipping; then
2490    AC_MSG_CHECKING([for source code location of $1])
2491    AC_MSG_RESULT([$m4_toupper(escape($1)SRCDIR)])
2492    AC_MSG_CHECKING([for object code location of $1])
2493    AC_MSG_RESULT([$m4_toupper(escape($1)OBJDIR)])
2494  fi
2495fi
2496]) # AC_COIN_HAS_PROJECT
2497
2498###########################################################################
2499#                        COIN_HAS_USER_LIBRARY                            #
2500###########################################################################
2501# This macro sets up usage of a user library with header files. The assumption
2502# is that the header file(s) and library do not reside in standard system
2503# directories, hence both the include directory and link flags must be
2504# specified. There are two mandatory arguments and two optional arguments.
2505#
2506# The first argument (mandatory) should be a name (LibraryName) for the
2507# library.  The second argument (mandatory) should be an abbreviation in
2508# upper case letters (LBRY) for the library. Ultimately, the macro will
2509# specify two variables, LBRYINCDIR and LBRYLIB, to be substituted in files
2510# generated during configuration; a preprocessor symbol COIN_HAS_LBRY; and a
2511# matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the
2512# directory containing include files for the library. LBRYLIB should specify
2513# the flags necessary to link to the library. A variable coin_has_lbry will
2514# be set to true or false, as appropriate. A variable lbry_libcheck will be
2515# be set to yes or no; no indicates link checks should not be attempted.
2516#
2517# The macro defines three configure arguments, --with-libraryname-incdir,
2518# --with-libraryname-lib, and --disable-libraryname-libcheck, by converting
2519# LibraryName to lower case.
2520#
2521# LBRYINCDIR and LBRYLIB can be specified as environment variables or as
2522# part of the configure command using --with-libraryname-incdir and
2523# --with-libraryname-lib, respectively. Command line arguments override
2524# environment variables.
2525#
2526# If a third argument is given, it should specify a file in LBRYINCDIR.  The
2527# macro will check for the presence of the file. If a fourth argument is given,
2528# it should specify a function name, `fname'.  The macro will attempt to link a
2529# trivial program containing a parameterless call to the function, `fname()',
2530# using the LBRYLIB flags. The link check uses C as the language; this has been
2531# adequate to date but has limitations. It is possible to disable the link
2532# check by specifying --disable-libraryname-libcheck. This is a workaround for
2533# instances where the link check does not work properly, for whatever reason.
2534# If you're trying to link to a Fortran library, consider using F77_FUNC or
2535# FC_FUNC to obtain a mangled fname appropriate for use from C code. For a C++
2536# library, you're on your own unless the library declares some function with
2537# extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++
2538# name.
2539
2540AC_DEFUN([AC_COIN_HAS_USER_LIBRARY],
2541[ AC_REQUIRE([AC_COIN_PROJECTDIR_INIT])
2542  AC_MSG_CHECKING(if user provides library for $1)
2543
2544# Check for header file directory
2545
2546  AC_ARG_WITH(m4_tolower($1)-incdir,
2547      AS_HELP_STRING([--with-m4_tolower($1)-incdir],
2548                     [specify the header file directory for library $1]),
2549      [$2INCDIR=`cd $withval; pwd`])
2550
2551# Check for library directory
2552
2553  AC_ARG_WITH(m4_tolower($1)-lib,
2554      AS_HELP_STRING([--with-m4_tolower($1)-lib],
2555                     [specify the flags used to link with the library $1]),
2556      [$2LIB=$withval])
2557
2558# Switch to disable library check if requested
2559
2560  AC_ARG_ENABLE(m4_tolower($1)-libcheck,
2561      AS_HELP_STRING([--enable-m4_tolower($1)-libcheck],
2562                     [use disable-m4_tolower($1)-libcheck to skip the link
2563                      check at configuration time]),
2564      [m4_tolower($1)_libcheck=$enableval],
2565      [m4_tolower($1)_libcheck=yes])
2566
2567# At this point, if we're going to use the library, both LBRYINCDIR and
2568# LBRYLIB must be defined and not empty.
2569
2570  if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then
2571    if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then
2572      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.])
2573    fi
2574    m4_tolower(coin_has_$2)=true
2575    AC_MSG_RESULT(yes)
2576  else
2577    m4_tolower(coin_has_$2)=false
2578    AC_MSG_RESULT(no)
2579  fi
2580
2581# If we have instructions for use, consider header and link checks.
2582
2583  if test $m4_tolower(coin_has_$2) = true; then
2584
2585# If argument 3 (file) is given, check for the file. Typically this will be a
2586# header file, but that's not assumed.
2587
2588    m4_ifval([$3],
2589        [AC_COIN_CHECK_FILE([$$2INCDIR/$3],[],
2590             [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])])
2591
2592# Now see if we can link the function. There are arguments for and against
2593# assuming argument 3 is a header file declaring the function. A correct
2594# function declaration is the main argument in favour. Having to cope with
2595# possible dependencies or other oddities are the main arguments against.
2596# Force the use of C as the best single choice amongst C++, C, and Fortran.
2597# Obviously, this has limits.
2598
2599    m4_ifvaln([$4],
2600        [if test x"$m4_tolower($1)_libcheck" != xno; then
2601           coin_save_LIBS="$LIBS"
2602           LIBS="$$2LIB $ADDLIBS"
2603           coin_$2_link=no
2604           AC_LANG_PUSH(C)
2605           for fnm in $4 ; do
2606             AC_MSG_CHECKING([whether symbol $fnm is available with $2])
2607             AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$fnm()]])],
2608                 [AC_MSG_RESULT(yes)
2609                  coin_$2_link=yes
2610                  break],
2611                 [AC_MSG_RESULT(no)])
2612           done
2613           AC_LANG_POP(C)
2614           if test x"$coin_$2_link" = xyes ; then
2615             LIBS="$coin_save_LIBS"
2616           else
2617             AC_MSG_ERROR([Cannot find symbol(s) $4 with $2])
2618           fi
2619         fi])
2620
2621# If we make it this far, we've verified the file and linked the function. Add
2622# the necessary link flags to ADDLIBS and define the preprocessor symbol
2623# COIN_HAS_LBRY.
2624
2625    ADDLIBS="$$2LIB $ADDLIBS"
2626    AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available])
2627  fi
2628
2629# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
2630# automake conditional. These actions must occur unconditionally.
2631
2632  AC_SUBST($2INCDIR)
2633  AC_SUBST($2LIB)
2634  AM_CONDITIONAL(COIN_HAS_$2, test $m4_tolower(coin_has_$2) = true)
2635]) #AC_COIN_HAS_USER_LIBRARY
2636
2637###########################################################################
2638#                               COIN_HAS_ASL                              #
2639###########################################################################
2640
2641# This macro checks if the user has provide arguments that say where
2642# the precompiled ASL files should be found (with the --with-asldir
2643# flag).  If this is not the case, we check if the ThirdParty/ASL
2644# directory has been configured, which indicates that the files will
2645# be in that directory and can be used.
2646
2647AC_DEFUN([AC_COIN_HAS_ASL],
2648[coin_aslobjdir=../ThirdParty/ASL
2649coin_aslsrcdir=$srcdir/$coin_aslobjdir
2650
2651# Determine the name of the ASL library
2652case "$CC" in
2653  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2654    ampllib=amplsolv.lib ;;
2655  *)
2656    ampllib=amplsolver.a ;;
2657esac
2658
2659AC_ARG_WITH([asldir],
2660            AC_HELP_STRING([--with-asldir],
2661                           [specify path to AMPL solver directory (or BUILD for compilation, or "no" for disabling AMPL)]),
2662            [use_asldir=$withval], [use_asldir=])
2663
2664if test "$use_asldir" = BUILD; then
2665  if test "$PACKAGE_NAME" != ThirdPartyASL; then
2666    # If we are configuring ThirdParty/ASL, don't check
2667    if test -r $coin_aslobjdir/.MakeOk; then :; else
2668      AC_MSG_ERROR([option \"BUILD\" specified for asldir, but directory is not configure (sources missing?)])
2669    fi
2670  fi
2671elif test -z "$use_asldir"; then
2672 # try to find sources - if not given don't compile
2673  if test "$PACKAGE_NAME" != ThirdPartyASL; then
2674    if test -r $coin_aslobjdir/.MakeOk; then
2675      use_asldir=BUILD
2676    else
2677      use_asldir=no
2678    fi
2679  else
2680    use_asldir=no
2681  fi
2682elif test "$use_asldir" != "no"; then
2683  AC_COIN_CHECK_FILE([$use_asldir/$ampllib],[],
2684                     [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but library missing])])
2685  AC_COIN_CHECK_FILE([$use_asldir/asl.h],[],
2686                     [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but header files are missing])])
2687  use_asldir=`cd $use_asldir; pwd`
2688  case $build in
2689    *-cygwin*) use_asldir=`cygpath -w $use_asldir | sed -e sX\\\\\\\\X/Xg` ;;
2690  esac
2691fi
2692
2693# Variable containing ASL library (including full path)
2694AC_SUBST(ASLLIB)
2695# Variable containing flags for including ASL header files
2696AC_SUBST(ASL_CPPFLAGS)
2697
2698if test "$use_asldir" = BUILD; then
2699  coin_aslobjdir=`cd $coin_aslobjdir; pwd`
2700  ASLLIB=`$CYGPATH_W $coin_aslobjdir/$ampllib | sed -e sX\\\\\\\\X/Xg`
2701  coin_aslsrcdir=`cd $coin_aslsrcdir; pwd`
2702  ASL_CPPFLAGS="-I"`$CYGPATH_W $coin_aslobjdir | sed -e sX\\\\\\\\X/Xg`" -I"`$CYGPATH_W $coin_aslsrcdir/solvers | sed -e sX\\\\\\\\X/Xg`
2703elif test "$use_asldir" != no; then
2704  ASLLIB=`$CYGPATH_W $use_asldir/$ampllib | sed -e sX\\\\\\\\X/Xg`
2705  ASL_CPPFLAGS="-I"`$CYGPATH_W $use_asldir | sed -e sX\\\\\\\\X/Xg`
2706fi
2707
2708if test "$use_asldir" != no; then
2709  AC_LANG_PUSH(C)
2710  AC_CHECK_LIB(dl,[dlopen],[ASLLIB="$ASLLIB -ldl"],[])
2711  coin_has_asl=yes
2712  AC_DEFINE([COIN_HAS_ASL],[1],
2713            [If defined, the Ampl Solver Library is available.])
2714  AC_LANG_POP(C)
2715else
2716  coin_has_asl=no
2717fi
2718AM_CONDITIONAL(COIN_HAS_ASL, test $coin_has_asl = yes)
2719]) # AC_COIN_HAS_ASL
2720
2721###########################################################################
2722#                            COIN_TRY_FLINK                               #
2723###########################################################################
2724
2725# Auxilliary macro to test if a Fortran function name can be linked,
2726# given the current settings of LIBS.  We determine from the context, what
2727# the currently active programming language is, and cast the name accordingly.
2728# The first argument is the name of the function/subroutine, in small letters,
2729# the second argument are the actions taken when the test works, and the
2730# third argument are the actions taken if the test fails.
2731
2732AC_DEFUN([AC_COIN_TRY_FLINK],
2733[case $ac_ext in
2734  f)
2735    AC_TRY_LINK(,[      call $1],[$2],[$3])
2736    ;;
2737  c)
2738    AC_F77_FUNC($1,cfunc$1)
2739    if test x"$coin_need_flibs" = xyes; then
2740      flink_try=no;
2741    else
2742      AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2743                  [flink_try=yes],[flink_try=no])
2744    fi
2745    if test $flink_try = yes; then
2746      $2
2747    else
2748      if test x"$FLIBS" != x; then
2749        flink_save_libs="$LIBS"
2750        LIBS="$LIBS $FLIBS"
2751        AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2752                    [LIBS="$flink_save_libs"
2753                     $2
2754                     coin_need_flibs=yes],
2755                    [LIBS="$flink_save_libs"
2756                     $3])
2757      else
2758        $3
2759      fi
2760    fi
2761    ;;
2762  cc|cpp)
2763    AC_F77_FUNC($1,cfunc$1)
2764    if test x"$coin_need_flibs" = xyes; then
2765      flink_try=no;
2766    else
2767      AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2768                  [flink_try=yes],[flink_try=no])
2769    fi
2770    if test $flink_try = yes; then
2771      $2
2772    else
2773      if test x"$FLIBS" != x; then
2774        flink_save_libs="$LIBS"
2775        LIBS="$LIBS $FLIBS"
2776        AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2777                    [LIBS="$flink_save_libs"
2778                     $2
2779                     coin_need_flibs=yes],
2780                    [LIBS="$flink_save_libs"
2781                     $3])
2782      else
2783        $3
2784      fi
2785    fi
2786    ;;
2787esac
2788]) # AC_COIN_TRY_FLINK
2789
2790###########################################################################
2791#                             COIN_HAS_BLAS                               #
2792###########################################################################
2793
2794# This macro checks for a library containing the BLAS library.  It
2795# tries standard libraries, and if none is found to be working, it
2796# checks whether the BLAS ThirdParty/Blas directory has been configured.
2797# It adds to ADDLIBS any flags required to link with an externally provided
2798# BLAS.  It defines the makefile conditional and preprocessor macro
2799# COIN_HAS_BLAS, if blas is available, and it defines the makefile conditional
2800# COIN_BUILD_BLAS, if blas is compiled within COIN.
2801
2802AC_DEFUN([AC_COIN_HAS_BLAS],
2803[if test "$PACKAGE_NAME" = ThirdPartyBlas || test "$PACKAGE_NAME" = ThirdPartyLapack || test "$PACKAGE_NAME" = ThirdPartyMumps; then
2804  coin_blasobjdir=../Blas
2805else
2806  coin_blasobjdir=../ThirdParty/Blas
2807fi
2808coin_blassrcdir=$srcdir/$coin_blasobjdir
2809
2810AC_ARG_WITH([blas],
2811            AC_HELP_STRING([--with-blas],
2812                           [specify BLAS library (or BUILD for compilation)]),
2813            [use_blas=$withval], [use_blas=])
2814
2815MAKEOKFILE=.MakeOk
2816# Check if user supplied option makes sense
2817if test x"$use_blas" != x; then
2818  if test "$use_blas" = "BUILD"; then
2819    # Don't check for course code if this is executed in ThirdParty/Blas
2820    if test "$PACKAGE_NAME" != ThirdPartyBlas; then
2821      if test -r $coin_blasobjdir/.MakeOk; then :; else
2822        AC_MSG_ERROR([option \"BUILD\" specified for Blas, but $coin_blasobjdir directory is not properly configured])
2823      fi
2824    fi
2825  elif test "$use_blas" != no ; then
2826    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
2827    LIBS="$use_blas $LIBS"
2828    ADDLIBS="$use_blas $ADDLIBS"
2829    AC_COIN_TRY_FLINK([daxpy],
2830                      [AC_MSG_RESULT([yes])],
2831                      [AC_MSG_RESULT([no])
2832                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
2833  fi
2834else
2835# Try to autodetect the library for blas based on build system
2836  #AC_MSG_CHECKING([default locations for BLAS])
2837  skip_lblas_check=no
2838  case $build in
2839    *-sgi-*)
2840      SAVE_LIBS="$LIBS"
2841      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
2842      LIBS="-lcomplib.sgimath $LIBS"
2843      AC_COIN_TRY_FLINK([daxpy],
2844                        [AC_MSG_RESULT([yes])
2845                         use_blas=-lcomplib.sgimath;
2846                         ADDLIBS="-lcomplib.sgimath $ADDLIBS"],
2847                        [AC_MSG_RESULT([no])
2848                         SAVE_LIBS="$LIBS"])
2849      ;;
2850
2851# Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
2852# cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
2853# recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
2854# that CC and cc will understand -library in Studio 13. The main extra
2855# function of -xlic_lib and -library is to arrange for the Fortran run-time
2856# libraries to be linked for C++ and C. We can arrange that explicitly.
2857    *-*-solaris*)
2858      SAVE_LIBS="$LIBS"
2859      AC_MSG_CHECKING([for BLAS in libsunperf])
2860      LIBS="-lsunperf $FLIBS $LIBS"
2861      AC_COIN_TRY_FLINK([daxpy],
2862                        [AC_MSG_RESULT([yes])
2863                         use_blas='-lsunperf'
2864                         ADDLIBS="-lsunperf $ADDLIBS"
2865                         coin_need_flibs=yes],
2866                        [AC_MSG_RESULT([no])
2867                         LIBS="$SAVE_LIBS"])
2868      ;;
2869    *-cygwin* | *-mingw*)
2870# On cygwin, consider -lblas only if doscompile is disabled. The prebuilt
2871# library will want to link with cygwin, hence won't run standalone in DOS.
2872      if test "$enable_doscompile" = mingw; then
2873        skip_lblas_check=yes
2874      fi
2875      case "$CC" in
2876        cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2877          SAVE_LIBS="$LIBS"
2878          AC_MSG_CHECKING([for BLAS in MKL])
2879          LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
2880          AC_COIN_TRY_FLINK([daxpy],
2881                            [AC_MSG_RESULT([yes])
2882                             use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'
2883                             ADDLIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $ADDLIBS"],
2884                            [AC_MSG_RESULT([no])
2885                             LIBS="$SAVE_LIBS"])
2886          ;;
2887      esac
2888      ;;
2889  esac
2890
2891  if test -z "$use_blas" && test $skip_lblas_check = no; then
2892    SAVE_LIBS="$LIBS"
2893    AC_MSG_CHECKING([whether -lblas has BLAS])
2894    LIBS="-lblas $LIBS"
2895    AC_COIN_TRY_FLINK([daxpy],
2896                      [AC_MSG_RESULT([yes])
2897                       ADDLIBS="-lblas $ADDLIBS"
2898                       use_blas='-lblas'],
2899                      [AC_MSG_RESULT([no])
2900                       LIBS="$SAVE_LIBS"])
2901  fi
2902
2903# If we have no other ideas, consider building BLAS.
2904  if test -z "$use_blas"; then
2905    if test "$PACKAGE_NAME" != ThirdPartyBlas; then
2906      if test -r $coin_blasobjdir/.MakeOk; then
2907        use_blas=BUILD
2908      fi
2909    fi
2910  fi
2911fi
2912
2913if test "$use_blas" = BUILD; then
2914  coin_need_flibs=yes
2915fi
2916
2917AM_CONDITIONAL([COIN_HAS_BLAS],[test x"$use_blas" != x])
2918AM_CONDITIONAL([COIN_BUILD_BLAS],[test "$use_blas" = BUILD])
2919
2920if test x"$use_blas" = x || test "$use_blas" = no; then
2921  coin_has_blas=no
2922else
2923  coin_has_blas=yes
2924  AC_DEFINE([COIN_HAS_BLAS],[1],
2925            [If defined, the BLAS Library is available.])
2926fi
2927]) # AC_COIN_HAS_BLAS
2928
2929###########################################################################
2930#                            COIN_HAS_LAPACK                              #
2931###########################################################################
2932
2933# This macro checks for a library containing the LAPACK library.  It
2934# tries standard libraries, and if none is found to be working, it
2935# checks whether the LAPACK ThirdParty/Lapack directory has been
2936# configured.  It adds to ADDLIBS any flags required to link with an
2937# externally provided LAPACK.  It defines the makefile conditional and
2938# preprocessor macro COIN_HAS_LAPACK, if lapack is available, and it
2939# defines the makefile conditional COIN_BUILD_LAPACK, if lapack is
2940# compiled within COIN.
2941
2942AC_DEFUN([AC_COIN_HAS_LAPACK],
2943[coin_lapackobjdir=../ThirdParty/Lapack
2944coin_lapacksrcdir=$srcdir/$coin_lapackobjdir
2945
2946AC_ARG_WITH([lapack],
2947            AC_HELP_STRING([--with-lapack],
2948                           [specify LAPACK library (or BUILD for compilation)]),
2949            [use_lapack=$withval], [use_lapack=])
2950
2951# Check if user supplied option makes sense
2952if test x"$use_lapack" != x; then
2953  if test "$use_lapack" = "BUILD"; then
2954    # Don't check for course code if this is executed in ThirdParty/Lapack
2955    if test "$PACKAGE_NAME" != ThirdPartyLapack; then
2956      if test -r $coin_lapackobjdir/.MakeOk; then :; else
2957        AC_MSG_ERROR([option \"BUILD\" specified for LAPACK, but $coin_lapackobjdir directory is not configured])
2958      fi
2959    fi
2960  elif test "$use_lapack" != no; then
2961    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
2962    LIBS="$use_lapack $LIBS"
2963    ADDLIBS="$use_lapack $ADDLIBS"
2964    AC_COIN_TRY_FLINK([dsyev],
2965                      [AC_MSG_RESULT([yes])],
2966                      [AC_MSG_RESULT([no])
2967                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
2968  fi
2969else
2970  if test x$coin_has_blas = xyes; then
2971    # First try to see if LAPACK is already available with BLAS library
2972    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
2973    AC_COIN_TRY_FLINK([dsyev],
2974                      [AC_MSG_RESULT([yes]); use_lapack=ok],
2975                      [AC_MSG_RESULT([no])])
2976  fi
2977  skip_llapack_check=no
2978  if test -z "$use_lapack"; then
2979    # Try to autodetect the library for lapack based on build system
2980    case $build in
2981      *-sgi-*)
2982        SAVE_LIBS="$LIBS"
2983        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
2984        LIBS="-lcomplib.sgimath $LIBS"
2985        AC_COIN_TRY_FLINK([dsyev],
2986                          [AC_MSG_RESULT([yes])
2987                           use_lapack=-lcomplib.sgimath;
2988                           ADDLIBS="-lcomplib.sgimath $ADDLIBS"],
2989                          [AC_MSG_RESULT([no])
2990                           SAVE_LIBS="$LIBS"])
2991        ;;
2992
2993# See comments in COIN_HAS_BLAS.
2994      *-*-solaris*)
2995      SAVE_LIBS="$LIBS"
2996      AC_MSG_CHECKING([for LAPACK in libsunperf])
2997      LIBS="-lsunperf $FLIBS $LIBS"
2998      AC_COIN_TRY_FLINK([dsyev],
2999                        [AC_MSG_RESULT([yes])
3000                         use_blas='-lsunperf'
3001                         ADDLIBS="-lsunperf $ADDLIBS"
3002                         coin_need_flibs=yes],
3003                        [AC_MSG_RESULT([no])
3004                         LIBS="$SAVE_LIBS"])
3005        ;;
3006# On cygwin, do this check only if doscompile is disabled. The prebuilt library
3007# will want to link with cygwin, hence won't run standalone in DOS.
3008      *-cygwin*)
3009        if test "$enable_doscompile" = mingw; then
3010          skip_llapack_check=yes
3011        fi
3012        ;;
3013    esac
3014  fi
3015
3016  if test -z "$use_lapack" && test $skip_llapack_check = no; then
3017    SAVE_LIBS="$LIBS"
3018    AC_MSG_CHECKING([whether -llapack has LAPACK])
3019    LIBS="-llapack $LIBS"
3020    AC_COIN_TRY_FLINK([dsyev],
3021                      [AC_MSG_RESULT([yes])
3022                       ADDLIBS="-llapack $ADDLIBS"
3023                       use_lapack='-llapack'],
3024                      [AC_MSG_RESULT([no])
3025                       LIBS="$SAVE_LIBS"])
3026  fi
3027
3028# If we have no other ideas, consider building LAPACK.
3029  if test -z "$use_lapack"; then
3030    if test "$PACKAGE_NAME" != ThirdPartyLapack; then
3031      if test -r $coin_lapackobjdir/.MakeOk; then
3032        use_lapack=BUILD
3033      fi
3034    fi
3035  fi
3036fi
3037
3038if test "$use_lapack" = BUILD; then
3039  coin_need_flibs=yes
3040fi
3041
3042AM_CONDITIONAL([COIN_HAS_LAPACK],[test x"$use_lapack" != x])
3043AM_CONDITIONAL([COIN_BUILD_LAPACK],[test "$use_lapack" = BUILD])
3044
3045if test x"$use_lapack" = x || test "$use_lapack" = no; then
3046  coin_has_lapack=no
3047else
3048  coin_has_lapack=yes
3049  AC_DEFINE([COIN_HAS_LAPACK],[1],
3050            [If defined, the LAPACK Library is available.])
3051fi
3052]) # AC_COIN_HAS_LAPACK
3053
3054###########################################################################
3055#                            COIN_HAS_MUMPS                               #
3056###########################################################################
3057
3058# This macro checks for a library containing the MUMPS library.  It
3059# checks if the user has provided an argument for the MUMPS library,
3060# and if not, it checks whether the MUMPS ThirdParty/Mumps directory has
3061# been configured.  It adds to ADDLIBS any flags required to link with
3062# an externally provided MUMPS.  It defines the makefile conditional
3063# and preprocessor macro COIN_HAS_MUMPS, if MUMPS is available, and it
3064# defines the makefile conditional COIN_BUILD_MUMPS, if MUMPS is
3065# compiled within COIN.
3066
3067AC_DEFUN([AC_COIN_HAS_MUMPS],
3068[
3069if test "$PACKAGE_NAME" = ThirdPartyMumps; then
3070  coin_mumpsobjdir=../Mumps
3071else
3072  coin_mumpsobjdir=../ThirdParty/Mumps
3073fi
3074coin_mumpssrcdir=$abs_source_dir/$coin_mumpsobjdir/MUMPS
3075
3076MAKEOKFILE=.MakeOk
3077
3078#check if user provides a MUMPS library (that works)
3079AC_LANG_PUSH(C)
3080SAVE_ADDLIBS="$ADDLIBS"
3081ADDLIBS="$ADDLIBS $FLIBS"
3082AC_COIN_HAS_USER_LIBRARY(mumps, MUMPS, dmumps_c.h, dmumps_c)
3083ADDLIBS="$SAVE_ADDLIBS"
3084AC_LANG_POP(C)
3085
3086if test "$coin_has_mumps" = "true"; then  # user provided mumps library
3087  use_mumps=yes
3088  coin_has_mumps=yes
3089
3090  MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $MUMPSINCDIR\`"
3091  ADDLIBS="$MUMPSLIB $ADDLIBS"
3092
3093else # no user provided library, so we try to build our own
3094  use_mumps=BUILD
3095
3096  # Check if the MUMPS' ThirdParty project has been configured
3097  if test "$PACKAGE_NAME" != ThirdPartyMumps; then
3098    if test -r $coin_mumpsobjdir/.MakeOk; then
3099      use_mumps=BUILD
3100      # Mumps needs pthreads
3101      AC_LANG_PUSH(C)
3102      save_LIBS="$LIBS"
3103      LIBS="$LIBS $FLIBS"
3104      AC_CHECK_LIB([pthread],[pthread_create],[LIBS="-lpthread $save_LIBS"; ADDLIBS="-lpthread $ADDLIBS"],[LIBS="save_LIBS"])
3105      AC_LANG_POP(C)
3106 
3107      MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $coin_mumpssrcdir/libseq\` -I\`\$(CYGPATH_W) $coin_mumpssrcdir/include\`"
3108    else
3109      use_mumps=
3110    fi
3111  fi
3112
3113  # if a user provided library is used, then COIN_HAS_USER_LIBRARY takes care of the COIN_HAS_MUMPS conditional and preprocessor symbol
3114  AM_CONDITIONAL([COIN_HAS_MUMPS],[test x"$use_mumps" != x])
3115  if test x"$use_mumps" != x; then
3116    AC_DEFINE([COIN_HAS_MUMPS],[1],[If defined, the MUMPS Library is available.])
3117    coin_has_mumps=yes
3118  else
3119    coin_has_mumps=no
3120  fi
3121  AC_MSG_CHECKING([whether MUMPS is available])
3122  AC_MSG_RESULT([$coin_has_mumps])
3123fi
3124
3125if test x"$use_mumps" != x; then
3126  # we need the Fortran runtime libraries if we want to link with C/C++
3127  coin_need_flibs=yes
3128
3129  AC_SUBST(MUMPS_INCFLAGS)
3130fi
3131
3132AM_CONDITIONAL([COIN_BUILD_MUMPS],[test "$use_mumps" = BUILD])
3133
3134]) # AC_COIN_HAS_MUMPS
3135
3136###########################################################################
3137#                            COIN_HAS_METIS                               #
3138###########################################################################
3139
3140# This macro checks for a library containing the METIS library.  It
3141# checks if the user has provided an argument for the METIS library,
3142# and if not, it checks whether the METIS ThirdParty/Metis directory has
3143# been configured.  It adds to ADDLIBS any flags required to link with
3144# an externally provided METIS.  It defines the makefile conditional
3145# and preprocessor macro COIN_HAS_METIS, if METIS is available, and it
3146# defines the makefile conditional COIN_BUILD_METIS, if METIS is
3147# compiled within COIN.
3148
3149AC_DEFUN([AC_COIN_HAS_METIS],
3150[
3151case "$PACKAGE_NAME" in
3152  ThirdParty*)
3153    coin_metisobjdir=../Metis
3154    ;;
3155  *)
3156    coin_metisobjdir=../ThirdParty/Metis
3157    ;;
3158esac
3159
3160MAKEOKFILE=.MakeOk
3161
3162#check if user provides a METIS library (that works)
3163AC_LANG_PUSH(C)
3164AC_ARG_WITH(metis,
3165   AS_HELP_STRING([--with-metis], [specify flags to link with METIS library]),
3166   [METISLIB="$withval"; coin_has_metis=true], [coin_has_metis=no])
3167
3168if test $coin_has_metis = true; then
3169  coin_save_LIBS="$LIBS"
3170  LIBS="$METISLIB $ADDLIBS"
3171  AC_MSG_CHECKING([whether symbol metis_nodend is available with ])
3172  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[metis_nodend()]])],
3173     [AC_MSG_RESULT(yes)],
3174     [AC_MSG_RESULT(no)
3175      AC_MSG_ERROR([User-supplied METIS library does not work])])
3176  LIBS="$coin_save_LIBS"
3177fi
3178AC_LANG_POP(C)
3179
3180if test "$coin_has_metis" = "true"; then  # user provided metis library
3181  use_metis=yes
3182  coin_has_metis=yes
3183
3184  ADDLIBS="$METISLIB $ADDLIBS"
3185
3186else # no user provided library, so we try to build our own
3187  use_metis=BUILD
3188
3189  # Check if the METIS' ThirdParty project has been configured
3190  if test "$PACKAGE_NAME" != ThirdPartyMetis; then
3191    if test -r $coin_metisobjdir/.MakeOk; then
3192      use_metis=BUILD
3193    else
3194      use_metis=
3195    fi
3196  fi
3197
3198  if test x"$use_metis" != x; then
3199    coin_has_metis=yes
3200  else
3201    coin_has_metis=no
3202  fi
3203  AC_MSG_CHECKING([whether METIS is available])
3204  AC_MSG_RESULT([$coin_has_metis])
3205fi
3206
3207AM_CONDITIONAL([COIN_HAS_METIS],[test $coin_has_metis = yes])
3208if test $coin_has_metis = yes; then
3209  AC_DEFINE([COIN_HAS_METIS],[1],[If defined, the METIS library is available.])
3210fi
3211
3212]) # AC_COIN_HAS_METIS
3213
3214
3215###########################################################################
3216#                             COIN_HAS_GLPK                               #
3217###########################################################################
3218#
3219# This macro checks for the GLPK package. GLPK provides two capabilities,
3220# an LP and MIP solver (GLPK) and the GNU Mathprog modelling language (GMPL).
3221# The macro checks for either Glpk or Gmpl, according to the value specified as
3222# the parameter. Use one of Glpk or Gmpl. Use *exactly* these strings, eh?
3223#
3224#
3225# The macro first uses COIN_HAS_USER_LIBRARY to see if the user has specified
3226# a preexisting library (this allows the use of any glpk version, if the user
3227# is fussy). The macro then checks for ThirdParty/Glpk.
3228#
3229# This macro will define the following variables for Glpk:
3230#   coin_has_glpk       true or false
3231#   GLPKLIB             link flags for GLPK (if user supplied)
3232#   GLPKINCDIR          location of glpk include files
3233#   COIN_HAS_GLPK       Preprocessor symbol, defined to 1
3234#   COIN_HAS_GLPK       Automake conditional
3235#   COIN_BUILD_GLPK     Automake conditional, defined only if Glpk is to be
3236#                       built in ThirdParty/Glpk
3237#
3238# With the exception of COIN_BUILD_GLPK, an identical set of variables is
3239# defined for Gmpl.
3240
3241AC_DEFUN([AC_COIN_HAS_GLPK],
3242[
3243if test "$PACKAGE_NAME" = ThirdPartyGlpk; then
3244  coin_glpkobjdir=../Glpk
3245else
3246  coin_glpkobjdir=../ThirdParty/Glpk
3247fi
3248coin_glpksrcdir=$abs_source_dir/$coin_glpkobjdir
3249
3250use_thirdpartyglpk=no
3251
3252# Check for the requested component. If the user specified an external glpk
3253# library don't force a ThirdParty build, let the error propagate.
3254
3255m4_if([$1],[Glpk],
3256[AC_COIN_HAS_USER_LIBRARY([Glpk],[GLPK],[glpk.h],
3257    [_glp_lpx_simplex glp_lpx_simplex])
3258 if test x"$coin_has_glpk" = xfalse && test x"$GLPKLIB" = x ; then
3259   use_thirdpartyglpk=try
3260 fi])
3261m4_if([$1],[Gmpl],
3262[AC_COIN_HAS_USER_LIBRARY([Gmpl],[GMPL],[glpmpl.h],
3263    [_glp_mpl_initialize glp_mpl_initialize])
3264 if test x"$coin_has_gmpl" = xfalse && test x"$GMPLLIB" = x ; then
3265   use_thirdpartyglpk=try
3266 fi])
3267
3268# If the user has supplied an external library, use it. Otherwise, consider
3269# a build in ThirdParty/Glpk. If we build, assume we get both glpk and gmpl.
3270
3271if test x"$use_thirdpartyglpk" = xtry ; then
3272  MAKEOKFILE=.MakeOk
3273  # Check if the Glpk's ThirdParty project has been configured
3274  if test "$PACKAGE_NAME" != ThirdPartyGlpk; then
3275    if test -r $coin_glpkobjdir/.MakeOk; then
3276      use_thirdpartyglpk=build
3277    else
3278      use_thirdpartyglpk=no
3279    fi
3280  else
3281    use_thirdpartyglpk=build
3282  fi
3283
3284# If we're building, set the library and include directory variables, create a
3285# preprocessor symbol, define a variable that says we're using glpk/gmpl, and
3286# another to indicate a link check is a bad idea (hard to do before the library
3287# exists).
3288
3289  if test x"$use_thirdpartyglpk" = xbuild ; then
3290    m4_toupper($1INCDIR)="$coin_glpksrcdir/glpk/include"
3291    AC_SUBST(m4_toupper($1INCDIR))
3292    AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],
3293              [Define to 1 if $1 package is available])
3294    m4_tolower(coin_has_$1)=true
3295    m4_tolower($1_libcheck)=no
3296    AC_MSG_NOTICE([Using $1 in ThirdParty/Glpk])
3297  fi
3298fi
3299
3300# Define the necessary automake conditionals.
3301
3302AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
3303               [test x"$m4_tolower(coin_has_$1)" = xtrue])
3304AM_CONDITIONAL([COIN_BUILD_GLPK],[test x"$use_thirdpartyglpk" = xbuild])
3305
3306]) # AC_COIN_HAS_GLPK
Note: See TracBrowser for help on using the repository browser.