source: ThirdParty/HSL/trunk/configure.ac @ 3301

Last change on this file since 3301 was 3301, checked in by tkr, 5 years ago

restoring BuildTools/ThirdParty?/HSL/trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.8 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 3301 2015-01-17 03:24:03Z tkr $
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.4],[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 BuildTools 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
25AC_CONFIG_SRCDIR([coinhsl/common/deps.f])
26
27# Where should everything be installed by default?  Here, we want it
28# to be installed directly in 'bin', 'lib', 'include' subdirectories
29# of the directory where configure is run.  The default would be
30# /usr/local.
31AC_PREFIX_DEFAULT([`pwd`])
32
33AC_COIN_PROJECTDIR_INIT(COINHSL)
34
35#############################################################################
36#                         Standard build tool stuff                         #
37#############################################################################
38
39# Get the system type
40AC_CANONICAL_BUILD
41
42# provide flag to allow compilation of a stand-alone shared library
43AC_ARG_ENABLE([loadable-library],
44[AC_HELP_STRING([--enable-loadable-library],
45                [compile stand-alone shared library for delayed loading])])
46
47# Check if user wants to produce debugging code
48AC_COIN_DEBUG_COMPILE(HSL)
49
50# Get the name of the C compiler (for a dummy program)
51AC_COIN_PROG_CC
52
53# Get the name of the Fortran compiler and appropriate compiler options
54AC_COIN_PROG_F77
55
56# Check if pkg-config is available (to setup addlibs file)
57AC_COIN_HAS_PKGCONFIG
58
59# Get the linker flags (FLIBS) that are required for linking against this blas library
60AC_COIN_F77_WRAPPERS
61
62# Add FLIBS to HSL_PCLIBS, so that they get into the .pc files
63HSL_PCLIBS="$HSL_PCLIBS $FLIBS"
64
65# Need egrep later on
66AC_PROG_EGREP
67
68# Also set up the FC compiler variable, required to compile .f90
69# files.  We use the same compile and flags as F77 and FFLAGS, unless
70# the user has set FC and FCFLAGS explicitly.
71if test "$FC" = ""; then
72  FC="$F77"
73fi
74if test "$FCFLAGS" = ""; then
75  FCFLAGS="$FFLAGS"
76fi
77AC_PROG_FC
78
79# recent autotools versions can recognize OpenMP with the following macro
80# this would be useful when using MA86 and MA97
81# AC_OPENMP
82
83# Initialize autotools
84
85if test x$enable_loadable_library = xyes; then
86  flag=force_shared
87fi
88AC_COIN_INIT_AUTO_TOOLS([$flag])
89
90#############################################################################
91#                    Find out which files are available                     #
92#############################################################################
93
94AC_MSG_CHECKING([whether we can compile Fortran 90 code])
95AC_LANG_PUSH(Fortran 77)
96AC_COMPILE_IFELSE([        MODULE BLA
97      PUBLIC TEST_TYPE
98      DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: BLUBB
99      TYPE TEST_TYPE
100      DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: TTVAR
101      END TYPE TEST_TYPE
102      END MODULE BLA],[have_f90=yes ; rm -f bla.mod],[have_f90=no])
103AC_MSG_RESULT([$have_f90])
104AC_LANG_POP(Fortran 77)
105
106coin_has_something=no
107hsl2013=no
108
109AC_DEFUN([MY_CHECK_HSLFILE],
110[AC_MSG_CHECKING([for m4_toupper(m4_bpatsubst($1, hsl_))])
111AC_COIN_CHECK_FILE([$srcdir/coinhsl/$1/$1d.f],
112                    [AC_DEFINE(m4_toupper(COINHSL_HAS_$1), [1], Define to 1 if m4_toupper(m4_bpatsubst($1, hsl_)) is available.)
113                     coin_has_something=yes
114                     coin_has_$1=yes],
115                    [coin_has_$1=no])
116AC_MSG_RESULT($coin_has_$1)
117AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),[test $coin_has_$1 = yes])
118])
119
120AC_DEFUN([MY_CHECK_HSLFILE_F90],
121[if test $have_f90 = yes; then
122   AC_MSG_CHECKING([for m4_toupper(m4_bpatsubst($1, hsl_))])
123   AC_COIN_CHECK_FILE([$srcdir/coinhsl/$1/$1d.f90],
124                      [AC_DEFINE([COINHSL_HAS_]m4_toupper(m4_bpatsubst($1, hsl_)), [1], Define to 1 if m4_toupper(m4_bpatsubst($1, hsl_)) is available.)
125                       coin_has_something=yes
126                       coin_has_$1=yes],
127                      [coin_has_$1=no])
128   AC_MSG_RESULT($coin_has_$1)
129else
130  coin_has_$1=no
131fi
132AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),[test $coin_has_$1 = yes])
133])
134
135MY_CHECK_HSLFILE(mc19)
136MY_CHECK_HSLFILE(ma27)
137MY_CHECK_HSLFILE(ma28)
138MY_CHECK_HSLFILE(ma57)
139MY_CHECK_HSLFILE_F90(hsl_ma77)
140MY_CHECK_HSLFILE_F90(hsl_ma86)
141MY_CHECK_HSLFILE_F90(hsl_ma97)
142
143if test $have_f90 = yes; then
144  AC_MSG_CHECKING([for C interface to MC68])
145  AC_COIN_CHECK_FILE([$srcdir/coinhsl/hsl_mc68/C/hsl_mc68i_ciface.f90],
146                     [AC_DEFINE(COINHSL_HAS_MC68, [1], Define to 1 if MC68 is available.)
147                      coin_has_something=yes
148                      grep -q mc68_default_control_i $srcdir/coinhsl/hsl_mc68/C/hsl_mc68i_ciface.f90 && hsl2013=yes
149                      coin_has_hsl_mc68=yes],
150                     [coin_has_hsl_mc68=no])
151  AC_MSG_RESULT($coin_has_hsl_mc68)
152else
153  coin_has_hsl_mc68=no
154fi
155AM_CONDITIONAL(COIN_HAS_HSL_MC68,[test $coin_has_hsl_mc68 = yes])
156
157# the F90 codes depend on deps90.f90
158if test $coin_has_hsl_mc68$coin_has_hsl_ma77$coin_has_hsl_ma86$coin_has_hsl_ma97 != nononono ; then
159  AC_MSG_CHECKING([for deps90.f90])
160  AC_COIN_CHECK_FILE([$srcdir/coinhsl/common/deps90.f90],
161                     [coin_has_depsf90=yes],
162                     [coin_has_depsf90=no])
163  AC_MSG_RESULT($coin_has_depsf90)
164  if test $coin_has_depsf90 = no; then
165    AC_MSG_ERROR([Required file common/deps90.f90 not found])
166  fi
167else
168  coin_has_depsf90=no
169fi
170AM_CONDITIONAL(COIN_HAS_DEPSF90,[test $coin_has_depsf90 = yes])
171
172# MA57, MA77, and MA86 require BLAS
173if test $coin_has_ma57$coin_has_hsl_ma77$coin_has_hsl_ma86 != nonono ; then
174  AC_COIN_CHECK_PACKAGE_BLAS(HSL)
175  if test $coin_has_blas != yes ; then
176    AC_MSG_ERROR([Required package BLAS not found.])
177  fi
178else
179  AM_CONDITIONAL(COIN_HAS_BLAS, [test 0 = 1])
180fi
181
182# MA57, MA77, MA97, and MC68 can use Metis
183# if Metis is not available, then we compile a dummy metis.f that defines the Metis function symbol
184if test $coin_has_ma57$coin_has_hsl_ma77$coin_has_hsl_ma97$coin_has_hsl_mc68 != nononono ; then
185  AC_COIN_CHECK_PACKAGE(Metis, [coinmetis], HSL)
186  if test $coin_has_metis = yes ; then
187    AC_DEFINE(COINHSL_HAS_METIS, [1], Define to 1 if METIS is available)
188  fi
189else
190  # do as if we had metis, so metis.f is not compiled
191  AM_CONDITIONAL(COIN_HAS_METIS, [test 1 = 1])
192fi
193
194# MC68 and MA77 changed the interface from HSL 2012 to HSL 2013,
195# so we check whether we have the 2013 version (for mc68, we did this test above)
196# and set a compiletime define
197if test $coin_has_hsl_ma77 = yes ; then
198  grep -q ma77_solve_fredholm $srcdir/coinhsl/hsl_ma77/hsl_ma77d.f90 && hsl2013=yes
199fi
200if test $hsl2013 = yes ; then
201  AC_DEFINE(COINHSL_HSL2013, [1], Define to 1 if HSL library is from 2013)
202  AC_MSG_NOTICE([HSL source recognized as HSL 2013])
203fi
204
205#############################################################################
206#                        Setup build of loadable library                    #
207#############################################################################
208
209HSL_SHARED_LIB=
210if test x$enable_loadable_library = xyes; then
211  case $build in
212    *-cygwin* | *-mingw*)
213      HSL_SHARED_LIB=libhsl.dll
214      F77_SHARED_CMD='$(F77) -shared $(FFLAGS)'
215      case $F77 in
216        compile_f2c*)
217          EXPORT_SYMBOLS=
218          if test $coin_has_ma27 = yes; then
219            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma27ad_ ma27bd_ ma27cd_ ma27id_"
220          fi
221          if test $coin_has_ma28 = yes; then
222            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma28ad_"
223          fi
224          if test $coin_has_ma57 = yes; then
225            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma57ad_ ma57bd_ ma57cd_ ma57ed_ ma57id_"
226          fi
227          if test $coin_has_mc19 = yes; then
228            EXPORT_SYMBOLS="$EXPORT_SYMBOLS mc19ad_"
229          fi
230          if test $coin_has_hsl_ma77 = yes; then
231            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma77_default_control_ ma77_open_nelt_ ma77_open_ ma77_input_vars_ ma77_input_reals_ ma77_analyse_ ma77_factor_ ma77_factor_solve_ ma77_solve_ ma77_resid_ ma77_scale_ ma77_enquire_posdef_ ma77_enquire_indef_ ma77_alter_ ma77_restart_ ma77_finalise_"           
232          fi
233          if test $coin_has_hsl_ma86 = yes; then
234            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma86_default_control_ ma86_analyse_ ma86_factor_ ma86_factor_solve_ ma86_solve_ ma86_finalise_"
235          fi
236          if test $coin_has_hsl_ma97 = yes; then
237            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma97_default_control_ ma97_analyse_ ma97_factor_ ma97_factor_solve_ ma97_solve_ ma97_finalise_ ma97_free_akeep_"
238          fi
239          if test $coin_has_hsl_mc68 = yes; then
240            EXPORT_SYMBOLS="$EXPORT_SYMBOLS mc68_default_control_ mc68_order_"
241          fi
242          F77_SHARED_CMD='$(F77) -shared $(FFLAGS) -def:$(DEFFILE)'
243          DEFFILE='Export.def'
244          ;;
245        ifort* | IFORT*)
246          EXPORT_SYMBOLS=
247          if test $coin_has_ma27 = yes; then
248            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA27AD MA27BD MA27CD MA27ID"
249          fi
250          if test $coin_has_ma28 = yes; then
251            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA28AD"
252          fi
253          if test $coin_has_ma57 = yes; then
254            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA57AD MA57BD MA57CD MA57ED MA57ID"
255          fi
256          if test $coin_has_hsl_ma77 = yes; then
257            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA77_DEFAULT_CONTROL MA77_OPEN_NELT MA77_OPEN MA77_INPUT_VARS MA77_INPUT_REALS MA77_ANALYSE MA77_FACTOR MA77_FACTOR_SOLVE MA77_SOLVE MA77_RESID MA77_SCALE MA77_ENQUIRE_POSDEF MA77_ENQUIRE_INDEF MA77_ALTER MA77_RESTART MA77_FINALISE"           
258          fi
259          if test $coin_has_mc19 = yes; then
260            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MC19AD"
261          fi
262          if test $coin_has_hsl_ma86 = yes; then
263            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA86_DEFAULT_CONTROL MA86_ANALAYSE MA86_FACTOR MA86_FACTOR_SOLVE MA86_SOLVE MA86_FINALISE"
264          fi
265          if test $coin_has_hsl_ma97 = yes; then
266            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA97_DEFAULT_CONTROL MA97_ANALAYSE MA97_FACTOR MA97_FACTOR_SOLVE MA97_SOLVE MA97_FINALISE MA97_FREE_AKEEP"
267          fi
268          if test $coin_has_hsl_mc68 = yes; then
269            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MC68_DEFAULT_CONTROL MC68_ORDER"
270          fi
271          DEFFILE='Export.def'
272          F77_SHARED_CMD='$(F77) $(FFLAGS)'
273          F77_DLL_LINKFLAGS='-link -dll -def:$(DEFFILE)'
274          ;;
275        *)
276          F77_SHARED_CMD='$(F77) -shared $(FFLAGS)'
277          ;;
278      esac
279      ;;
280  esac
281fi
282AC_SUBST(F77_SHARED_CMD)
283AC_SUBST(F77_DLL_LINKFLAGS)
284AC_SUBST(HSL_SHARED_LIB)
285AC_SUBST(EXPORT_SYMBOLS)
286AC_SUBST(DEFFILE)
287AM_CONDITIONAL([INSTALL_LOADABLE_LIBRARY],[test x$flag = xforce_shared])
288AM_CONDITIONAL([NEED_DEFFILE], [test ! x"$DEFFILE" = x])
289
290AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test ! x"$F77_SHARED_CMD" = x])
291#AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test "$F77_SHARED_CMD" = x])
292
293#############################################################################
294#                              Write the output                             #
295#############################################################################
296
297AC_CONFIG_FILES([Makefile])
298
299# we build the library and setup the .pc files only if there is at least one source code
300# if there is no source code, then .pc files should not be setup, so for others this is as if we do not exist
301if test $coin_has_something = yes ; then
302  AC_CONFIG_FILES([coinhsl.pc coinhsl-uninstalled.pc])
303  AC_CONFIG_HEADER(config.h config_coinhsl.h)
304else
305  # in case something is left over from a previous build
306  rm -f coinhsl.pc coinhsl-uninstalled.pc
307fi
308AM_CONDITIONAL(BUILD_COINHSL, [test $coin_has_something = yes])
309
310AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.