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

Last change on this file since 3335 was 3335, checked in by stefan, 5 years ago

merge r3256 from stable/1.4

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.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 3335 2015-01-18 08:32:41Z 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.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# MA97 requires LAPACK (dpotrf)
183if test $coin_has_hsl_ma97 != no ; then
184  AC_COIN_CHECK_PACKAGE_LAPACK(HSL)
185  if test $coin_has_lapack != yes ; then
186    AC_MSG_ERROR([Required package LAPACK not found.])
187  fi
188else
189  AM_CONDITIONAL(COIN_HAS_LAPACK, [test 0 = 1])
190fi
191
192# MA57, MA77, MA97, and MC68 can use Metis
193# if Metis is not available, then we compile a dummy metis.f that defines the Metis function symbol
194if test $coin_has_ma57$coin_has_hsl_ma77$coin_has_hsl_ma97$coin_has_hsl_mc68 != nononono ; then
195  AC_COIN_CHECK_PACKAGE(Metis, [coinmetis], HSL)
196  if test $coin_has_metis = yes ; then
197    AC_DEFINE(COINHSL_HAS_METIS, [1], Define to 1 if METIS is available)
198  fi
199else
200  # do as if we had metis, so metis.f is not compiled
201  AM_CONDITIONAL(COIN_HAS_METIS, [test 1 = 1])
202fi
203
204# MC68 and MA77 changed the interface from HSL 2012 to HSL 2013,
205# so we check whether we have the 2013 version (for mc68, we did this test above)
206# and set a compiletime define
207if test $coin_has_hsl_ma77 = yes ; then
208  grep -q ma77_solve_fredholm $srcdir/coinhsl/hsl_ma77/hsl_ma77d.f90 && hsl2013=yes
209fi
210if test $hsl2013 = yes ; then
211  AC_DEFINE(COINHSL_HSL2013, [1], Define to 1 if HSL library is from 2013)
212  AC_MSG_NOTICE([HSL source recognized as HSL 2013])
213fi
214
215#############################################################################
216#                        Setup build of loadable library                    #
217#############################################################################
218
219HSL_SHARED_LIB=
220if test x$enable_loadable_library = xyes; then
221  case $build in
222    *-cygwin* | *-mingw*)
223      HSL_SHARED_LIB=libhsl.dll
224      F77_SHARED_CMD='$(F77) -shared $(FFLAGS)'
225      case $F77 in
226        compile_f2c*)
227          EXPORT_SYMBOLS=
228          if test $coin_has_ma27 = yes; then
229            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma27ad_ ma27bd_ ma27cd_ ma27id_"
230          fi
231          if test $coin_has_ma28 = yes; then
232            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma28ad_"
233          fi
234          if test $coin_has_ma57 = yes; then
235            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma57ad_ ma57bd_ ma57cd_ ma57ed_ ma57id_"
236          fi
237          if test $coin_has_mc19 = yes; then
238            EXPORT_SYMBOLS="$EXPORT_SYMBOLS mc19ad_"
239          fi
240          if test $coin_has_hsl_ma77 = yes; then
241            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_"           
242          fi
243          if test $coin_has_hsl_ma86 = yes; then
244            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma86_default_control_ ma86_analyse_ ma86_factor_ ma86_factor_solve_ ma86_solve_ ma86_finalise_"
245          fi
246          if test $coin_has_hsl_ma97 = yes; then
247            EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma97_default_control_ ma97_analyse_ ma97_factor_ ma97_factor_solve_ ma97_solve_ ma97_finalise_ ma97_free_akeep_"
248          fi
249          if test $coin_has_hsl_mc68 = yes; then
250            EXPORT_SYMBOLS="$EXPORT_SYMBOLS mc68_default_control_ mc68_order_"
251          fi
252          F77_SHARED_CMD='$(F77) -shared $(FFLAGS) -def:$(DEFFILE)'
253          DEFFILE='Export.def'
254          ;;
255        ifort* | IFORT*)
256          EXPORT_SYMBOLS=
257          if test $coin_has_ma27 = yes; then
258            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA27AD MA27BD MA27CD MA27ID"
259          fi
260          if test $coin_has_ma28 = yes; then
261            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA28AD"
262          fi
263          if test $coin_has_ma57 = yes; then
264            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA57AD MA57BD MA57CD MA57ED MA57ID"
265          fi
266          if test $coin_has_hsl_ma77 = yes; then
267            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"           
268          fi
269          if test $coin_has_mc19 = yes; then
270            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MC19AD"
271          fi
272          if test $coin_has_hsl_ma86 = yes; then
273            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA86_DEFAULT_CONTROL MA86_ANALAYSE MA86_FACTOR MA86_FACTOR_SOLVE MA86_SOLVE MA86_FINALISE"
274          fi
275          if test $coin_has_hsl_ma97 = yes; then
276            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA97_DEFAULT_CONTROL MA97_ANALAYSE MA97_FACTOR MA97_FACTOR_SOLVE MA97_SOLVE MA97_FINALISE MA97_FREE_AKEEP"
277          fi
278          if test $coin_has_hsl_mc68 = yes; then
279            EXPORT_SYMBOLS="$EXPORT_SYMBOLS MC68_DEFAULT_CONTROL MC68_ORDER"
280          fi
281          DEFFILE='Export.def'
282          F77_SHARED_CMD='$(F77) $(FFLAGS)'
283          F77_DLL_LINKFLAGS='-link -dll -def:$(DEFFILE)'
284          ;;
285        *)
286          F77_SHARED_CMD='$(F77) -shared $(FFLAGS)'
287          ;;
288      esac
289      ;;
290  esac
291fi
292AC_SUBST(F77_SHARED_CMD)
293AC_SUBST(F77_DLL_LINKFLAGS)
294AC_SUBST(HSL_SHARED_LIB)
295AC_SUBST(EXPORT_SYMBOLS)
296AC_SUBST(DEFFILE)
297AM_CONDITIONAL([INSTALL_LOADABLE_LIBRARY],[test x$flag = xforce_shared])
298AM_CONDITIONAL([NEED_DEFFILE], [test ! x"$DEFFILE" = x])
299
300AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test ! x"$F77_SHARED_CMD" = x])
301#AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test "$F77_SHARED_CMD" = x])
302
303#############################################################################
304#                              Write the output                             #
305#############################################################################
306
307AC_CONFIG_FILES([Makefile])
308
309# we build the library and setup the .pc files only if there is at least one source code
310# if there is no source code, then .pc files should not be setup, so for others this is as if we do not exist
311if test $coin_has_something = yes ; then
312  AC_CONFIG_FILES([coinhsl.pc coinhsl-uninstalled.pc])
313  AC_CONFIG_HEADER(config.h config_coinhsl.h)
314else
315  # in case something is left over from a previous build
316  rm -f coinhsl.pc coinhsl-uninstalled.pc
317fi
318AM_CONDITIONAL(BUILD_COINHSL, [test $coin_has_something = yes])
319
320AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.