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

Last change on this file since 2256 was 2256, checked in by stefan, 10 years ago

add configuration header file instead of telling config via cflags do not build library if there is no source, remove dummy.c

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.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 2256 2011-06-11 16:21:17Z 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],[trunk],[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 Coin 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
25# Here we don't know yet which files are actually provided...
26AC_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.
32AC_PREFIX_DEFAULT([`pwd`])
33
34AC_COIN_PROJECTDIR_INIT(COINHSL)
35
36#############################################################################
37#                         Standard build tool stuff                         #
38#############################################################################
39
40# Get the system type
41AC_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
45coin_skip_warn_fflags=yes
46
47# provide flag to allow compilation of a stand-alone shared library
48AC_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
53AC_COIN_DEBUG_COMPILE(HSL)
54
55# Get the name of the C compiler (for a dummy program)
56AC_COIN_PROG_CC
57
58# Get the name of the Fortran compiler and appropriate compiler options
59AC_COIN_PROG_F77
60
61# Check if pkg-config is available (to setup addlibs file)
62AC_COIN_HAS_PKGCONFIG
63
64# Get the linker flags (FLIBS) that are required for linking against this blas library
65AC_COIN_F77_WRAPPERS
66
67# Add FLIBS to HSL_PCLIBS, so that they get into the .pc files
68HSL_PCLIBS="$HSL_PCLIBS $FLIBS"
69
70# Need egrep later on
71AC_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.
76if test "$FC" = ""; then
77  FC="$F77"
78fi
79if test "$FCFLAGS" = ""; then
80  FCFLAGS="$FFLAGS"
81fi
82AC_PROG_FC
83
84# Initialize autotools
85
86if test x$enable_loadable_library = xyes; then
87  flag=force_shared
88fi
89AC_COIN_INIT_AUTO_TOOLS([$flag])
90
91#############################################################################
92#                    Find out which files are available                     #
93#############################################################################
94
95AC_MSG_CHECKING([whether we can compile Fortran 90 code])
96AC_LANG_PUSH(Fortran 77)
97AC_COMPILE_IFELSE([        MODULE BLA
98      DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: BLUBB
99      END MODULE BLA],[have_f90=yes ; rm -f bla.mod],[have_f90=no])
100AC_MSG_RESULT([$have_f90])
101AC_LANG_POP(Fortran 77)
102
103coin_has_something=no
104
105AC_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])
112AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])])
113
114AC_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])
122else
123  coin_has_$1=no
124fi
125AM_CONDITIONAL([COIN_HAS_$2],[test $coin_has_$1 = yes])])
126
127MY_CHECK_HSLFILE(ma27ad,MA27)
128if 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
136fi
137
138MY_CHECK_HSLFILE(ma57ad,MA57)
139if test $coin_has_ma57ad = yes; then
140  AC_COIN_CHECK_PACKAGE(Metis, [coinmetis], HSL)
141  if test $coin_has_metis != yes ; then
142    AC_MSG_ERROR([MA57 requires METIS, which is not found.])
143  fi
144else
145  AM_CONDITIONAL(COIN_HAS_METIS, [test 0 = 1])
146fi
147
148MY_CHECK_HSLFILE(mc19ad,MC19)
149MY_CHECK_HSLFILE(ma28ad,MA28)
150MY_CHECK_HSLFILE_F90(hsl_ma77d,MA77)
151
152#############################################################################
153#                        Setup build of loadable library                    #
154#############################################################################
155
156HSL_SHARED_LIB=
157if 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
204fi
205AC_SUBST(F77_SHARED_CMD)
206AC_SUBST(F77_DLL_LINKFLAGS)
207AC_SUBST(HSL_SHARED_LIB)
208AC_SUBST(EXPORT_SYMBOLS)
209AC_SUBST(DEFFILE)
210AM_CONDITIONAL([INSTALL_LOADABLE_LIBRARY],[test x$flag = xforce_shared])
211AM_CONDITIONAL([NEED_DEFFILE], [test ! x"$DEFFILE" = x])
212
213AM_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
220AC_CONFIG_FILES([Makefile])
221
222# we build the library and setup the .pc files only if there is at least one source code
223# if there is no source code, then .pc files should not be setup, so for others this is as if we do not exist
224if test $coin_has_something = yes ; then
225  AC_CONFIG_FILES([coinhsl.pc coinhsl-uninstalled.pc])
226  AC_CONFIG_HEADER(config.h config_coinhsl.h)
227else
228  # in case something is left over from a previous build
229  rm -f coinhsl.pc coinhsl-uninstalled.pc
230fi
231AM_CONDITIONAL(BUILD_COINHSL, [test $coin_has_something = yes])
232
233AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.