source: ThirdParty/Glpk/trunk/configure.ac @ 2373

Last change on this file since 2373 was 2029, checked in by stefan, 9 years ago

restoring BuildTools/ThirdParty/Glpk?/trunk

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