source: ThirdParty/Glpk/stable/1.9/configure.ac

Last change on this file was 3342, checked in by stefan, 5 years ago

restoring BuildTools/ThirdParty/Glpk?/stable/1.9

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