source: trunk/coin.m4 @ 265

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

reverted order of Intel and GNU compilers to original order

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