source: ThirdParty/Glpk/stable/1.6/configure.ac @ 1462

Last change on this file since 1462 was 1462, checked in by stefan, 11 years ago

synchronize with trunk rev 1458: use glpk 4.41

  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1# Copyright (C) 2007-2009 Stefan Vigerske and others.
2# All Rights Reserved.
3# This file is distributed under the Common Public License.
4
5## $Id: configure.ac 1462 2010-01-01 18:30:21Z stefan $
6
7#############################################################################
8#                       Names and other basic things                        #
9#############################################################################
10
11AC_PREREQ(2.59)
12
13AC_INIT([ThirdPartyGlpk],[1.6stable],[http://projects.coin-or.org/BuildTools/newticket])
14
15AC_COPYRIGHT([
16Copyright 2007-2009 Stefan Vigerske and others.
17All Rights Reserved.
18This file is part of the open source package Coin which is distributed
19under the Common Public License.])
20
21# List one file in the package so that the configure script can test
22# whether the package is actually there
23AC_CONFIG_SRCDIR(Makefile.am)
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.
29AC_PREFIX_DEFAULT([`pwd`])
30
31AC_COIN_PROJECTDIR_INIT
32
33#############################################################################
34#                         Standard build tool stuff                         #
35#############################################################################
36
37# Get the system type
38AC_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
42coin_skip_warn_cflags=yes
43
44# Check if user wants to produce debugging code
45AC_COIN_DEBUG_COMPILE(Glpk)
46
47# Get the name of the C compiler
48AC_COIN_PROG_CC
49
50# Initialize automake
51AC_COIN_INIT_AUTO_TOOLS
52
53###########################################################################
54#                            COIN_HAS_GLPK                                #
55###########################################################################
56
57# This macro checks for a library containing the GLPK library.  It
58# checks if the user has provided an argument for the GLPK library,
59# and if not, it checks whether the GLPK ThirdParty/GLPK directory has
60# been configured.  It adds to ADDLIBS any flags required to link with
61# an externally provided GLPK.  It defines the makefile conditional
62# and preprocessor macro COIN_HAS_GLPK, if GLPK is available, and it
63# defines the makefile conditional COIN_BUILD_GLPK, if GLPK is
64# compiled within COIN.
65
66## Check if GLPK is already provided by user
67AC_COIN_HAS_GLPK(Glpk)
68
69rm -f $MAKEOKFILE
70if test x"$use_thirdpartyglpk" = xbuild ; then
71  touch $MAKEOKFILE
72  AC_MSG_CHECKING([GLPK version])
73  majorver=`awk '/define GLP_MAJOR_VERSION/ {print $3}' ${GLPKINCDIR}/glpk.h`
74  minorver=`awk '/define GLP_MINOR_VERSION/ {print $3}' ${GLPKINCDIR}/glpk.h`
75  AC_MSG_RESULT([${majorver}.${minorver}])
76  if test x$majorver != x4 || test x$minorver != x41 ; then
77    AC_MSG_ERROR(["Incorrect GLPK version. This build system is made for GLPK 4.41. Please update by rerunning get.GLPK"])
78  fi
79else
80  if test x$coin_has_glpk = xtrue ; then
81    AC_MSG_NOTICE([The Glpk sources don't need to be compiled])
82  else
83    AC_MSG_WARN([Glpk source is available but will not be built. No valid external library is detected. Are you sure this is what you want?])
84  fi
85  MAKEOKFILE=
86fi
87AC_SUBST(MAKEOKFILE)
88
89###########################################################################
90#                 GNU packages and C functions                            #
91###########################################################################
92
93ADDLIBS=
94
95AC_LANG_PUSH(C)
96
97AC_COIN_CHECK_GNU_ZLIB
98if test $coin_has_zlib = "yes"; then
99  AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if GNU zlib is available])
100fi
101
102if test $coin_enable_gnu = yes; then
103  coin_has_gmp=no
104  AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])])
105  if test $coin_has_gmp = yes; then
106    AC_DEFINE([HAVE_GMP],[1],[Define to 1 if GMP is available])
107    ADDLIBS="-lgmp $ADDLIBS"
108  fi
109fi
110
111AC_CHECK_FUNC([vsnprintf])
112
113AC_LANG_POP(C)
114
115###########################################################################
116#                     Database connectivity                               #
117###########################################################################
118
119#whether we have any means to load shared libraries
120enable_dl=no
121
122AC_LANG_PUSH(C)
123
124AC_COIN_CHECK_HEADER([dlfcn.h],[enable_dl=yes])
125if test "$enable_dl" = "yes"; then
126  #if dlfcn.h is there, check also if libdl is there; if so, set corresponding define for GLPK
127  AC_CHECK_LIB(dl,[dlopen],[AC_DEFINE([HAVE_DLFCN],[1],[Define to 1 if dlfcn support is available])],[enable_dl=no])
128  if test $enable_dl = yes; then
129    ADDLIBS="-ldl $ADDLIBS"
130  fi
131fi
132
133if test "$enable_dl" = "no"; then
134AC_COIN_CHECK_HEADER([ltdl.h],[enable_dl=yes])
135  if test "$enable_dl" = "yes"; then
136    #if ltdl.h is there, check also if libltdl is there; if so, set corresponding define for GLPK
137    AC_CHECK_LIB(ldtl,[lt_dlopen],[AC_DEFINE([HAVE_LTDL],[1],[Define to 1 if ltdl support is available])],[enable_dl=no])
138    if test $enable_dl = yes; then
139      ADDLIBS="-lltdl $ADDLIBS"
140    fi
141  fi
142fi
143
144if test "$enable_dl" = "no"; then
145  AC_COIN_CHECK_HEADER([windows.h],[enable_dl=yes])
146  if test "$enable_dl" = "yes"; then
147    AC_DEFINE([__WOE__],[1],[Define to 1 if windows dll support is available])
148  fi
149fi
150
151AC_ARG_ENABLE(odbc,
152        AC_HELP_STRING([--enable-odbc],[enable MathProg ODBC support [[default=auto]]]),
153        [case $enableval in
154           yes | unix)
155       AC_COIN_CHECK_HEADER([sql.h],,[AC_MSG_ERROR(["need sql.h to enable ODBC support"])])
156       enable_odbc="$enableval"
157     ;;
158     no)
159       enable_odbc="no"
160     ;;
161           *)
162             AC_MSG_ERROR([invalid value '$enableval' for --enable-odbc])
163           ;;
164   esac],
165        [AC_COIN_CHECK_HEADER([sql.h],[enable_odbc=yes],[enable_odbc=no])]
166)
167
168AC_ARG_ENABLE(mysql,
169        AC_HELP_STRING([--enable-mysql],[enable MathProg MySQL support [[default=auto]]]),
170        [case $enableval in
171           yes)
172       AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],,[AC_MSG_ERROR(["need mysql.h to enable MySQL support"])])
173       enable_mysql="$enableval"
174     ;;
175     no)
176       enable_mysql="no"
177     ;;
178           *)
179             AC_MSG_ERROR([invalid value '$enableval' for --enable-mysql])
180           ;;
181   esac],
182        [AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],[enable_mysql=yes],[enable_mysql=no])]
183)
184
185AC_LANG_POP(C)
186       
187if test "$enable_dl" = "yes" && ( test "$enable_odbc" = "yes" || test "$enable_odbc" = "unix"); then
188  AC_MSG_CHECKING([checking name of ODBC library])
189  case $build in
190    *-cygwin* |  *-mingw32*)
191       case "$CC" in
192         *cl* )
193            odbclibname="odbc32.dll"
194         ;;
195         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
196            if test "$enable_odbc" = "yes"; then
197              odbclibname="libiodbc.dll"
198            else
199              odbclibname="libodbc.dll"
200            fi
201         ;;
202       esac
203    ;;
204    *-mingw64*)
205       case "$CC" in
206         *cl* )
207            odbclibname="odbc64.dll"
208         ;;
209         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
210            if test "$enable_odbc" = "yes"; then
211              odbclibname="libiodbc.dll"
212            else
213              odbclibname="libodbc.dll"
214            fi
215         ;;
216       esac
217    ;;
218    *-darwin*)
219       if test "$enable_odbc" = "yes"; then
220          odbclibname="libiodbc.dylib"
221       else
222          odbclibname="libodbc.dylib"
223       fi
224    ;;
225    *)
226       if test "$enable_odbc" = "yes"; then
227          odbclibname="libiodbc.so"
228       else
229          odbclibname="libodbc.so"
230       fi
231    ;;
232  esac
233
234  AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$odbclibname"], ["Set to the name of the ODBC dynamic library"])
235  AC_MSG_RESULT([$odbclibname])
236fi
237
238if test "$enable_dl" = "yes" && test "$enable_mysql" = "yes" ; then
239  AC_MSG_CHECKING([checking name of MySQL library])
240  case $build in
241    *-cygwin* |  *-mingw*)
242       case "$CC" in
243         *cl* )
244            mysqllibname="libmysql.dll"
245         ;;
246         *) #FIXME: what is the correct library name for using MySQL with gnu compiler under Windows?
247            mysqllibname="libmysqlclient.dll"
248            CFLAGS="-I/usr/include/mysql $CFLAGS"
249         ;;
250       esac
251    ;;
252    *-darwin*)
253       mysqllibname="libmysqlclient.dylib"
254       CFLAGS="-I/usr/include/mysql $CFLAGS"
255    ;;
256    *)
257       mysqllibname="libmysqlclient.so"
258       CFLAGS="-I/usr/include/mysql $CFLAGS"
259    ;;
260  esac
261
262  AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$mysqllibname"], ["Set to the name of the MySQL dynamic library"])
263  AC_MSG_RESULT([$mysqllibname])
264fi
265
266GLPKDIR=glpk
267AC_SUBST(GLPKDIR)
268
269AC_CONFIG_FILES([Makefile glpk_addlibs.txt])
270AC_CONFIG_HEADER([config_glpk.h])
271
272AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.