source: ThirdParty/Glpk/branches/BSPsplit/configure.ac @ 1446

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

stop using COIN_HAS_PROJECT; some cleanup; use MODULE_BLAS in Mumps

  • Property svn:keywords set to Author Date Id Revision
File size: 7.7 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 1446 2009-11-22 18:47:29Z stefan $
6
7#############################################################################
8#                       Names and other basic things                        #
9#############################################################################
10
11AC_PREREQ(2.59)
12
13AC_INIT([ThirdPartyGlpk],[0.0],[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(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.
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#                            check GLPK version                           #
55###########################################################################
56
57AC_MSG_CHECKING([GLPK version])
58glpkmajorver=`awk '/define GLP_MAJOR_VERSION/ {print $3}' $srcdir/glpk/include/glpk.h`
59glpkminorver=`awk '/define GLP_MINOR_VERSION/ {print $3}' $srcdir/glpk/include/glpk.h`
60AC_MSG_RESULT([${glpkmajorver}.${glpkminorver}])
61if test x$glpkmajorver != x4 || test x$glpkminorver != x39 ; then
62  AC_MSG_ERROR(["Incorrect GLPK version. This build system is made for GLPK 4.39. Please update by rerunning get.GLPK"])
63fi
64AC_SUBST(glpkmajorver)
65AC_SUBST(glpkminorver)
66
67###########################################################################
68#                 GNU packages and C functions                            #
69###########################################################################
70
71ADDLIBS=
72
73AC_LANG_PUSH(C)
74
75AC_COIN_CHECK_GNU_ZLIB
76if test $coin_has_zlib = "yes"; then
77  AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if GNU zlib is available])
78fi
79
80if test $coin_enable_gnu = yes; then
81  coin_has_gmp=no
82  AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])])
83  if test $coin_has_gmp = yes; then
84    AC_DEFINE([HAVE_GMP],[1],[Define to 1 if GMP is available])
85    ADDLIBS="-lgmp $ADDLIBS"
86  fi
87fi
88
89AC_CHECK_FUNC([vsnprintf])
90
91AC_LANG_POP(C)
92
93###########################################################################
94#                     Database connectivity                               #
95###########################################################################
96
97#whether we have any means to load shared libraries
98enable_dl=no
99
100AC_LANG_PUSH(C)
101
102AC_COIN_CHECK_HEADER([dlfcn.h],[enable_dl=yes])
103if test "$enable_dl" = "yes"; then
104  #if dlfcn.h is there, check also if libdl is there; if so, set corresponding define for GLPK
105  AC_CHECK_LIB(dl,[dlopen],[AC_DEFINE([HAVE_DLFCN],[1],[Define to 1 if dlfcn support is available])],[enable_dl=no])
106  if test $enable_dl = yes; then
107    ADDLIBS="-ldl $ADDLIBS"
108  fi
109fi
110
111if test "$enable_dl" = "no"; then
112  AC_COIN_CHECK_HEADER([ltdl.h],[enable_dl=yes])
113  if test "$enable_dl" = "yes"; then
114    #if ltdl.h is there, check also if libltdl is there; if so, set corresponding define for GLPK
115    AC_CHECK_LIB(ldtl,[lt_dlopen],[AC_DEFINE([HAVE_LTDL],[1],[Define to 1 if ltdl support is available])],[enable_dl=no])
116    if test $enable_dl = yes; then
117      ADDLIBS="-lltdl $ADDLIBS"
118    fi
119  fi
120fi
121
122if test "$enable_dl" = "no"; then
123  AC_COIN_CHECK_HEADER([windows.h],[enable_dl=yes])
124  if test "$enable_dl" = "yes"; then
125    AC_DEFINE([__WOE__],[1],[Define to 1 if windows dll support is available])
126  fi
127fi
128
129AC_ARG_ENABLE(odbc,
130  AC_HELP_STRING([--enable-odbc],[enable MathProg ODBC support [[default=auto]]]),
131  [case $enableval in
132     yes | unix)
133       AC_COIN_CHECK_HEADER([sql.h],,[AC_MSG_ERROR(["need sql.h to enable ODBC support"])])
134       enable_odbc="$enableval"
135     ;;
136     no)
137       enable_odbc="no"
138     ;;
139     *)
140       AC_MSG_ERROR([invalid value '$enableval' for --enable-odbc])
141     ;;
142   esac],
143  [AC_COIN_CHECK_HEADER([sql.h],[enable_odbc=yes],[enable_odbc=no])]
144)
145
146AC_ARG_ENABLE(mysql,
147  AC_HELP_STRING([--enable-mysql],[enable MathProg MySQL support [[default=auto]]]),
148  [case $enableval in
149     yes)
150       AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],,[AC_MSG_ERROR(["need mysql.h to enable MySQL support"])])
151       enable_mysql="$enableval"
152     ;;
153     no)
154       enable_mysql="no"
155     ;;
156     *)
157       AC_MSG_ERROR([invalid value '$enableval' for --enable-mysql])
158     ;;
159   esac],
160  [AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],[enable_mysql=yes],[enable_mysql=no])]
161)
162
163AC_LANG_POP(C)
164
165if test "$enable_dl" = "yes" && ( test "$enable_odbc" = "yes" || test "$enable_odbc" = "unix"); then
166  AC_MSG_CHECKING([checking name of ODBC library])
167  case $build in
168    *-cygwin* |  *-mingw32*)
169       case "$CC" in
170         *cl* )
171            odbclibname="odbc32.dll"
172         ;;
173         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
174            if test "$enable_odbc" = "yes"; then
175              odbclibname="libiodbc.dll"
176            else
177              odbclibname="libodbc.dll"
178            fi
179         ;;
180       esac
181    ;;
182    *-mingw64*)
183       case "$CC" in
184         *cl* )
185            odbclibname="odbc64.dll"
186         ;;
187         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
188            if test "$enable_odbc" = "yes"; then
189              odbclibname="libiodbc.dll"
190            else
191              odbclibname="libodbc.dll"
192            fi
193         ;;
194       esac
195    ;;
196    *-darwin*)
197       if test "$enable_odbc" = "yes"; then
198          odbclibname="libiodbc.dylib"
199       else
200          odbclibname="libodbc.dylib"
201       fi
202    ;;
203    *)
204       if test "$enable_odbc" = "yes"; then
205          odbclibname="libiodbc.so"
206       else
207          odbclibname="libodbc.so"
208       fi
209    ;;
210  esac
211
212  AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$odbclibname"], ["Set to the name of the ODBC dynamic library"])
213  AC_MSG_RESULT([$odbclibname])
214fi
215
216if test "$enable_dl" = "yes" && test "$enable_mysql" = "yes" ; then
217  AC_MSG_CHECKING([checking name of MySQL library])
218  case $build in
219    *-cygwin* |  *-mingw*)
220       case "$CC" in
221         *cl* )
222            mysqllibname="libmysql.dll"
223         ;;
224         *) #FIXME: what is the correct library name for using MySQL with gnu compiler under Windows?
225            mysqllibname="libmysqlclient.dll"
226            CFLAGS="-I/usr/include/mysql $CFLAGS"
227         ;;
228       esac
229    ;;
230    *-darwin*)
231       mysqllibname="libmysqlclient.dylib"
232       CFLAGS="-I/usr/include/mysql $CFLAGS"
233    ;;
234    *)
235       mysqllibname="libmysqlclient.so"
236       CFLAGS="-I/usr/include/mysql $CFLAGS"
237    ;;
238  esac
239
240  AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$mysqllibname"], ["Set to the name of the MySQL dynamic library"])
241  AC_MSG_RESULT([$mysqllibname])
242fi
243
244GLPKDIR=glpk
245AC_SUBST(GLPKDIR)
246
247AC_CONFIG_FILES([Makefile glpk_addlibs.txt glpk.pc glpk-uninstalled.pc])
248AC_CONFIG_HEADER([config_glpk.h])
249
250AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.