source: stable/0.6/coin.m4 @ 2112

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

merge chgsets 2105 and 2111 from trunk: fixes to maintainer mode

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