-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
177 lines (148 loc) · 5.74 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Copyright (C) 2006, 2009 International Business Machines.
# All Rights Reserved.
# This file is distributed under the Eclipse Public License.
# Author: Andreas Waechter IBM 2006-04-13
#############################################################################
# Names and other basic things #
#############################################################################
AC_PREREQ(2.59)
AC_INIT([CoinHSL],[2.1.0],[https://github.com/coin-or-tools/ThirdParty-HSL/issues/new],,[https://github.com/coin-or-tools/ThirdParty-HSL])
AC_COPYRIGHT([
Copyright 2006, 2009 International Business Machines and others.
All Rights Reserved.
This file is part of the open source package BuildTools which is distributed
under the Eclipse Public License.])
# List one file in the package so that the configure script can test
# whether the package is actually there
AC_CONFIG_SRCDIR([coinhsl/common/deps.f])
AC_COIN_INITIALIZE
#############################################################################
# Standard build tool stuff #
#############################################################################
# Get the name of the C compiler (for metis_adapter.c)
AC_COIN_PROG_CC
# Get the name of the Fortran 77 compiler and appropriate compiler options
AC_COIN_PROG_F77
if test -z "$F77" ; then
AC_MSG_ERROR([No Fortran compiler.])
fi
AC_COIN_F77_SETUP
# Get the name of the Fortran 90 compiler and appropriate compiler options
AC_COIN_PROG_FC
# Initialize libtool
AC_COIN_PROG_LIBTOOL(no-win32-dll)
# Add FLIBS to HSL_LFLAGS, so that they get into the .pc files section for static builds
HSL_LFLAGS="$HSL_LFLAGS $FLIBS"
#############################################################################
# Find out which files are available #
#############################################################################
# do this unconditionally to make sure COIN_HAS_PKGCONFIG is also defined if no >= MA57
AC_COIN_HAS_PKGCONFIG
AC_DEFUN([MY_CHECK_HSLFILE],
[AC_MSG_CHECKING([for m4_toupper(m4_bpatsubst($1, hsl_))])
if test -r "$srcdir/coinhsl/$1/$1d.f" ; then
AC_DEFINE(m4_toupper(COINHSL_HAS_$1), [1], Define to 1 if m4_toupper(m4_bpatsubst($1, hsl_)) is available.)
coin_has_$1=yes
else
coin_has_$1=no
fi
AC_MSG_RESULT($coin_has_$1)
AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),[test $coin_has_$1 = yes])
])
AC_DEFUN([MY_CHECK_HSLFILE_F90],
[if test -n "$FC" ; then
AC_MSG_CHECKING([for m4_toupper(m4_bpatsubst($1, hsl_))])
if test -r "$srcdir/coinhsl/$1/$1d.f90" ; then
AC_DEFINE([COINHSL_HAS_]m4_toupper(m4_bpatsubst($1, hsl_)), [1], Define to 1 if m4_toupper(m4_bpatsubst($1, hsl_)) is available.)
coin_has_$1=yes
else
coin_has_$1=no
fi
AC_MSG_RESULT($coin_has_$1)
else
coin_has_$1=no
fi
AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),[test $coin_has_$1 = yes])
])
MY_CHECK_HSLFILE(mc19)
MY_CHECK_HSLFILE(ma27)
MY_CHECK_HSLFILE(ma28)
MY_CHECK_HSLFILE(ma57)
MY_CHECK_HSLFILE_F90(hsl_ma77)
MY_CHECK_HSLFILE_F90(hsl_ma86)
MY_CHECK_HSLFILE_F90(hsl_ma97)
coin_has_hsl_mc68=no
if test -n "$FC"; then
AC_MSG_CHECKING([for C interface to MC68])
if test -r "$srcdir/coinhsl/hsl_mc68/C/hsl_mc68i_ciface.f90" ; then
AC_DEFINE(COINHSL_HAS_MC68, [1], Define to 1 if MC68 is available.)
coin_has_hsl_mc68=yes
fi
AC_MSG_RESULT($coin_has_hsl_mc68)
fi
AM_CONDITIONAL(COIN_HAS_HSL_MC68,[test $coin_has_hsl_mc68 = yes])
# the F90 codes depend on deps90.f90
coin_has_depsf90=no
if test $coin_has_hsl_mc68$coin_has_hsl_ma77$coin_has_hsl_ma86$coin_has_hsl_ma97 != nononono ; then
AC_MSG_CHECKING([for deps90.f90])
if test -r "$srcdir/coinhsl/common/deps90.f90" ; then
coin_has_depsf90=yes
fi
AC_MSG_RESULT($coin_has_depsf90)
if test $coin_has_depsf90 = no; then
AC_MSG_ERROR([Required file common/deps90.f90 not found])
fi
fi
AM_CONDITIONAL(COIN_HAS_DEPSF90,[test $coin_has_depsf90 = yes])
# MA57, MA77, and MA86 require BLAS, MA97 requires LAPACK
if test $coin_has_ma57$coin_has_hsl_ma77$coin_has_hsl_ma86$coin_has_hsl_ma97 != nononono ; then
AC_COIN_CHK_LAPACK(HSL)
if test $coin_has_lapack != yes ; then
AC_MSG_ERROR([Required package LAPACK not found.])
fi
else
AM_CONDITIONAL(COIN_HAS_LAPACK, [false])
fi
# MA57, MA77, MA97, and MC68 can use Metis
if test $coin_has_ma57$coin_has_hsl_ma77$coin_has_hsl_ma97$coin_has_hsl_mc68 != nononono ; then
AC_COIN_CHK_LIBM(METISCHECK)
AC_LANG_PUSH(Fortran)
AC_COIN_CHK_LIB(Metis,[HSL],[-lmetis "$METISCHECK_LFLAGS"],[],[],[metis_nodend])
AC_LANG_POP(Fortran)
else
coin_has_metis=no
fi
if test $coin_has_metis = yes ; then
AC_LANG_PUSH(C)
coin_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $metis_cflags"
AC_CHECK_HEADER([metis.h],,[coin_has_metis=no])
CPPFLAGS="$coin_CPPFLAGS"
AC_LANG_POP(C)
fi
# check whether we can redefine metis_nodend to coinmetis_nodend from metis_adapter
if test $coin_has_metis = yes ; then
AC_FC_PP_DEFINE([],[coin_has_metis=no])
fi
if test $coin_has_metis = yes ; then
AC_FC_PP_SRCEXT(f,[],[coin_has_metis=no])
fi
if test $coin_has_metis = yes ; then
AC_FC_PP_SRCEXT(f90,[],[coin_has_metis=no])
fi
AM_CONDITIONAL(COIN_HAS_METIS, [test $coin_has_metis = yes])
# MA86 and MA97 can use OpenMP
if test $coin_has_hsl_ma86$coin_has_hsl_ma97 != nono ; then
AC_LANG_PUSH(Fortran)
AC_OPENMP
FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
HSL_LFLAGS="$HSL_LFLAGS $OPENMP_FCFLAGS"
AC_LANG_POP(Fortran)
fi
#############################################################################
# Write the output #
#############################################################################
AC_CONFIG_FILES([Makefile coinhsl.pc])
AC_CONFIG_HEADER(config.h CoinHslConfig.h)
AC_COIN_FINALIZE_FLAGS([HSL])
AC_COIN_FINALIZE