source: trunk/coin.m4 @ 303

Last change on this file since 303 was 291, checked in by andreasw, 14 years ago

added description of configure options in config.site file

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