source: ThirdParty/HSL/stable/1.3/configure.ac @ 2930

Last change on this file since 2930 was 2930, checked in by stefan, 6 years ago

restoring BuildTools/ThirdParty?/HSL/stable/1.3

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.1 KB
Line 
1# Copyright (C) 2006, 2009 International Business Machines.
2# All Rights Reserved.
3# This file is distributed under the Eclipse Public License.
4
5## $Id: configure.ac 2930 2013-09-12 12:55:53Z stefan $
6
7# Author:  Andreas Waechter            IBM    2006-04-13
8
9#############################################################################
10#                       Names and other basic things                        #
11#############################################################################
12
13AC_PREREQ(2.59)
14
15AC_INIT([ThirdPartyHSL],[1.3],[http://projects.coin-or.org/BuildTools/newticket])
16
17AC_COPYRIGHT([
18Copyright 2006, 2009 International Business Machines and others.
19All Rights Reserved.
20This file is part of the open source package Coin which is distributed
21under the Eclipse Public License.])
22
23# List one file in the package so that the configure script can test
24# whether the package is actually there
25# Here we don't know yet which files are actually provided...
26AC_CONFIG_SRCDIR(configure.ac)
27
28# Where should everything be installed by default?  Here, we want it
29# to be installed directly in 'bin', 'lib', 'include' subdirectories
30# of the directory where configure is run.  The default would be
31# /usr/local.
32AC_PREFIX_DEFAULT([`pwd`])
33
34AC_COIN_PROJECTDIR_INIT(COINHSL)
35
36#############################################################################
37#                         Standard build tool stuff                         #
38#############################################################################
39
40# Get the system type
41AC_CANONICAL_BUILD
42
43# turn off warnings and pedantic mode since they could make trouble on some platforms,
44# and we couldn't fix them anyway
45coin_skip_warn_fflags=yes
46
47# provide flag to allow compilation of a stand-alone shared library
48AC_ARG_ENABLE([loadable-library],
49[AC_HELP_STRING([--enable-loadable-library],
50                [compile stand-alone shared library for delayed loading])])
51
52# Check if user wants to produce debugging code
53AC_COIN_DEBUG_COMPILE(HSL)
54
55# Get the name of the C compiler (for a dummy program)
56AC_COIN_PROG_CC
57
58# Get the name of the Fortran compiler and appropriate compiler options
59AC_COIN_PROG_F77
60
61# Check if pkg-config is available (to setup addlibs file)
62AC_COIN_HAS_PKGCONFIG
63
64# Get the linker flags (FLIBS) that are required for linking against this blas library
65AC_COIN_F77_WRAPPERS
66
67# Add FLIBS to HSL_PCLIBS, so that they get into the .pc files
68HSL_PCLIBS="$HSL_PCLIBS $FLIBS"
69
70# Need egrep later on
71AC_PROG_EGREP
72
73# Also set up the FC compiler variable, required to compile .f90
74# files.  We use the same compile and flags as F77 and FFLAGS, unless
75# the user has set FC and FCFLAGS explicitly.
76if test "$FC" = ""; then
77  FC="$F77"
78fi
79if test "$FCFLAGS" = ""; then
80  FCFLAGS="$FFLAGS"
81fi
82AC_PROG_FC
83
84# Initialize autotools
85
86if test x$enable_loadable_library = xyes; then
87  flag=force_shared
88fi
89AC_COIN_INIT_AUTO_TOOLS([$flag])
90
91#############################################################################
92#                    Find out which files are available                     #
93#############################################################################
94
95AC_MSG_CHECKING([whether we can compile Fortran 90 code])
96AC_LANG_PUSH(Fortran 77)
97AC_COMPILE_IFELSE([        MODULE BLA
98      DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: BLUBB
99      END MODULE BLA],[have_f90=yes ; rm -f bla.mod],[have_f90=no])
100AC_MSG_RESULT([$have_f90])
101AC_LANG_POP(Fortran 77)
102
103coin_has_something=no
104
105AC_DEFUN([MY_CHECK_HSLFILE],
106[AC_COIN_CHECK_FILE([$srcdir/$1.f],
107                    [hsl_files="$hsl_files $1.f"
108                     AC_DEFINE(COINHSL_HAS_$2, [1], [Define to 1 if $2 is available.])
109                     coin_has_something=yes
110                     coin_has_$1=yes],
111                    [coin_has_$1=no])
112AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])])
113
114AC_DEFUN([MY_CHECK_HSLFILE_F90],
115[if test $have_f90 = yes; then
116   AC_COIN_CHECK_FILE([$srcdir/$1.f90],
117                      [hsl_files="$hsl_files $1.f"
118                       AC_DEFINE(COINHSL_HAS_$2, [1], [Define to 1 if $2 is available.])
119                       coin_has_something=yes
120                       coin_has_$1=yes],
121                      [coin_has_$1=no])
122else
123  coin_has_$1=no
124fi
125AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])])
126
127MY_CHECK_HSLFILE(ma27ad,MA27)
128if test $coin_has_ma27ad = yes; then
129  AC_MSG_CHECKING([whether MA27 is threadsafe])
130  if $EGREP MA27UD $srcdir/ma27ad.f >/dev/null 2>&1; then
131    AC_MSG_RESULT(yes)
132  else
133    AC_MSG_RESULT(no)
134    AC_MSG_ERROR([Please obtain the threadsafe (newer) version of MA27])
135  fi
136fi
137
138AC_COIN_CHECK_PACKAGE(Metis, [coinmetis], HSL)
139if test $coin_has_metis = yes ; then
140  AC_DEFINE(COINHSL_HAS_METIS, [1], Define to 1 if METIS is available)
141fi
142
143MY_CHECK_HSLFILE(ma57ad,MA57)
144if test $coin_has_ma57ad = yes; then
145  if test $coin_has_metis != yes ; then
146    AC_MSG_ERROR([MA57 requires METIS, which is not found.])
147  fi
148  AC_COIN_CHECK_PACKAGE_BLAS(HSL)
149  if test $coin_has_blas != yes ; then
150    AC_MSG_ERROR([MA57 requires BLAS, which is not found.])
151  fi
152else
153  AM_CONDITIONAL(COIN_HAS_METIS, [test 0 = 1])
154  AM_CONDITIONAL(COIN_HAS_BLAS, [test 0 = 1])
155fi
156
157MY_CHECK_HSLFILE(mc19ad,MC19)
158MY_CHECK_HSLFILE(ma28ad,MA28)
159MY_CHECK_HSLFILE_F90(hsl_ma77d,MA77)
160
161#############################################################################
162#                        Setup build of loadable library                    #
163#############################################################################
164
165HSL_SHARED_LIB=
166if test x$enable_loadable_library = xyes; then
167  case $build in
168    *-cygwin* | *-mingw*)
169      HSL_SHARED_LIB=libhsl.dll
170      F77_SHARED_CMD='$(F77) -shared $(FFLAGS)'
171      case $F77 in
172        compile_f2c*)
173          EXPORT_SYMBOLS=
174          if test $coin_has_ma27ad = yes; then
175            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma27id_ ma27ad_ ma27bd_ ma27cd_"
176          fi
177          if test $coin_has_ma28ad = yes; then
178            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma28ad_"
179          fi
180          if test $coin_has_ma57ad = yes; then
181            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma57id_ ma57ad_ ma57bd_ ma57cd_ ma57ed_"
182          fi
183          if test $coin_has_mc19ad = yes; then
184            EXPORT_SYMBOLS="$EXPORT_SYMBOLS mc19ad_"
185          fi
186          F77_SHARED_CMD='$(F77) -shared $(FFLAGS) -def:$(DEFFILE)'
187          DEFFILE='Export.def'
188          ;;
189        ifort* | IFORT*)
190          EXPORT_SYMBOLS=
191          if test $coin_has_ma27ad = yes; then
192            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA27ID MA27AD MA27BD MA27CD"
193          fi
194          if test $coin_has_ma28ad = yes; then
195            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA28AD"
196          fi
197          if test $coin_has_ma57ad = yes; then
198            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA57ID MA57AD MA57BD MA57CD MA57ED"
199          fi
200          if test $coin_has_mc19ad = yes; then
201            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MC19AD"
202          fi
203          DEFFILE='Export.def'
204          F77_SHARED_CMD='$(F77) $(FFLAGS)'
205          F77_DLL_LINKFLAGS='-link -dll -def:$(DEFFILE)'
206          ;;
207        *)
208          F77_SHARED_CMD='$(F77) -shared $(FFLAGS)'
209          ;;
210      esac
211      ;;
212  esac
213fi
214AC_SUBST(F77_SHARED_CMD)
215AC_SUBST(F77_DLL_LINKFLAGS)
216AC_SUBST(HSL_SHARED_LIB)
217AC_SUBST(EXPORT_SYMBOLS)
218AC_SUBST(DEFFILE)
219AM_CONDITIONAL([INSTALL_LOADABLE_LIBRARY],[test x$flag = xforce_shared])
220AM_CONDITIONAL([NEED_DEFFILE], [test ! x"$DEFFILE" = x])
221
222AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test ! x"$F77_SHARED_CMD" = x])
223#AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test "$F77_SHARED_CMD" = x])
224
225#############################################################################
226#                              Write the output                             #
227#############################################################################
228
229AC_CONFIG_FILES([Makefile])
230
231# we build the library and setup the .pc files only if there is at least one source code
232# if there is no source code, then .pc files should not be setup, so for others this is as if we do not exist
233if test $coin_has_something = yes ; then
234  AC_CONFIG_FILES([coinhsl.pc coinhsl-uninstalled.pc])
235  AC_CONFIG_HEADER(config.h config_coinhsl.h)
236else
237  # in case something is left over from a previous build
238  rm -f coinhsl.pc coinhsl-uninstalled.pc
239fi
240AM_CONDITIONAL(BUILD_COINHSL, [test $coin_has_something = yes])
241
242AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.