source: trunk/coin.m4 @ 134

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

correcting quotation in COIN_HAS_BLAS and COIN_HAS_LAPACK; reported by Lou Hafer in ticket #2

  • Property svn:keywords set to Author Date Id Revision
File size: 77.6 KB
Line 
1# Copyright (C) 2006 International Business Machines..
2# All Rights Reserved.
3# This file is distributed under the Common Public License.
4#
5## $Id: coin.m4 134 2006-11-15 21:05:56Z 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)
233elif test -r $srcdir/$2/$3; then
234  coin_subdirs="$coin_subdirs $2"
235  AC_MSG_RESULT(yes)
236  AC_CONFIG_SUBDIRS($2)
237else
238  AC_MSG_RESULT(no)
239fi
240]) # AC_COIN_THIRDPARTY_SUBDIRS
241
242###########################################################################
243#                           COIN_CHECK_VPATH                              #
244###########################################################################
245
246# This macro sets the variable coin_vpath_config to true if this is a
247# VPATH configuration, otherwise it sets it to false.
248AC_DEFUN([AC_COIN_CHECK_VPATH],
249[AC_MSG_CHECKING(whether this is a VPATH configuration)
250if test `cd $srcdir; pwd` != `pwd`; then
251  coin_vpath_config=yes;
252else
253  coin_vpath_config=no;
254fi
255AC_MSG_RESULT($coin_vpath_config)
256]) # AC_COIN_CHECK_VPATH
257
258###########################################################################
259#                         COIN_PROJECTDIR_INIT                            #
260###########################################################################
261
262# This macro does everything that is required in the early part in the
263# configure script, such as defining a few variables.  This should only
264# be used in the main directory of a project directory (the one under
265# which src is)
266
267AC_DEFUN([AC_COIN_PROJECTDIR_INIT],
268[# Initialize the ADDLIBS variable
269ADDLIBS='-lm'
270AC_SUBST(ADDLIBS)
271
272# Initialize the FADDLIBS variable (which is to be used with a fortran
273# compiler and will not include FLIBS)
274FADDLIBS=
275AC_SUBST(FADDLIBS)
276
277# A useful makefile conditional that is always false
278AM_CONDITIONAL(ALWAYS_FALSE, false)
279
280# We set the following variable so that we know later in AC_COIN_FINALIZE
281# that we are in a project main directory
282coin_projectdir=yes
283]) # AC_COIN_PROJECTDIR_INIT
284
285###########################################################################
286#                          COIN_DEBUG_COMPILE                             #
287###########################################################################
288
289# enable the configure flags --enable-debug and --enable-debug-prjct
290# (where prcjt is the name of the project in lower case) and set the
291# variable coin_debug_compile to true or false This is used by
292# COIN_PROG_CXX, COIN_PROG_CC and COIN_PROG_F77 to determine the
293# compilation flags.  This macro also makes the switches
294# --with-prjct-verbosity and --with-prjct-checklevel available, which
295# define the preprocessor macros COIN_PRJCT_VERBOSITY and
296# COIN_PRJCT_CHECKLEVEL to the specified value (default is 0).
297#
298# The project specific flags are only made available, if one gives the
299# name of the project as first argument to this macro.
300
301AC_DEFUN([AC_COIN_DEBUG_COMPILE],
302[AC_BEFORE([$0],[AC_COIN_PROG_CXX])dnl
303AC_BEFORE([$0],[AC_COIN_PROG_CC])dnl
304AC_BEFORE([$0],[AC_COIN_PROG_F77])dnl
305
306AC_MSG_CHECKING([whether we want to compile in debug mode])
307
308AC_ARG_ENABLE([debug],
309[AC_HELP_STRING([--enable-debug],
310                [compile all projects with debug options tests])],
311[case "${enableval}" in
312   yes) coin_debug_compile=true
313        enable_shared=no
314        ;;
315   no)  coin_debug_compile=false
316        ;;
317   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
318        ;;
319esac],
320[coin_debug_compile=false])
321
322m4_ifvaln([$1],
323[AC_ARG_ENABLE(debug-m4_tolower($1),
324 [AC_HELP_STRING([--enable-debug-m4_tolower($1)],
325                 [compile this project ($1) with debug options])],
326 [case "${enableval}" in
327    yes) coin_debug_compile=true
328         enable_shared=no
329         ;;
330    no)  coin_debug_compile=false
331         ;;
332    *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-m4_tolower($1))
333         ;;
334 esac],[:])
335]) # m4_ifvaln([$1],
336
337if test $coin_debug_compile = true; then
338  AC_MSG_RESULT([yes])
339else
340  AC_MSG_RESULT([no])
341fi
342
343m4_ifvaln([$1],
344[AC_ARG_WITH(m4_tolower($1)-verbosity,
345             AC_HELP_STRING([--with-m4_tolower($1)-verbosity],
346                            [specify the debug verbosity level for project $1]),
347             [m4_tolower(coin_$1_verbosity)=$withval],
348             [m4_tolower(coin_$1_verbosity)=0])
349 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_VERBOSITY),
350                    m4_tolower($coin_$1_verbosity),
351                    [Define to the debug verbosity level (0 is no output)])
352
353 AC_ARG_WITH(m4_tolower($1)-checklevel,
354             AC_HELP_STRING([--with-m4_tolower($1)-checklevel],
355                            [specify the sanity check level for project $1]),
356             [m4_tolower(coin_$1_checklevel)=$withval],
357             [m4_tolower(coin_$1_checklevel)=0])
358 AC_DEFINE_UNQUOTED(m4_toupper(COIN_$1_CHECKLEVEL),
359                    m4_tolower($coin_$1_checklevel),
360                    [Define to the debug sanity check level (0 is no test)])
361
362# We use the following variable to have a string with the upper case
363# version of the project name
364COIN_PRJCT=m4_toupper($1)
365
366]) # m4_ifvaln([$1],
367 
368]) # AC_COIN_DEBUG_COMPILE
369
370###########################################################################
371#                          COIN_MINGW_LD_FIX                              #
372###########################################################################
373
374# This macro is included by any PROG_compiler macro, to set the LD
375# environment variable on MinWG to the correct value (link)
376
377AC_DEFUN([AC_COIN_MINGW_LD_FIX],
378[case $build in
379  *-mingw*)
380    if test "${LD+set}" = set; then :; else
381      LD=link
382    fi
383    ;;
384esac
385])
386
387###########################################################################
388#                        COIN_ENABLE_DOSCOMPILE                           #
389###########################################################################
390
391# This macro is included by any PROG_compiler macro, to enable the
392# --enable-doscompile options which is to be used when one wants to
393# compile an executable under Cygwin which also runs directly under
394# does (without requiring Cygwin1.dll).  Essentially, if enabled and
395# the GNU compilers are used, it switches the --mno-cygwin flag on.
396
397AC_DEFUN([AC_COIN_ENABLE_DOSCOMPILE],
398[AC_ARG_ENABLE([doscompile],
399[AC_HELP_STRING([--enable-doscompile],
400                [Under Cygwin, compile so that executables run under DOS (default: disabled)])],
401[if test "$enable_doscompile = yes"; then
402  case $build in
403    *-cygwin*) ;;
404    *) AC_MSG_ERROR([--enable-doscompile option makes only sense under Cygwin]) ;;
405  esac
406fi],
407[enable_doscompile=no])
408])
409
410###########################################################################
411#                             COIN_PROG_CXX                               #
412###########################################################################
413
414# Find the compile command by running AC_PROG_CXX (with compiler names
415# for different operating systems) and put it into CXX (unless it was
416# given my the user), and find an appropriate value for CXXFLAGS.  It is
417# possible to provide additional -D flags in the variable CXXDEFS.
418
419AC_DEFUN([AC_COIN_PROG_CXX],
420[AC_REQUIRE([AC_COIN_PROG_CC]) #Let's try if that overcomes configuration problem with VC++ 6.0
421AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
422AC_LANG_PUSH(C++)
423
424AC_ARG_VAR(CXXDEFS,[Additional -D flags to be used when compiling C++ code.])
425AC_ARG_VAR(ADD_CXXFLAGS,[Additional C++ compiler options])
426AC_ARG_VAR(DBG_CXXFLAGS,[Debug C++ compiler options])
427AC_ARG_VAR(OPT_CXXFLAGS,[Optimize C++ compiler options])
428
429coin_has_cxx=yes
430
431save_cxxflags="$CXXFLAGS"
432case $build in
433  *-cygwin* | *-mingw*)
434             comps="g++ cl" ;;
435  *-darwin*) comps="g++ c++ CC" ;;
436          *) comps="xlC aCC CC g++ c++ pgCC icpc gpp cxx cc++ cl FCC KCC RCC" ;;
437esac
438
439# We delete the cached value, since the test might not have been
440# performed with out choise of compilers earlier
441$as_unset ac_cv_prog_CXX || test "${ac_cv_prog_CXX+set}" != set || { ac_cv_prog_CXX=; export ac_cv_prog_CXX; }
442AC_PROG_CXX([$comps])
443CXXFLAGS="$save_cxxflags"
444
445# Check if a project specific CXXFLAGS variable has been set
446if test x$COIN_PRJCT != x; then
447  eval coin_tmp=\${${COIN_PRJCT}_CXXFLAGS+set}
448  if test x$coin_tmp = xset; then
449    eval CXXFLAGS=\${${COIN_PRJCT}_CXXFLAGS}
450  fi
451fi
452
453if test x"$CXXFLAGS" = x; then
454
455# ToDo decide whether we want -DNDEBUG for optimization
456  coin_add_cxxflags=
457  coin_opt_cxxflags=
458  coin_dbg_cxxflags=
459  coin_warn_cxxflags=
460
461  if test "$GXX" = "yes"; then
462    case "$CXX" in
463      icpc* | */icpc*)
464        ;;
465      *)
466# ToDo decide about unroll-loops
467        coin_opt_cxxflags="-O3 -fomit-frame-pointer"
468        coin_add_cxxflags="-pipe"
469        coin_dbg_cxxflags="-g"
470        coin_warn_cxxflags="-pedantic-errors -Wimplicit -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion"
471        if test "$enable_doscompile" = yes; then
472          case $build in
473            *-cygwin*)
474              CXXFLAGS="-mno-cygwin"
475              AC_TRY_LINK([],[int i=0; i++;],
476                          [coin_add_cxxflags="-mno-cygwin $coin_add_cxxflags"])
477              CXXFLAGS=
478              ;;
479          esac
480        fi
481    esac
482  fi
483  if test -z "$coin_opt_cxxflags"; then
484    case $build in
485      *-cygwin* | *-mingw*)
486        case "$CXX" in
487          cl* | */cl*)
488            coin_opt_cxxflags='-O2'
489            coin_add_cxxflags='-nologo -EHsc -GR -MT'
490            coin_dbg_cxxflags='-Yd'
491            ;;
492        esac
493        ;;
494      *-linux-*)
495        case "$CXX" in
496          icpc* | */icpc*)
497            coin_opt_cxxflags="-O3 -ip"
498            coin_add_cxxflags=""
499            coin_dbg_cxxflags="-g"
500            # Check if -i_dynamic is necessary (for new glibc library)
501            CXXFLAGS=
502            AC_TRY_LINK([],[int i=0; i++;],[],
503                        [coin_add_cxxflags="-i_dynamic $coin_add_cxxflags"])
504            ;;
505          pgCC* | */pgCC*)
506            coin_opt_cxxflags="-fast"
507            coin_add_cxxflags="-Kieee -pc 64"
508            coin_dbg_cxxflags="-g"
509            ;;
510        esac
511        ;;
512      *-ibm-*)
513        case "$CXX" in
514          xlC* | */xlC* | mpxlC* | */mpxlC*)
515            coin_opt_cxxflags="-O3 -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
516            coin_add_cxxflags="-bmaxdata:0x80000000 -qrtti=dyna"
517            coin_dbg_cxxflags="-g"
518            ;;
519        esac
520        ;;
521      *-hp-*)
522        case "$CXX" in
523          aCC* | */aCC* )
524            coin_opt_cxxflags="-O"
525            coin_add_cxxflags="-AA"
526            coin_dbg_cxxflags="-g"
527            ;;
528        esac
529        ;;
530      *-sun-*)
531          coin_opt_cxxflags="-O4"
532          coin_dbg_cxxflags="-g"
533        ;;
534    esac
535  fi
536
537  if test "$ac_cv_prog_cxx_g" = yes && test -z "$coin_dbg_cxxflags" ; then
538    coin_dbg_cxxflags="-g"
539  fi
540
541  if test -z "$coin_opt_cxxflags"; then
542    # Try if -O option works if nothing else is set
543    CXXFLAGS=-O
544    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cxxflags="-O"])
545  fi
546
547  if test x${DBG_CXXFLAGS+set} != xset; then
548    DBG_CXXFLAGS="$coin_dbg_cxxflags $coin_add_cxxflags $coin_warn_cxxflags"
549  fi
550  if test x${OPT_CXXFLAGS+set} != xset; then
551    OPT_CXXFLAGS="$coin_opt_cxxflags $coin_add_cxxflags -DNDEBUG $coin_warn_cxxflags"
552  fi
553
554  DBG_CXXFLAGS="$DBG_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
555  OPT_CXXFLAGS="$OPT_CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
556
557  if test "$coin_debug_compile" = "true"; then
558    CXXFLAGS="$DBG_CXXFLAGS"
559  else
560    CXXFLAGS="$OPT_CXXFLAGS"
561  fi
562else
563  CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS $CXXDEFS"
564  if test x${DBG_CXXFLAGS+set} != xset; then
565    DBG_CXXFLAGS="$CXXFLAGS"
566  fi
567  if test x${OPT_CXXFLAGS+set} != xset; then
568    OPT_CXXFLAGS="$CXXFLAGS"
569  fi
570fi
571
572# Try if CXXFLAGS works
573save_CXXFLAGS="$CXXFLAGS"
574AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
575if test -z "$CXXFLAGS"; then
576  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.])
577  CXXFLAGS='-O'
578  AC_TRY_LINK([],[int i=0; i++;],[],[CXXFLAGS=])
579  if test -z "$CXXFLAGS"; then
580    AC_MSG_WARN([This value for CXXFLAGS does not work.  I will continue with empty CXXFLAGS, but you might want to set CXXFLAGS manually.])
581  fi
582fi
583
584AC_MSG_NOTICE([C++ compiler options are: $CXXFLAGS])
585
586AC_ARG_VAR(MPICXX,[C++ MPI Compiler])
587if test x"$MPICXX" = x; then :; else
588  AC_MSG_NOTICE([Will use MPI C++ compiler $MPICXX])
589  CXX="$MPICXX"
590fi
591
592case "$CXX" in
593  cl*)
594    AC_COIN_MINGW_LD_FIX
595    ;;
596esac
597
598AC_LANG_POP(C++)
599]) # AC_COIN_PROG_CXX
600
601
602###########################################################################
603#                             COIN_CXXLIBS                                #
604###########################################################################
605
606# Determine the C++ runtime libraries required for linking a C++ library
607# with a Fortran or C compiler.  The result is available in CXXLIBS.
608
609AC_DEFUN([AC_COIN_CXXLIBS],
610[AC_REQUIRE([AC_PROG_CXX])dnl
611AC_LANG_PUSH(C++)
612AC_ARG_VAR(CXXLIBS,[Libraries necessary for linking C++ code with Fortran compiler])
613if test -z "$CXXLIBS"; then
614  if test "$GXX" = "yes"; then
615    case "$CXX" in
616      icpc* | */icpc*)
617        CXXLIBS=""
618        ;;
619      *)
620        CXXLIBS="-lstdc++ -lm" # -lgcc"
621        ;;
622    esac
623  else
624    case $build in
625     *-mingw32 | *-cygwin-* )
626      case "$CXX" in
627      cl*)
628        CXXLIBS=nothing;;
629      esac;;
630     *-linux-*)
631      case "$CXX" in
632      icpc* | */icpc*)
633        CXXLIBS=""
634             ;;
635      pgCC* | */pgCC*)
636        CXXLIBS="-lstd -lC -lc"
637             ;;
638      esac;;
639    *-ibm-*)
640      CXXLIBS="-lC -lc"
641      ;;
642    *-hp-*)
643      CXXLIBS="-L/opt/aCC/lib -l++ -lstd_v2 -lCsup_v2 -lm -lcl -lc"
644      ;;
645    *-sun-*)
646      CXXLIBS="-lCstd -lCrun"
647    esac
648  fi
649fi
650if test -z "$CXXLIBS"; then
651  AC_MSG_WARN([Could not automatically determine CXXLIBS (C++ link libraries; necessary if main program is in Fortran of C).])
652else
653  AC_MSG_NOTICE([Assuming that CXXLIBS is \"$CXXLIBS\".])
654fi
655if test x"$CXXLIBS" = xnothing; then
656  CXXLIBS=
657fi
658AC_LANG_POP(C++)
659]) # AC_COIN_CXXLIBS
660
661###########################################################################
662#                           COIN_CHECK_HEADER                             #
663###########################################################################
664
665# This macro checks for a header file, but it does so without the
666# standard header.  This avoids warning messages like:
667#
668# configure: WARNING: dlfcn.h: present but cannot be compiled
669# configure: WARNING: dlfcn.h:     check for missing prerequisite headers?
670# configure: WARNING: dlfcn.h: see the Autoconf documentation
671# configure: WARNING: dlfcn.h:     section "Present But Cannot Be Compiled"
672# configure: WARNING: dlfcn.h: proceeding with the preprocessor's result
673# configure: WARNING: dlfcn.h: in the future, the compiler will take precedence
674
675AC_DEFUN([AC_COIN_CHECK_HEADER],
676[if test x"$4" = x; then
677  hdr="#include <$1>"
678else
679  hdr="$4"
680fi
681AC_CHECK_HEADERS([$1],[$2],[$3],[$hdr])
682]) # AC_COIN_CHECK_HEADER
683
684###########################################################################
685#                       COIN_CHECK_CXX_CHEADER                             #
686###########################################################################
687
688# This macro checks for C header files that are used from C++.  For a give
689# stub (e.g., math), it first checks if the C++ library (cmath) is available.
690# If it is, it defines HAVE_CMATH (or whatever the stub is).  If it is not
691# available, it checks for the old C head (math.h) and defines HAVE_MATH_H
692# if that one exists.
693
694AC_DEFUN([AC_COIN_CHECK_CXX_CHEADER],
695[AC_LANG_PUSH(C++)
696AC_COIN_CHECK_HEADER([c$1],[$2],[$3],[$4])
697if test "$ac_cv_header_c$1" != "yes"; then
698  AC_COIN_CHECK_HEADER([$1.h],[$2],[$3],[$4])
699fi
700AC_LANG_POP(C++)
701]) # AC_COIN_CHECK_CXX_CHEADER
702
703###########################################################################
704#                             COIN_PROG_CC                                #
705###########################################################################
706
707# Find the compile command by running AC_PROG_CC (with compiler names
708# for different operating systems) and put it into CC (unless it was
709# given my the user), and find an appropriate value for CFLAGS.  It is
710# possible to provide additional -D flags in the variable CDEFS.
711
712AC_DEFUN([AC_COIN_PROG_CC],
713[AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
714AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
715AC_LANG_PUSH(C)
716
717# For consistency, we set the C compiler to the same value of the C++
718# compiler, if the C++ is set, but the C compiler isn't (only for CXX=cl)
719if test x"$CXX" != x; then
720  case "$CXX" in
721    cl*)
722      if test x"$CC" = x; then
723        CC="$CXX"
724        AC_MSG_WARN([C++ compiler name provided as $CXX, but CC is unset. Setting CC to $CXX])
725      fi
726      ;;
727  esac
728fi
729
730AC_ARG_VAR(CDEFS,[Additional -D flags to be used when compiling C code.])
731AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options])
732AC_ARG_VAR(DBG_CFLAGS,[Debug C compiler options])
733AC_ARG_VAR(OPT_CFLAGS,[Optimize C compiler options])
734
735coin_has_cc=yes
736
737save_cflags="$CFLAGS"
738case $build in
739  *-cygwin* | *-mingw*)
740             comps="gcc cl" ;;
741  *-linux-*) comps="xlc gcc cc pgcc icc" ;;
742  *)         comps="xlc_r xlc cc gcc pgcc icc" ;;
743esac
744
745# We delete the cached value, since the test might not have been
746# performed with out choise of compilers earlier
747$as_unset ac_cv_prog_CC || test "${ac_cv_prog_CC+set}" != set || { ac_cv_prog_CC=; export ac_cv_prog_CC; }
748AC_PROG_CC([$comps])
749CFLAGS="$save_cflags"
750
751# Check if a project specific CFLAGS variable has been set
752if test x$COIN_PRJCT != x; then
753  eval coin_tmp=\${${COIN_PRJCT}_CFLAGS+set}
754  if test x$coin_tmp = xset; then
755    eval CFLAGS=\${${COIN_PRJCT}_CFLAGS}
756  fi
757fi
758
759if test x"$CFLAGS" = x; then
760
761  coin_add_cflags=
762  coin_opt_cflags=
763  coin_dbg_cflags=
764  coin_warn_cflags=
765
766  if test "$GCC" = "yes"; then
767    case "$CC" in
768      icc* | */icc*)
769        ;;
770      *)
771        coin_opt_cflags="-O3 -fomit-frame-pointer"
772        coin_add_cflags="-pipe"
773        coin_dbg_cflags="-g"
774        coin_warn_cflags="-pedantic-errors -Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall"
775        if test "$enable_doscompile" = yes; then
776          case $build in
777            *-cygwin*)
778              CFLAGS="-mno-cygwin"
779              AC_TRY_LINK([],[int i=0; i++;],
780                          [coin_add_cflags="-mno-cygwin $coin_add_cflags"])
781              CFLAGS=
782            ;;
783          esac
784        fi
785    esac
786  fi
787  if test -z "$coin_opt_cflags"; then
788    case $build in
789      *-cygwin* | *-mingw*)
790        case "$CC" in
791          cl* | */cl*)
792            coin_opt_cflags='-O2'
793            coin_add_cflags='-nologo'
794            coin_dbg_cflags='-Yd'
795            ;;
796        esac
797        ;;
798      *-linux-*)
799        case "$CC" in
800          icc* | */icc*)
801            coin_opt_cflags="-O3 -ip"
802            coin_add_cflags=""
803            coin_dbg_cflags="-g"
804            # Check if -i_dynamic is necessary (for new glibc library)
805            CFLAGS=
806            AC_TRY_LINK([],[int i=0; i++;],[],
807                        [coin_add_cflags="-i_dynamic $coin_add_cflags"])
808            ;;
809          pgcc* | */pgcc*)
810            coin_opt_cflags="-fast"
811            coin_add_cflags="-Kieee -pc 64"
812            coin_dbg_cflags="-g"
813            ;;
814        esac
815        ;;
816      *-ibm-*)
817        case "$CC" in
818          xlc* | */xlc* | mpxlc* | */mpxlc*)
819            coin_opt_cflags="-O3 -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
820            coin_add_cflags="-bmaxdata:0x80000000"
821            coin_dbg_cflags="-g"
822          ;;
823        esac
824        ;;
825      *-hp-*)
826        coin_opt_cflags="-O"
827        coin_add_cflags="-Ae"
828        coin_dbg_cflags="-g"
829        ;;
830      *-sun-*)
831        coin_opt_cflags="-xO4"
832        coin_dbg_cflags="-g"
833        ;;
834      *-sgi-*)
835        coin_opt_cflags="-O -OPT:Olimit=0"
836        coin_dbg_cflags="-g"
837        ;;
838    esac
839  fi
840
841  if test "$ac_cv_prog_cc_g" = yes && test -z "$coin_dbg_cflags" ; then
842    coin_dbg_cflags="-g"
843  fi
844
845  if test -z "$coin_opt_cflags"; then
846    # Try if -O option works if nothing else is set
847    CFLAGS="-O"
848    AC_TRY_LINK([],[int i=0; i++;],[coin_opt_cflags="-O"])
849  fi
850
851  if test x${DBG_CFLAGS+set} != xset; then
852    DBG_CFLAGS="$coin_dbg_cflags $coin_add_cflags $coin_warn_cflags"
853  fi
854  if test x${OPT_CFLAGS+set} != xset; then
855    OPT_CFLAGS="$coin_opt_cflags $coin_add_cflags -DNDEBUG $coin_warn_cflags"
856  fi
857
858  DBG_CFLAGS="$DBG_CFLAGS $ADD_CFLAGS $CDEFS"
859  OPT_CFLAGS="$OPT_CFLAGS $ADD_CFLAGS $CDEFS"
860
861  if test "$coin_debug_compile" = "true"; then
862    CFLAGS="$DBG_CFLAGS"
863  else
864    CFLAGS="$OPT_CFLAGS"
865  fi
866else
867  CFLAGS="$CFLAGS $ADD_CFLAGS $CDEFS"
868  if test x${DBG_CFLAGS+set} != xset; then
869    DBG_CFLAGS="$CFLAGS"
870  fi
871  if test x${OPT_CFLAGS+set} != xset; then
872    OPT_CFLAGS="$CFLAGS"
873  fi
874fi
875
876# Check if user wants to have additional CFLAGS options
877AC_ARG_VAR(ADD_CFLAGS,[Additional C compiler options])
878if test x"$ADD_CFLAGS" != x; then
879  CFLAGS="$CFLAGS $ADD_CFLAGS"
880fi
881
882# Try if CFLAGS works
883save_CFLAGS="$CFLAGS"
884AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
885if test -z "$CFLAGS"; then
886  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.])
887  CFLAGS='-O'
888  AC_TRY_LINK([],[int i=0; i++;],[],[CFLAGS=])
889  if test -z "$CFLAGS"; then
890    AC_MSG_WARN([This value for CFLAGS does not work.  I will continue with empty CFLAGS, but you might want to set CFLAGS manually.])
891  fi
892fi
893
894AC_MSG_NOTICE([C compiler options are: $CFLAGS])
895
896AC_ARG_VAR(MPICC,[C MPI Compiler])
897if test x"$MPICC" = x; then :; else
898  AC_MSG_NOTICE([Will use MPI C compiler $MPICC])
899  CC="$MPICC"
900fi
901
902# Correct ADDLIBS initialization if we are using the MS compiler
903case "$CC" in
904  cl*)
905    ADDLIBS=
906    AC_COIN_MINGW_LD_FIX
907    ;;
908esac
909
910AC_LANG_POP(C)
911]) # AC_COIN_PROG_CC
912
913###########################################################################
914#                             COIN_PROG_F77                               #
915###########################################################################
916
917# Find the compile command by running AC_PROG_F77 (with compiler names
918# for different operating systems) and put it into F77 (unless it was
919# given my the user), and find an appropriate value for FFLAGS
920
921AC_DEFUN([AC_COIN_PROG_F77],
922[AC_REQUIRE([AC_COIN_MINGW_LD_FIX])
923AC_REQUIRE([AC_COIN_ENABLE_DOSCOMPILE])
924AC_REQUIRE([AC_COIN_PROG_CC])
925AC_LANG_PUSH([Fortran 77])
926
927AC_ARG_VAR(ADD_FFLAGS,[Additional Fortran compiler options])
928AC_ARG_VAR(DBG_FFLAGS,[Debug Fortran compiler options])
929AC_ARG_VAR(OPT_FFLAGS,[Optimize Fortran compiler options])
930
931coin_has_f77=yes
932
933save_fflags="$FFLAGS"
934case $build in
935  *-cygwin* | *-mingw*)
936             comps="gfortran g77 ifort fl32" ;;
937  *)         comps="xlf fort77 gfortran f77 g77 pgf90 pgf77 ifort ifc frt af77" ;;
938esac
939
940# We delete the cached value, since the test might not have been
941# performed with out choise of compilers earlier
942$as_unset ac_cv_prog_F77 || test "${ac_cv_prog_F77+set}" != set || { ac_cv_prog_F77=; export ac_cv_prog_F77; }
943AC_PROG_F77($comps)
944FFLAGS="$save_fflags"
945
946# Check if a project specific FFLAGS variable has been set
947if test x$COIN_PRJCT != x; then
948  eval coin_tmp=\${${COIN_PRJCT}_FFLAGS+set}
949  if test x$coin_tmp = xset; then
950    eval FFLAGS=\${${COIN_PRJCT}_FFLAGS}
951  fi
952fi
953
954if test x"$FFLAGS" = x; then
955
956  coin_add_fflags=
957  coin_opt_fflags=
958  coin_dbg_fflags=
959  coin_warn_fflags=
960
961  if test "$G77" = "yes"; then
962    coin_opt_fflags="-O3 -fomit-frame-pointer"
963    coin_add_fflags="-pipe"
964    coin_dbg_fflags="-g"
965    if test "$enable_doscompile" = yes; then
966      case $build in
967        *-cygwin*)
968          FFLAGS="-mno-cygwin"
969          AC_TRY_LINK([],[      write(*,*) 'Hello world'],
970                      [coin_add_fflags="-mno-cygwin $coin_add_fflags"])
971          FFLAGS=
972        ;;
973      esac
974    fi
975  else
976    case $build in
977      *-cygwin* | *-mingw*)
978        case $F77 in
979          ifort* | */ifort*)
980            coin_opt_fflags='-O3'
981            coin_add_fflags='-nologo -MT'
982            coin_dbg_fflags='-debug'
983          ;;
984        esac
985        ;;
986      *-linux-*)
987        case $F77 in
988          ifc* | */ifc* | ifort* | */ifort*)
989            coin_opt_fflags="-O3 -ip"
990            coin_add_fflags="-cm -w90 -w95"
991            coin_dbg_fflags="-g -CA -CB -CS"
992            # Check if -i_dynamic is necessary (for new glibc library)
993            FFLAGS=
994            AC_TRY_LINK([],[      write(*,*) 'Hello world'],[],
995                        [coin_add_fflags="-i_dynamic $coin_add_fflags"])
996            ;;
997          pgf77* | */pgf77* | pgf90* | */pgf90*)
998            coin_opt_fflags="-fast"
999            coin_add_fflags="-Kieee -pc 64"
1000            coin_dbg_fflags="-g"
1001          ;;
1002        esac
1003        ;;
1004      *-ibm-*)
1005        case "$F77" in
1006          xlf* | */xlf* | mpxlf* | */mpxlf* )
1007            coin_opt_fflags="-O3 -qarch=auto -qcache=auto -qtune=auto -qmaxmem=-1"
1008            coin_add_fflags="-bmaxdata:0x80000000"
1009            coin_dbg_fflags="-g -C"
1010            ;;
1011        esac
1012        ;;
1013      *-hp-*)
1014        coin_opt_fflags="+O3"
1015        coin_add_fflags="+U77"
1016        coin_dbg_fflags="-C -g"
1017        ;;
1018      *-sun-*)
1019        coin_opt_fflags="-O4"
1020        coin_dbg_fflags="-g"
1021        ;;
1022      *-sgi-*)
1023        coin_opt_fflags="-O5 -OPT:Olimit=0"
1024        coin_dbg_fflags="-g"
1025        ;;
1026    esac
1027  fi
1028
1029  if test "$ac_cv_prog_f77_g" = yes && test -z "$coin_dbg_fflags" ; then
1030    coin_dbg_fflags="-g"
1031  fi
1032
1033  if test -z "$coin_opt_fflags"; then
1034    # Try if -O option works if nothing else is set
1035    FFLAGS=-O
1036    AC_TRY_LINK([],[      integer i], [coin_opt_fflags="-O"])
1037  fi
1038
1039  if test x${DBG_FFLAGS+set} != xset; then
1040    DBG_FFLAGS="$coin_dbg_fflags $coin_add_fflags $coin_warn_fflags"
1041  fi
1042  if test x${OPT_FFLAGS+set} != xset; then
1043    OPT_FFLAGS="$coin_opt_fflags $coin_add_fflags $coin_warn_fflags"
1044  fi
1045
1046  DBG_FFLAGS="$DBG_FFLAGS $ADD_FFLAGS"
1047  OPT_FFLAGS="$OPT_FFLAGS $ADD_FFLAGS"
1048
1049  if test "$coin_debug_compile" = "true"; then
1050    FFLAGS="$DBG_FFLAGS"
1051  else
1052    FFLAGS="$OPT_FFLAGS"
1053  fi
1054else
1055  FFLAGS="$FFLAGS $ADD_FFLAGS"
1056  if test x${DBG_FFLAGS+set} != xset; then
1057    DBG_FFLAGS="$FFLAGS"
1058  fi
1059  if test x${OPT_FFLAGS+set} != xset; then
1060    OPT_FFLAGS="$FFLAGS"
1061  fi
1062fi
1063
1064# Try if FFLAGS works
1065AC_TRY_LINK([],[      integer i],[],[FFLAGS=])
1066if test -z "$FFLAGS"; then
1067  AC_MSG_WARN([The flags FFLAGS="$FFLAGS" do not work.  I will now just try '-O', but you might want to set FFLAGS manually.])
1068  FFLAGS='-O'
1069  AC_TRY_LINK([],[      integer i],[],[FFLAGS=])
1070  if test -z "$FFLAGS"; then
1071    AC_MSG_WARN([This value for FFLAGS does not work.  I will continue with empty FFLAGS, but you might want to set FFLAGS manually.])
1072  fi
1073fi
1074
1075AC_MSG_NOTICE([Fortran compiler options are: $FFLAGS])
1076
1077AC_ARG_VAR(MPIF77,[Fortran MPI Compiler])
1078if test x"$MPIF77" = x; then :; else
1079  AC_MSG_NOTICE([Will use MPI Fortran compiler $MPIF77])
1080  F77="$MPIF77"
1081fi
1082
1083case "$F77" in
1084  ifort*)
1085    AC_COIN_MINGW_LD_FIX
1086    ;;
1087esac
1088
1089AC_LANG_POP([Fortran 77])
1090]) # AC_COIN_PROG_F77
1091
1092###########################################################################
1093#                           COIN_F77_WRAPPERS                             #
1094###########################################################################
1095
1096# Calls autoconfs AC_F77_WRAPPERS and does additional corrections to FLIBS
1097
1098AC_DEFUN([AC_COIN_F77_WRAPPERS],
1099[AC_BEFORE([AC_COIN_PROG_F77],[$0])dnl
1100AC_BEFORE([AC_PROG_F77],[$0])dnl
1101
1102AC_LANG_PUSH([Fortran 77])
1103
1104AC_F77_WRAPPERS
1105
1106# This is to correct a missing exclusion in autoconf 2.59
1107if test x"$FLIBS" != x; then
1108  my_flibs=
1109  for flag in $FLIBS; do
1110    case flag in
1111      -lcrt*.o) ;;
1112             *) my_flibs="$my_flibs $flag" ;;
1113    esac
1114  done
1115  FLIBS="$my_flibs"
1116fi
1117
1118case $build in
1119# The following is a fix to define FLIBS for ifort on Windows
1120   *-cygwin* | *-mingw*)
1121     case "$F77" in
1122       ifort* | */ifort*)
1123           FLIBS="-link libifcorert.lib $LIBS /NODEFAULTLIB:libc.lib";;
1124     esac;;
1125   *-hp-*)
1126       FLIBS="$FLIBS -lm";;
1127   *-ibm-*)
1128       FLIBS=`echo $FLIBS | sed 's/-lc)/-lc/g'` ;;
1129   *-linux-*)
1130     case "$F77" in
1131       pgf77* | */pgf77* | pgf90* | */pgf90*)
1132# ask linker to go through the archives multiple times
1133# (the Fortran compiler seems to do that automatically...
1134         FLIBS="-Wl,--start-group $FLIBS -Wl,--end-group" ;;
1135     esac
1136esac
1137
1138]) # AC_COIN_F77_WRAPPERS
1139
1140
1141###########################################################################
1142#                          COIN_INIT_AUTOMAKE                             #
1143###########################################################################
1144
1145# This macro calls the regular INIT_AUTOMAKE and MAINTAINER_MODE
1146# macros, and defines additional variables and makefile conditionals,
1147# that are used in the maintainer parts of the makfile.  It also
1148# checks if the correct versions of the autotools are used.
1149#
1150# This also defines the AC_SUBST variables:
1151# abs_source_dir     absolute path to source code for this package
1152# abs_bin_dir        absolute path to the directory where binaries are
1153#                    going to be installed (prefix/bin)
1154# abs_lib_dir        absolute path to the directory where libraries are
1155#                    going to be installed (prefix/lib)
1156# abs_include_dir    absolute path to the directory where the header files
1157#                    are installed (prefix/include)
1158
1159AC_DEFUN([AC_COIN_INIT_AUTOMAKE],
1160[AC_REQUIRE([AC_PROG_EGREP])
1161# Stuff for automake
1162AM_INIT_AUTOMAKE
1163AM_MAINTAINER_MODE
1164
1165coin_have_externals=no
1166if test "$enable_maintainer_mode" = yes; then
1167
1168  # If maintainer mode is chosen, we make sure that the correct versions
1169  # of the tools are used, and that we know where libtoo.m4 is (to
1170  # recreate acinclude.m4)
1171
1172  AC_SUBST(LIBTOOLM4)
1173  LIBTOOLM4=
1174
1175  # Check if we have autoconf
1176  AC_CHECK_PROG([have_autoconf],[autoconf],[yes],[no])
1177  if test $have_autoconf = no; then
1178    AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find autoconf in your path.])
1179  fi
1180
1181  # Check whether autoconf is the correct version
1182  correct_version='2.59'
1183  grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1184  AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of autoconf])
1185  autoconf --version > confauto.out 2>&1
1186  if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
1187    AC_MSG_RESULT([yes])
1188  else
1189    rm -f confauto.out
1190    AC_MSG_RESULT([no])
1191    AC_MSG_ERROR([You don't have the correct version of autoconf as the first one in your path.])
1192  fi
1193  rm -f confauto.out
1194
1195  # Check if the executable autoconf is picked up from the correct location
1196  AC_MSG_CHECKING([whether autoconf is coming from the correct location])
1197  autoconf_dir=`which autoconf | sed -e 's=/autoconf=='`
1198  autoconf_dir=`cd $autoconf_dir; pwd`
1199  if test x$AUTOTOOLS_DIR = x; then
1200    want_dir=$HOME/bin
1201  else
1202    want_dir=$AUTOTOOLS_DIR/bin
1203  fi
1204  if test $autoconf_dir = `cd $want_dir; pwd`; then
1205    AC_MSG_RESULT([yes])
1206  else
1207    rm -f confauto.out
1208    AC_MSG_RESULT([no])
1209    AC_MSG_ERROR([The autoconf executable should be picked up from \$HOME/bin or \$AUTOTOOLS_DIR/bin.])
1210  fi
1211
1212  # Check if we have automake
1213  AC_CHECK_PROG([have_automake],[automake],[yes],[no])
1214  if test $have_automake = no; then
1215    AC_MSG_ERROR([You specified you want to use maintainer mode, but I cannot find automake in your path.])
1216  fi
1217 
1218  # Check whether automake is the correct version
1219  correct_version='1.9.6'
1220  grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1221  AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of automake])
1222  automake --version > confauto.out 2>&1
1223  if $EGREP $grep_version confauto.out >/dev/null 2>&1; then
1224    AC_MSG_RESULT([yes])
1225  else
1226    rm -f confauto.out
1227    AC_MSG_RESULT([no])
1228    AC_MSG_ERROR([You don't have the correct version of automake as the first one in your path.])
1229  fi
1230  rm -f confauto.out
1231
1232  # Check if the executable automake is picked up from the correct location
1233  AC_MSG_CHECKING([whether automake is coming from the correct location])
1234  automake_dir=`which automake | sed -e 's=/automake=='`
1235  automake_dir=`cd $automake_dir; pwd`
1236  if test x$AUTOTOOLS_DIR = x; then
1237    want_dir=$HOME/bin
1238  else
1239    want_dir=$AUTOTOOLS_DIR/bin
1240  fi
1241  if test $automake_dir = `cd $want_dir; pwd`; then
1242    AC_MSG_RESULT([yes])
1243  else
1244    rm -f confauto.out
1245    AC_MSG_RESULT([no])
1246    AC_MSG_ERROR([The automake executable should be picked up from \$HOME/bin or \$AUTOTOOLS_DIR/bin.])
1247  fi
1248
1249  # Check if we can find the libtool file
1250  if test x$AUTOTOOLS_DIR = x; then
1251    want_dir=$HOME/share
1252  else
1253    want_dir=$AUTOTOOLS_DIR/share
1254  fi
1255  AC_CHECK_FILE([$want_dir/aclocal/libtool.m4],
1256                [LIBTOOLM4="$want_dir/aclocal/libtool.m4"],
1257                [AC_MSG_ERROR([I cannot find the libtool.m4 file.])])
1258
1259  # Check if this is the correct version of libtool (with escaped dots)
1260  correct_version='1.5.22'
1261  grep_version=`echo  $correct_version | sed -e 's/\\./\\\\\\./g'`
1262  AC_CHECK_FILE([$want_dir/libtool/ltmain.sh],
1263                [have_ltmain=yes],
1264                [have_ltmain=no])
1265  AC_MSG_CHECKING([whether we are using the correct version ($correct_version) of libtool.])
1266  if test $have_ltmain = yes; then
1267    if $EGREP $grep_version $want_dir/libtool/ltmain.sh >/dev/null 2>&1; then
1268      AC_MSG_RESULT([yes])
1269    else
1270      AC_MSG_RESULT([no])
1271      AC_MSG_ERROR([You don't have the correct version of libtool.])
1272    fi
1273  else
1274    AC_MSG_RESULT([no])
1275    AC_MSG_ERROR([I cannot find the ltmain.sh file.])
1276  fi 
1277
1278  # Check if we have an Externals file
1279  if test -r $srcdir/Externals; then
1280    coin_have_externals=yes
1281  fi
1282  # Check if subversion is installed and understands https
1283  AC_CHECK_PROG([have_svn],[svn],[yes],[no])
1284  if test x$have_svn = xyes; then
1285    AC_MSG_CHECKING([svn understands https])
1286    svn --version > confauto.out 2>&1
1287    if $EGREP https confauto.out >/dev/null 2>&1; then
1288      AC_MSG_RESULT(yes)
1289    else
1290      AC_MSG_RESULT(no)
1291      have_svn=no
1292    fi
1293    rm -f confauto.out
1294  fi
1295
1296  # Find the location of the BuildTools directory
1297  BUILDTOOLSDIR=
1298  if test -r $srcdir/BuildTools/coin.m4; then
1299    BUILDTOOLSDIR=$srcdir/BuildTools
1300  else
1301    if test -r $srcdir/../BuildTools/coin.m4; then
1302      BUILDTOOLSDIR=$srcdir/../BuildTools
1303    else
1304      if test -r $srcdir/../../BuildTools/coin.m4; then
1305        BUILDTOOLSDIR=$srcdir/../../BuildTools
1306      else
1307        AC_MSG_ERROR(Cannot find the BuildTools directory)
1308      fi
1309    fi
1310  fi
1311  AC_SUBST(BUILDTOOLSDIR)
1312
1313  # The following variable is set to the name of the directory where
1314  # the autotool scripts are located
1315  AC_SUBST(AUX_DIR)
1316  AUX_DIR=$ac_aux_dir
1317fi
1318
1319# helpful variable for the base directory of this package
1320abs_source_dir=`cd $srcdir; pwd`
1321AC_SUBST(abs_source_dir)
1322
1323# Stuff for example Makefiles
1324if test x$prefix = xNONE; then
1325  full_prefix=$ac_default_prefix
1326else
1327  full_prefix=$prefix
1328fi
1329full_prefix=`cd $full_prefix ; pwd`
1330AC_SUBST(abs_lib_dir)
1331abs_lib_dir=$full_prefix/lib
1332AC_SUBST(abs_include_dir)
1333abs_include_dir=$full_prefix/include
1334AC_SUBST(abs_bin_dir)
1335abs_bin_dir=$full_prefix/bin
1336
1337AM_CONDITIONAL(HAVE_EXTERNALS,
1338               test $coin_have_externals = yes && test x$have_svn = xyes)
1339]) # AC_COIN_INIT_AUTOMAKE
1340
1341###########################################################################
1342#                         COIN_INIT_AUTO_TOOLS                            #
1343###########################################################################
1344
1345# Initialize the auto tools automake and libtool, with all
1346# modifications we want for COIN packages.
1347#
1348# RPATH_FLAGS        link flags for hardcoding path to shared objects
1349
1350# This is a trick to have this code before AC_COIN_PROG_LIBTOOL
1351AC_DEFUN([AC_COIN_DISABLE_STATIC],
1352[
1353# On Cygwin, building DLLs doesn't work
1354case $build in
1355  *-cygwin*)
1356    coin_disable_shared=yes
1357    platform=Cygwin
1358  ;;
1359  *-mingw*)
1360    coin_disable_shared=yes
1361    platform="Msys"
1362#    case "$CXX" in
1363#      cl*)
1364#        coin_disable_shared=yes
1365#        platform="Msys with cl"
1366#    ;;
1367#    esac
1368  ;;
1369esac
1370if test x"$coin_disable_shared" = xyes; then
1371  if test x"$enable_shared" = xyes; then
1372    AC_MSG_WARN([On $platform, shared objects are not supported. I'm disabling your choice.])
1373  fi
1374  enable_shared=no
1375fi
1376# By default, we only want the shared objects to be compiled
1377AC_DISABLE_STATIC
1378])
1379
1380AC_DEFUN([AC_COIN_INIT_AUTO_TOOLS],
1381[AC_BEFORE([AC_COIN_PROG_CXX],[$0])
1382AC_BEFORE([AC_COIN_PROG_CC],[$0])
1383AC_BEFORE([AC_COIN_PROG_F77],[$0])
1384AC_REQUIRE([AC_COIN_DISABLE_STATIC])
1385
1386# Initialize automake
1387AC_COIN_INIT_AUTOMAKE
1388
1389# Stuff for libtool
1390AC_COIN_PROG_LIBTOOL
1391
1392# set RPATH_FLAGS to the compiler link flags required to hardcode location
1393# of the shared objects
1394AC_COIN_RPATH_FLAGS($abs_lib_dir)
1395]) # AC_COIN_INIT_AUTO_TOOLS
1396
1397###########################################################################
1398#                           COIN_PROG_LIBTOOL                             #
1399###########################################################################
1400
1401# Setup the libtool stuff together with any modifications to make it
1402# work on additional platforms
1403
1404AC_DEFUN([AC_COIN_PROG_LIBTOOL],
1405[AC_REQUIRE([AC_COIN_DLFCN_H])
1406
1407# We check for this header here in a non-standard way to avoid warning
1408# messages
1409AC_PROG_LIBTOOL
1410
1411# Fix bugs in libtool script for Windows native compilation:
1412# - cygpath is not correctly quoted in fix_srcfile_path
1413# - paths generated for .lib files is not run through cygpath -w
1414
1415
1416# - lib includes subdirectory information; we want to replace
1417#
1418# old_archive_cmds="lib /OUT:\$oldlib\$oldobjs\$old_deplibs"
1419#
1420# by
1421#
1422# 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"
1423#
1424#          -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"%' \
1425
1426# The following was a hack for chaniing @BACKSLASH to \
1427#          -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' \
1428
1429# Correct cygpath for minGW (ToDo!)
1430case $build in
1431  *-mingw*)
1432    CYGPATH_W=echo
1433    ;;
1434esac
1435
1436case $build in
1437  *-cygwin* | *-mingw*)
1438  case "$CXX" in
1439    cl* | */cl*)
1440      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
1441      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1442          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1443          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1444          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
1445          -e 's%lib /OUT:%lib -OUT:%' \
1446          -e "s%cygpath -w%$CYGPATH_W%" \
1447          -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%' \
1448          -e 's/$AR t/lib -nologo -list/' \
1449          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
1450          -e  's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
1451      libtool > conftest.bla
1452
1453      mv conftest.bla libtool
1454      chmod 755 libtool
1455      ;;
1456    *)
1457      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
1458      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
1459          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
1460          -e 's|libext="lib"|libext="a"|' \
1461      libtool > conftest.bla
1462
1463      mv conftest.bla libtool
1464      chmod 755 libtool
1465      ;;
1466  esac
1467esac
1468
1469# ToDo
1470# For now, don't use the -no-undefined flag, since the Makefiles are
1471# not yet set up that way.  But we need to fix this, when we want
1472# to comile DLLs under Windows.
1473LT_LDFLAGS=
1474AC_SUBST(LT_LDFLAGS)
1475]) # AC_COIN_PROG_LIBTOOL
1476
1477# This is a trick to force the check for the dlfcn header to be done before
1478# the checks for libtool
1479AC_DEFUN([AC_COIN_DLFCN_H],
1480[AC_LANG_PUSH(C)
1481AC_COIN_CHECK_HEADER([dlfcn.h])
1482AC_LANG_POP(C)
1483]) # AC_COIN_DLFCN_H
1484
1485###########################################################################
1486#                            COIN_RPATH_FLAGS                             #
1487###########################################################################
1488
1489# This macro, in case shared objects are used, defines a variable
1490# RPATH_FLAGS that can be used by the linker to hardwire the library
1491# search path for the given directories.  This is useful for example
1492# Makefiles
1493
1494AC_DEFUN([AC_COIN_RPATH_FLAGS],
1495[RPATH_FLAGS=
1496
1497if test $enable_shared = yes; then
1498  case $build in
1499    *-linux-*)
1500      if test "$GXX" = "yes"; then
1501        RPATH_FLAGS=
1502        for dir in $1; do
1503          RPATH_FLAGS="$RPATH_FLAGS -Wl,--rpath -Wl,$dir"
1504        done
1505      fi ;;
1506    *-darwin*)
1507        RPATH_FLAGS=nothing ;;
1508    *-ibm-*)
1509      case "$CXX" in
1510      xlC* | */xlC* | mpxlC* | */mpxlC*)
1511        RPATH_FLAGS=nothing ;;
1512      esac ;;
1513    *-hp-*)
1514        RPATH_FLAGS=nothing ;;
1515    *-mingw32)
1516        RPATH_FLAGS=nothing ;;
1517    *-sun-*)
1518        RPATH_FLAGS=
1519        for dir in $1; do
1520          RPATH_FLAGS="$RPATH_FLAGS -R$dir"
1521        done
1522  esac
1523
1524  if test "$RPATH_FLAGS" = ""; then
1525    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.])
1526  fi
1527  if test "$RPATH_FLAGS" = "nothing"; then
1528    RPATH_FLAGS=
1529  fi
1530fi
1531
1532AC_SUBST(RPATH_FLAGS)
1533]) # AC_COIN_RPATH_FLAGS
1534
1535###########################################################################
1536#                              COIN_FINALIZE                              #
1537###########################################################################
1538
1539# This macro should be called at the very end of the configure.ac file.
1540# It creates the output files (by using AC_OUTPUT), and might do some other
1541# things (such as generating links to data files in a VPATH configuration).
1542# It also prints the "success" message.
1543
1544AC_DEFUN([AC_COIN_FINALIZE],
1545[
1546FADDLIBS="$ADDLIBS"
1547if test x"$coin_need_flibs" = xyes; then
1548  ADDLIBS="$ADDLIBS $FLIBS"
1549fi
1550
1551# library extension
1552AC_SUBST(LIBEXT)
1553case "$CC" in
1554  cl*) LIBEXT=lib ;;
1555    *) LIBEXT=a ;;
1556esac
1557
1558# Define VPATH_DISTCLEANFILES to be everything that needs to be
1559# cleaned for distclean in a vpath configuration
1560AC_SUBST(VPATH_DISTCLEANFILES)
1561VPATH_DISTCLEANFILES="$coin_vpath_link_files"
1562
1563AC_OUTPUT
1564
1565if test x"$coin_vpath_link_files" = x; then : ; else
1566  AC_MSG_NOTICE(Creating VPATH links for data files)
1567  for file in $coin_vpath_link_files; do
1568    rm -f $file
1569    $LN_S $abs_source_dir/$file $file
1570  done
1571fi
1572
1573if test x$coin_projectdir = xyes; then
1574  AC_MSG_NOTICE([Configuration of $PACKAGE_NAME successful])
1575else
1576  AC_MSG_NOTICE([Main configuration of $PACKAGE_NAME successful])
1577fi
1578]) #AC_COIN_FINALIZE
1579
1580###########################################################################
1581#                             COIN_VPATH_LINK                             #
1582###########################################################################
1583
1584# This macro makes sure that a symbolic link is created to a file in
1585# the source code directory tree if we are in a VPATH compilation, and
1586# if this package is the main package to be installed
1587
1588AC_DEFUN([AC_COIN_VPATH_LINK],
1589[AC_REQUIRE([AC_COIN_CHECK_VPATH])
1590if test $coin_vpath_config = yes; then
1591  coin_vpath_link_files="$coin_vpath_link_files $1"
1592fi
1593]) #AC_COIN_VPATH_LINK
1594
1595###########################################################################
1596#                       COIN_ENABLE_GNU_PACKAGES                          #
1597###########################################################################
1598
1599# This macro defined the --enable-gnu-packages flag.  This can be used
1600# to check if a user wants to compile GNU packges (such as readline or
1601# zlib) into the executable.  By default, GNU packages are disabled.
1602# This also defines the automake conditional COIN_ENABLE_GNU_PACKAGES
1603
1604AC_DEFUN([AC_COIN_ENABLE_GNU_PACKAGES],
1605[AC_ARG_ENABLE([gnu-packages],
1606               [AC_HELP_STRING([--enable-gnu-packages],
1607                               [compile with GNU packages (disabled by default)])],
1608               [coin_enable_gnu=$enableval],
1609               [coin_enable_gnu=no])
1610]) # AC_COIN_ENABLE_GNU_PACKAGES
1611
1612###########################################################################
1613#                           COIN_CHECK_GNU_ZLIB                           #
1614###########################################################################
1615
1616# This macro checks for the libz library.
1617
1618AC_DEFUN([AC_COIN_CHECK_GNU_ZLIB],
1619[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
1620AC_BEFORE([AC_COIN_PROG_CXX],[$0])
1621AC_BEFORE([AC_COIN_PROG_CC],[$0])
1622AC_BEFORE([AC_COIN_PROG_F77],[$0])
1623AC_BEFORE([$0],[AC_COIN_FINISH])
1624
1625coin_has_zlib=no
1626if test $coin_enable_gnu = yes; then
1627  AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes])
1628
1629  if test $coin_has_zlib = yes; then
1630    AC_CHECK_LIB([z],[gzopen],
1631                 [ADDLIBS="-lz $ADDLIBS"],
1632                 [coin_has_zlib=no])
1633  fi
1634
1635  if test $coin_has_zlib = yes; then
1636    AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available])
1637  fi
1638fi
1639
1640AM_CONDITIONAL(COIN_HAS_ZLIB,test x$coin_has_zlib = xyes)
1641]) # AC_COIN_CHECK_GNU_ZLIB
1642
1643
1644###########################################################################
1645#                          COIN_CHECK_GNU_BZLIB                           #
1646###########################################################################
1647
1648# This macro checks for the libbz2 library.
1649
1650AC_DEFUN([AC_COIN_CHECK_GNU_BZLIB],
1651[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
1652AC_BEFORE([AC_COIN_PROG_CXX],[$0])
1653AC_BEFORE([AC_COIN_PROG_CC],[$0])
1654AC_BEFORE([AC_COIN_PROG_F77],[$0])
1655AC_BEFORE([$0],[AC_COIN_FINISH])
1656
1657coin_has_bzlib=no
1658if test $coin_enable_gnu = yes; then
1659  AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes])
1660
1661  if test $coin_has_bzlib = yes; then
1662    AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],
1663                 [ADDLIBS="-lbz2 $ADDLIBS"],
1664                 [coin_has_bzlib=no])
1665  fi
1666
1667  if test $coin_has_bzlib = yes; then
1668    AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available])
1669  fi
1670fi
1671]) # AC_COIN_CHECK_GNU_BZLIB
1672
1673
1674###########################################################################
1675#                         COIN_CHECK_GNU_READLINE                         #
1676###########################################################################
1677
1678# This macro checks for GNU's readline.  It verifies that the header
1679# readline/readline.h is available, and that the -lreadline library
1680# contains "readline".  It is assumed that #include <stdio.h> is included
1681# in the source file before the #include<readline/readline.h>
1682
1683AC_DEFUN([AC_COIN_CHECK_GNU_READLINE],
1684[AC_REQUIRE([AC_COIN_ENABLE_GNU_PACKAGES])
1685AC_BEFORE([AC_COIN_PROG_CXX],[$0])
1686AC_BEFORE([AC_COIN_PROG_CC],[$0])
1687AC_BEFORE([AC_COIN_PROG_F77],[$0])
1688AC_BEFORE([$0],[AC_COIN_FINISH])
1689
1690coin_has_readline=no
1691if test $coin_enable_gnu = yes; then
1692  AC_COIN_CHECK_HEADER([readline/readline.h],
1693                       [coin_has_readline=yes],[],
1694                       [#include <stdio.h>])
1695
1696  coin_save_LIBS="$LIBS"
1697  LIBS=
1698  # First we check if tputs and friends are available
1699  if test $coin_has_readline = yes; then
1700    AC_SEARCH_LIBS([tputs],[ncurses termcap curses],[],
1701                   [coin_has_readline=no])
1702  fi
1703
1704  # Now we check for readline
1705  if test $coin_has_readline = yes; then
1706    AC_CHECK_LIB([readline],[readline],
1707                 [ADDLIBS="-lreadline $LIBS $ADDLIBS"],
1708                 [coin_has_readline=no])
1709  fi
1710
1711  if test $coin_has_readline = yes; then
1712    AC_DEFINE([COIN_HAS_READLINE],[1],[Define to 1 if readline is available])
1713  fi
1714
1715  LIBS="$coin_save_LIBS"
1716fi
1717]) # AC_COIN_CHECK_GNU_READLINE
1718
1719###########################################################################
1720#                             COIN_DATA_PATH                              #
1721###########################################################################
1722
1723# This macro defines a preprocessor macro with the absolute path to a
1724# subdirectory of Data.  The argument of this macro is the name of the
1725# subdirectory (in correct case), and the name of the macro is
1726# COIN_DATA_DIR_PATH, where dir is replaced by the capitalized name of
1727# the directory.  The path ends with a separator ("/" for linux and
1728# '\\' for Windows).  The default value for this path can be
1729# overwritten with the input variable with the same name
1730# (COIN_DATA_DIR_PATH).  At this point we chech only for the
1731# $srcdir/../Data subdirectory.
1732
1733AC_DEFUN([AC_COIN_DATA_PATH],
1734[AC_MSG_CHECKING([absolute path to data directory $1])
1735
1736AC_ARG_VAR(m4_toupper(COIN_DATA_$1_PATH),[Set to absolute path to Data/$1 subdirectory])
1737
1738if test x"$m4_toupper(COIN_DATA_$1_PATH)" = x; then
1739  m4_toupper(COIN_DATA_$1_PATH)=`cd $srcdir/../Data/$1; pwd`
1740fi
1741
1742# Under Cygwin, use Windows path.  Add separator
1743case $build in
1744  *-cygwin*)
1745    m4_toupper(COIN_DATA_$1_PATH)=`cygwin -w $m4_toupper(COIN_DATA_$1_PATH)`\\
1746    ;;
1747  *)
1748    m4_toupper(COIN_DATA_$1_PATH)="$m4_toupper(COIN_DATA_$1_PATH)/"
1749    ;;
1750esac
1751
1752if test -r $m4_toupper(COIN_DATA_$1_PATH); then
1753  AC_DEFINE_UNQUOTED(m4_toupper(COIN_DATA_$1_PATH),["$m4_toupper(COIN_DATA_$1_PATH)"],
1754            [Define to absolute path for Data subdirectory $1])
1755  AC_MSG_RESULT($m4_toupper(COIN_DATA_$1_PATH))
1756else
1757  AC_MSG_ERROR(Directory $m4_toupper(COIN_DATA_$1_PATH) does not exist)
1758fi
1759]) # AC_COIN_HAS_DATA
1760
1761###########################################################################
1762#                          COIN_EXAMPLE_FILES                             #
1763###########################################################################
1764
1765# This macro determines the names of the example files (using the
1766# argument in an "ls" command) and sets up the variables EXAMPLE_FILES
1767# and EXAMPLE_CLEAN_FILES.  If this is a VPATH configuration, it also
1768# creates soft links to the example files.
1769
1770AC_DEFUN([AC_COIN_EXAMPLE_FILES],
1771[AC_REQUIRE([AC_COIN_CHECK_GNU_ZLIB])
1772AC_REQUIRE([AC_COIN_CHECK_VPATH])
1773files=`cd $srcdir; ls $1`
1774# We need to do the following loop to make sure that are no newlines
1775# in the variable
1776for file in $files; do
1777  EXAMPLE_FILES="$EXAMPLE_FILES $file"
1778done
1779if test $coin_vpath_config = yes; then
1780  lnkcmd=
1781  if test "$enable_doscompile" = yes; then
1782    lnkcmd=cp
1783  fi
1784  case "$CC" in
1785    cl* | */cl*)
1786      lnkcmd=cp ;;
1787  esac
1788  if test "$lnkcmd" = cp; then
1789    AC_MSG_NOTICE([Copying example files ($1)])
1790  else
1791    AC_PROG_LN_S
1792    AC_MSG_NOTICE([Creating links to the example files ($1)])
1793    lnkcmd="$LN_S"
1794  fi
1795  for file in $EXAMPLE_FILES; do
1796    rm -f $file
1797    $lnkcmd $srcdir/$file $file
1798  done
1799  EXAMPLE_CLEAN_FILES='$1'
1800else
1801  EXAMPLE_CLEAN_FILES=
1802fi
1803
1804# In case there are compressed files, we create a variable with the
1805# uncompressed names
1806EXAMPLE_UNCOMPRESSED_FILES=
1807for file in $EXAMPLE_FILES; do
1808  case $file in
1809    *.gz)
1810      EXAMPLE_UNCOMPRESSED_FILES="$EXAMPLE_UNCOMPRESSED_FILES `echo $file | sed -e s/.gz//`"
1811      ;;
1812  esac
1813done
1814
1815AC_SUBST(EXAMPLE_UNCOMPRESSED_FILES)
1816AC_SUBST(EXAMPLE_FILES)
1817AC_SUBST(EXAMPLE_CLEAN_FILES)
1818]) #AC_COIN_EXAMPLE_FILES
1819
1820###########################################################################
1821#                            COIN_HAS_PROJECT                             #
1822###########################################################################
1823
1824# This macro sets up usage of a Coin package.  It defines the
1825# PKGSRCDIR and PKGOBJDIR variables, refering to the main source and
1826# object directory of the package, respectively.  It also defines
1827# a COIN_HAS_PKG preprocessor macro and makefile conditional.  The
1828# argument should be the name (Pkg) of the project (in correct lower
1829# and upper case)
1830
1831AC_DEFUN([AC_COIN_HAS_PROJECT],
1832[AC_MSG_CHECKING([for COIN project $1])
1833
1834# First check, if the sub-project is actually available (ToDo: allow
1835# other locations)
1836
1837m4_tolower(coin_has_$1)=unavailable
1838if test x"$COIN_SKIP_PROJECTS" != x; then
1839  for dir in $COIN_SKIP_PROJECTS; do
1840    if test $dir = $1; then
1841      m4_tolower(coin_has_$1)=skipping
1842    fi
1843  done
1844fi
1845
1846if test $m4_tolower(coin_has_$1) != skipping; then
1847  if test $PACKAGE_TARNAME = m4_tolower($1); then
1848    m4_tolower(coin_has_$1)=.
1849  else
1850    if test -d $srcdir/../$1; then
1851      m4_tolower(coin_has_$1)=../$1
1852    fi
1853  fi
1854fi
1855
1856if test $m4_tolower(coin_has_$1) != unavailable &&
1857   test $m4_tolower(coin_has_$1) != skipping; then
1858  # Set the #define if the component is available
1859  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is used])
1860
1861  # Set the variables for source and object code location
1862  AC_SUBST(m4_toupper($1SRCDIR))
1863  m4_toupper($1SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_$1); pwd`
1864  AC_SUBST(m4_toupper($1OBJDIR))
1865  m4_toupper($1OBJDIR)=`pwd`/$m4_tolower(coin_has_$1)
1866fi
1867
1868  # Define the Makefile conditional
1869AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
1870               [test $m4_tolower(coin_has_$1) != unavailable &&
1871                test $m4_tolower(coin_has_$1) != skipping])
1872AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
1873]) # AC_COIN_HAS
1874
1875###########################################################################
1876#                        COIN_HAS_USER_LIBRARY                            #
1877###########################################################################
1878
1879# This macro sets up usage of a library with header files.  It defines
1880# the LBRYINCDIR variable, and it defines COIN_HAS_LBRY preprocessor
1881# macro and makefile conditional.  The first argument should be the
1882# full name (LibraryName) of the library, and the second argument (in
1883# upper case letters) the abbreviation (LBRY).  This macro also
1884# introduces the configure arguments --with-libraryname-incdir and
1885# --with-libraryname-lib which have to be both given by a user to use
1886# this solver to tell the configure script where the include files and
1887# the library are located.  Those arguments can also be given as
1888# environement variables LBRYINCDIR and LBRYLIB, but a --with-*
1889# argument overwrites an environment variable.  If a third argument is
1890# given, it is assumed that this is the name of a header file that can
1891# be checked for in the given include directory, and if a fourth
1892# argument is given, it is assumed to be the name of a C function
1893# which is given and defined in the library, and a test is done to
1894# check if that symbol is defined in the library.
1895# If it possible to disable the check, by specifying
1896# --disable-libraryname-libcheck - this is a workaround for platforms
1897# where checks don't work (yet) properly.
1898
1899AC_DEFUN([AC_COIN_HAS_USER_LIBRARY],
1900[AC_REQUIRE([AC_COIN_PROJECTDIR_INIT])
1901AC_MSG_CHECKING(if user provides library for $1)
1902
1903# Check for header file directory
1904AC_ARG_WITH(m4_tolower($1)-incdir,
1905            AC_HELP_STRING([--with-m4_tolower($1)-incdir],
1906                           [specify the directory with the header files for library $1]),
1907                           [$2INCDIR=`cd $withval; pwd`])
1908# Check for library directory
1909AC_ARG_WITH(m4_tolower($1)-lib,
1910            AC_HELP_STRING([--with-m4_tolower($1)-lib],
1911                           [specify the flags to link with the library $1]),
1912                           [$2LIB=$withval])
1913# Switch to disable library check if requested
1914AC_ARG_ENABLE(m4_tolower($1)-libcheck,
1915              AC_HELP_STRING([--enable-m4_tolower($1)-libcheck],
1916                             [use disable-m4_tolower($1)-libcheck to skip the link check at configuration time]),
1917              [m4_tolower($1)_libcheck=$enableval],
1918              [m4_tolower($1)_libcheck=yes])
1919
1920if test x"$$2INCDIR" != x || test x"$$2LIB" != x; then
1921  m4_tolower(coin_has_$2)=true
1922else
1923  m4_tolower(coin_has_$2)=false
1924fi
1925
1926if test $m4_tolower(coin_has_$2) = true; then
1927# Check either both arguments or none are given
1928  if test x"$$2INCDIR" = x || test x"$$2LIB" = x; then
1929    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])
1930  fi
1931  AC_MSG_RESULT(yes)
1932  # Check if the given header file is there
1933  m4_ifvaln([$3],[AC_CHECK_FILE([$$2INCDIR/$3],[],
1934                 [AC_MSG_ERROR([Cannot find file $3 in $$2INCDIR])])])
1935  # Check if the symbol is provided in the library
1936  # ToDo: FOR NOW WE ASSUME THAT WE ARE USING THE C++ COMPILER
1937  m4_ifvaln([$4],[if test x"$m4_tolower($1)_libcheck" != xno; then
1938                    coin_save_LIBS="$LIBS"
1939                    LIBS="$$2LIB $ADDLIBS"
1940                    AC_MSG_CHECKING([whether symbol $4 is available with $2])
1941# ToDo find out what to do about extern "C"
1942#                    AC_TRY_LINK([extern "C" {void $4();}],[$4()],
1943                    AC_TRY_LINK([void $4();],[$4()],
1944                                [AC_MSG_RESULT(yes)],
1945                                [AC_MSG_RESULT(no)
1946                                 AC_MSG_ERROR([Cannot find symbol $4 with $2])])
1947                    LIBS="$coin_save_LIBS"
1948                  fi])
1949  ADDLIBS="$$2LIB $ADDLIBS"
1950  AC_DEFINE(COIN_HAS_$2,[1],[Define to 1 if the $1 package is used])
1951else
1952  AC_MSG_RESULT(no)
1953fi
1954
1955AC_SUBST($2INCDIR)
1956AC_SUBST($2LIB)
1957AM_CONDITIONAL(COIN_HAS_$2,
1958               test $m4_tolower(coin_has_$2) = true)
1959]) #AC_COIN_HAS_SOLVER
1960
1961###########################################################################
1962#                               COIN_HAS_ASL                              #
1963###########################################################################
1964
1965# This macro checks if the user has provide arguments that say where
1966# the precompiled ASL files should be found (with the --with-asldir
1967# flag).  If this is not the case, we check if the ThirdParty/ASL
1968# directory has been configured, which indicates that the files will
1969# be in that directory and can be used.
1970
1971AC_DEFUN([AC_COIN_HAS_ASL],
1972[coin_aslobjdir=../ThirdParty/ASL
1973coin_aslsrcdir=$srcdir/$coin_aslobjdir
1974
1975# Determine the name of the ASL library
1976case "$CXX" in
1977  cl* | */cl*)
1978    ampllib=amplsolv.lib ;;
1979  *)
1980    ampllib=amplsolver.a ;;
1981esac
1982
1983AC_ARG_WITH([asldir],
1984            AC_HELP_STRING([--with-asldir],
1985                           [specify path to AMPL solver directory (or BUILD for compilation, or "no" for disabling AMPL)]),
1986            [use_asldir=$withval], [use_asldir=])
1987
1988if test "$use_asldir" = BUILD; then
1989  AC_CHECK_FILE([$coin_aslobjdir/Makefile],[],
1990                [AC_MSG_ERROR([option \"BUILD\" specified for asldir, but directory is not configure (sources missing?)])])
1991elif test -z "$use_asldir"; then
1992 # try to find sources - if not given don't compile
1993  AC_CHECK_FILE([$coin_aslobjdir/Makefile],[use_asldir=BUILD],[use_asldir=no])
1994elif test "$use_asldir" != "no"; then
1995  AC_CHECK_FILE([$use_asldir/$ampllib],[],
1996                [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but library missing])])
1997  AC_CHECK_FILE([$use_asldir/asl.h],[],
1998                [AC_MSG_ERROR([ASL directory \"$use_asldir\" specified, but header files are missing])])
1999  use_asldir=`cd $use_asldir; pwd`
2000  case $build in
2001    *-cygwin*) use_asldir=`cygpath -w $use_asldir | sed -e sX\\\\\\\\X/Xg` ;;
2002  esac
2003fi
2004
2005# Variable containing ASL library (including full path)
2006AC_SUBST(ASLLIB)
2007# Variable containing flags for including ASL header files
2008AC_SUBST(ASL_CPPFLAGS)
2009
2010if test "$use_asldir" = BUILD; then
2011  coin_aslobjdir=`cd $coin_aslobjdir; pwd`
2012  ASLLIB=`$CYGPATH_W $coin_aslobjdir/$ampllib | sed -e sX\\\\\\\\X/Xg`
2013  coin_aslsrcdir=`cd $coin_aslsrcdir; pwd`
2014  ASL_CPPFLAGS="-I"`$CYGPATH_W $coin_aslobjdir | sed -e sX\\\\\\\\X/Xg`" -I"`$CYGPATH_W $coin_aslsrcdir/solvers | sed -e sX\\\\\\\\X/Xg`
2015elif test "$use_asldir" != no; then
2016  ASLLIB=`$CYGPATH_W $use_asldir/$ampllib | sed -e sX\\\\\\\\X/Xg`
2017  ASL_CPPFLAGS="-I"`$CYGPATH_W $use_asldir | sed -e sX\\\\\\\\X/Xg`
2018fi
2019
2020if test "$use_asldir" != no; then
2021  AC_CHECK_LIB(dl,[dlopen],[ASLLIB="$ASLLIB -ldl"],[])
2022  coin_has_asl=yes
2023  AC_DEFINE([COIN_HAS_ASL],[1],
2024            [If defined, the Ampl Solver Library is available.])
2025else
2026  coin_has_asl=no
2027fi
2028AM_CONDITIONAL(COIN_HAS_ASL, test $coin_has_asl = yes)
2029]) # AC_COIN_HAS_ASL
2030
2031###########################################################################
2032#                            COIN_TRY_FLINK                               #
2033###########################################################################
2034
2035# Auxilliary macro to test if a Fortran function name can be linked,
2036# given the current settings of LIBS.  We determine from the context, what
2037# the currently active programming language is, and cast the name accordingly.
2038# The first argument is the name of the function/subroutine, in small letters,
2039# the second argument are the actions taken when the test works, and the
2040# third argument are the actions taken if the test fails.
2041
2042AC_DEFUN([AC_COIN_TRY_FLINK],
2043[case $ac_ext in
2044  f)
2045    AC_TRY_LINK([],[      call $1],[$2],[$3])
2046    ;;
2047  c)
2048    AC_F77_FUNC($1,cfunc$1)
2049    if test x"$coin_need_flibs" = xyes; then
2050      flink_try=no;
2051    else
2052      AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2053                  [flink_try=yes],[flink_try=no])
2054    fi
2055    if test $flink_try = yes; then
2056      $2
2057    else
2058      if test x"$FLIBS" != x; then
2059        flink_save_libs="$LIBS"
2060        LIBS="$LIBS $FLIBS"
2061        AC_TRY_LINK([void $cfunc$1();],[$cfunc$1()],
2062                    [LIBS="$flink_save_libs"
2063                     $2
2064                     coin_need_flibs=yes],
2065                    [LIBS="$flink_save_libs"
2066                     $3])
2067      else
2068        $3
2069      fi
2070    fi
2071    ;;
2072  cc)
2073    AC_F77_FUNC($1,cfunc$1)
2074    if test x"$coin_need_flibs" = xyes; then
2075      flink_try=no;
2076    else
2077      AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2078                  [flink_try=yes],[flink_try=no])
2079    fi
2080    if test $flink_try = yes; then
2081      $2
2082    else
2083      if test x"$FLIBS" != x; then
2084        flink_save_libs="$LIBS"
2085        LIBS="$LIBS $FLIBS"
2086        AC_TRY_LINK([extern "C" {void $cfunc$1();}],[$cfunc$1()],
2087                    [LIBS="$flink_save_libs"
2088                     $2
2089                     coin_need_flibs=yes],
2090                    [LIBS="$flink_save_libs"
2091                     $3])
2092      else
2093        $3
2094      fi
2095    fi
2096    ;;
2097esac
2098]) # AC_COIN_TRY_FLINK
2099
2100###########################################################################
2101#                             COIN_HAS_BLAS                               #
2102###########################################################################
2103
2104# This macro checks for a library containing the BLAS library.  It
2105# tried standard libraries, and if none is found to be working, it
2106# checks whether the BLAS ThirdParty/Blas directory has been configured.
2107# It adds to ADDLIBS any flags required to link with an externally provided
2108# BLAS.  It defines the makefile conditional and preprocessor macro
2109# COIN_HAS_BLAS, if blas is available, and it defines the makefile conditional
2110# COIN_BUILD_BLAS, if blas is compiled within COIN.
2111
2112AC_DEFUN([AC_COIN_HAS_BLAS],
2113[coin_blasobjdir=../ThirdParty/Blas
2114coin_blassrcdir=$srcdir/$coin_blasobjdir
2115
2116AC_ARG_WITH([blas],
2117            AC_HELP_STRING([--with-blas],
2118                           [specify BLAS library (or BUILD for compilation)]),
2119            [use_blas=$withval], [use_blas=])
2120
2121# Check if user supplied option makes sense
2122if test x"$use_blas" != x; then
2123  if test "$use_blas" = "BUILD"; then
2124    AC_CHECK_FILE([$coin_blasobjdir/Makefile],[],
2125                  [AC_MSG_ERROR([option \"BUILD\" specified for Blas, but $coin_blasobjdir directory is not configured])])
2126  else
2127    AC_MSG_CHECKING([whether user supplied BLASLIB=\"$use_blas\" works])
2128    LIBS="$use_blas $LIBS"
2129    ADDLIBS="$use_blas $ADDLIBS"
2130    AC_COIN_TRY_FLINK([daxpy],
2131                      [AC_MSG_RESULT([yes])],
2132                      [AC_MSG_RESULT([no])
2133                       AC_MSG_ERROR([user supplied BLAS library \"$use_blas\" does not work])])
2134  fi
2135else
2136# Try to autodetect the library for blas based on build system
2137  case $build in
2138    *-sgi-*)
2139      SAVE_LIBS="$LIBS"
2140      AC_MSG_CHECKING([whether -lcomplib.sgimath has BLAS])
2141      LIBS="-lcomplib.sgimath $LIBS"
2142      AC_COIN_TRY_FLINK([daxpy],
2143                        [AC_MSG_RESULT([yes])
2144                         use_blas=-lcomplib.sgimath;
2145                         ADDLIBS="-lcomplib.sgimath $ADDLIBS"],
2146                        [AC_MSG_RESULT([no])
2147                         SAVE_LIBS="$LIBS"])
2148      ;;
2149    *-sun-*)
2150      SAVE_LIBS="$LIBS"
2151      AC_MSG_CHECKING([whether -xlic_lib=sunperf has BLAS])
2152      LIBS="-xlic_lib=sunperf $LIBS"
2153      AC_COIN_TRY_FLINK([daxpy],
2154                        [AC_MSG_RESULT([yes])
2155                         use_blas='-xlic_lib=sunperf'
2156                         ADDLIBS="-xlic_lib=sunperf $ADDLIBS"],
2157                        [AC_MSG_RESULT([no])
2158                         LIBS="$SAVE_LIBS"])
2159      ;;
2160  esac
2161  # On cygwin, if enable_doscompile is used, recompile blas because it
2162  # otherwise links with the cygwin blas which doesn't run under DOS
2163  if test "$enable_doscompile" != yes; then
2164    if test -z "$use_blas"; then
2165      SAVE_LIBS="$LIBS"
2166      AC_MSG_CHECKING([whether -lblas has BLAS])
2167      LIBS="-lblas $LIBS"
2168      AC_COIN_TRY_FLINK([daxpy],
2169                        [AC_MSG_RESULT([yes])
2170                         ADDLIBS="-lblas $ADDLIBS"
2171                         use_blas='-lblas'],
2172                        [AC_MSG_RESULT([no])
2173                         LIBS="$SAVE_LIBS"])
2174    fi
2175  fi
2176  if test -z "$use_blas"; then
2177    AC_CHECK_FILE([$coin_blasobjdir/Makefile],[use_blas=BUILD])
2178  fi
2179fi
2180
2181AM_CONDITIONAL([COIN_HAS_BLAS],[test x"$use_blas" != x])
2182AM_CONDITIONAL([COIN_BUILD_BLAS],[test "$use_blas" = BUILD])
2183
2184if test x"$use_blas" = x; then
2185  coin_has_blas=no
2186else
2187  coin_has_blas=yes
2188  AC_DEFINE([COIN_HAS_BLAS],[1],
2189            [If defined, the BLAS Library is available.])
2190fi
2191]) # AC_COIN_HAS_BLAS
2192
2193###########################################################################
2194#                            COIN_HAS_LAPACK                              #
2195###########################################################################
2196
2197# This macro checks for a library containing the LAPACK library.  It
2198# tried standard libraries, and if none is found to be working, it
2199# checks whether the LAPACK ThirdParty/Lapack directory has been
2200# configured.  It adds to ADDLIBS any flags required to link with an
2201# externally provided LAPACK.  It defines the makefile conditional and
2202# preprocessor macro COIN_HAS_LAPACK, if lapack is available, and it
2203# defines the makefile conditional COIN_BUILD_LAPACK, if lapack is
2204# compiled within COIN.
2205
2206AC_DEFUN([AC_COIN_HAS_LAPACK],
2207[coin_lapackobjdir=../ThirdParty/Lapack
2208coin_lapacksrcdir=$srcdir/$coin_lapackobjdir
2209
2210AC_ARG_WITH([lapack],
2211            AC_HELP_STRING([--with-lapack],
2212                           [specify LAPACK library (or BUILD for compilation)]),
2213            [use_lapack=$withval], [use_lapack=])
2214
2215# Check if user supplied option makes sense
2216if test x"$use_lapack" != x; then
2217  if test "$use_lapack" = "BUILD"; then
2218    AC_CHECK_FILE([$coin_lapackobjdir/Makefile],[],
2219                  [AC_MSG_ERROR([option \"BUILD\" specified for Lapack, but $coin_lapackobjdir directory is not configured])])
2220  else
2221    AC_MSG_CHECKING([whether user supplied LAPACKLIB=\"$use_lapack\" works])
2222    LIBS="$use_lapack $LIBS"
2223    ADDLIBS="$use_lapack $ADDLIBS"
2224    AC_COIN_TRY_FLINK([dsyev],
2225                      [AC_MSG_RESULT([yes])],
2226                      [AC_MSG_RESULT([no])
2227                       AC_MSG_ERROR([user supplied LAPACK library \"$use_lapack\" does not work])])
2228  fi
2229else
2230  if test x$coin_has_blas = xyes; then
2231    # First try to see if LAPACK is already available with BLAS library
2232    AC_MSG_CHECKING([whether LAPACK is already available with BLAS library])
2233    AC_COIN_TRY_FLINK([dsyev],
2234                      [AC_MSG_RESULT([yes]); use_lapack=ok],
2235                      [AC_MSG_RESULT([no])])
2236  fi
2237  if test -z "$use_lapack"; then
2238    # Try to autodetect the library for lapack based on build system
2239    case $build in
2240      *-sgi-*)
2241        SAVE_LIBS="$LIBS"
2242        AC_MSG_CHECKING([whether -lcomplib.sgimath has LAPACK])
2243        LIBS="-lcomplib.sgimath $LIBS"
2244        AC_COIN_TRY_FLINK([dsyev],
2245                          [AC_MSG_RESULT([yes])
2246                           use_lapack=-lcomplib.sgimath;
2247                           ADDLIBS="-lcomplib.sgimath $ADDLIBS"],
2248                          [AC_MSG_RESULT([no])
2249                           SAVE_LIBS="$LIBS"])
2250        ;;
2251      *-sun-*)
2252        SAVE_LIBS="$LIBS"
2253        AC_MSG_CHECKING([whether -xlic_lib=sunperf has LAPACK])
2254        LIBS="-xlic_lib=sunperf $LIBS"
2255        AC_COIN_TRY_FLINK([dsyev],
2256                          [AC_MSG_RESULT([yes])
2257                           use_lapack='-xlic_lib=sunperf'
2258                           ADDLIBS="-xlic_lib=sunperf $ADDLIBS"],
2259                          [AC_MSG_RESULT([no])
2260                           LIBS="$SAVE_LIBS"])
2261        ;;
2262    esac
2263  fi
2264  # On cygwin, if enable_doscompile is used, recompile lapack because it
2265  # otherwise links with the cygwin lapack which doesn't run under DOS
2266  if test "$enable_doscompile" != yes; then
2267    if test -z "$use_lapack"; then
2268      SAVE_LIBS="$LIBS"
2269      AC_MSG_CHECKING([whether -llapack has LAPACK])
2270      LIBS="-llapack $LIBS"
2271      AC_COIN_TRY_FLINK([dsyev],
2272                        [AC_MSG_RESULT([yes])
2273                         ADDLIBS="-llapack $ADDLIBS"
2274                         use_lapack='-llapack'],
2275                        [AC_MSG_RESULT([no])
2276                         LIBS="$SAVE_LIBS"])
2277    fi
2278  fi
2279  if test -z "$use_lapack"; then
2280    AC_CHECK_FILE([$coin_lapackobjdir/Makefile],[use_lapack=BUILD])
2281  fi
2282fi
2283
2284AM_CONDITIONAL([COIN_HAS_LAPACK],[test x"$use_lapack" != x])
2285AM_CONDITIONAL([COIN_BUILD_LAPACK],[test "$use_lapack" = BUILD])
2286
2287if test x"$use_lapack" = x; then
2288  coin_has_lapack=no
2289else
2290  coin_has_lapack=yes
2291  AC_DEFINE([COIN_HAS_LAPACK],[1],
2292            [If defined, the LAPACK Library is available.])
2293fi
2294]) # AC_COIN_HAS_LAPACK
Note: See TracBrowser for help on using the repository browser.