source: stable/0.6/coin.m4 @ 2166

Last change on this file since 2166 was 2166, checked in by stefan, 9 years ago

merge chgsets 2128-2165 from trunk

  • Property svn:keywords set to Author Date Id Revision
File size: 170.7 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 2166 2011-04-03 12:07:35Z 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"
638        coin_warn_cxxflags="-Wimplicit -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"
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"
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_PROGS([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  if test x$coin_projectdir = xyes; then
2273    AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful])
2274  else
2275    AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful])
2276  fi
2277else
2278  AC_MSG_NOTICE([No configuration of $PACKAGE_NAME necessary])
2279fi
2280
2281]) #AC_COIN_FINALIZE
2282
2283###########################################################################
2284#                             COIN_VPATH_LINK                             #
2285###########################################################################
2286
2287# This macro queues source files that need to be available in the build
2288# directory. In a VPATH configuration, the files will be made available by
2289# symbolic link or copy (when the platform does not support links). The list
2290# is processed by COIN_FINALIZE. The parameter is a whitespace-separated
2291# list of files.
2292
2293AC_DEFUN([AC_COIN_VPATH_LINK],
2294[
2295AC_REQUIRE([AC_COIN_CHECK_VPATH])
2296# Allow for newlines in the parameter
2297if test $coin_vpath_config = yes; then
2298  cvl_tmp="$1"
2299  for file in $cvl_tmp ; do
2300    coin_vpath_link_files="$coin_vpath_link_files $file"
2301  done
2302fi
2303]) #AC_COIN_VPATH_LINK
2304
2305###########################################################################
2306#                       COIN_ENABLE_GNU_PACKAGES                          #
2307###########################################################################
2308
2309# This macro defined the --enable-gnu-packages flag.  This can be used
2310# to check if a user wants to compile GNU packges (such as readline or
2311# zlib) into the executable.  By default, GNU packages are disabled.
2312# This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES
2313
2314AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES],
2315[AC_ARG_ENABLE([gnu-packages],
2316               [AC_HELP_STRING([--enable-gnu-packages],
2317                               [compile with GNU packages (disabled by default)])],
2318               [coin_enable_gnu=$enableval],
2319               [coin_enable_gnu=no])
2320]) # AC_COIN_ENABLE_GNU_PACKAGES
2321
2322#######################################################################
2323#                           COIN_CHECK_LIBM                           #
2324#######################################################################
2325
2326# For a (space separated) list of arguments X, this macro adds the flags
2327# for linking against the math library to a X_LIBS and X_PCLIBS.
2328
2329AC_DEFUN([AC_COIN_CHECK_LIBM],
2330[AC_BEFORE([AC_COIN_PROG_CC],[$0])
2331
2332case "$CC" in
2333  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2334    ;;
2335  *)
2336    coin_foreach_w([myvar], [$1], [
2337      m4_toupper(myvar)_LIBS="-lm $m4_toupper(myvar)_LIBS"
2338      m4_toupper(myvar)_PCLIBS="-lm $m4_toupper(myvar)_PCLIBS"
2339      m4_toupper(myvar)_LIBS_INSTALLED="-lm $m4_toupper(myvar)_LIBS_INSTALLED"
2340    ])
2341  ;;
2342esac
2343
2344]) # AC_COIN_CHECK_LIBM
2345
2346###########################################################################
2347#                           COIN_CHECK_GNU_ZLIB                           #
2348###########################################################################
2349
2350# This macro checks for the libz library.  If found, it sets the automake
2351# conditional COIN_HAS_ZLIB and defines the C preprocessor variable
2352# COIN_HAS_ZLIB.  Further, for a (space separated) list of arguments X,
2353# it adds the linker flag to the variables X_LIBS and X_PCLIBS.
2354
2355AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB],
2356[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2357AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2358AC_BEFORE([AC_COIN_PROG_CC],[$0])
2359AC_BEFORE([AC_COIN_PROG_F77],[$0])
2360AC_BEFORE([$0],[AC_COIN_FINALIZE])
2361
2362coin_has_zlib=no
2363if test $coin_enable_gnu = yes; then
2364  AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
2365
2366  if test $coin_has_zlib = yes; then
2367    AC_CHECK_LIB([z],[gzopen],
2368                 [ADDLIBS="-lz $ADDLIBS"
2369                  coin_foreach_w([myvar], [$1], [
2370                    m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS"
2371                    m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS"
2372                    m4_toupper(myvar)_LIBS_INSTALLED="-lz $m4_toupper(myvar)_LIBS_INSTALLED"
2373                  ])
2374                 ],
2375                 [coin_has_zlib=no])
2376  fi
2377
2378  if test $coin_has_zlib = yes; then
2379    AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
2380  fi
2381fi
2382
2383AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes)
2384]) # AC_COIN_CHECK_GNU_ZLIB
2385
2386
2387###########################################################################
2388#                          COIN_CHECK_GNU_BZLIB                           #
2389###########################################################################
2390
2391# This macro checks for the libbz2 library.  If found, it defines the C
2392# preprocessor variable COIN_HAS_BZLIB.  Further, for a (space separated) list
2393# of arguments X, it adds the linker flag to the variables X_LIBS and X_PCLIBS.
2394
2395AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB],
2396[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2397AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2398AC_BEFORE([AC_COIN_PROG_CC],[$0])
2399AC_BEFORE([AC_COIN_PROG_F77],[$0])
2400AC_BEFORE([$0],[AC_COIN_FINALIZE])
2401
2402coin_has_bzlib=no
2403if test $coin_enable_gnu = yes; then
2404  AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
2405
2406  if test $coin_has_bzlib = yes; then
2407    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
2408                 [ADDLIBS="-lbz2 $ADDLIBS"
2409                  coin_foreach_w([myvar], [$1], [
2410                    m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS"
2411                    m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS"
2412                    m4_toupper(myvar)_LIBS_INSTALLED="-lbz2 $m4_toupper(myvar)_LIBS_INSTALLED"
2413                  ])
2414                 ],
2415                 [coin_has_bzlib=no])
2416  fi
2417
2418  if test $coin_has_bzlib = yes; then
2419    AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
2420  fi
2421fi
2422]) # AC_COIN_CHECK_GNU_BZLIB
2423
2424
2425###########################################################################
2426#                         COIN_CHECK_GNU_READLINE                         #
2427###########################################################################
2428
2429# This macro checks for GNU's readline.  It verifies that the header
2430# readline/readline.h is available, and that the -lreadline library
2431# contains "readline".  It is assumed that #include <stdio.h> is included
2432# in the source file before the #include<readline/readline.h>
2433# If found, it defines the C preprocessor variable COIN_HAS_READLINE.
2434# Further, for a (space separated) list of arguments X, it adds the linker flag to the variable X_LIBS and X_PCLIBS.
2435
2436AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
2437[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
2438AC_BEFORE([AC_COIN_PROG_CXX],[$0])
2439AC_BEFORE([AC_COIN_PROG_CC],[$0])
2440AC_BEFORE([AC_COIN_PROG_F77],[$0])
2441AC_BEFORE([$0],[AC_COIN_FINALIZE])
2442
2443coin_has_readline=no
2444if test $coin_enable_gnu = yes; then
2445  AC_COIN_CHECK_HEADER([readline/readline.h],
2446                       [coin_has_readline=yes],[],
2447                       [#include <stdio.h>])
2448
2449  coin_save_LIBS="$LIBS"
2450  LIBS=
2451  # First we check if tputs and friends are available
2452  if test $coin_has_readline = yes; then
2453    AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
2454                   [coin_has_readline=no])
2455  fi
2456
2457  # Now we check for readline
2458  if test $coin_has_readline = yes; then
2459    AC_CHECK_LIB([readline],[readline],
2460                 [ADDLIBS="-lreadline $LIBS $ADDLIBS"
2461                  coin_foreach_w([myvar], [$1], [
2462                    m4_toupper(myvar)_LIBS="-lreadline $LIBS $m4_toupper(myvar)_LIBS"
2463                    m4_toupper(myvar)_PCLIBS="-lreadline $LIBS $m4_toupper(myvar)_PCLIBS"
2464                    m4_toupper(myvar)_LIBS_INSTALLED="-lreadline $LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
2465                  ])
2466                 ],
2467                 [coin_has_readline=no])
2468  fi
2469
2470  if test $coin_has_readline = yes; then
2471    AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
2472  fi
2473
2474  LIBS="$coin_save_LIBS"
2475fi
2476]) # AC_COIN_CHECK_GNU_READLINE
2477
2478###########################################################################
2479#                             COIN_DATA_PATH                              #
2480###########################################################################
2481
2482# This macro defines a preprocessor macro with the absolute path to a
2483# subdirectory of Data.  The argument of this macro is the name of the
2484# subdirectory (in correct case), and the name of the macro is
2485# COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of
2486# the directory.  The path ends with a separator ("/" for linux and
2487# '\\' for Windows).  The default value for this path can be
2488# overwritten with the input variable with the same name
2489# (COIN_DATA_DIR_PATH).  At this point we chech only for the
2490# $srcdir/../Data subdirectory.
2491
2492AC_DEFUN([AC_COIN_DATA_PATH],
2493[AC_MSG_CHECKING([absolute path to data directory $1])
2494
2495AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory])
2496
2497if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then
2498  m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd`
2499fi
2500
2501# Under Cygwin, use Windows path.  Add separator
2502case $build in
2503  *-cygwin*)
2504    m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\
2505    ;;
2506  *)
2507    m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/"
2508    ;;
2509esac
2510
2511if test -r $m4_toupper(COIN_DATA_$1_PATH); then
2512  AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"],
2513            [Define to absolute path for Data subdirectory $1])
2514  AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH))
2515else
2516  AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist)
2517fi
2518]) # AC_COIN_DATA_PATH
2519
2520###########################################################################
2521#                       COIN_LINK_FROM_FILELIST                           #
2522###########################################################################
2523
2524# This macro creates links (or copies, if necessary) to files listed
2525# as content in a text file (second argument) into a target directory
2526# (first argument), which is created if it doesn't exist yet.  If s link
2527# already exists, nothing happens.
2528
2529AC_DEFUN([AC_COIN_LINKCOPY_FROM_FILELIST],
2530[cmd="$3"
2531if test -e $srcdir/$2 ; then
2532  my_target_dir="$1"
2533  my_link_files=`cat $srcdir/$2`
2534  my_dirname=`AS_DIRNAME($2)`
2535#  if test -e $my_target_dir; then : ; else
2536#    AS_MKDIR_P($my_target_dir)
2537#  fi
2538  for i in $my_link_files; do
2539    #rm -rf $my_target_dir/$i
2540    if test -e $my_target_dir/$i; then : ; else
2541      dirn2=`AS_DIRNAME($my_target_dir/$i)`
2542      if test -e $dirn2; then : ; else
2543        AS_MKDIR_P($dirn2)
2544      fi
2545      $cmd $abs_source_dir/$my_dirname/$i $my_target_dir/$i
2546    fi
2547  done
2548else
2549  AC_MSG_WARN([File list file $2 missing!])
2550fi
2551])
2552
2553AC_DEFUN([AC_COIN_LINK_FROM_FILELIST],
2554[
2555AC_REQUIRE([AC_COIN_LINK_INPUT_CMD])
2556echo Creating links in $1 ...
2557AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, $coin_link_input_cmd)
2558])
2559
2560###########################################################################
2561#                       COIN_COPY_FROM_FILELIST                           #
2562###########################################################################
2563
2564# Like COIN_LINK_FROM_FILELIST, but copies the files.
2565
2566AC_DEFUN([AC_COIN_COPY_FROM_FILELIST],
2567[
2568echo Creating copies in $1 ...
2569AC_COIN_LINKCOPY_FROM_FILELIST($1, $2, [cp])
2570])
2571
2572###########################################################################
2573#                          COIN_EXAMPLE_FILES                             #
2574###########################################################################
2575
2576# This macro determines the names of the example files (using the
2577# argument in an "ls" command) and sets up the variables EXAMPLE_FILES
2578# and EXAMPLE_CLEAN_FILES.  If this is a VPATH configuration, it also
2579# creates soft links to the example files.
2580
2581AC_DEFUN([AC_COIN_EXAMPLE_FILES],
2582[AC_REQUIRE([AC_COIN_CHECK_GNU_ZLIB])
2583AC_REQUIRE([AC_COIN_CHECK_VPATH])
2584AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
2585AC_REQUIRE([AC_PROG_LN_S])
2586
2587files=`cd $srcdir; ls $1`
2588# We need to do the following loop to make sure that are no newlines
2589# in the variable
2590for file in $files; do
2591  EXAMPLE_FILES="$EXAMPLE_FILES $file"
2592done
2593if test $coin_vpath_config = yes; then
2594  lnkcmd=
2595  if test "$enable_doscompile" != no; then
2596    lnkcmd=cp
2597  fi
2598  case "$CC" in
2599    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2600      lnkcmd=cp ;;
2601  esac
2602  if test "x$lnkcmd" = xcp; then
2603    AC_MSG_NOTICE([Copying example files ($1)])
2604  else
2605    AC_MSG_NOTICE([Creating links to the example files ($1)])
2606    lnkcmd="$LN_S"
2607  fi
2608  for file in $EXAMPLE_FILES; do
2609    rm -f $file
2610    $lnkcmd $srcdir/$file $file
2611  done
2612  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES $1"
2613else
2614  EXAMPLE_CLEAN_FILES="$EXAMPLE_CLEAN_FILES"
2615fi
2616
2617# In case there are compressed files, we create a variable with the
2618# uncompressed names
2619EXAMPLE_UNCOMPRESSED_FILES=
2620for file in $EXAMPLE_FILES; do
2621  case $file in
2622    *.gz)
2623      EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`"
2624      ;;
2625  esac
2626done
2627
2628AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES)
2629AC_SUBST(EXAMPLE_FILES)
2630AC_SUBST(EXAMPLE_CLEAN_FILES)
2631]) #AC_COIN_EXAMPLE_FILES
2632
2633###########################################################################
2634#                            COIN_HAS_PROJECT (deprecated)                #
2635###########################################################################
2636
2637# This macro sets up usage of a Coin package.  It defines the PKGSRCDIR,
2638# PKGOBJDIR, and PKGDOCDIR variables, referring to the main source, object, and
2639# documentation directories of the package, respectively.  It also defines a
2640# COIN_HAS_PKG preprocessor macro and makefile conditional.  The argument
2641# should be the name (Pkg) of the project (in correct lower and upper case)
2642
2643AC_DEFUN([AC_COIN_HAS_PROJECT],
2644[AC_MSG_CHECKING([for COIN project $1])
2645
2646# First check, if the sub-project is actually available (ToDo: allow
2647# other locations)
2648
2649m4_tolower(coin_has_$1)=unavailable
2650if test x"$COIN_SKIP_PROJECTS" != x; then
2651  for dir in $COIN_SKIP_PROJECTS; do
2652    if test $dir = $1; then
2653      m4_tolower(coin_has_$1)=skipping
2654    fi
2655  done
2656fi
2657
2658if test $m4_tolower(coin_has_$1) != skipping; then
2659  if test $PACKAGE_TARNAME = m4_tolower($1); then
2660    m4_tolower(coin_has_$1)=.
2661  else
2662    if test -d $srcdir/../$1; then
2663      m4_tolower(coin_has_$1)=../$1
2664    fi
2665  fi
2666fi
2667
2668if test $m4_tolower(coin_has_$1) != unavailable &&
2669   test $m4_tolower(coin_has_$1) != skipping; then
2670  # Set the #define if the component is available
2671  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is used])
2672
2673  # Set the variables for source and object code location
2674  AC_SUBST(m4_toupper($1SRCDIR))
2675  m4_toupper($1SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_$1); pwd`
2676  AC_SUBST(m4_toupper($1OBJDIR))
2677  m4_toupper($1OBJDIR)=`pwd`/$m4_tolower(coin_has_$1)
2678  AC_SUBST(m4_toupper($1DOCDIR))
2679  m4_toupper($1DOCDIR)=$abs_lib_dir/../../share/doc/coin/$1
2680fi
2681
2682  # Define the Makefile conditional
2683AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
2684               [test $m4_tolower(coin_has_$1) != unavailable &&
2685                test $m4_tolower(coin_has_$1) != skipping])
2686AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
2687]) # AC_COIN_HAS_PROJECT
2688
2689###########################################################################
2690#                      COIN_CHECK_USER_LIBRARY                            #
2691###########################################################################
2692# This macro sets up usage of a user library with header files. The assumption
2693# is that the header file(s) and library do not reside in standard system
2694# directories, hence both the include directory and link flags must be
2695# specified. There are two mandatory arguments and two optional arguments.
2696#
2697# The first argument (mandatory) should be a name (LibraryName) for the
2698# library.  The second argument (mandatory) should be an abbreviation in
2699# upper case letters (LBRY) for the library. Ultimately, the macro will
2700# specify two variables, LBRYINCDIR and LBRYLIB, to be substituted in files
2701# generated during configuration; a preprocessor symbol COIN_HAS_LBRY; and a
2702# matching automake conditional COIN_HAS_LBRY. LBRYINCDIR should specify the
2703# directory containing include files for the library. LBRYLIB should specify
2704# the flags necessary to link to the library. A variable coin_has_lbry will
2705# be set to true or false, as appropriate. A variable lbry_libcheck will be
2706# be set to yes or no; no indicates link checks should not be attempted.
2707#
2708# The macro defines three configure arguments, --with-libraryname-incdir,
2709# --with-libraryname-lib, and --disable-libraryname-libcheck, by converting
2710# LibraryName to lower case.
2711#
2712# LBRYINCDIR and LBRYLIB can be specified as environment variables or as
2713# part of the configure command using --with-libraryname-incdir and
2714# --with-libraryname-lib, respectively. Command line arguments override
2715# environment variables.
2716#
2717# If a third argument is given, it should specify a file in LBRYINCDIR.  The
2718# macro will check for the presence of the file. If a fourth argument is given,
2719# it should specify a function name, `fname'.  The macro will attempt to link a
2720# trivial program containing a parameterless call to the function, `fname()',
2721# using the LBRYLIB flags. The link check uses C as the language; this has been
2722# adequate to date but has limitations. It is possible to disable the link
2723# check by specifying --disable-libraryname-libcheck. This is a workaround for
2724# instances where the link check does not work properly, for whatever reason.
2725# If you're trying to link to a Fortran library, consider using F77_FUNC or
2726# FC_FUNC to obtain a mangled fname appropriate for use from C code. For a C++
2727# library, you're on your own unless the library declares some function with
2728# extern "C" linkage. Otherwise, you'll have to somehow find the mangled C++
2729# name.
2730# A fifth argument can be specified to include linker flags that may be required
2731# to sucessfully perform the linking check.
2732#
2733# An optional sixth argument can be given to specify a list of targets.
2734# For each target X, the variables X_LIBS and X_PCLIBS will be extended by $LBRYLIB,
2735# if the library has been found and seems to work.
2736
2737AC_DEFUN([AC_COIN_CHECK_USER_LIBRARY],
2738[ AC_REQUIRE([AC_COIN_PROJECTDIR_INIT])
2739  AC_MSG_CHECKING(if user provides library for $1)
2740
2741# Check for header file directory
2742
2743  AC_ARG_WITH(m4_tolower($1)-incdir,
2744      AS_HELP_STRING([--with-m4_tolower($1)-incdir],
2745                     [specify the header file directory for library $1]),
2746      [$2INCDIR=`cd $withval; pwd`])
2747
2748# Check for library directory
2749
2750  AC_ARG_WITH(m4_tolower($1)-lib,
2751      AS_HELP_STRING([--with-m4_tolower($1)-lib],
2752                     [specify the flags used to link with the library $1]),
2753      [$2LIB=$withval])
2754
2755# Switch to disable library check if requested
2756
2757  AC_ARG_ENABLE(m4_tolower($1)-libcheck,
2758      AS_HELP_STRING([--enable-m4_tolower($1)-libcheck],
2759                     [use disable-m4_tolower($1)-libcheck to skip the link
2760                      check at configuration time]),
2761      [m4_tolower($1)_libcheck=$enableval],
2762      [m4_tolower($1)_libcheck=yes])
2763
2764# At this point, if we're going to use the library, both LBRYINCDIR and
2765# LBRYLIB must be defined and not empty.
2766
2767  if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then
2768    if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then
2769      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.])
2770    fi
2771    m4_tolower(coin_has_$2)=true
2772    AC_MSG_RESULT(yes)
2773  else
2774    m4_tolower(coin_has_$2)=false
2775    AC_MSG_RESULT(no)
2776  fi
2777
2778# If we have instructions for use, consider header and link checks.
2779
2780  if test $m4_tolower(coin_has_$2) = true; then
2781
2782# If argument 3 (file) is given, check for the file. Typically this will be a
2783# header file, but that's not assumed.
2784
2785    m4_ifval([$3],
2786        [AC_COIN_CHECK_FILE([$$2INCDIR/$3],[],
2787             [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])])
2788
2789# Now see if we can link the function. There are arguments for and against
2790# assuming argument 3 is a header file declaring the function. A correct
2791# function declaration is the main argument in favour. Having to cope with
2792# possible dependencies or other oddities are the main arguments against.
2793# Force the use of C as the best single choice amongst C++, C, and Fortran.
2794# Obviously, this has limits.
2795
2796    m4_ifvaln([$4],
2797        [if test x"$m4_tolower($1)_libcheck" != xno; then
2798           coin_save_LIBS="$LIBS"
2799           LIBS="$$2LIB $ADDLIBS $5"
2800           coin_$2_link=no
2801           AC_LANG_PUSH(C)
2802           for fnm in $4 ; do
2803             AC_MSG_CHECKING([whether symbol $fnm is available with $2])
2804             AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$fnm()]])],
2805                 [AC_MSG_RESULT(yes)
2806                  coin_$2_link=yes
2807                  break],
2808                 [AC_MSG_RESULT(no)])
2809           done
2810           AC_LANG_POP(C)
2811           LIBS="$coin_save_LIBS"
2812           if test x"$coin_$2_link" != xyes ; then
2813             AC_MSG_ERROR([Cannot find symbol(s) $4 with $2])
2814           fi
2815         fi])
2816
2817# If we make it this far, we've verified the file and linked the function. Add
2818# the necessary link flags to ADDLIBS and $6_{PC}LIBS and define the preprocessor symbol
2819# COIN_HAS_LBRY.
2820
2821    ADDLIBS="$$2LIB $ADDLIBS"
2822    coin_foreach_w([myvar], [$6], [
2823      m4_toupper(myvar)_LIBS="$$2LIB $m4_toupper(myvar)_LIBS"
2824      m4_toupper(myvar)_PCLIBS="$$2LIB $m4_toupper(myvar)_PCLIBS"
2825      m4_toupper(myvar)_LIBS_INSTALLED="$$2LIB $m4_toupper(myvar)_LIBS_INSTALLED"
2826    ])
2827   
2828    AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is available])
2829  fi
2830
2831# Arrange for configure to substitute LBRYINCDIR and LBRYLIB and create the
2832# automake conditional. These actions must occur unconditionally.
2833
2834  AC_SUBST($2INCDIR)
2835  AC_SUBST($2LIB)
2836  AM_CONDITIONAL(COIN_HAS_$2, test $m4_tolower(coin_has_$2) = true)
2837]) #AC_COIN_CHECK_USER_LIBRARY
2838
2839###########################################################################
2840#                       COIN_HAS_USER_LIBRARY (deprecated)                #
2841###########################################################################
2842
2843AC_DEFUN([AC_COIN_HAS_USER_LIBRARY],
2844         [AC_COIN_CHECK_USER_LIBRARY([$1],[$2], [$3], [$4], [$5], [$6])])
2845
2846###########################################################################
2847#                               COIN_HAS_ASL (deprecated)                 #
2848###########################################################################
2849
2850# This macro checks if the user has provide arguments that say where
2851# the precompiled ASL files should be found (with the --with-asldir
2852# flag).  If this is not the case, we check if the ThirdParty/ASL
2853# directory has been configured, which indicates that the files will
2854# be in that directory and can be used.
2855
2856AC_DEFUN([AC_COIN_HAS_ASL],
2857[coin_aslobjdir=../ThirdParty/ASL
2858coin_aslsrcdir=$srcdir/$coin_aslobjdir
2859
2860# Determine the name of the ASL library
2861case "$CC" in
2862  cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
2863    ampllib=amplsolv.lib ;;
2864  *)
2865    ampllib=amplsolver.a ;;
2866esac
2867
2868AC_ARG_WITH([asldir],
2869            AC_HELP_STRING([--with-asldir],
2870                           [specify path to AMPL solver directory (or BUILD for compilation, or "no" for disabling AMPL)]),
2871            [use_asldir=$withval], [use_asldir=])
2872
2873if test "$use_asldir" = BUILD; then
2874  if test "$PACKAGE_NAME" != ThirdPartyASL; then
2875    # If we are configuring ThirdParty/ASL, don't check
2876    if test -r $coin_aslobjdir/.MakeOk; then :; else
2877      AC_MSG_ERROR([option \"BUILD\" specified for asldir, but directory is not configure (sources missing?)])
2878    fi
2879  fi
2880elif test -z "$use_asldir"; then
2881 # try to find sources - if not given don't compile
2882  if test "$PACKAGE_NAME" != ThirdPartyASL; then
2883    if test -r $coin_aslobjdir/.MakeOk; then
2884      use_asldir=BUILD
2885    else
2886      use_asldir=no
2887    fi
2888  else
2889    use_asldir=no
2890  fi
2891elif test "$use_asldir" != "no"; then
2892  AC_COIN_CHECK_FILE([$use_asldir/$ampllib],[],
2893                     [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but library missing])])
2894  AC_COIN_CHECK_FILE([$use_asldir/asl.h],[],
2895                     [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but header files are missing])])
2896  use_asldir=`cd $use_asldir; pwd`
2897  case $build in
2898    *-cygwin*) use_asldir=`cygpath -w $use_asldir | sed -e sX\\\\\\\\X/Xg` ;;
2899  esac
2900fi
2901
2902# Variable containing ASL library (including full path)
2903AC_SUBST(ASLLIB)
2904# Variable containing flags for including ASL header files
2905AC_SUBST(ASL_CPPFLAGS)
2906
2907if test "$use_asldir" = BUILD; then
2908  coin_aslobjdir=`cd $coin_aslobjdir; pwd`
2909  ASLLIB=`$CYGPATH_W $coin_aslobjdir/$ampllib | sed -e sX\\\\\\\\X/Xg`
2910  coin_aslsrcdir=`cd $coin_aslsrcdir; pwd`
2911  ASL_CPPFLAGS="-I"`$CYGPATH_W $coin_aslobjdir | sed -e sX\\\\\\\\X/Xg`" -I"`$CYGPATH_W $coin_aslsrcdir/solvers | sed -e sX\\\\\\\\X/Xg`
2912elif test "$use_asldir" != no; then
2913  ASLLIB=`$CYGPATH_W $use_asldir/$ampllib | sed -e sX\\\\\\\\X/Xg`
2914  ASL_CPPFLAGS="-I"`$CYGPATH_W $use_asldir | sed -e sX\\\\\\\\X/Xg`
2915fi
2916
2917if test "$use_asldir" != no; then
2918  AC_LANG_PUSH(C)
2919  AC_CHECK_LIB(dl,[dlopen],[ASLLIB="$ASLLIB -ldl"],[])
2920  coin_has_asl=yes
2921  AC_DEFINE([COIN_HAS_ASL],[1],
2922            [If defined, the Ampl Solver Library is available.])
2923  AC_LANG_POP(C)
2924else
2925  coin_has_asl=no
2926fi
2927AM_CONDITIONAL(COIN_HAS_ASL, test $coin_has_asl = yes)
2928]) # AC_COIN_HAS_ASL
2929
2930###########################################################################
2931#                            COIN_TRY_FLINK                               #
2932###########################################################################
2933
2934# Auxilliary macro to test if a Fortran function name can be linked,
2935# given the current settings of LIBS.  We determine from the context, what
2936# the currently active programming language is, and cast the name accordingly.
2937# The first argument is the name of the function/subroutine, in small letters,
2938# the second argument are the actions taken when the test works, and the
2939# third argument are the actions taken if the test fails.
2940
2941AC_DEFUN([AC_COIN_TRY_FLINK],
2942[case $ac_ext in
2943  f)
2944    AC_TRY_LINK(,[      call $1],[$2],[$3])
2945    ;;
2946  c)
2947    AC_F77_FUNC($1,cfunc$1)
2948    if test x"$coin_need_flibs" = xyes; then
2949      flink_try=no;
2950    else
2951      AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2952                  [flink_try=yes],[flink_try=no])
2953    fi
2954    if test $flink_try = yes; then
2955      $2
2956    else
2957      if test x"$FLIBS" != x; then
2958        flink_save_libs="$LIBS"
2959        LIBS="$LIBS $FLIBS"
2960        AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2961                    [LIBS="$flink_save_libs"
2962                     coin_need_flibs=yes
2963                     $2
2964                    ],
2965                    [LIBS="$flink_save_libs"
2966                     $3])
2967      else
2968        $3
2969      fi
2970    fi
2971    ;;
2972  cc|cpp)
2973    AC_F77_FUNC($1,cfunc$1)
2974    if test x"$coin_need_flibs" = xyes; then
2975      flink_try=no;
2976    else
2977      AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2978                  [flink_try=yes],[flink_try=no])
2979    fi
2980    if test $flink_try = yes; then
2981      $2
2982    else
2983      if test x"$FLIBS" != x; then
2984        flink_save_libs="$LIBS"
2985        LIBS="$LIBS $FLIBS"
2986        AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2987                    [LIBS="$flink_save_libs"
2988                     coin_need_flibs=yes
2989                     $2
2990                    ],
2991                    [LIBS="$flink_save_libs"
2992                     $3])
2993      else
2994        $3
2995      fi
2996    fi
2997    ;;
2998esac
2999]) # AC_COIN_TRY_FLINK
3000
3001###########################################################################
3002#                             COIN_HAS_BLAS (deprecated)                  #
3003###########################################################################
3004
3005# This macro checks for a library containing the BLAS library.  It
3006# tries standard libraries, and if none is found to be working, it
3007# checks whether the BLAS ThirdParty/Blas directory has been configured.
3008# It adds to ADDLIBS any flags required to link with an externally provided
3009# BLAS.  It defines the makefile conditional and preprocessor macro
3010# COIN_HAS_BLAS, if blas is available, and it defines the makefile conditional
3011# COIN_BUILD_BLAS, if blas is compiled within COIN.
3012
3013AC_DEFUN([AC_COIN_HAS_BLAS],
3014[if test "$PACKAGE_NAME" = ThirdPartyBlas || test "$PACKAGE_NAME" = ThirdPartyLapack || test "$PACKAGE_NAME" = ThirdPartyMumps; then
3015  coin_blasobjdir=../Blas
3016else
3017  coin_blasobjdir=../ThirdParty/Blas
3018fi
3019coin_blassrcdir=$srcdir/$coin_blasobjdir
3020
3021AC_ARG_WITH([blas],
3022            AC_HELP_STRING([--with-blas],
3023                           [specify BLAS library (or BUILD for compilation)]),
3024            [use_blas=$withval], [use_blas=])
3025
3026MAKEOKFILE=.MakeOk
3027# Check if user supplied option makes sense
3028if test x"$use_blas" != x; then
3029  if test "$use_blas" = "BUILD"; then
3030    # Don't check for course code if this is executed in ThirdParty/Blas
3031    if test "$PACKAGE_NAME" != ThirdPartyBlas; then
3032      if test -r $coin_blasobjdir/.MakeOk; then :; else
3033        AC_MSG_ERROR([option \"BUILD\" specified for Blas, but $coin_blasobjdir directory is not properly configured])
3034      fi
3035    fi
3036  elif test "$use_blas" != no ; then
3037    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
3038    LIBS="$use_blas $LIBS"
3039    ADDLIBS="$use_blas $ADDLIBS"
3040    AC_COIN_TRY_FLINK([daxpy],
3041                      [AC_MSG_RESULT([yes])],
3042                      [AC_MSG_RESULT([no])
3043                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
3044  fi
3045else
3046# Try to autodetect the library for blas based on build system
3047  #AC_MSG_CHECKING([default locations for BLAS])
3048  skip_lblas_check=no
3049  case $build in
3050    *-sgi-*)
3051      SAVE_LIBS="$LIBS"
3052      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
3053      LIBS="-lcomplib.sgimath $LIBS"
3054      AC_COIN_TRY_FLINK([daxpy],
3055                        [AC_MSG_RESULT([yes])
3056                         use_blas=-lcomplib.sgimath;
3057                         ADDLIBS="-lcomplib.sgimath $ADDLIBS"],
3058                        [AC_MSG_RESULT([no])
3059                         SAVE_LIBS="$LIBS"])
3060      ;;
3061
3062# Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
3063# cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
3064# recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
3065# that CC and cc will understand -library in Studio 13. The main extra
3066# function of -xlic_lib and -library is to arrange for the Fortran run-time
3067# libraries to be linked for C++ and C. We can arrange that explicitly.
3068    *-*-solaris*)
3069      SAVE_LIBS="$LIBS"
3070      AC_MSG_CHECKING([for BLAS in libsunperf])
3071      LIBS="-lsunperf $FLIBS $LIBS"
3072      AC_COIN_TRY_FLINK([daxpy],
3073                        [AC_MSG_RESULT([yes])
3074                         use_blas='-lsunperf'
3075                         ADDLIBS="-lsunperf $ADDLIBS"
3076                         coin_need_flibs=yes],
3077                        [AC_MSG_RESULT([no])
3078                         LIBS="$SAVE_LIBS"])
3079      ;;
3080    *-cygwin* | *-mingw*)
3081# On cygwin, consider -lblas only if doscompile is disabled. The prebuilt
3082# library will want to link with cygwin, hence won't run standalone in DOS.
3083      if test "$enable_doscompile" = mingw; then
3084        skip_lblas_check=yes
3085      fi
3086      case "$CC" in
3087        cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
3088          SAVE_LIBS="$LIBS"
3089          AC_MSG_CHECKING([for BLAS in MKL])
3090          LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
3091          AC_COIN_TRY_FLINK([daxpy],
3092                            [AC_MSG_RESULT([yes])
3093                             use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'
3094                             ADDLIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $ADDLIBS"],
3095                            [AC_MSG_RESULT([no])
3096                             LIBS="$SAVE_LIBS"])
3097          ;;
3098      esac
3099      ;;
3100  esac
3101
3102  if test -z "$use_blas" && test $skip_lblas_check = no; then
3103    SAVE_LIBS="$LIBS"
3104    AC_MSG_CHECKING([whether -lblas has BLAS])
3105    LIBS="-lblas $LIBS"
3106    AC_COIN_TRY_FLINK([daxpy],
3107                      [AC_MSG_RESULT([yes])
3108                       ADDLIBS="-lblas $ADDLIBS"
3109                       use_blas='-lblas'],
3110                      [AC_MSG_RESULT([no])
3111                       LIBS="$SAVE_LIBS"])
3112  fi
3113
3114# If we have no other ideas, consider building BLAS.
3115  if test -z "$use_blas"; then
3116    if test "$PACKAGE_NAME" != ThirdPartyBlas; then
3117      if test -r $coin_blasobjdir/.MakeOk; then
3118        use_blas=BUILD
3119      fi
3120    fi
3121  fi
3122fi
3123
3124if test "$use_blas" = BUILD; then
3125  coin_need_flibs=yes
3126fi
3127
3128AM_CONDITIONAL([COIN_HAS_BLAS],[test x"$use_blas" != x])
3129AM_CONDITIONAL([COIN_BUILD_BLAS],[test "$use_blas" = BUILD])
3130
3131if test x"$use_blas" = x || test "$use_blas" = no; then
3132  coin_has_blas=no
3133else
3134  coin_has_blas=yes
3135  AC_DEFINE([COIN_HAS_BLAS],[1],
3136            [If defined, the BLAS Library is available.])
3137fi
3138]) # AC_COIN_HAS_BLAS
3139
3140###########################################################################
3141#                            COIN_HAS_LAPACK (deprecated)                 #
3142###########################################################################
3143
3144# This macro checks for a library containing the LAPACK library.  It
3145# tries standard libraries, and if none is found to be working, it
3146# checks whether the LAPACK ThirdParty/Lapack directory has been
3147# configured.  It adds to ADDLIBS any flags required to link with an
3148# externally provided LAPACK.  It defines the makefile conditional and
3149# preprocessor macro COIN_HAS_LAPACK, if lapack is available, and it
3150# defines the makefile conditional COIN_BUILD_LAPACK, if lapack is
3151# compiled within COIN.
3152
3153AC_DEFUN([AC_COIN_HAS_LAPACK],
3154[coin_lapackobjdir=../ThirdParty/Lapack
3155coin_lapacksrcdir=$srcdir/$coin_lapackobjdir
3156
3157AC_ARG_WITH([lapack],
3158            AC_HELP_STRING([--with-lapack],
3159                           [specify LAPACK library (or BUILD for compilation)]),
3160            [use_lapack=$withval], [use_lapack=])
3161
3162# Check if user supplied option makes sense
3163if test x"$use_lapack" != x; then
3164  if test "$use_lapack" = "BUILD"; then
3165    # Don't check for course code if this is executed in ThirdParty/Lapack
3166    if test "$PACKAGE_NAME" != ThirdPartyLapack; then
3167      if test -r $coin_lapackobjdir/.MakeOk; then :; else
3168        AC_MSG_ERROR([option \"BUILD\" specified for LAPACK, but $coin_lapackobjdir directory is not configured])
3169      fi
3170    fi
3171  elif test "$use_lapack" != no; then
3172    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
3173    LIBS="$use_lapack $LIBS"
3174    ADDLIBS="$use_lapack $ADDLIBS"
3175    AC_COIN_TRY_FLINK([dsyev],
3176                      [AC_MSG_RESULT([yes])],
3177                      [AC_MSG_RESULT([no])
3178                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
3179  fi
3180else
3181  if test x$coin_has_blas = xyes; then
3182    # First try to see if LAPACK is already available with BLAS library
3183    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
3184    AC_COIN_TRY_FLINK([dsyev],
3185                      [AC_MSG_RESULT([yes]); use_lapack=ok],
3186                      [AC_MSG_RESULT([no])])
3187  fi
3188  skip_llapack_check=no
3189  if test -z "$use_lapack"; then
3190    # Try to autodetect the library for lapack based on build system
3191    case $build in
3192      *-sgi-*)
3193        SAVE_LIBS="$LIBS"
3194        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
3195        LIBS="-lcomplib.sgimath $LIBS"
3196        AC_COIN_TRY_FLINK([dsyev],
3197                          [AC_MSG_RESULT([yes])
3198                           use_lapack=-lcomplib.sgimath;
3199                           ADDLIBS="-lcomplib.sgimath $ADDLIBS"],
3200                          [AC_MSG_RESULT([no])
3201                           SAVE_LIBS="$LIBS"])
3202        ;;
3203
3204# See comments in COIN_HAS_BLAS.
3205      *-*-solaris*)
3206      SAVE_LIBS="$LIBS"
3207      AC_MSG_CHECKING([for LAPACK in libsunperf])
3208      LIBS="-lsunperf $FLIBS $LIBS"
3209      AC_COIN_TRY_FLINK([dsyev],
3210                        [AC_MSG_RESULT([yes])
3211                         use_blas='-lsunperf'
3212                         ADDLIBS="-lsunperf $ADDLIBS"
3213                         coin_need_flibs=yes],
3214                        [AC_MSG_RESULT([no])
3215                         LIBS="$SAVE_LIBS"])
3216        ;;
3217# On cygwin, do this check only if doscompile is disabled. The prebuilt library
3218# will want to link with cygwin, hence won't run standalone in DOS.
3219      *-cygwin*)
3220        if test "$enable_doscompile" = mingw; then
3221          skip_llapack_check=yes
3222        fi
3223        ;;
3224    esac
3225  fi
3226
3227  if test -z "$use_lapack" && test $skip_llapack_check = no; then
3228    SAVE_LIBS="$LIBS"
3229    AC_MSG_CHECKING([whether -llapack has LAPACK])
3230    LIBS="-llapack $LIBS"
3231    AC_COIN_TRY_FLINK([dsyev],
3232                      [AC_MSG_RESULT([yes])
3233                       ADDLIBS="-llapack $ADDLIBS"
3234                       use_lapack='-llapack'],
3235                      [AC_MSG_RESULT([no])
3236                       LIBS="$SAVE_LIBS"])
3237  fi
3238
3239# If we have no other ideas, consider building LAPACK.
3240  if test -z "$use_lapack"; then
3241    if test "$PACKAGE_NAME" != ThirdPartyLapack; then
3242      if test -r $coin_lapackobjdir/.MakeOk; then
3243        use_lapack=BUILD
3244      fi
3245    fi
3246  fi
3247fi
3248
3249if test "$use_lapack" = BUILD; then
3250  coin_need_flibs=yes
3251fi
3252
3253AM_CONDITIONAL([COIN_HAS_LAPACK],[test x"$use_lapack" != x])
3254AM_CONDITIONAL([COIN_BUILD_LAPACK],[test "$use_lapack" = BUILD])
3255
3256if test x"$use_lapack" = x || test "$use_lapack" = no; then
3257  coin_has_lapack=no
3258else
3259  coin_has_lapack=yes
3260  AC_DEFINE([COIN_HAS_LAPACK],[1],
3261            [If defined, the LAPACK Library is available.])
3262fi
3263]) # AC_COIN_HAS_LAPACK
3264
3265###########################################################################
3266#                            COIN_HAS_MUMPS (deprecated)                  #
3267###########################################################################
3268
3269# This macro checks for a library containing the MUMPS library.  It
3270# checks if the user has provided an argument for the MUMPS library,
3271# and if not, it checks whether the MUMPS ThirdParty/Mumps directory has
3272# been configured.  It adds to ADDLIBS any flags required to link with
3273# an externally provided MUMPS.  It defines the makefile conditional
3274# and preprocessor macro COIN_HAS_MUMPS, if MUMPS is available, and it
3275# defines the makefile conditional COIN_BUILD_MUMPS, if MUMPS is
3276# compiled within COIN.
3277
3278AC_DEFUN([AC_COIN_HAS_MUMPS],
3279[
3280if test "$PACKAGE_NAME" = ThirdPartyMumps; then
3281  coin_mumpsobjdir=../Mumps
3282else
3283  coin_mumpsobjdir=../ThirdParty/Mumps
3284fi
3285coin_mumpssrcdir=$abs_source_dir/$coin_mumpsobjdir/MUMPS
3286
3287MAKEOKFILE=.MakeOk
3288
3289#check if user provides a MUMPS library (that works)
3290AC_LANG_PUSH(C)
3291SAVE_ADDLIBS="$ADDLIBS"
3292ADDLIBS="$ADDLIBS $FLIBS"
3293AC_COIN_HAS_USER_LIBRARY(mumps, MUMPS, dmumps_c.h, dmumps_c)
3294ADDLIBS="$SAVE_ADDLIBS"
3295AC_LANG_POP(C)
3296
3297if test "$coin_has_mumps" = "true"; then  # user provided mumps library
3298  use_mumps=yes
3299  coin_has_mumps=yes
3300
3301  MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $MUMPSINCDIR\`"
3302  ADDLIBS="$MUMPSLIB $ADDLIBS"
3303
3304else # no user provided library, so we try to build our own
3305  use_mumps=BUILD
3306
3307  # Check if the MUMPS' ThirdParty project has been configured
3308  if test "$PACKAGE_NAME" != ThirdPartyMumps; then
3309    if test -r $coin_mumpsobjdir/.MakeOk; then
3310      use_mumps=BUILD
3311      # Mumps needs pthreads
3312      AC_LANG_PUSH(C)
3313      save_LIBS="$LIBS"
3314      LIBS="$LIBS $FLIBS"
3315      AC_CHECK_LIB([pthread],[pthread_create],[LIBS="-lpthread $save_LIBS"; ADDLIBS="-lpthread $ADDLIBS"],[LIBS="save_LIBS"])
3316      AC_LANG_POP(C)
3317 
3318      MUMPS_INCFLAGS="-I\`\$(CYGPATH_W) $coin_mumpssrcdir/libseq\` -I\`\$(CYGPATH_W) $coin_mumpssrcdir/include\`"
3319    else
3320      use_mumps=
3321    fi
3322  fi
3323
3324  # if a user provided library is used, then COIN_HAS_USER_LIBRARY takes care of the COIN_HAS_MUMPS conditional and preprocessor symbol
3325  AM_CONDITIONAL([COIN_HAS_MUMPS],[test x"$use_mumps" != x])
3326  if test x"$use_mumps" != x; then
3327    AC_DEFINE([COIN_HAS_MUMPS],[1],[If defined, the MUMPS Library is available.])
3328    coin_has_mumps=yes
3329  else
3330    coin_has_mumps=no
3331  fi
3332  AC_MSG_CHECKING([whether MUMPS is available])
3333  AC_MSG_RESULT([$coin_has_mumps])
3334fi
3335
3336if test x"$use_mumps" != x; then
3337  # we need the Fortran runtime libraries if we want to link with C/C++
3338  coin_need_flibs=yes
3339
3340  AC_SUBST(MUMPS_INCFLAGS)
3341fi
3342
3343AM_CONDITIONAL([COIN_BUILD_MUMPS],[test "$use_mumps" = BUILD])
3344
3345]) # AC_COIN_HAS_MUMPS
3346
3347###########################################################################
3348#                            COIN_HAS_METIS (deprecated)                  #
3349###########################################################################
3350
3351# This macro checks for a library containing the METIS library.  It
3352# checks if the user has provided an argument for the METIS library,
3353# and if not, it checks whether the METIS ThirdParty/Metis directory has
3354# been configured.  It adds to ADDLIBS any flags required to link with
3355# an externally provided METIS.  It defines the makefile conditional
3356# and preprocessor macro COIN_HAS_METIS, if METIS is available, and it
3357# defines the makefile conditional COIN_BUILD_METIS, if METIS is
3358# compiled within COIN.
3359
3360AC_DEFUN([AC_COIN_HAS_METIS],
3361[
3362case "$PACKAGE_NAME" in
3363  ThirdParty*)
3364    coin_metisobjdir=../Metis
3365    ;;
3366  *)
3367    coin_metisobjdir=../ThirdParty/Metis
3368    ;;
3369esac
3370
3371MAKEOKFILE=.MakeOk
3372
3373#check if user provides a METIS library (that works)
3374AC_LANG_PUSH(C)
3375AC_ARG_WITH(metis,
3376   AS_HELP_STRING([--with-metis], [specify flags to link with METIS library]),
3377   [METISLIB="$withval"; coin_has_metis=true], [coin_has_metis=no])
3378
3379if test $coin_has_metis = true; then
3380  coin_save_LIBS="$LIBS"
3381  LIBS="$METISLIB $ADDLIBS"
3382  AC_MSG_CHECKING([whether symbol metis_nodend is available with ])
3383  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[metis_nodend()]])],
3384     [AC_MSG_RESULT(yes)],
3385     [AC_MSG_RESULT(no)
3386      AC_MSG_ERROR([User-supplied METIS library does not work])])
3387  LIBS="$coin_save_LIBS"
3388fi
3389AC_LANG_POP(C)
3390
3391if test "$coin_has_metis" = "true"; then  # user provided metis library
3392  use_metis=yes
3393  coin_has_metis=yes
3394
3395  ADDLIBS="$METISLIB $ADDLIBS"
3396
3397else # no user provided library, so we try to build our own
3398  use_metis=BUILD
3399
3400  # Check if the METIS' ThirdParty project has been configured
3401  if test "$PACKAGE_NAME" != ThirdPartyMetis; then
3402    if test -r $coin_metisobjdir/.MakeOk; then
3403      use_metis=BUILD
3404    else
3405      use_metis=
3406    fi
3407  fi
3408
3409  if test x"$use_metis" != x; then
3410    coin_has_metis=yes
3411  else
3412    coin_has_metis=no
3413  fi
3414  AC_MSG_CHECKING([whether METIS is available])
3415  AC_MSG_RESULT([$coin_has_metis])
3416fi
3417
3418AM_CONDITIONAL([COIN_HAS_METIS],[test $coin_has_metis = yes])
3419if test $coin_has_metis = yes; then
3420  AC_DEFINE([COIN_HAS_METIS],[1],[If defined, the METIS library is available.])
3421fi
3422
3423]) # AC_COIN_HAS_METIS
3424
3425
3426###########################################################################
3427#                             COIN_HAS_GLPK (deprecated)                  #
3428###########################################################################
3429#
3430# This macro checks for the GLPK package. GLPK provides two capabilities,
3431# an LP and MIP solver (GLPK) and the GNU Mathprog modelling language (GMPL).
3432# The macro checks for either Glpk or Gmpl, according to the value specified as
3433# the parameter. Use one of Glpk or Gmpl. Use *exactly* these strings, eh?
3434#
3435#
3436# The macro first uses COIN_HAS_USER_LIBRARY to see if the user has specified
3437# a preexisting library (this allows the use of any glpk version, if the user
3438# is fussy). The macro then checks for ThirdParty/Glpk.
3439#
3440# This macro will define the following variables for Glpk:
3441#   coin_has_glpk       true or false
3442#   GLPKLIB             link flags for GLPK (if user supplied)
3443#   GLPKINCDIR          location of glpk include files
3444#   COIN_HAS_GLPK       Preprocessor symbol, defined to 1
3445#   COIN_HAS_GLPK       Automake conditional
3446#   COIN_BUILD_GLPK     Automake conditional, defined only if Glpk is to be
3447#                       built in ThirdParty/Glpk
3448#
3449# With the exception of COIN_BUILD_GLPK, an identical set of variables is
3450# defined for Gmpl.
3451
3452AC_DEFUN([AC_COIN_HAS_GLPK],
3453[
3454if test "$PACKAGE_NAME" = ThirdPartyGlpk; then
3455  coin_glpkobjdir=../Glpk
3456else
3457  coin_glpkobjdir=../ThirdParty/Glpk
3458fi
3459coin_glpksrcdir=$abs_source_dir/$coin_glpkobjdir
3460
3461use_thirdpartyglpk=no
3462
3463# Check for the requested component. If the user specified an external glpk
3464# library don't force a ThirdParty build, let the error propagate.
3465
3466m4_if([$1],[Glpk],
3467[AC_COIN_HAS_USER_LIBRARY([Glpk],[GLPK],[glpk.h],
3468    [_glp_lpx_simplex glp_lpx_simplex])
3469 if test x"$coin_has_glpk" = xfalse && test x"$GLPKLIB" = x ; then
3470   use_thirdpartyglpk=try
3471 fi])
3472m4_if([$1],[Gmpl],
3473[AC_COIN_HAS_USER_LIBRARY([Gmpl],[GMPL],[glpmpl.h],
3474    [_glp_mpl_initialize glp_mpl_initialize])
3475 if test x"$coin_has_gmpl" = xfalse && test x"$GMPLLIB" = x ; then
3476   use_thirdpartyglpk=try
3477 fi])
3478
3479# If the user has supplied an external library, use it. Otherwise, consider
3480# a build in ThirdParty/Glpk. If we build, assume we get both glpk and gmpl.
3481
3482if test x"$use_thirdpartyglpk" = xtry ; then
3483  MAKEOKFILE=.MakeOk
3484  # Check if the Glpk's ThirdParty project has been configured
3485  if test "$PACKAGE_NAME" != ThirdPartyGlpk; then
3486    if test -r $coin_glpkobjdir/.MakeOk; then
3487      use_thirdpartyglpk=build
3488    else
3489      use_thirdpartyglpk=no
3490    fi
3491  else
3492    use_thirdpartyglpk=build
3493  fi
3494
3495# If we're building, set the library and include directory variables, create a
3496# preprocessor symbol, define a variable that says we're using glpk/gmpl, and
3497# another to indicate a link check is a bad idea (hard to do before the library
3498# exists).
3499
3500  if test x"$use_thirdpartyglpk" = xbuild ; then
3501    m4_toupper($1INCDIR)="$coin_glpksrcdir/glpk/include"
3502    AC_SUBST(m4_toupper($1INCDIR))
3503    AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],
3504              [Define to 1 if $1 package is available])
3505    m4_tolower(coin_has_$1)=true
3506    m4_tolower($1_libcheck)=no
3507    m4_toupper($1OBJDIR)=`cd $coin_glpkobjdir; pwd`
3508    AC_SUBST(m4_toupper($1OBJDIR))
3509    AC_MSG_NOTICE([Using $1 in ThirdParty/Glpk])
3510  fi
3511fi
3512
3513# Define the necessary automake conditionals.
3514
3515AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
3516               [test x"$m4_tolower(coin_has_$1)" = xtrue])
3517AM_CONDITIONAL([COIN_BUILD_GLPK],[test x"$use_thirdpartyglpk" = xbuild])
3518
3519]) # AC_COIN_HAS_GLPK
3520
3521
3522###########################################################################
3523#                           COIN_DOXYGEN                                  #
3524###########################################################################
3525#
3526# This macro determines the configuration information for doxygen, the tool
3527# used to generate online documentation of COIN code. It takes one parameter,
3528# a list of projects (mixed-case, to match the directory names) that should
3529# be processed as external tag files. E.g., COIN_DOXYGEN([Clp Osi]).
3530#
3531# This macro will define the following variables:
3532#  coin_have_doxygen    Yes if doxygen is found, no otherwise
3533#  coin_doxy_usedot     Defaults to `yes'; --with-dot will still check to see
3534#                       if dot is available
3535#  coin_doxy_tagname    Name of doxygen tag file (placed in doxydoc directory)
3536#  coin_doxy_logname    Name of doxygen log file (placed in doxydoc directory)
3537#  coin_doxy_tagfiles   List of doxygen tag files used to reference other
3538#                       doxygen documentation
3539#  coin_doxy_excludes   Directories to exclude from doxygen processing
3540
3541AC_DEFUN([AC_COIN_DOXYGEN],
3542[
3543
3544AC_MSG_NOTICE([configuring doxygen documentation options])
3545
3546# Check to see if doxygen is available.
3547
3548AC_CHECK_PROG([coin_have_doxygen],[doxygen],[yes],[no])
3549
3550# Look for the dot tool from the graphviz package, unless the user has
3551# disabled it.
3552
3553AC_ARG_WITH([dot],
3554  AS_HELP_STRING([--with-dot],
3555                 [use dot (from graphviz) when creating documentation with
3556                  doxygen if available; --without-dot to disable]),
3557  [],[withval=yes])
3558if test x"$withval" = xno ; then
3559  coin_doxy_usedot=NO
3560  AC_MSG_CHECKING([for dot ])
3561  AC_MSG_RESULT([disabled])
3562else
3563  AC_CHECK_PROG([coin_doxy_usedot],[dot],[YES],[NO])
3564fi
3565
3566# Generate a tag file name and a log file name
3567
3568AC_SUBST([coin_doxy_tagname],[doxydoc/${PACKAGE}_doxy.tag])
3569AC_SUBST([coin_doxy_logname],[doxydoc/${PACKAGE}_doxy.log])
3570
3571# Process the list of project names and massage them into possible doxygen
3572# doc'n directories. Prefer 1) classic external, source processed using
3573# a project-specific doxygen.conf, we use the tag file; 2) classic
3574# external, source processed using package doxygen.conf; 3) installed
3575# doxydoc. Alternatives 1) and 2) are only possible if the directory will be
3576# configured, which we can't know unless this is the package base configure,
3577# since coin_subdirs is only set there. Hence it's sufficient to check for
3578# membership. If we use a tag file from a classic external, exclude the
3579# source from doxygen processing when doxygen runs in the base directory.
3580
3581coin_doxy_tagfiles=
3582coin_doxy_excludes=
3583tmp="$1"
3584for proj in $tmp ; do
3585  lc_proj=`echo $proj | [tr [A-Z] [a-z]]`
3586  AC_MSG_CHECKING([for doxygen doc'n for $proj ])
3587  doxytag=${lc_proj}_doxy.tag
3588  doxyfound=no
3589  for chkProj in $coin_subdirs ; do
3590    if test "$chkProj" = "$proj" ; then
3591      # proj will be configured, hence doxydoc present in build tree
3592      doxysrcdir="${srcdir}/${proj}"
3593      # AC_MSG_NOTICE([Considering $doxysrcdir (base)])
3594      if test -d "$doxysrcdir" ; then
3595        # with a doxydoc directory?
3596        doxydir="$doxysrcdir/doxydoc"
3597        # AC_MSG_NOTICE([Considering $doxydir (base)])
3598        # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
3599        if test -d "$doxydir" ; then
3600          # use tag file; don't process source
3601          eval doxydir="`pwd`/${proj}/doxydoc"
3602          coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
3603          AC_MSG_RESULT([$doxydir (tag)])
3604          coin_doxy_excludes="$coin_doxy_excludes */${proj}"
3605        else
3606          # will process the source -- nothing further to be done here
3607          AC_MSG_RESULT([$doxysrcdir (src)])
3608        fi
3609        doxyfound=yes
3610      fi
3611    fi
3612  done
3613  # Not built, fall back to installed tag file
3614  if test $doxyfound = no ; then
3615    eval doxydir="${datadir}/coin/doc/${proj}/doxydoc"
3616    # AC_MSG_NOTICE([Considering $doxydir (install)])
3617    # AC_MSG_NOTICE([Subdirs: $coin_subdirs)])
3618    coin_doxy_tagfiles="$coin_doxy_tagfiles $doxydir/$doxytag=$doxydir/html"
3619    AC_MSG_RESULT([$doxydir (tag)])
3620  fi
3621done
3622AC_SUBST([coin_doxy_tagfiles])
3623AC_SUBST([coin_doxy_excludes])
3624
3625]) # AC_COIN_DOXYGEN
3626
3627
3628###########################################################################
3629#                           COIN_HAS_PKGCONFIG                            #
3630###########################################################################
3631
3632# This macro checks whether a pkg-config tool with a minimal version number
3633# is available.  If so, then the variable PKGCONFIG is set to its path.
3634# If not, PKGCONFIG is set to "".  The minimal version number can be given
3635# as first parameter, by default it is 0.9.0.  This macro is a modified
3636# version of PKG_PROG_PKG_CONFIG in pkg.m4.  Further, the AM_CONDITIONAL
3637# COIN_HAS_PKGCONFIG is set and PKGCONFIG is AC_SUBST'ed.  Finally, if this
3638# setup belongs to a project directory, then the search path for .pc files
3639# is assembled from the value of $PKG_CONFIG_PATH, the values of --prefix,
3640# --coin-instdir, and the directory named in a file ../coin_subdirs.txt
3641# or ../../coin_subdirs.txt in a variable COIN_PKG_CONFIG_PATH, which is
3642# also AC_SUBST'ed.
3643
3644AC_DEFUN([AC_COIN_HAS_PKGCONFIG],
3645[AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
3646
3647AC_ARG_ENABLE([pkg-config],
3648  [AC_HELP_STRING([--enable-pkg-config],[use pkg-config if available (default is yes)])],
3649  [use_pkgconfig="$enableval"],
3650  [use_pkgconfig=yes])
3651
3652if test $use_pkgconfig = yes ; then
3653  if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
3654    AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
3655  fi
3656  if test -n "$PKG_CONFIG"; then
3657    _pkg_min_version=m4_default([$1], [0.9.0])
3658    AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
3659    if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
3660      AC_MSG_RESULT([yes])
3661    else
3662      AC_MSG_RESULT([no])
3663      PKG_CONFIG=""
3664    fi
3665  fi
3666
3667  # check if pkg-config supports the short-errors flag
3668  if test -n "$PKG_CONFIG" && \
3669    $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
3670    pkg_short_errors=" --short-errors "
3671  else
3672    pkg_short_errors=""
3673  fi
3674fi
3675
3676AM_CONDITIONAL([COIN_HAS_PKGCONFIG], [test -n "$PKG_CONFIG"])
3677AC_SUBST(PKG_CONFIG)
3678
3679# assemble pkg-config search path for installed projects
3680COIN_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
3681
3682# 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
3683# best would actually to use ${libdir}, since .pc files get installed into ${libdir}/pkgconfig,
3684# unfortunately, ${libdir} expands to ${exec_prefix}/lib and ${exec_prefix} to ${prefix}...
3685if test "x${prefix}" = xNONE ; then
3686  COIN_PKG_CONFIG_PATH="${ac_default_prefix}/lib/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3687else
3688  COIN_PKG_CONFIG_PATH="${prefix}/lib/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3689fi
3690
3691AC_ARG_WITH([coin-instdir],
3692  AC_HELP_STRING([--with-coin-instdir],
3693                 [prefix of installation directory for precompiled COIN packages]),
3694  [if test -d "$withval"; then : ; else
3695     AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
3696   fi
3697   COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:${COIN_PKG_CONFIG_PATH}"
3698  ],[])
3699
3700AC_SUBST(COIN_PKG_CONFIG_PATH)
3701
3702# assemble additional pkg-config search paths for uninstalled projects
3703if test x$coin_projectdir = xyes ; then
3704  # if we are in a project setup, then in a classic setup, we want to find uninstalled projects
3705  # their (relative) location is written to coin_subdirs.txt by the configure in the project base directory
3706  # unfortunately, if the user set prefix, then we do not know where the project base directory is located
3707  # 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)
3708  COIN_PKG_CONFIG_PATH_UNINSTALLED=
3709  if test -e ../coin_subdirs.txt ; then
3710    for i in `cat ../coin_subdirs.txt` ; do
3711      if test -d ../$i ; then
3712        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3713      fi
3714    done
3715  fi
3716
3717  if test -e ../../coin_subdirs.txt ; then
3718    for i in `cat ../../coin_subdirs.txt` ; do
3719      if test -d ../../$i ; then
3720        COIN_PKG_CONFIG_PATH_UNINSTALLED="`cd ../../$i; pwd`:${COIN_PKG_CONFIG_PATH_UNINSTALLED}"
3721      fi
3722    done
3723  fi
3724
3725  AC_SUBST(COIN_PKG_CONFIG_PATH_UNINSTALLED)
3726fi
3727
3728])
3729
3730###########################################################################
3731#                           COIN_PKG_CHECK_PROJECT_EXISTS                 #
3732###########################################################################
3733
3734# COIN_PKG_CHECK_PROJECT_EXISTS(PROJECT, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3735#
3736# Check to see whether a particular project exists.  Similar
3737# to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables
3738#
3739AC_DEFUN([AC_COIN_PKG_CHECK_PROJECT_EXISTS],
3740[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3741if test -n "$PKG_CONFIG" ; then
3742  if $PKG_CONFIG --exists "m4_tolower($1)"; then
3743    m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null`
3744    m4_ifval([$2], [$2], [:])
3745  else
3746    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"`
3747    $3
3748  fi
3749else
3750  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
3751fi
3752])
3753
3754###########################################################################
3755#                           COIN_PKG_CHECK_MODULE_EXISTS                  #
3756###########################################################################
3757
3758# COIN_PKG_CHECK_MODULES_EXISTS(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3759#
3760# Check to see whether a particular set of packages exists.
3761# Similar to PKG_CHECK_MODULES(), but set only the variable $1_VERSIONS and $1_PKG_ERRORS
3762#
3763AC_DEFUN([AC_COIN_PKG_CHECK_MODULE_EXISTS],
3764[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3765if test -n "$PKG_CONFIG" ; then
3766  if $PKG_CONFIG --exists "$2"; then
3767    m4_toupper($1)[]_VERSIONS="`$PKG_CONFIG --modversion "$2" 2>/dev/null`"
3768    $3
3769  else
3770    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "$2"`
3771    $4
3772  fi
3773else
3774  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
3775fi
3776])
3777
3778###########################################################################
3779#                           COIN_PKG_HAS_MODULE                           #
3780###########################################################################
3781
3782# COIN_PKG_HAS_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3783#
3784# Checks whether pkg-config files for a given set of packages is available.
3785# If so, sets MODULE_CFLAGS, MODULE_LIBS, and MODULES_DATA and executes ACTION-IF-FOUND.
3786# If not, then ACTION-IF-NOT-FOUND is executed.
3787# A reason for not finding a package is stored in MODULE_PKG_ERRORS
3788#
3789# --------------------------------------------------------------
3790AC_DEFUN([AC_COIN_PKG_HAS_MODULE],
3791[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3792
3793AC_COIN_PKG_CHECK_MODULE_EXISTS([$1],[$2],
3794  [ cflags=`$PKG_CONFIG --cflags "$2" 2>/dev/null`
3795    # pkg-config cannot handle spaces, so CYGPATH_W cannot be put into .pc files
3796        # thus, we modify the cflags extracted from pkg-config by putting CYGPATH_W behind -I's
3797        # but only do this if is not trivial
3798    if test "$CYGPATH_W" != "echo" ; then
3799      # need to put into brackets since otherwise autoconf replaces the brackets in the sed command
3800      [cflags=`echo $cflags | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
3801    fi
3802    m4_toupper($1)[]_CFLAGS="$cflags"
3803    m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "$2" 2>/dev/null`
3804    m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "$2" 2>/dev/null`
3805    $3
3806  ],
3807  [ $4 ])
3808
3809])# PKG_CHECK_MODULES
3810
3811###########################################################################
3812#                           COIN_MAIN_PACKAGEDIR                          #
3813###########################################################################
3814
3815# This macro substitutes COIN_MAIN_SUBDIR.
3816# If $2/$1 or $1 is in COIN_SKIP_PROJECTS, do nothing.
3817# If --with-$1-lib, --with-$1-incdir, or --with-$1-datadir is given, then assume that the package is installed.
3818# Otherwise, if pkg-config is available, use it to check whether the package is available.
3819#   If $4 is given, then pkg-config is asked for the existance of $4, otherwise tolower($1) is used.
3820# Otherwise, if the directory $2/$1 and the file $2/$1/$3 exist, check whether $2/$1/configure exists.
3821#   If so, include this directory into the list of directories where configure and make recourse into.
3822# tolower(coin_has_$1) is set to notGiven, skipping, installed, the version of an installed project, or the projects main directory (if uninstalled).
3823
3824AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],
3825[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3826AC_MSG_CHECKING([whether project $1 is available])
3827
3828m4_tolower(coin_has_$1)=notGiven
3829coin_have_project_dir=no
3830
3831# check if user wants to skip project in any case
3832AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
3833if test x"$COIN_SKIP_PROJECTS" != x; then
3834  for dir in $COIN_SKIP_PROJECTS; do
3835    if test $dir = "$1"; then
3836      m4_tolower(coin_has_$1)=skipping
3837    fi
3838    if test $dir = "$2/$1"; then
3839      m4_tolower(coin_has_$1)=skipping
3840    fi
3841  done
3842fi
3843
3844if test "$m4_tolower(coin_has_$1)" != skipping; then
3845  if test $PACKAGE_TARNAME = m4_tolower($1); then
3846    m4_tolower(coin_has_$1)=yes
3847    coin_have_project_dir=yes
3848  fi
3849
3850  AC_ARG_WITH([m4_tolower($1)-lib],
3851    AC_HELP_STRING([--with-m4_tolower($1)-lib],
3852                   [linker flags for using project $1]),
3853      [m4_tolower(coin_has_$1)="yes, via --with-m4_tolower($1)-lib"],
3854      [])
3855
3856  AC_ARG_WITH([m4_tolower($1)-incdir],
3857    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
3858                   [directory with header files for using project $1]),
3859    [m4_tolower(coin_has_$1)="yes, via --with-m4_tolower($1)-incdir"],
3860    [])
3861
3862  AC_ARG_WITH([m4_tolower($1)-datadir],
3863    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
3864                   [directory with data files for using project $1]),
3865    [m4_tolower(coin_has_$1)="yes, via --with-m4_tolower($1)-datadir"],
3866    [])
3867
3868  m4_if(m4_tolower($1), blas, [
3869    #--with-blas can overwrite --with-blas-lib, and can be set to BUILD to enforce building blas
3870    AC_ARG_WITH([blas],
3871      AC_HELP_STRING([--with-blas], [specify BLAS library (or BUILD for compilation)]),
3872        [if test x"$withval" = "xBUILD" ; then
3873           coin_has_blas=notGiven
3874         else
3875           coin_has_blas="yes, via --with-blas"
3876         fi],
3877        [])])
3878
3879  m4_if(m4_tolower($1), lapack, [
3880    #--with-lapack can overwrite --with-lapack-lib, and can be set to BUILD to enforce building lapack
3881    AC_ARG_WITH([lapack],
3882      AC_HELP_STRING([--with-lapack], [specify LAPACK library (or BUILD for compilation)]),
3883        [if test x"$withval" = "xBUILD" ; then
3884           coin_has_lapack=notGiven
3885         else
3886           coin_has_lapack="yes, via --with-lapack"
3887         fi],
3888        [])])
3889
3890fi
3891
3892# check if project is available in present directory
3893if test "$m4_tolower(coin_has_$1)" = notGiven; then
3894  if test -d $srcdir/$2/$1; then
3895    # If a third argument is given, then we have to check if one one the files given in that third argument is present.
3896    # If none of the files in the third argument is available, then we consider the project directory as non-existing.
3897    # However, if no third argument is given, then this means that there should be no check, and existence of the directory is sufficient.
3898    m4_ifvaln([$3],
3899      [for i in $srcdir/m4_ifval($2,[$2/],)$1/$3; do
3900         if test -r $i; then
3901           coin_have_project_dir=yes
3902         fi
3903       done],
3904      [ coin_have_project_dir=yes ])
3905    if test $coin_have_project_dir = yes; then
3906      m4_tolower(coin_has_$1)="yes, source in m4_ifval($2,[$2/],)$1"
3907    fi
3908  fi
3909fi
3910
3911# check for project by using pkg-config, if pkg-config is available
3912if test "$m4_tolower(coin_has_$1)" = notGiven; then
3913  #we are only interested in installed packages here, so we do not search in $COIN_PKG_CONFIG_PATH_UNINSTALLED
3914  if test -n "$PKG_CONFIG" ; then
3915    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
3916    PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH" ; export PKG_CONFIG_PATH
3917      m4_ifval([$4],
3918        [AC_COIN_PKG_CHECK_PROJECT_EXISTS([$4],
3919                [m4_tolower(coin_has_$1)="yes, found installed version $m4_toupper([$4])_VERSION"])],
3920              [AC_COIN_PKG_CHECK_PROJECT_EXISTS([$1],
3921                [m4_tolower(coin_has_$1)="yes, found installed version $m4_toupper([$1])_VERSION"])])
3922    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
3923    export PKG_CONFIG_PATH
3924  fi
3925fi
3926
3927if test "$m4_tolower(coin_has_$1)" = notGiven; then
3928  m4_case(m4_tolower($1),
3929    [blas],
3930    [AC_MSG_RESULT([no (but will check for system blas later)])],
3931    [lapack],
3932    [AC_MSG_RESULT([no (but will check for system lapack later)])],
3933    [AC_MSG_RESULT([not given])]
3934  )
3935else
3936  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
3937fi
3938
3939AC_MSG_CHECKING(whether project m4_ifval([$2],[$2/])$1 needs to be configured)
3940if test "$coin_have_project_dir" = yes ; then
3941
3942  if test -r $srcdir/m4_ifval($2,[$2/],)$1/configure; then
3943    coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1"
3944    AC_MSG_RESULT(yes)
3945    AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1)
3946  else
3947    AC_MSG_RESULT(no)
3948  fi
3949else
3950  AC_MSG_RESULT(no)
3951fi
3952])
3953
3954###########################################################################
3955#                            COIN_CHECK_PACKAGE                           #
3956###########################################################################
3957
3958# This macro checks for the existance of a COIN-OR package and provides compiler and linker flags to compile against this package.
3959# A package can consists of one or more COIN-OR or other projects.
3960# It defines the PACKAGE_CFLAGS, PACKAGE_LIBS, PACKAGE_DEPENDENCIES, and PACKAGE_DATA variables, referring to the compiler and linker
3961# flags to use when linking against this module, the libraries the package depends on, and the directories where the module data resists.
3962# The difference between PACKAGE_LIBS and PACKAGE_DEPENDENCIES is that PACKAGE_DEPENDENCIES does not contain arguments starting with '-',
3963# so it can be used to setup the _DEPENDENCIES variable in a Makefile.am.
3964# It also defines a COIN_HAS_PACKAGE preprocessor macro and makefile conditional.
3965# Further, tolower(coin_has_$1) is set to "yes".
3966# If a list of build targets using this projects is given in the third argument,
3967# then the compiler and linker variables and .pc file setup variable corresponding to this build target
3968# are extended with the values for this package.
3969# That is, for each build target X, the variables X_CFLAGS, X_LIBS, X_DEPENDENCIES, X_PCLIBS, X_PCREQUIRES are setup,
3970# whereas the last two specify the values to put into the "Libs:" and "Requires:" fields of the .pc file, resp.
3971#
3972# The first argument should be the name (PACKAGE) of the package (in correct lower
3973# and upper case).
3974# The second argument should be a (space separated) list of projects which this
3975# package consists of. Optionally, required version numbers can be added.
3976# The optional third argument should be a (space separated) list of build targets
3977# which use this package, if available.
3978#
3979# It is also possible to specify a preinstalled version of this package
3980# or to specify only the linker and compiler flags and data directory.
3981#
3982# If the user did not specify --with-$1-... flags and pkg-config is not available,
3983# COIN_CHECK_PACKAGE_FALLBACK($1, $2, $3) is called.
3984
3985AC_DEFUN([AC_COIN_CHECK_PACKAGE],
3986[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
3987AC_MSG_CHECKING([for COIN-OR package $1])
3988
3989m4_tolower(coin_has_$1)=notGiven
3990
3991# check if user wants to skip package in any case
3992if test x"$COIN_SKIP_PROJECTS" != x; then
3993  for dir in $COIN_SKIP_PROJECTS; do
3994    if test $dir = "$1"; then
3995      m4_tolower(coin_has_$1)=skipping
3996    fi
3997  done
3998fi
3999
4000m4_toupper($1_LIBS)=
4001m4_toupper($1_CFLAGS)=
4002m4_toupper($1_DATA)=
4003AC_SUBST(m4_toupper($1_LIBS))
4004AC_SUBST(m4_toupper($1_CFLAGS))
4005AC_SUBST(m4_toupper($1_DATA))
4006AC_SUBST(m4_toupper($1_DEPENDENCIES))
4007AC_SUBST(m4_toupper($1_LIBS_INSTALLED))
4008AC_SUBST(m4_toupper($1_CFLAGS_INSTALLED))
4009AC_SUBST(m4_toupper($1_DATA_INSTALLED))
4010coin_foreach_w([myvar], [$3], [
4011  AC_SUBST(m4_toupper(myvar)_CFLAGS)
4012  AC_SUBST(m4_toupper(myvar)_LIBS)
4013  AC_SUBST(m4_toupper(myvar)_PCLIBS)
4014  AC_SUBST(m4_toupper(myvar)_PCREQUIRES)
4015  AC_SUBST(m4_toupper(myvar)_DEPENDENCIES)
4016  AC_SUBST(m4_toupper(myvar)_CFLAGS_INSTALLED)
4017  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
4018])
4019
4020#check if user provided LIBS, CFLAGS, or DATA for module
4021if test $m4_tolower(coin_has_$1) != skipping; then
4022
4023  AC_ARG_WITH([m4_tolower($1)-lib],
4024    AC_HELP_STRING([--with-m4_tolower($1)-lib],
4025                   [linker flags for using package $1]),
4026      [m4_tolower(coin_has_$1)=yes
4027       m4_toupper($1_LIBS)="$withval"
4028       coin_foreach_w([myvar], [$3], [
4029         m4_toupper(myvar)_PCLIBS="$withval $m4_toupper(myvar)_PCLIBS"
4030         m4_toupper(myvar)_LIBS="$withval $m4_toupper(myvar)_LIBS"
4031       ])
4032       # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
4033       if test -z "$PKG_CONFIG" ; then
4034         m4_toupper($1_LIBS_INSTALLED)="$withval"
4035         coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_LIBS_INSTALLED="$withval $m4_toupper(myvar)_LIBS_INSTALLED"])
4036       fi
4037      ],
4038      [])
4039
4040  AC_ARG_WITH([m4_tolower($1)-incdir],
4041    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
4042                   [directory with header files for using package $1]),
4043    [m4_tolower(coin_has_$1)=yes
4044     m4_toupper($1_CFLAGS)="-I`${CYGPATH_W} $withval`"
4045     coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="$withval $m4_toupper(myvar)_CFLAGS"
4046     coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="-I`${CYGPATH_W} $withval` $m4_toupper(myvar)_CFLAGS"])
4047     # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
4048     if test -z "$PKG_CONFIG" ; then
4049       m4_toupper($1_CFLAGS_INSTALLED)="$m4_toupper($1_CFLAGS)"
4050       coin_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1_CFLAGS) $m4_toupper(myvar)_CFLAGS_INSTALLED"])
4051     fi
4052     ])
4053    ],
4054    [])
4055
4056  AC_ARG_WITH([m4_tolower($1)-datadir],
4057    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
4058                   [directory with data files for using package $1]),
4059    [m4_tolower(coin_has_$1)=yes
4060     m4_toupper($1_DATA)="$withval"
4061     # if project flags are given by user and we build without pkg-config, then we need to setup the _INSTALLED variables
4062     if test -z "$PKG_CONFIG" ; then
4063       m4_toupper($1_DATA_INSTALLED)="$withval"
4064     fi
4065    ],
4066    [])
4067fi
4068
4069if test $m4_tolower(coin_has_$1) = notGiven; then
4070  if test -n "$PKG_CONFIG" ; then
4071    # set search path for pkg-config
4072    # need to export variable to be sure that the following pkg-config gets these values
4073    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
4074    PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED"
4075    export PKG_CONFIG_PATH
4076   
4077    # let pkg-config do it's magic
4078    AC_COIN_PKG_HAS_MODULE([$1],[$2],
4079      [ m4_tolower(coin_has_$1)=yes
4080        AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
4081
4082        # adjust linker flags for (i)cl compiler
4083        # 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)
4084        if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
4085        then
4086          m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
4087        fi
4088   
4089        # augment X_PCREQUIRES, X_CFLAGS, and X_LIBS for each build target X in $3
4090        coin_foreach_w([myvar], [$3], [
4091          m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
4092          m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
4093          m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
4094        ])
4095      ],
4096      [ m4_tolower(coin_has_$1)=notGiven
4097        AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS])
4098      ])
4099
4100    # reset PKG_CONFIG_PATH variable
4101    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
4102    export PKG_CONFIG_PATH
4103
4104  else
4105    AC_MSG_RESULT([skipped check via pkg-config, redirect to fallback])
4106    AC_COIN_CHECK_PACKAGE_FALLBACK([$1], [$2], [$3])
4107  fi
4108
4109else
4110  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
4111fi
4112
4113if test $m4_tolower(coin_has_$1) != skipping &&
4114   test $m4_tolower(coin_has_$1) != notGiven ; then
4115  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
4116
4117  AC_ARG_ENABLE([interpackage-dependencies],
4118    AC_HELP_STRING([--enable-interpackage-dependencies], [whether to deduce Makefile dependencies from package linker flags (default: yes)]),
4119    [], [enable_interpackage_dependencies=yes])
4120   
4121  if test $enable_interpackage_dependencies = yes ; then
4122     # construct dependencies variables from LIBS variables
4123     # we add an extra space in LIBS so we can substitute out everything starting with " -"
4124     # remove everything of the form -framework xxx as used on Mac and mklxxx as used on Windows
4125     # then remove everything of the form -xxx
4126     # also remove everything of the form `xxx`yyy (may have been added for cygwin/cl)
4127     m4_toupper($1)_DEPENDENCIES=`echo " $m4_toupper($1)_LIBS" | [sed -e 's/ mkl[^ ]*//g' -e 's/ -framework  *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']`
4128     coin_foreach_w([myvar], [$3], [
4129       m4_toupper(myvar)_DEPENDENCIES=`echo " $m4_toupper(myvar)_LIBS " | [sed -e 's/ mkl[^ ]*//g' -e 's/ -framework  *[^ ]*//g' -e 's/ -[^ ]*//g' -e 's/\`[^\`]*\`[^ ]* //g']`
4130     ])
4131  fi
4132
4133  if test 1 = 0 ; then  #change this test to enable a bit of debugging output
4134    if test -n "$m4_toupper($1)_CFLAGS" ; then
4135      AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
4136    fi
4137    if test -n "$m4_toupper($1)_LIBS" ; then
4138      AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
4139    fi
4140    if test -n "$m4_toupper($1)_DEPENDENCIES" ; then
4141      AC_MSG_NOTICE([$1 DEPENDENCIES are $m4_toupper($1)_DEPENDENCIES])
4142    fi
4143    if test -n "$m4_toupper($1)_DATA" ; then
4144      AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
4145    fi
4146    if test -n "$m4_toupper($1)_CFLAGS" ; then
4147      AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
4148    fi
4149    coin_foreach_w([myvar], [$3], [
4150      AC_MSG_NOTICE([myvar CFLAGS are $m4_toupper(myvar)_CFLAGS])
4151      AC_MSG_NOTICE([myvar LIBS   are $m4_toupper(myvar)_LIBS])
4152      AC_MSG_NOTICE([myvar DEPENDENCIES are $m4_toupper(myvar)_DEPENDENCIES])
4153    ])
4154  fi
4155fi
4156
4157# Define the Makefile conditional
4158AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
4159               [test $m4_tolower(coin_has_$1) != notGiven &&
4160                test $m4_tolower(coin_has_$1) != skipping])
4161
4162]) # AC_COIN_CHECK_PACKAGE
4163
4164###########################################################################
4165#                       COIN_CHECK_PACKAGE_FALLBACK                       #
4166###########################################################################
4167
4168# This macro is used by COIN_CHECK_PACKAGE, if it fails to find a package
4169# because pkg-config was disabled or is not available.
4170#
4171# For each project xxx specified in $2, it searches for a xxx-uninstalled.pc
4172# file in the directories specified in $COIN_PKG_CONFIG_PATH_UNINSTALLED. The
4173# latter variable is setup by COIN_HAS_PKGCONFIG and consists of the content
4174# of the coin_subdirs.txt file which has been created by configure in the
4175# base directory.  The content of xxx-uninstalled.pc is parsed in order
4176# to defines the variables PACKAGE_CFLAGS, PACKAGE_LIBS, and PACKAGE_DATA,
4177# referring to the compiler and linker flags to use when linking against this
4178# package and the directory where the package data resists.  Further, for each
4179# build target X specified in the third argument, the variables X_CFLAGS and
4180# X_LIBS are extended with the compiler and linker flags of this package and
4181# the variables X_PCLIBS and X_PCREQUIRES are extended by the list of linker
4182# flags and dependent projects as needed to setup a .pc file.  The macros
4183# checks also dependencies of $2.  Note that the PACKAGE_DATA variable is
4184# set to the content of datadir of the first .pc file that is parsed.
4185# Finally, for each X in the third argument, also variables
4186# X_CFLAGS_INSTALLED and X_LIBS_INSTALLED are setup. They contain the compiler
4187# and linker flags for X when all projects have been installed. Their content
4188# is assembled from the .pc files that correspond to installed projects. I.e.,
4189# whenever a file proj-uninstalled.pc is parsed, then also a corresponding
4190# proj.pc file is parsed for compiler and linker flags, if available in the
4191# same directory.
4192# Similar, a variable PACKAGE_DATA_INSTALLED is setup to the content of datadir
4193# of the first .pc file that is parsed.
4194#
4195# If .pc files for all projects in $2 and their dependencies is found,
4196# tolower(coin_has_$1) is set to "yes".  Otherwise, if some dependency
4197# is not found, tolower(coin_has_$1) is set to "notGiven".  Further, a
4198# COIN_HAS_PACKAGE preprocessor macro and a makefile conditional are defined.
4199#
4200# The first argument should be the name (PACKAGE) of the package (in correct
4201# lower and upper case).  The second argument should be the base names of the
4202# projects .pc file which define this package.  The optional third argument
4203# should be a (space separated) list of build targets which use this package,
4204# if available.
4205#
4206# $1 is not checked for $COIN_SKIP_PROJECTS, since we only look into
4207# $COIN_PKG_CONFIG_PATH_UNINSTALLED.  When the content of this variable was
4208# setup in the base directory, $COIN_SKIP_PROJECTS has already been considered.
4209
4210AC_DEFUN([AC_COIN_CHECK_PACKAGE_FALLBACK],
4211[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
4212AC_MSG_CHECKING([for COIN-OR package $1 (fallback)])
4213
4214m4_tolower(coin_has_$1)=notGiven
4215m4_toupper($1_LIBS)=
4216m4_toupper($1_LIBS_INSTALLED)=
4217m4_toupper($1_CFLAGS)=
4218m4_toupper($1_CFLAGS_INSTALLED)=
4219m4_toupper($1_DATA)=
4220m4_toupper($1_DATA_INSTALLED)=
4221
4222# initial list of dependencies is "$2", but we need to filter out version number specifications (= x, <= x, >= x)
4223projtoprocess="m4_bpatsubsts([$2], [<?>?=[      ]*[^    ]+])"
4224
4225# we first expand the list of projects to process by adding all dependencies just behind the project which depends on it
4226# further, we collect the list of corresponding .pc files, but do this in reverse order, because we need this order afterwards
4227# the latter we also do with .pc files corresponding to the installed projects, which will be needed to setup Makefiles for examples
4228# also, we setup the DATA variable
4229allproj=""
4230allpcfiles=""
4231allpcifiles=""
4232while test "x$projtoprocess" != x ; do
4233
4234  for proj in $projtoprocess ; do
4235    # if $proj is available and configured, then a project-uninstalled.pc file should have been created, so search for it
4236    pcfile=""
4237    save_IFS="$IFS"
4238    IFS=":"
4239    for dir in $COIN_PKG_CONFIG_PATH_UNINSTALLED ; do
4240      # 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
4241      if test -r "$dir/${proj}-uninstalled.pc" ; then
4242        pcfile="$dir/$proj-uninstalled.pc"
4243        if test -r "$dir/${proj}.pc" ; then
4244          pcifile="$dir/${proj}.pc"
4245        else
4246          AC_MSG_WARN([Found $pcfile, but $dir/${proj}.pc is not available. This may break Makefile's of examples.])
4247          pcifile=
4248        fi
4249        break
4250      fi
4251    done
4252    IFS="$save_IFS"
4253
4254    if test "x$pcfile" != x ; then
4255      # read dependencies from $pcfile and filter it
4256      projrequires=[`sed -n -e 's/Requires://gp' "$pcfile" | sed -e 's/<\{0,1\}>\{0,1\}=[       ]\{0,\}[^       ]\{1,\}//g'`]
4257
4258      # add projrequires to the front of the list of projects that have to be processed next
4259      # at the same time, remove $proj from this list
4260      projtoprocess=${projtoprocess/$proj/$projrequires}
4261
4262      # read DATA from $pcfile, if _DATA is still empty
4263      if test "x$m4_toupper($1_DATA)" = x ; then
4264        projdatadir=
4265        [pcfilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcfile`]
4266        eval `sh -c "$pcfilemod"`
4267        m4_toupper($1_DATA)="$projdatadir"
4268      fi
4269
4270      allproj="$allproj $proj"
4271      allpcfiles="$pcfile:$allpcfiles"
4272
4273    else
4274      AC_MSG_RESULT([no, dependency $proj not available])
4275      allproj=fail
4276      break 2
4277    fi
4278   
4279    if test "x$pcifile" != x ; then
4280      allpcifiles="$pcifile:$allpcifiles"
4281     
4282      # read DATA_INSTALLED from $pcifile, if _DATA_INSTALLED is still empty
4283      if test "x$m4_toupper($1_DATA_INSTALLED)" = x ; then
4284        projdatadir=
4285        [pcifilemod=`sed -e '/[a-zA-Z]:/d' -e 's/datadir=\(.*\)/echo projdatadir=\\\\"\1\\\\"/g' $pcifile`]
4286        eval `sh -c "$pcifilemod"`
4287        if test "${CYGPATH_W}" != "echo"; then
4288          projdatadir="\`\$(CYGPATH_W) ${projdatadir} | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g'\`"
4289        fi
4290        m4_toupper($1_DATA_INSTALLED)="$projdatadir"
4291      fi
4292     
4293    fi
4294
4295    break
4296  done
4297
4298  # remove spaces on begin of $projtoprocess
4299  projtoprocess=`echo $projtoprocess | sed -e 's/^[ ]*//'`
4300
4301done
4302
4303if test "$allproj" != fail ; then
4304
4305  # now go through the list of .pc files and assemble compiler and linker flags
4306  # important is here to obey the reverse order that has been setup before,
4307  # since then libraries that are required by several others should be after these other libraries
4308  pcfilesprocessed=""
4309
4310  save_IFS="$IFS"
4311  IFS=":"
4312  for pcfile in $allpcfiles ; do
4313
4314    # if $pcfile has been processed already, skip this round
4315    if test "x$pcfilesprocessed" != x ; then
4316      for pcfiledone in $pcfilesprocessed ; do
4317        if test "$pcfiledone" = "$pcfile" ; then
4318          continue 2
4319        fi
4320      done
4321    fi
4322
4323    # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
4324    #   replace "Libs:" by "echo projlibs="
4325    #   replace "Cflags:" by "echo projcflags="
4326    #   remove every line starting with <some word>:
4327    [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
4328
4329    # set projcflags and projlibs variables by running $pcfilemod
4330    projcflags=
4331    projlibs=
4332    eval `sh -c "$pcfilemod"`
4333
4334    # add CYGPATH_W cludge into include flags and set CFLAGS variable
4335    if test "${CYGPATH_W}" != "echo"; then
4336      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
4337    fi
4338    m4_toupper($1_CFLAGS)="$projcflags $m4_toupper($1_CFLAGS)"
4339
4340    # set LIBS variable
4341    m4_toupper($1_LIBS)="$projlibs $m4_toupper($1_LIBS)"
4342
4343    # remember that we have processed $pcfile
4344    pcfilesprocessed="$pcfilesprocessed:$pcfile"
4345
4346  done
4347  IFS="$save_IFS"
4348
4349
4350  # now go through the list of .pc files for installed projects and assemble compiler and linker flags
4351  # important is here again to obey the reverse order that has been setup before,
4352  # since then libraries that are required by several others should be after these other libraries
4353  pcfilesprocessed=""
4354
4355  save_IFS="$IFS"
4356  IFS=":"
4357  for pcfile in $allpcifiles ; do
4358
4359    # if $pcfile has been processed already, skip this round
4360    if test "x$pcfilesprocessed" != x ; then
4361      for pcfiledone in $pcfilesprocessed ; do
4362        if test "$pcfiledone" = "$pcfile" ; then
4363          continue 2
4364        fi
4365      done
4366    fi
4367
4368    # modify .pc file to a shell script that prints shell commands for setting the compiler and library flags:
4369    #   replace "Libs:" by "echo projlibs="
4370    #   replace "Cflags:" by "echo projcflags="
4371    #   remove every line starting with <some word>:
4372    [pcfilemod=`sed -e 's/Libs:\(.*\)$/echo projlibs=\\\\"\1\\\\"/g' -e 's/Cflags:\(.*\)/echo projcflags=\\\\"\1\\\\"/g' -e '/^[a-zA-Z]*:/d' $pcfile`]
4373
4374    # set projcflags and projlibs variables by running $pcfilemod
4375    projcflags=
4376    projlibs=
4377    eval `sh -c "$pcfilemod"`
4378
4379    # add CYGPATH_W cludge into include flags and set CFLAGS variable
4380    if test "${CYGPATH_W}" != "echo"; then
4381      projcflags=[`echo "$projcflags" | sed -e 's/-I\([^ ]*\)/-I\`${CYGPATH_W} \1\`/g'`]
4382    fi
4383    m4_toupper($1_CFLAGS_INSTALLED)="$projcflags $m4_toupper($1_CFLAGS_INSTALLED)"
4384
4385    # set LIBS variable
4386    m4_toupper($1_LIBS_INSTALLED)="$projlibs $m4_toupper($1_LIBS_INSTALLED)"
4387   
4388    # remember that we have processed $pcfile
4389    pcfilesprocessed="$pcfilesprocessed:$pcfile"
4390
4391  done
4392  IFS="$save_IFS"
4393
4394
4395  # finish up
4396  m4_tolower(coin_has_$1)=yes
4397  AC_MSG_RESULT([yes])
4398  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
4399
4400  # adjust linker flags for (i)cl compiler
4401  # 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),
4402  # for the LIBS_INSTALLED, we replace everything of the form "/somepath/" by "`$(CYGPATH_W) /somepath/`",
4403  #    everything of the form "-Lpath" by "/libpath:`$(CYGPATH_W) path`, and
4404  #    everything of the form "-lname" by "libname.lib"
4405  if test x$coin_cxx_is_cl = xtrue || test x$coin_cc_is_cl = xtrue ;
4406  then
4407    m4_toupper($1_LIBS)=`echo " $m4_toupper($1_LIBS) " | [sed -e 's/ \(\/[^ ]*\/\)\([^ ]*\)\.lib / \`$(CYGPATH_W) \1 | sed -e "s|\\\\\\\\\\\\\\\\\\\\|\/|g"\`\2.lib /g']`
4408    m4_toupper($1_LIBS_INSTALLED)=`echo " $m4_toupper($1_LIBS_INSTALLED)" | [sed -e 's/ \(\/[^ ]*\/\)/ \`$(CYGPATH_W) \1\`/g' -e 's/ -L\([^ ]*\)/ \/libpath:\`$(CYGPATH_W) \1\`/g' -e 's/ -l\([^ ]*\)/ lib\1.lib/g']`
4409  fi
4410
4411  coin_foreach_w([myvar], [$3], [
4412    m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
4413    m4_toupper(myvar)_CFLAGS="$m4_toupper($1)_CFLAGS $m4_toupper(myvar)_CFLAGS"
4414    m4_toupper(myvar)_LIBS="$m4_toupper($1)_LIBS $m4_toupper(myvar)_LIBS"
4415    m4_toupper(myvar)_CFLAGS_INSTALLED="$m4_toupper($1)_CFLAGS_INSTALLED $m4_toupper(myvar)_CFLAGS_INSTALLED"
4416    m4_toupper(myvar)_LIBS_INSTALLED="$m4_toupper($1)_LIBS_INSTALLED $m4_toupper(myvar)_LIBS_INSTALLED"
4417  ])
4418
4419fi
4420
4421AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
4422               [test $m4_tolower(coin_has_$1) != notGiven &&
4423                test $m4_tolower(coin_has_$1) != skipping])
4424
4425]) # AC_COIN_CHECK_PACKAGE_FALLBACK
4426
4427###########################################################################
4428#                         COIN_CHECK_PACKAGE_BLAS                         #
4429###########################################################################
4430
4431# This macro checks for a library containing the BLAS library.  It
4432# 1. checks the --with-blas argument
4433# 2. if --with-blas=BUILD has been specified goes to point 5
4434# 3. if --with-blas has been specified to a working library, sets BLAS_LIBS
4435#    to its value
4436# 4. tries standard libraries
4437# 5. calls COIN_CHECK_PACKAGE(Blas, [coinblas], [$1]) to check for
4438#    ThirdParty/Blas
4439# The makefile conditional and preprocessor macro COIN_HAS_BLAS is defined.
4440# BLAS_LIBS is set to the flags required to link with a Blas library.
4441# For each build target X in $1, X_LIBS is extended with $BLAS_LIBS.
4442# In case 3 and 4, the flags to link to Blas are added to X_PCLIBS too.
4443# In case 5, Blas is added to X_PCREQUIRES.
4444
4445AC_DEFUN([AC_COIN_CHECK_PACKAGE_BLAS],
4446[
4447AC_ARG_WITH([blas],
4448            AC_HELP_STRING([--with-blas],
4449                           [specify BLAS library (or BUILD for compilation)]),
4450            [use_blas="$withval"], [use_blas=])
4451
4452# if user specified --with-blas-lib, then we should give COIN_CHECK_PACKAGE
4453# preference
4454AC_ARG_WITH([blas-lib],,[use_blas=BUILD])
4455
4456# Check if user supplied option makes sense
4457if test x"$use_blas" != x; then
4458  if test "$use_blas" = "BUILD"; then
4459    # we come to this later
4460    :
4461  elif test "$use_blas" != "no"; then
4462    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
4463    coin_need_flibs=no
4464    coin_save_LIBS="$LIBS"
4465    LIBS="$use_blas $LIBS"
4466    AC_COIN_TRY_FLINK([daxpy],
4467                      [if test $coin_need_flibs = yes ; then
4468                         use_blas="$use_blas $FLIBS"
4469                       fi
4470                       AC_MSG_RESULT([yes: $use_blas])],
4471                      [AC_MSG_RESULT([no])
4472                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
4473    LIBS="$coin_save_LIBS"
4474  fi
4475else
4476# Try to autodetect the library for blas based on build system
4477  #AC_MSG_CHECKING([default locations for BLAS])
4478  skip_lblas_check=no
4479  case $build in
4480    *-sgi-*)
4481      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
4482      coin_need_flibs=no
4483      coin_save_LIBS="$LIBS"
4484      LIBS="-lcomplib.sgimath $LIBS"
4485      AC_COIN_TRY_FLINK([daxpy],
4486                        [use_blas="-lcomplib.sgimath"
4487                         if test $coin_need_flibs = yes ; then
4488                           use_blas="$use_blas $FLIBS"
4489                         fi
4490                         AC_MSG_RESULT([yes: $use_blas])
4491                        ],
4492                        [AC_MSG_RESULT([no])])
4493      LIBS="$coin_save_LIBS"
4494      ;;
4495
4496# Ideally, we'd use -library=sunperf, but it's an imperfect world. Studio
4497# cc doesn't recognise -library, it wants -xlic_lib. Studio 12 CC doesn't
4498# recognise -xlic_lib. Libtool doesn't like -xlic_lib anyway. Sun claims
4499# that CC and cc will understand -library in Studio 13. The main extra
4500# function of -xlic_lib and -library is to arrange for the Fortran run-time
4501# libraries to be linked for C++ and C. We can arrange that explicitly.
4502    *-*-solaris*)
4503      AC_MSG_CHECKING([for BLAS in libsunperf])
4504      coin_need_flibs=no
4505      coin_save_LIBS="$LIBS"
4506      LIBS="-lsunperf $FLIBS $LIBS"
4507      AC_COIN_TRY_FLINK([daxpy],
4508                        [use_blas='-lsunperf'
4509                         if test $coin_need_flibs = yes ; then
4510                           use_blas="$use_blas $FLIBS"
4511                         fi
4512                         AC_MSG_RESULT([yes: $use_blas])
4513                        ],
4514                        [AC_MSG_RESULT([no])])
4515      LIBS="$coin_save_LIBS"
4516      ;;
4517    *-cygwin* | *-mingw*)
4518# On cygwin, consider -lblas only if doscompile is disabled. The prebuilt
4519# library will want to link with cygwin, hence won't run standalone in DOS.
4520      if test "$enable_doscompile" = mingw; then
4521        skip_lblas_check=yes
4522      fi
4523      case "$CC" in
4524        cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
4525          AC_MSG_CHECKING([for BLAS in MKL])
4526          coin_save_LIBS="$LIBS"
4527          LIBS="mkl_intel_c.lib mkl_sequential.lib mkl_core.lib $LIBS"
4528          AC_COIN_TRY_FLINK([daxpy],
4529                            [use_blas='mkl_intel_c.lib mkl_sequential.lib mkl_core.lib'
4530                             AC_MSG_RESULT([yes: $use_blas])
4531                            ],
4532                            [AC_MSG_RESULT([no])])
4533          LIBS="$coin_save_LIBS"
4534          ;;
4535      esac
4536      ;;
4537  esac
4538
4539  if test -z "$use_blas" && test $skip_lblas_check = no; then
4540    AC_MSG_CHECKING([whether -lblas has BLAS])
4541    coin_need_flibs=no
4542    coin_save_LIBS="$LIBS"
4543    LIBS="-lblas $LIBS"
4544    AC_COIN_TRY_FLINK([daxpy],
4545                      [use_blas='-lblas'
4546                       if test $coin_need_flibs = yes ; then
4547                         use_blas="$use_blas $FLIBS"
4548                       fi
4549                       AC_MSG_RESULT([yes: $use_blas])
4550                      ],
4551                      [AC_MSG_RESULT([no])])
4552    LIBS="$coin_save_LIBS"
4553  fi
4554
4555  # If we have no other ideas, consider building BLAS.
4556  if test -z "$use_blas" ; then
4557    use_blas=BUILD
4558  fi
4559fi
4560
4561if test "x$use_blas" = xBUILD ; then
4562  AC_COIN_CHECK_PACKAGE(Blas, [coinblas], [$1])
4563 
4564elif test "x$use_blas" != x && test "$use_blas" != no; then
4565  coin_has_blas=yes
4566  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 0])
4567  AC_DEFINE([COIN_HAS_BLAS],[1], [If defined, the BLAS Library is available.])
4568  BLAS_LIBS="$use_blas"
4569  BLAS_CFLAGS=
4570  BLAS_DATA=
4571  AC_SUBST(BLAS_LIBS)
4572  AC_SUBST(BLAS_CFLAGS)
4573  AC_SUBST(BLAS_DATA)
4574  coin_foreach_w([myvar], [$1], [
4575    m4_toupper(myvar)_PCLIBS="$BLAS_LIBS $m4_toupper(myvar)_PCLIBS"
4576    m4_toupper(myvar)_LIBS="$BLAS_LIBS $m4_toupper(myvar)_LIBS"
4577    m4_toupper(myvar)_LIBS_INSTALLED="$BLAS_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
4578  ])
4579 
4580else
4581  coin_has_blas=no
4582  AM_CONDITIONAL([COIN_HAS_BLAS],[test 0 = 1])
4583fi
4584
4585coin_foreach_w([myvar], [$1], [
4586  AC_SUBST(m4_toupper(myvar)_PCLIBS)
4587  AC_SUBST(m4_toupper(myvar)_LIBS)
4588  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
4589])
4590
4591]) # AC_COIN_CHECK_PACKAGE_BLAS
4592
4593###########################################################################
4594#                       COIN_CHECK_PACKAGE_LAPACK                         #
4595###########################################################################
4596
4597# This macro checks for a library containing the LAPACK library.  It
4598# 1. checks the --with-lapack argument
4599# 2. if --with-lapack=BUILD has been specified goes to point 5
4600# 3. if --with-lapack has been specified to a working library, sets
4601#    LAPACK_LIBS to its value
4602# 4. tries standard libraries
4603# 5. calls COIN_CHECK_PACKAGE(Lapack, [lapack], [$1]) to check for
4604#    ThirdParty/Lapack
4605# The makefile conditional and preprocessor macro COIN_HAS_LAPACK is defined.
4606# LAPACK_LIBS is set to the flags required to link with a Lapack library.
4607# For each build target X in $1, X_LIBS is extended with $LAPACK_LIBS.
4608# In case 3 and 4, the flags to link to Lapack are added to X_PCLIBS too.
4609# In case 5, Lapack is added to X_PCREQUIRES.
4610
4611AC_DEFUN([AC_COIN_CHECK_PACKAGE_LAPACK],
4612[
4613AC_ARG_WITH([lapack],
4614            AC_HELP_STRING([--with-lapack],
4615                           [specify LAPACK library (or BUILD for compilation)]),
4616            [use_lapack=$withval], [use_lapack=])
4617
4618#if user specified --with-lapack-lib, then we should give COIN_HAS_PACKAGE preference
4619AC_ARG_WITH([lapack-lib],,[use_lapack=BUILD])
4620
4621# Check if user supplied option makes sense
4622if test x"$use_lapack" != x; then
4623  if test "$use_lapack" = "BUILD"; then
4624    # we come to this later
4625    :
4626  elif test "$use_lapack" != no; then
4627    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
4628    coin_need_flibs=no
4629    use_lapack="$use_lapack $BLAS_LIBS"
4630    coin_save_LIBS="$LIBS"
4631    LIBS="$use_lapack $LIBS"
4632    AC_COIN_TRY_FLINK([dsyev],
4633                      [if test $coin_need_flibs = yes ; then
4634                         use_lapack="$use_lapack $FLIBS"
4635                       fi
4636                       AC_MSG_RESULT([yes: $use_lapack])
4637                      ],
4638                      [AC_MSG_RESULT([no])
4639                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
4640    LIBS="$coin_save_LIBS"
4641  fi
4642else
4643  if test x$coin_has_blas = xyes; then
4644    # First try to see if LAPACK is already available with BLAS library
4645    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
4646    coin_save_LIBS="$LIBS"
4647    coin_need_flibs=no
4648    LIBS="$BLAS_LIBS $LIBS"
4649    AC_COIN_TRY_FLINK([dsyev],
4650                      [use_lapack="$BLAS_LIBS"
4651                       if test $coin_need_flibs = yes ; then
4652                         use_lapack="$use_lapack $FLIBS"
4653                       fi
4654                       AC_MSG_RESULT([yes: $use_lapack])
4655                      ],
4656                      [AC_MSG_RESULT([no])])
4657    LIBS="$coin_save_LIBS"
4658  fi
4659  skip_llapack_check=no
4660  if test -z "$use_lapack"; then
4661    # Try to autodetect the library for lapack based on build system
4662    case $build in
4663      *-sgi-*)
4664        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
4665        coin_save_LIBS="$LIBS"
4666        coin_need_flibs=no
4667        LIBS="-lcomplib.sgimath $BLAS_LIBS $LIBS"
4668        AC_COIN_TRY_FLINK([dsyev],
4669                          [use_lapack="-lcomplib.sgimath $BLAS_LIBS"
4670                           if test $coin_need_flibs = yes ; then
4671                             use_lapack="$use_lapack $FLIBS"
4672                           fi
4673                           AC_MSG_RESULT([yes: $use_lapack])
4674                          ],
4675                          [AC_MSG_RESULT([no])])
4676        LIBS="$coin_save_LIBS"
4677        ;;
4678
4679      # See comments in COIN_CHECK_PACKAGE_BLAS.
4680      *-*-solaris*)
4681        AC_MSG_CHECKING([for LAPACK in libsunperf])
4682        coin_need_flibs=no
4683        coin_save_LIBS="$LIBS"
4684        LIBS="-lsunperf $BLAS_LIBS $FLIBS $LIBS"
4685        AC_COIN_TRY_FLINK([dsyev],
4686                          [use_lapack='-lsunperf $BLAS_LIBS'
4687                           if test $coin_need_flibs = yes ; then
4688                             use_lapack="$use_lapack $FLIBS"
4689                           fi
4690                           AC_MSG_RESULT([yes: $use_lapack])
4691                          ],
4692                          [AC_MSG_RESULT([no])])
4693        LIBS="$coin_save_LIBS"
4694        ;;
4695        # On cygwin, do this check only if doscompile is disabled. The prebuilt library
4696        # will want to link with cygwin, hence won't run standalone in DOS.
4697      *-cygwin*)
4698        if test "$enable_doscompile" = mingw; then
4699          skip_llapack_check=yes
4700        fi
4701        ;;
4702    esac
4703  fi
4704
4705  if test -z "$use_lapack" && test $skip_llapack_check = no; then
4706    AC_MSG_CHECKING([whether -llapack has LAPACK])
4707    coin_need_flibs=no
4708    coin_save_LIBS="$LIBS"
4709    LIBS="-llapack $BLAS_LIBS $LIBS"
4710    AC_COIN_TRY_FLINK([dsyev],
4711                      [use_lapack='-llapack'
4712                       if test $coin_need_flibs = yes ; then
4713                         use_lapack="$use_lapack $FLIBS"
4714                       fi
4715                       AC_MSG_RESULT([yes: $use_lapack])
4716                      ],
4717                      [AC_MSG_RESULT([no])])
4718    LIBS="$coin_save_LIBS"
4719  fi
4720
4721  # If we have no other ideas, consider building LAPACK.
4722  if test -z "$use_lapack" ; then
4723    use_lapack=BUILD
4724  fi
4725fi
4726
4727if test "x$use_lapack" = xBUILD ; then
4728  AC_COIN_CHECK_PACKAGE(Lapack, [coinlapack], [$1])
4729
4730elif test "x$use_lapack" != x && test "$use_lapack" != no; then
4731  coin_has_lapack=yes
4732  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 0])
4733  AC_DEFINE([COIN_HAS_LAPACK],[1], [If defined, the LAPACK Library is available.])
4734  LAPACK_LIBS="$use_lapack"
4735  LAPACK_CFLAGS=
4736  LAPACK_DATA=
4737  AC_SUBST(LAPACK_LIBS)
4738  AC_SUBST(LAPACK_CFLAGS)
4739  AC_SUBST(LAPACK_DATA)
4740  coin_foreach_w([myvar], [$1], [
4741    m4_toupper(myvar)_PCLIBS="$LAPACK_LIBS $m4_toupper(myvar)_PCLIBS"
4742    m4_toupper(myvar)_LIBS="$LAPACK_LIBS $m4_toupper(myvar)_LIBS"
4743    m4_toupper(myvar)_LIBS_INSTALLED="$LAPACK_LIBS $m4_toupper(myvar)_LIBS_INSTALLED"
4744  ])
4745 
4746else
4747  coin_has_lapack=no
4748  AM_CONDITIONAL([COIN_HAS_LAPACK],[test 0 = 1])
4749fi
4750
4751coin_foreach_w([myvar], [$1], [
4752  AC_SUBST(m4_toupper(myvar)_PCLIBS)
4753  AC_SUBST(m4_toupper(myvar)_LIBS)
4754  AC_SUBST(m4_toupper(myvar)_LIBS_INSTALLED)
4755])
4756
4757]) # AC_COIN_CHECK_PACKAGE_LAPACK
Note: See TracBrowser for help on using the repository browser.