source: stable/0.6/coin.m4 @ 3346

Last change on this file since 3346 was 2359, checked in by stefan, 10 years ago

same as chgset 2335 in trunk

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