1 | # Copyright (C) 2006, 2009 International Business Machines. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Common Public License. |
---|
4 | |
---|
5 | ## $Id: configure.ac 1873 2010-11-25 22:53:22Z 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],[trunk],[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 Common 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(HSL) |
---|
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 | AC_DEFUN([MY_CHECK_HSLFILE], |
---|
104 | [AC_COIN_CHECK_FILE([$srcdir/$1.f], |
---|
105 | [hsl_files="$hsl_files $1.f" |
---|
106 | coin_has_$1=yes], |
---|
107 | [coin_has_$1=no]) |
---|
108 | AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])]) |
---|
109 | |
---|
110 | AC_DEFUN([MY_CHECK_HSLFILE_F90], |
---|
111 | [if test $have_f90 = yes; then |
---|
112 | AC_COIN_CHECK_FILE([$srcdir/$1.f90], |
---|
113 | [hsl_files="$hsl_files $1.f" |
---|
114 | coin_has_$1=yes], |
---|
115 | [coin_has_$1=no]) |
---|
116 | else |
---|
117 | coin_has_$1=no |
---|
118 | fi |
---|
119 | AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])]) |
---|
120 | |
---|
121 | MY_CHECK_HSLFILE(ma27ad,MA27) |
---|
122 | if test $coin_has_ma27ad = yes; then |
---|
123 | AC_MSG_CHECKING([whether MA27 is threadsafe]) |
---|
124 | if $EGREP MA27UD $srcdir/ma27ad.f >/dev/null 2>&1; then |
---|
125 | AC_MSG_RESULT(yes) |
---|
126 | else |
---|
127 | AC_MSG_RESULT(no) |
---|
128 | AC_MSG_ERROR([Please obtain the threadsafe (newer) version of MA27]) |
---|
129 | fi |
---|
130 | fi |
---|
131 | MY_CHECK_HSLFILE(mc19ad,MC19) |
---|
132 | MY_CHECK_HSLFILE(ma57ad,MA57) |
---|
133 | MY_CHECK_HSLFILE(ma28ad,MA28) |
---|
134 | MY_CHECK_HSLFILE_F90(hsl_ma77d,MA77) |
---|
135 | |
---|
136 | HAVE_MXXX_CFLAGS= |
---|
137 | if test $coin_has_ma27ad = yes; then |
---|
138 | HAVE_MXXX_CFLAGS="-DHAVE_MA27 $HAVE_MXXX_CFLAGS" |
---|
139 | fi |
---|
140 | if test $coin_has_mc19ad = yes; then |
---|
141 | HAVE_MXXX_CFLAGS="-DHAVE_MC19 $HAVE_MXXX_CFLAGS" |
---|
142 | fi |
---|
143 | if test $coin_has_ma57ad = yes; then |
---|
144 | HAVE_MXXX_CFLAGS="-DHAVE_MA57 $HAVE_MXXX_CFLAGS" |
---|
145 | AC_COIN_CHECK_PACKAGE(Metis, [coinmetis], HSL) |
---|
146 | else |
---|
147 | AM_CONDITIONAL(COIN_HAS_METIS, [test 0 = 1]) |
---|
148 | fi |
---|
149 | if test $coin_has_ma28ad = yes; then |
---|
150 | HAVE_MXXX_CFLAGS="-DHAVE_MA28 $HAVE_MXXX_CFLAGS" |
---|
151 | fi |
---|
152 | if test $coin_has_hsl_ma77d = yes; then |
---|
153 | HAVE_MXXX_CFLAGS="-DHAVE_MA77 $HAVE_MXXX_CFLAGS" |
---|
154 | fi |
---|
155 | AC_SUBST(HAVE_MXXX_CFLAGS) |
---|
156 | |
---|
157 | if test x$enable_loadable_library = xyes; then |
---|
158 | case $build in |
---|
159 | *-cygwin* | *-mingw*) |
---|
160 | HSL_SHARED_LIB=libhsl.dll |
---|
161 | F77_SHARED_CMD='$(F77) -shared $(FFLAGS)' |
---|
162 | case $F77 in |
---|
163 | compile_f2c*) |
---|
164 | EXPORT_SYMBOLS= |
---|
165 | if test $coin_has_ma27ad = yes; then |
---|
166 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma27id_ ma27ad_ ma27bd_ ma27cd_" |
---|
167 | fi |
---|
168 | if test $coin_has_ma28ad = yes; then |
---|
169 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma28ad_" |
---|
170 | fi |
---|
171 | if test $coin_has_ma57ad = yes; then |
---|
172 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS ma57id_ ma57ad_ ma57bd_ ma57cd_ ma57ed_" |
---|
173 | fi |
---|
174 | if test $coin_has_mc19ad = yes; then |
---|
175 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS mc19ad_" |
---|
176 | fi |
---|
177 | F77_SHARED_CMD='$(F77) -shared $(FFLAGS) -def:$(DEFFILE)' |
---|
178 | DEFFILE='Export.def' |
---|
179 | ;; |
---|
180 | ifort* | IFORT*) |
---|
181 | EXPORT_SYMBOLS= |
---|
182 | if test $coin_has_ma27ad = yes; then |
---|
183 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA27ID MA27AD MA27BD MA27CD" |
---|
184 | fi |
---|
185 | if test $coin_has_ma28ad = yes; then |
---|
186 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA28AD" |
---|
187 | fi |
---|
188 | if test $coin_has_ma57ad = yes; then |
---|
189 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS MA57ID MA57AD MA57BD MA57CD MA57ED" |
---|
190 | fi |
---|
191 | if test $coin_has_mc19ad = yes; then |
---|
192 | EXPORT_SYMBOLS="$EXPORT_SYMBOLS MC19AD" |
---|
193 | fi |
---|
194 | DEFFILE='Export.def' |
---|
195 | F77_SHARED_CMD='$(F77) $(FFLAGS)' |
---|
196 | F77_DLL_LINKFLAGS='-link -dll -def:$(DEFFILE)' |
---|
197 | ;; |
---|
198 | *) |
---|
199 | F77_SHARED_CMD='$(F77) -shared $(FFLAGS)' |
---|
200 | ;; |
---|
201 | esac |
---|
202 | ;; |
---|
203 | esac |
---|
204 | fi |
---|
205 | AC_SUBST(F77_SHARED_CMD) |
---|
206 | AC_SUBST(F77_DLL_LINKFLAGS) |
---|
207 | AC_SUBST(HSL_SHARED_LIB) |
---|
208 | AC_SUBST(EXPORT_SYMBOLS) |
---|
209 | AC_SUBST(DEFFILE) |
---|
210 | AM_CONDITIONAL([INSTALL_LOADABLE_LIBRARY],[test x$flag = xforce_shared]) |
---|
211 | AM_CONDITIONAL([NEED_DEFFILE], [test ! x"$DEFFILE" = x]) |
---|
212 | |
---|
213 | AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test ! x"$F77_SHARED_CMD" = x]) |
---|
214 | #AM_CONDITIONAL([EXTRA_SHARED_COMMAND],[test "$F77_SHARED_CMD" = x]) |
---|
215 | |
---|
216 | ############################################################################# |
---|
217 | # Write the output # |
---|
218 | ############################################################################# |
---|
219 | |
---|
220 | AC_CONFIG_FILES([Makefile coinhsl.pc coinhsl-uninstalled.pc]) |
---|
221 | |
---|
222 | AC_CONFIG_HEADER([config_hsl.h]) |
---|
223 | |
---|
224 | AC_COIN_FINALIZE |
---|