1 | # Copyright (C) 2007, 2009 International Business Machines. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Eclipse Public License. |
---|
4 | |
---|
5 | ## $Id: configure.ac 3196 2014-04-08 09:51:45Z stefan $ |
---|
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 | |
---|
14 | AC_PREREQ(2.59) |
---|
15 | |
---|
16 | AC_INIT([ThirdPartyASL],[1.2.16],[http://projects.coin-or.org/BuildTools/newticket]) |
---|
17 | |
---|
18 | AC_COPYRIGHT([ |
---|
19 | Copyright 2006, 2007, 2009 International Business Machines and others. |
---|
20 | All Rights Reserved. |
---|
21 | This file is part of the open source package Coin which is distributed |
---|
22 | under the Eclipse Public License.]) |
---|
23 | |
---|
24 | # List one file in the package so that the configure script can test |
---|
25 | # whether the package is actually there |
---|
26 | AC_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. |
---|
32 | AC_PREFIX_DEFAULT([`pwd`]) |
---|
33 | |
---|
34 | ############################################################################# |
---|
35 | # Standard build tool stuff # |
---|
36 | ############################################################################# |
---|
37 | |
---|
38 | # Get the system type |
---|
39 | AC_CANONICAL_BUILD |
---|
40 | |
---|
41 | # A bit of initial setup. |
---|
42 | AC_COIN_PROJECTDIR_INIT(ASL,3:16:2) |
---|
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. |
---|
46 | coin_skip_warn_cflags=yes |
---|
47 | |
---|
48 | # Check if user wants to produce debugging code |
---|
49 | AC_COIN_DEBUG_COMPILE(ASL) |
---|
50 | |
---|
51 | # We need egrep and ln -s somewhere |
---|
52 | AC_PROG_EGREP |
---|
53 | AC_PROG_LN_S |
---|
54 | |
---|
55 | # Get the name of the C compiler and compiler flags |
---|
56 | AC_COIN_PROG_CC |
---|
57 | |
---|
58 | # Initialize automake and libtool |
---|
59 | AC_COIN_INIT_AUTO_TOOLS |
---|
60 | |
---|
61 | # Check if pkg-config is available (to setup addlibs file) |
---|
62 | AC_COIN_HAS_PKGCONFIG |
---|
63 | |
---|
64 | ############################################################################# |
---|
65 | # AMPL SOLVER LIBRARY # |
---|
66 | ############################################################################# |
---|
67 | |
---|
68 | # Determine the name of the ASL library |
---|
69 | |
---|
70 | # Set a substitutable variable with the library name, and determine the compilation style. |
---|
71 | AC_SUBST(AMPLSOLVER_A) |
---|
72 | if test "x$coin_cc_is_cl" = xtrue ; then |
---|
73 | AMPLSOLVER_A=libamplsolver.lib |
---|
74 | else |
---|
75 | AMPLSOLVER_A=libamplsolver.a |
---|
76 | fi |
---|
77 | |
---|
78 | # Determine the host type to set linker options in the Makefile |
---|
79 | AC_SUBST(HOST_TYPE) |
---|
80 | case $host in |
---|
81 | *-cygwin* | *-mingw*) |
---|
82 | AM_CONDITIONAL(HOST_IS_CYGWIN, [test 0 = 0]) |
---|
83 | ;; |
---|
84 | *) |
---|
85 | AM_CONDITIONAL(HOST_IS_CYGWIN, [test 0 = 1]) |
---|
86 | ;; |
---|
87 | esac |
---|
88 | |
---|
89 | # Determine flags to be passed on the command line to (n)make. The main |
---|
90 | # activity is to groom CFLAGS and set up ASLMAKEFLAGS to pass CFLAGS on the |
---|
91 | # (n)make command line. |
---|
92 | # NON_STDIO no longer appears in any source file; removed all mention. |
---|
93 | # No_Control87 seems to be specific to DEC Alpha. Try leaving it undefined. |
---|
94 | |
---|
95 | if test -z "$ASLMAKEFLAGS" ; then |
---|
96 | asladdcflags= |
---|
97 | case $build in |
---|
98 | *-linux*) |
---|
99 | case $CC in |
---|
100 | pgcc* | */pgcc* | xlc* | */xlc* | blrts_xlc* | */blrts_xlc*) |
---|
101 | asladdcflags="$asladdcflags -DNO_fpu_control";; |
---|
102 | esac |
---|
103 | ;; |
---|
104 | esac |
---|
105 | |
---|
106 | # Various feature checks. Force the language to be C while we do this to avoid |
---|
107 | # issues with C++ (re)declarations. |
---|
108 | AC_LANG_PUSH(C) |
---|
109 | |
---|
110 | # The critical function for NO_RUSAGE is getrusage(). Use a standard test. |
---|
111 | |
---|
112 | AC_MSG_CHECKING([for getrusage]) |
---|
113 | AC_LINK_IFELSE( |
---|
114 | [AC_LANG_PROGRAM([[]],[[getrusage()]])], |
---|
115 | [AC_MSG_RESULT([yes])], |
---|
116 | [asladdcflags="$asladdcflags -DNO_RUSAGE" |
---|
117 | AC_MSG_RESULT([no])]) |
---|
118 | |
---|
119 | # Check for long long; we need to define NO_LONG_LONG if it's not present. ASL |
---|
120 | # makefile.u and makefile.vc both deal with this, in their own way. |
---|
121 | # Unfortunately, when trying to build with cl under cygwin, the makefile.vc |
---|
122 | # solution, comptry.bat, fails. To safely discard comptry.bat, we need to do |
---|
123 | # this check. It's hardly likely that long long is missing on any modern |
---|
124 | # system, but it's easy to check. |
---|
125 | # Also, if it's present, then ASL uses strtoull, which is not supported on Windows systems. |
---|
126 | # Instead, there should be a _strtoui64. |
---|
127 | |
---|
128 | AC_CHECK_TYPE([long long],[ |
---|
129 | if test "x$coin_cc_is_cl" = xtrue ; then |
---|
130 | asladdcflags="$asladdcflags -Dstrtoull=_strtoui64" |
---|
131 | fi], |
---|
132 | [asladdcflags="$asladdcflags -DNO_LONG_LONG"],[]) |
---|
133 | |
---|
134 | # Check for ssize_t; we need to define NO_SSIZE_T if it's not present. |
---|
135 | |
---|
136 | AC_CHECK_TYPE([ssize_t],[], |
---|
137 | [asladdcflags="$asladdcflags -DNO_SSIZE_T"],[]) |
---|
138 | |
---|
139 | # Check for dlopen, ASL uses it to load userdefined function libraries |
---|
140 | AC_CHECK_LIB(dl,[dlopen],[ASL_PCLIBS="-ldl $ASL_PCLIBS"]) |
---|
141 | |
---|
142 | # Back to whatever language we were in. |
---|
143 | AC_LANG_POP(C) |
---|
144 | |
---|
145 | # On BlueGene disable dynamic library loading |
---|
146 | if test x"$enable_bg" = xyes; then |
---|
147 | asladdcflags="$asladdcflags -DNO_FUNCADD" |
---|
148 | fi |
---|
149 | |
---|
150 | # Groom CFLAGS before we merge it with asladdcflags. |
---|
151 | # Remove -Werror if present, to make sure we are not interrupting compilation |
---|
152 | # of ASL because of warning messages. The cl equivalent is -WX. |
---|
153 | # SV: Our buildsystem should never add these flags to the CFLAGS, so why bother checking for them? |
---|
154 | # If the user added some, shouldn't we listen to it and not just remove them again? |
---|
155 | bla= |
---|
156 | if test "x$coin_cc_is_cl" = xtrue ; then |
---|
157 | warnToErr="-WX" |
---|
158 | else |
---|
159 | warnToErr="-Werror" |
---|
160 | fi |
---|
161 | for i in $CFLAGS; do |
---|
162 | if test "$i" != "$warnToErr"; then |
---|
163 | bla="$bla $i" |
---|
164 | fi |
---|
165 | done |
---|
166 | |
---|
167 | # Add -fPIC -DPIC if we actually build shared libraries |
---|
168 | if test x$enable_shared != xno; then |
---|
169 | asladdcflags="$asladdcflags -fPIC -DPIC" |
---|
170 | fi |
---|
171 | |
---|
172 | ASLMAKEFLAGS="CFLAGS=\"$bla $asladdcflags\"" |
---|
173 | |
---|
174 | # Somehow, the flags specified here cause ASL to segfault on the AIX |
---|
175 | # compiler, so take them out. |
---|
176 | case $CC in |
---|
177 | xlc* | */xlc* | mpxlc* | */mpxlc*) |
---|
178 | ASLMAKEFLAGS=`echo $ASLMAKEFLAGS | sed -e 's/-qtune=auto//g' -e 's/-qarch=auto//g' -e 's/-qcache=auto//g' -e 's/-qhot//g' -e 's/-O3/-O/g'` |
---|
179 | ;; |
---|
180 | pgcc* | */pgcc*) |
---|
181 | ASLMAKEFLAGS=`echo $ASLMAKEFLAGS | sed -e 's/-fast/-O1/g'` |
---|
182 | ;; |
---|
183 | esac |
---|
184 | |
---|
185 | # Limit GNU make to one thread. But remember that if we're building with |
---|
186 | # cl, ultimately we're going to use nmake, which knows nothing of this. |
---|
187 | if test "x$coin_cc_is_cl" != xtrue ; then |
---|
188 | rm -rf conftest.mak |
---|
189 | ($am_make -v > conftest.grp) 2>&5 |
---|
190 | if $EGREP GNU conftest.grp >&5 ; then |
---|
191 | ASLMAKEFLAGS="-j 1 $ASLMAKEFLAGS" |
---|
192 | fi |
---|
193 | rm -f conftest.grp |
---|
194 | fi |
---|
195 | fi |
---|
196 | # End if-then to construct ASLMAKEFLAGS. Announce the result. |
---|
197 | |
---|
198 | AC_MSG_NOTICE([Command line flags for (n)make \"$ASLMAKEFLAGS\".]) |
---|
199 | AC_ARG_VAR(ASLMAKEFLAGS, [Compilation flags necessary for compiling the AMPL solver library]) |
---|
200 | |
---|
201 | # generate the output files. |
---|
202 | |
---|
203 | AC_CONFIG_FILES([Makefile]) |
---|
204 | AC_CONFIG_FILES([compile_MS_ASL],[chmod a+x compile_MS_ASL]) |
---|
205 | AC_CONFIG_FILES([compile_Unix_ASL],[chmod a+x compile_Unix_ASL]) |
---|
206 | AC_CONFIG_FILES([coinasl.pc coinasl-uninstalled.pc]) |
---|
207 | |
---|
208 | AC_COIN_CHECK_LIBM(ASL) |
---|
209 | AC_SUBST(ASL_PCLIBS) |
---|
210 | |
---|
211 | AC_COIN_FINALIZE |
---|