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 2797 2013-06-14 13:59:07Z stefan $ |
---|
6 | |
---|
7 | # Author: Andreas Waechter IBM 2006-04-13 |
---|
8 | |
---|
9 | ############################################################################# |
---|
10 | # Names and other basic things # |
---|
11 | ############################################################################# |
---|
12 | |
---|
13 | AC_PREREQ(2.59) |
---|
14 | |
---|
15 | AC_INIT([ThirdPartyHSL],[1.3.5],[http://projects.coin-or.org/BuildTools/newticket]) |
---|
16 | |
---|
17 | AC_COPYRIGHT([ |
---|
18 | Copyright 2006, 2009 International Business Machines and others. |
---|
19 | All Rights Reserved. |
---|
20 | This file is part of the open source package Coin which is distributed |
---|
21 | under 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... |
---|
26 | AC_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. |
---|
32 | AC_PREFIX_DEFAULT([`pwd`]) |
---|
33 | |
---|
34 | AC_COIN_PROJECTDIR_INIT(COINHSL,4:5:3) |
---|
35 | |
---|
36 | ############################################################################# |
---|
37 | # Standard build tool stuff # |
---|
38 | ############################################################################# |
---|
39 | |
---|
40 | # Get the system type |
---|
41 | AC_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 |
---|
45 | coin_skip_warn_fflags=yes |
---|
46 | |
---|
47 | # provide flag to allow compilation of a stand-alone shared library |
---|
48 | AC_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 |
---|
53 | AC_COIN_DEBUG_COMPILE(HSL) |
---|
54 | |
---|
55 | # Get the name of the C compiler (for a dummy program) |
---|
56 | AC_COIN_PROG_CC |
---|
57 | |
---|
58 | # Get the name of the Fortran compiler and appropriate compiler options |
---|
59 | AC_COIN_PROG_F77 |
---|
60 | |
---|
61 | # Check if pkg-config is available (to setup addlibs file) |
---|
62 | AC_COIN_HAS_PKGCONFIG |
---|
63 | |
---|
64 | # Get the linker flags (FLIBS) that are required for linking against this blas library |
---|
65 | AC_COIN_F77_WRAPPERS |
---|
66 | |
---|
67 | # Add FLIBS to HSL_PCLIBS, so that they get into the .pc files |
---|
68 | HSL_PCLIBS="$HSL_PCLIBS $FLIBS" |
---|
69 | |
---|
70 | # Need egrep later on |
---|
71 | AC_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. |
---|
76 | if test "$FC" = ""; then |
---|
77 | FC="$F77" |
---|
78 | fi |
---|
79 | if test "$FCFLAGS" = ""; then |
---|
80 | FCFLAGS="$FFLAGS" |
---|
81 | fi |
---|
82 | AC_PROG_FC |
---|
83 | |
---|
84 | # Initialize autotools |
---|
85 | |
---|
86 | if test x$enable_loadable_library = xyes; then |
---|
87 | flag=force_shared |
---|
88 | fi |
---|
89 | AC_COIN_INIT_AUTO_TOOLS([$flag]) |
---|
90 | |
---|
91 | ############################################################################# |
---|
92 | # Find out which files are available # |
---|
93 | ############################################################################# |
---|
94 | |
---|
95 | AC_MSG_CHECKING([whether we can compile Fortran 90 code]) |
---|
96 | AC_LANG_PUSH(Fortran 77) |
---|
97 | AC_COMPILE_IFELSE([ MODULE BLA |
---|
98 | DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: BLUBB |
---|
99 | END MODULE BLA],[have_f90=yes ; rm -f bla.mod],[have_f90=no]) |
---|
100 | AC_MSG_RESULT([$have_f90]) |
---|
101 | AC_LANG_POP(Fortran 77) |
---|
102 | |
---|
103 | coin_has_something=no |
---|
104 | |
---|
105 | AC_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]) |
---|
112 | AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])]) |
---|
113 | |
---|
114 | AC_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]) |
---|
122 | else |
---|
123 | coin_has_$1=no |
---|
124 | fi |
---|
125 | AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])]) |
---|
126 | |
---|
127 | MY_CHECK_HSLFILE(ma27ad,MA27) |
---|
128 | if 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 |
---|
136 | fi |
---|
137 | |
---|
138 | AC_COIN_CHECK_PACKAGE(Metis, [coinmetis], HSL) |
---|
139 | if test $coin_has_metis = yes ; then |
---|
140 | AC_DEFINE(COINHSL_HAS_METIS, [1], Define to 1 if METIS is available) |
---|
141 | fi |
---|
142 | |
---|
143 | MY_CHECK_HSLFILE(ma57ad,MA57) |
---|
144 | if 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 |
---|
152 | else |
---|
153 | AM_CONDITIONAL(COIN_HAS_METIS, [test 0 = 1]) |
---|
154 | AM_CONDITIONAL(COIN_HAS_BLAS, [test 0 = 1]) |
---|
155 | fi |
---|
156 | |
---|
157 | MY_CHECK_HSLFILE(mc19ad,MC19) |
---|
158 | MY_CHECK_HSLFILE(ma28ad,MA28) |
---|
159 | MY_CHECK_HSLFILE_F90(hsl_ma77d,MA77) |
---|
160 | |
---|
161 | ############################################################################# |
---|
162 | # Setup build of loadable library # |
---|
163 | ############################################################################# |
---|
164 | |
---|
165 | HSL_SHARED_LIB= |
---|
166 | if 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 |
---|
213 | fi |
---|
214 | AC_SUBST(F77_SHARED_CMD) |
---|
215 | AC_SUBST(F77_DLL_LINKFLAGS) |
---|
216 | AC_SUBST(HSL_SHARED_LIB) |
---|
217 | AC_SUBST(EXPORT_SYMBOLS) |
---|
218 | AC_SUBST(DEFFILE) |
---|
219 | AM_CONDITIONAL([INSTALL_LOADABLE_LIBRARY],[test x$flag = xforce_shared]) |
---|
220 | AM_CONDITIONAL([NEED_DEFFILE], [test ! x"$DEFFILE" = x]) |
---|
221 | |
---|
222 | AM_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 | |
---|
229 | AC_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 |
---|
233 | if test $coin_has_something = yes ; then |
---|
234 | AC_CONFIG_FILES([coinhsl.pc coinhsl-uninstalled.pc]) |
---|
235 | AC_CONFIG_HEADER(config.h config_coinhsl.h) |
---|
236 | else |
---|
237 | # in case something is left over from a previous build |
---|
238 | rm -f coinhsl.pc coinhsl-uninstalled.pc |
---|
239 | fi |
---|
240 | AM_CONDITIONAL(BUILD_COINHSL, [test $coin_has_something = yes]) |
---|
241 | |
---|
242 | AC_COIN_FINALIZE |
---|