source: branches/pre-1.0/coin.m4 @ 145

Last change on this file since 145 was 135, checked in by andreasw, 13 years ago

enabled inactivation of warning flags for compilers

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