source: ThirdParty/ASL/trunk/configure.ac @ 589

Last change on this file since 589 was 588, checked in by andreasw, 12 years ago

included changes proposed by Lou Hafer for ASL configuration and compilation with MSVC

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 6.2 KB
Line 
1# Copyright (C) 2007 International Business Machines.
2# All Rights Reserved.
3# This file is distributed under the Common Public License.
4
5## $Id: configure.ac 588 2007-09-29 22:12:30Z andreasw $
6
7# Author:  Andreas Waechter            IBM    2006-04-13
8# Revised: Lou Hafer                   SFU    2007-09-15
9
10#############################################################################
11#                       Names and other basic things                        #
12#############################################################################
13
14AC_PREREQ(2.59)
15
16AC_INIT([ThirdPartyASL],[1.0trunk],[http://projects.coin-or.org/BuildTools/newticket])
17
18AC_COPYRIGHT([
19Copyright 2006 International Business Machines and others.
20All Rights Reserved.
21This file is part of the open source package Coin which is distributed
22under the Common Public License.])
23
24# List one file in the package so that the configure script can test
25# whether the package is actually there
26AC_CONFIG_SRCDIR(solvers/asl.h)
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
34#############################################################################
35#                         Standard build tool stuff                         #
36#############################################################################
37
38# Get the system type
39AC_CANONICAL_BUILD
40
41# A bit of initial setup.
42AC_COIN_PROJECTDIR_INIT
43
44# Turn off warnings and pedantic mode since they could make trouble on some
45# platforms, and we can't fix issues in third-party code.
46coin_skip_warn_cflags=yes
47
48# Check if user wants to produce debugging code
49AC_COIN_DEBUG_COMPILE(ASL)
50
51# We need egrep and ln -s somewhere
52AC_PROG_EGREP
53AC_PROG_LN_S
54
55# Get the name of the C compiler and compiler flags
56AC_COIN_PROG_CC
57
58# Initialize automake and libtool
59AC_COIN_INIT_AUTO_TOOLS
60
61# See what we're actually going to do for ASL. This will define ampllib.
62AC_COIN_HAS_ASL
63
64MAKEOKFILE=.MakeOk
65if test $coin_has_asl != no && test "$use_asldir" != BUILD; then
66  skip_further_test=yes
67  rm -f $MAKEOKFILE
68  AC_MSG_NOTICE([The ASL sources don't need to be compiled])
69  MAKEOKFILE=
70else
71  touch $MAKEOKFILE
72fi
73AC_SUBST(MAKEOKFILE)
74AM_CONDITIONAL(SKIPMAKE, test -z "$MAKEOKFILE")
75
76#############################################################################
77#                          AMPL SOLVER LIBRARY                              #
78#############################################################################
79
80if test x$skip_further_test != xyes; then
81
82# Set a substitutable variable with the library name, and determine the
83# compilation style.
84
85  AC_SUBST(AMPLSOLVER_A)
86  AMPLSOLVER_A=$ampllib
87  case "$CC" in
88    cl* | */cl* | CL* | */CL*)
89      msvc_compile=yes ;;
90    *)
91      msvc_compile=no ;;
92  esac
93  AC_MSG_NOTICE([Configuring ASL to build $AMPLSOLVER_A.])
94
95# Determine flags to be passed on the command line to (n)make. The main
96# activity is to groom CFLAGS and set up ASLMAKEFLAGS to pass CFLAGS on the
97# (n)make command line.
98# NON_STDIO no longer appears in any source file; removed all mention.
99# No_Control87 seems to be specific to DEC Alpha. Try leaving it undefined.
100# -- lh, 070915 --
101
102  if test -z "$ASLMAKEFLAGS" ; then
103    asladdcflags=
104    case $build in
105      *-linux*)
106        case $CC in
107          pgcc* | */pgcc* | xlc* | */xlc* | blrts_xlc* | */blrts_xlc*)
108            asladdcflags="$asladdcflags -DNO_fpu_control";;
109        esac
110        ;;
111    esac
112
113# The critical function for NO_RUSAGE is getrusage(). Use a standard test.
114# -- lh, 070915 --
115
116    AC_MSG_CHECKING([for getrusage])
117    AC_LANG_PUSH(C)
118    AC_LINK_IFELSE(
119      [AC_LANG_PROGRAM([[]],[[getrusage()]])],
120      [AC_MSG_RESULT([yes])],
121      [asladdcflags="$asladdcflags -DNO_RUSAGE"
122       AC_MSG_RESULT([no])])
123    AC_LANG_POP(C)
124
125# On BlueGene disable dynamic library loading
126
127    if test x"$enable_bg" = xyes; then
128      asladdcflags="$asladdcflags -DNO_FUNCADD"
129    fi
130
131# Groom CFLAGS before we merge it with asladdcflags.
132# Remove -Werror if present, to make sure we are not interrupting compilation
133# of ASL because of warning messages. The cl equivalent is -WX.
134
135    bla=
136    if test x$msvc_compile = xyes ; then
137      warnToErr="-WX"
138    else
139      warnToErr="-Werror"
140    fi
141    for i in $CFLAGS; do
142      if test "$i" != "$warnToErr"; then
143        bla="$bla $i"
144      fi
145    done
146    ASLMAKEFLAGS="CFLAGS=\"$bla $asladdcflags\""
147
148# Somehow, the flags specified here cause ASL to segfault on the AIX
149# compiler, so take them out.
150
151    case $CC in
152      xlc* | */xlc* | mpxlc* | */mpxlc*)
153        ASLMAKEFLAGS=`echo $ASLMAKEFLAGS | sed -e 's/-qtune=auto//g' -e 's/-qarch=auto//g' -e 's/-qcache=auto//g' -e 's/-qhot//g' -e sed 's/-O3/-O/g'`
154        ;;
155      pgcc* | */pgcc*)
156        ASLMAKEFLAGS=`echo $ASLMAKEFLAGS | sed -e 's/-fast/-O1/g'`
157        ;;
158    esac
159
160# Limit GNU make to one thread. But remember that if we're building with
161# cl, ultimately we're going to use nmake, which knows nothing of this.
162
163    if test x$msvc_compile = xno ; then
164      rm -rf conftest.mak
165      ($am_make -v > conftest.grp) 2>&5
166      if $EGREP GNU conftest.grp >&5 ; then
167        ASLMAKEFLAGS="-j 1 $ASLMAKEFLAGS"
168      fi
169      rm -f conftest.grp
170    fi
171  fi
172
173# End if-then to construct ASLMAKEFLAGS
174
175  AC_MSG_NOTICE([Command line flags for (n)make \"$ASLMAKEFLAGS\".])
176
177# Now create appropriate makefile commands. This applies only to non-msvc
178# builds. Perhaps convert to a script, following pattern of compile_MS_ASL?
179
180  if test x"$AR" = x; then
181    AR=ar
182  fi
183
184  ASLMAKEFILECMDS="sed -e 's%ar \$\$(ARFLAGS)%$AR \$\$(ARFLAGS)%' makefile.u | sed -e 's%ar ruv%$AR ruv%' "
185  if test "$EXEEXT" = ".exe"; then
186    ASLMAKEFILECMDS="$ASLMAKEFILECMDS | sed 's/a.out/a.exe/'"
187  fi
188  case $build in
189    *-cygwin*)
190      ASLMAKEFILECMDS="$ASLMAKEFILECMDS | sed 's%s/System_details/\`uname -sr\`/%s|System_details|\`uname -sr\`|%'" ;;
191  esac
192  ASLMAKEFILECMDS="$ASLMAKEFILECMDS > makefile"
193
194  AC_ARG_VAR(ASLMAKEFLAGS,[Compilation flags necessary for compiling the AMPL solver library])
195  AC_SUBST(ASLMAKEFILECMDS)
196
197fi
198
199AM_CONDITIONAL(MSVC_COMPILE, test x$msvc_compile = xyes)
200
201AC_CONFIG_FILES([Makefile compile_MS_ASL])
202
203AC_COIN_FINALIZE
204
205# Finally, we need to make sure that compile_MS_ASL is executable
206chmod a+x compile_MS_ASL
Note: See TracBrowser for help on using the repository browser.