1 | # Copyright (C) 2007-2010 Stefan Vigerske and others. |
---|
2 | # All Rights Reserved. |
---|
3 | # This file is distributed under the Eclipse Public License. |
---|
4 | |
---|
5 | ## $Id: configure.ac 2441 2011-09-20 09:53:01Z tkr $ |
---|
6 | |
---|
7 | ############################################################################# |
---|
8 | # Names and other basic things # |
---|
9 | ############################################################################# |
---|
10 | |
---|
11 | AC_PREREQ(2.59) |
---|
12 | |
---|
13 | AC_INIT([ThirdPartyGlpk],[1.8],[http://projects.coin-or.org/BuildTools/newticket]) |
---|
14 | |
---|
15 | AC_COPYRIGHT([ |
---|
16 | Copyright 2007-2010 Stefan Vigerske and others. |
---|
17 | All Rights Reserved. |
---|
18 | This file is part of the open source package Coin which is distributed |
---|
19 | under the Eclipse Public License.]) |
---|
20 | |
---|
21 | # List one file in the package so that the configure script can test |
---|
22 | # whether the package is actually there |
---|
23 | AC_CONFIG_SRCDIR(glpk/include/glpk.h) |
---|
24 | |
---|
25 | # Where should everything be installed by default? Here, we want it |
---|
26 | # to be installed directly in 'bin', 'lib', 'include' subdirectories |
---|
27 | # of the directory where configure is run. The default would be |
---|
28 | # /usr/local. |
---|
29 | AC_PREFIX_DEFAULT([`pwd`]) |
---|
30 | |
---|
31 | AC_COIN_PROJECTDIR_INIT(Glpk) |
---|
32 | |
---|
33 | ############################################################################# |
---|
34 | # Standard build tool stuff # |
---|
35 | ############################################################################# |
---|
36 | |
---|
37 | # Get the system type |
---|
38 | AC_CANONICAL_BUILD |
---|
39 | |
---|
40 | #turn off warnings and pedantic mode since it seem to make trouble on solaris platform |
---|
41 | #and we couldn't fix it anyway |
---|
42 | coin_skip_warn_cflags=yes |
---|
43 | |
---|
44 | # Check if user wants to produce debugging code |
---|
45 | AC_COIN_DEBUG_COMPILE(Glpk) |
---|
46 | |
---|
47 | # Get the name of the C compiler |
---|
48 | AC_COIN_PROG_CC |
---|
49 | |
---|
50 | # Check if pkg-config is available (to setup addlibs file) |
---|
51 | AC_COIN_HAS_PKGCONFIG |
---|
52 | |
---|
53 | # Initialize automake |
---|
54 | AC_COIN_INIT_AUTO_TOOLS |
---|
55 | |
---|
56 | ########################################################################### |
---|
57 | # check GLPK version # |
---|
58 | ########################################################################### |
---|
59 | |
---|
60 | AC_MSG_CHECKING([GLPK version]) |
---|
61 | glpkmajorver=`awk '/define GLP_MAJOR_VERSION/ {print $3}' $srcdir/glpk/include/glpk.h` |
---|
62 | glpkminorver=`awk '/define GLP_MINOR_VERSION/ {print $3}' $srcdir/glpk/include/glpk.h` |
---|
63 | AC_MSG_RESULT([${glpkmajorver}.${glpkminorver}]) |
---|
64 | if test x$glpkmajorver != x4 || ( test x$glpkminorver != x44 && test x$glpkminorver != x45 ); then |
---|
65 | AC_MSG_ERROR(["Incorrect GLPK version. This build system is made for GLPK 4.44 or 4.45. Please update by rerunning get.GLPK"]) |
---|
66 | fi |
---|
67 | AC_SUBST(glpkmajorver) |
---|
68 | AC_SUBST(glpkminorver) |
---|
69 | |
---|
70 | ########################################################################### |
---|
71 | # Other packages and C functions # |
---|
72 | ########################################################################### |
---|
73 | |
---|
74 | AC_LANG_PUSH(C) |
---|
75 | |
---|
76 | AC_COIN_CHECK_GNU_ZLIB(GLPK) |
---|
77 | if test $coin_has_zlib = "yes"; then |
---|
78 | AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if GNU zlib is available]) |
---|
79 | fi |
---|
80 | |
---|
81 | AC_COIN_CHECK_GMP(Glpk) |
---|
82 | if test $coin_has_gmp = yes; then |
---|
83 | AC_DEFINE([HAVE_GMP],[1],[Define to 1 if GMP is available]) |
---|
84 | fi |
---|
85 | |
---|
86 | AC_CHECK_FUNC([vsnprintf]) |
---|
87 | |
---|
88 | AC_LANG_POP(C) |
---|
89 | |
---|
90 | ########################################################################### |
---|
91 | # Database connectivity # |
---|
92 | ########################################################################### |
---|
93 | |
---|
94 | #whether we have any means to load shared libraries |
---|
95 | enable_dl=no |
---|
96 | |
---|
97 | AC_LANG_PUSH(C) |
---|
98 | |
---|
99 | AC_COIN_CHECK_HEADER([dlfcn.h],[enable_dl=yes]) |
---|
100 | if test "$enable_dl" = "yes"; then |
---|
101 | #if dlfcn.h is there, check also if libdl is there; if so, set corresponding define for GLPK |
---|
102 | AC_CHECK_LIB(dl,[dlopen],[AC_DEFINE([HAVE_DLFCN],[1],[Define to 1 if dlfcn support is available])],[enable_dl=no]) |
---|
103 | if test $enable_dl = yes; then |
---|
104 | GLPK_LIBS="-ldl $GLPK_LIBS" |
---|
105 | GLPK_PCLIBS="-ldl $GLPK_PCLIBS" |
---|
106 | fi |
---|
107 | fi |
---|
108 | |
---|
109 | if test "$enable_dl" = "no"; then |
---|
110 | AC_COIN_CHECK_HEADER([ltdl.h],[enable_dl=yes]) |
---|
111 | if test "$enable_dl" = "yes"; then |
---|
112 | #if ltdl.h is there, check also if libltdl is there; if so, set corresponding define for GLPK |
---|
113 | AC_CHECK_LIB(ldtl,[lt_dlopen],[AC_DEFINE([HAVE_LTDL],[1],[Define to 1 if ltdl support is available])],[enable_dl=no]) |
---|
114 | if test $enable_dl = yes; then |
---|
115 | GLPK_LIBS="-lltdl $GLPK_LIBS" |
---|
116 | GLPK_PCLIBS="-lltdl $GLPK_PCLIBS" |
---|
117 | fi |
---|
118 | fi |
---|
119 | fi |
---|
120 | |
---|
121 | if test "$enable_dl" = "no"; then |
---|
122 | AC_COIN_CHECK_HEADER([windows.h],[enable_dl=yes]) |
---|
123 | if test "$enable_dl" = "yes"; then |
---|
124 | AC_DEFINE([__WOE__],[1],[Define to 1 if windows dll support is available]) |
---|
125 | fi |
---|
126 | fi |
---|
127 | |
---|
128 | AC_ARG_ENABLE(odbc, |
---|
129 | AC_HELP_STRING([--enable-odbc],[enable MathProg ODBC support [[default=auto]]]), |
---|
130 | [case $enableval in |
---|
131 | yes | unix) |
---|
132 | AC_COIN_CHECK_HEADER([sql.h],,[AC_MSG_ERROR(["need sql.h to enable ODBC support"])]) |
---|
133 | enable_odbc="$enableval" |
---|
134 | ;; |
---|
135 | no) |
---|
136 | enable_odbc="no" |
---|
137 | ;; |
---|
138 | *) |
---|
139 | AC_MSG_ERROR([invalid value '$enableval' for --enable-odbc]) |
---|
140 | ;; |
---|
141 | esac], |
---|
142 | [AC_COIN_CHECK_HEADER([sql.h],[enable_odbc=yes],[enable_odbc=no])] |
---|
143 | ) |
---|
144 | |
---|
145 | AC_ARG_ENABLE(mysql, |
---|
146 | AC_HELP_STRING([--enable-mysql],[enable MathProg MySQL support [[default=auto]]]), |
---|
147 | [case $enableval in |
---|
148 | yes) |
---|
149 | AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],,[AC_MSG_ERROR(["need mysql.h to enable MySQL support"])]) |
---|
150 | enable_mysql="$enableval" |
---|
151 | ;; |
---|
152 | no) |
---|
153 | enable_mysql="no" |
---|
154 | ;; |
---|
155 | *) |
---|
156 | AC_MSG_ERROR([invalid value '$enableval' for --enable-mysql]) |
---|
157 | ;; |
---|
158 | esac], |
---|
159 | [AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],[enable_mysql=yes],[enable_mysql=no])] |
---|
160 | ) |
---|
161 | |
---|
162 | AC_LANG_POP(C) |
---|
163 | |
---|
164 | if test "$enable_dl" = "yes" && ( test "$enable_odbc" = "yes" || test "$enable_odbc" = "unix"); then |
---|
165 | AC_MSG_CHECKING([checking name of ODBC library]) |
---|
166 | case $build in |
---|
167 | *-cygwin* | *-mingw32*) |
---|
168 | case "$CC" in |
---|
169 | *cl* ) |
---|
170 | odbclibname="odbc32.dll" |
---|
171 | ;; |
---|
172 | *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows? |
---|
173 | if test "$enable_odbc" = "yes"; then |
---|
174 | odbclibname="libiodbc.dll" |
---|
175 | else |
---|
176 | odbclibname="libodbc.dll" |
---|
177 | fi |
---|
178 | ;; |
---|
179 | esac |
---|
180 | ;; |
---|
181 | *-mingw64*) |
---|
182 | case "$CC" in |
---|
183 | *cl* ) |
---|
184 | odbclibname="odbc64.dll" |
---|
185 | ;; |
---|
186 | *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows? |
---|
187 | if test "$enable_odbc" = "yes"; then |
---|
188 | odbclibname="libiodbc.dll" |
---|
189 | else |
---|
190 | odbclibname="libodbc.dll" |
---|
191 | fi |
---|
192 | ;; |
---|
193 | esac |
---|
194 | ;; |
---|
195 | *-darwin*) |
---|
196 | if test "$enable_odbc" = "yes"; then |
---|
197 | odbclibname="libiodbc.dylib" |
---|
198 | else |
---|
199 | odbclibname="libodbc.dylib" |
---|
200 | fi |
---|
201 | ;; |
---|
202 | *) |
---|
203 | if test "$enable_odbc" = "yes"; then |
---|
204 | odbclibname="libiodbc.so" |
---|
205 | else |
---|
206 | odbclibname="libodbc.so" |
---|
207 | fi |
---|
208 | ;; |
---|
209 | esac |
---|
210 | |
---|
211 | AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$odbclibname"], ["Set to the name of the ODBC dynamic library"]) |
---|
212 | AC_MSG_RESULT([$odbclibname]) |
---|
213 | fi |
---|
214 | |
---|
215 | if test "$enable_dl" = "yes" && test "$enable_mysql" = "yes" ; then |
---|
216 | AC_MSG_CHECKING([checking name of MySQL library]) |
---|
217 | case $build in |
---|
218 | *-cygwin* | *-mingw*) |
---|
219 | case "$CC" in |
---|
220 | *cl* ) |
---|
221 | mysqllibname="libmysql.dll" |
---|
222 | ;; |
---|
223 | *) #FIXME: what is the correct library name for using MySQL with gnu compiler under Windows? |
---|
224 | mysqllibname="libmysqlclient.dll" |
---|
225 | CFLAGS="-I/usr/include/mysql $CFLAGS" |
---|
226 | ;; |
---|
227 | esac |
---|
228 | ;; |
---|
229 | *-darwin*) |
---|
230 | mysqllibname="libmysqlclient.dylib" |
---|
231 | CFLAGS="-I/usr/include/mysql $CFLAGS" |
---|
232 | ;; |
---|
233 | *) |
---|
234 | mysqllibname="libmysqlclient.so" |
---|
235 | CFLAGS="-I/usr/include/mysql $CFLAGS" |
---|
236 | ;; |
---|
237 | esac |
---|
238 | |
---|
239 | AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$mysqllibname"], ["Set to the name of the MySQL dynamic library"]) |
---|
240 | AC_MSG_RESULT([$mysqllibname]) |
---|
241 | fi |
---|
242 | |
---|
243 | GLPKDIR=glpk |
---|
244 | AC_SUBST(GLPKDIR) |
---|
245 | |
---|
246 | AC_CONFIG_FILES([Makefile coinglpk.pc coinglpk-uninstalled.pc]) |
---|
247 | AC_CONFIG_HEADER([config_glpk.h]) |
---|
248 | |
---|
249 | AC_SUBST(GLPK_PCLIBS) |
---|
250 | |
---|
251 | AC_COIN_FINALIZE |
---|