source: stable/BSPsplit/coin.m4 @ 1392

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

change last weeks commit again: give project directory and name as separate arguments

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