source: ThirdParty/Glpk/branches/autotools-update/configure.ac @ 3239

Last change on this file since 3239 was 3239, checked in by stefan, 6 years ago

add glpk dependencies to libcoinglpk

  • 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 3239 2014-06-28 22:14:26Z 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 ThirdParty/Glpk 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_INITIALIZE(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
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
49AC_PROG_CC
50
51# Check if pkg-config is available (to setup addlibs file)
52#AC_COIN_HAS_PKGCONFIG
53
54# Initialize automake
55#AC_COIN_INIT_AUTO_TOOLS
56AM_INIT_AUTOMAKE
57AM_MAINTAINER_MODE
58
59AC_PROG_LIBTOOL
60
61###########################################################################
62#                            check GLPK version                           #
63###########################################################################
64
65AC_MSG_CHECKING([GLPK version])
66glpkmajorver=`awk '/define GLP_MAJOR_VERSION/ {print $3}' $srcdir/glpk/src/glpk.h`
67glpkminorver=`awk '/define GLP_MINOR_VERSION/ {print $3}' $srcdir/glpk/src/glpk.h`
68AC_MSG_RESULT([${glpkmajorver}.${glpkminorver}])
69if test x$glpkmajorver != x4 || test x$glpkminorver != x48 ; then
70  AC_MSG_ERROR(["Incorrect GLPK version. This build system is made for GLPK 4.48. Please update by rerunning get.GLPK"])
71fi
72AC_SUBST(glpkmajorver)
73AC_SUBST(glpkminorver)
74
75###########################################################################
76#                 Other packages and C functions                          #
77###########################################################################
78
79AC_LANG_PUSH(C)
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
86AC_CHECK_FUNC([vsnprintf])
87
88AC_LANG_POP(C)
89
90#AC_COIN_CHECK_LIBM(Glpk)
91
92###########################################################################
93#                     Database connectivity                               #
94###########################################################################
95
96#whether we have any means to load shared libraries
97enable_dl=no
98
99AC_LANG_PUSH(C)
100
101AC_CHECK_HEADER([dlfcn.h],[enable_dl=yes])
102if test "$enable_dl" = "yes"; then
103  #if dlfcn.h is there, check also if libdl is there; if so, set corresponding define for GLPK
104  AC_CHECK_LIB(dl,[dlopen],[AC_DEFINE([HAVE_DLFCN],[1],[Define to 1 if dlfcn support is available])],[enable_dl=no])
105  if test $enable_dl = yes; then
106    GLPK_LIBS="-ldl $GLPK_LIBS"
107    GLPK_PCLIBS="-ldl $GLPK_PCLIBS"
108  fi
109fi
110
111if test "$enable_dl" = "no"; then
112  AC_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      GLPK_LIBS="-lltdl $GLPK_LIBS"
118      GLPK_PCLIBS="-lltdl $GLPK_PCLIBS"
119    fi
120  fi
121fi
122
123if test "$enable_dl" = "no"; then
124  AC_CHECK_HEADER([windows.h],[enable_dl=yes])
125  if test "$enable_dl" = "yes"; then
126    AC_DEFINE([__WOE__],[1],[Define to 1 if windows dll support is available])
127  fi
128fi
129
130AC_ARG_ENABLE(odbc,
131  AC_HELP_STRING([--enable-odbc],[enable MathProg ODBC support [[default=auto]]]),
132  [case $enableval in
133     yes | unix)
134       AC_CHECK_HEADER([sql.h],,[AC_MSG_ERROR(["need sql.h to enable ODBC support"])])
135       enable_odbc="$enableval"
136     ;;
137     no)
138       enable_odbc="no"
139     ;;
140     *)
141       AC_MSG_ERROR([invalid value '$enableval' for --enable-odbc])
142     ;;
143   esac],
144  [AC_CHECK_HEADER([sql.h],[enable_odbc=yes],[enable_odbc=no])]
145)
146
147AC_ARG_ENABLE(mysql,
148  AC_HELP_STRING([--enable-mysql],[enable MathProg MySQL support [[default=auto]]]),
149  [case $enableval in
150     yes)
151       AC_CHECK_HEADER([mysql.h mysql/mysql.h],,[AC_MSG_ERROR(["need mysql.h to enable MySQL support"])])
152       enable_mysql="$enableval"
153     ;;
154     no)
155       enable_mysql="no"
156     ;;
157     *)
158       AC_MSG_ERROR([invalid value '$enableval' for --enable-mysql])
159     ;;
160   esac],
161  [AC_CHECK_HEADER([mysql.h mysql/mysql.h],[enable_mysql=yes],[enable_mysql=no])]
162)
163
164AC_LANG_POP(C)
165
166if test "$enable_dl" = "yes" && ( test "$enable_odbc" = "yes" || test "$enable_odbc" = "unix"); then
167  AC_MSG_CHECKING([checking name of ODBC library])
168  case $build in
169    *-cygwin* |  *-mingw32*)
170       case "$CC" in
171         *cl* )
172            odbclibname="odbc32.dll"
173         ;;
174         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
175            if test "$enable_odbc" = "yes"; then
176              odbclibname="libiodbc.dll"
177            else
178              odbclibname="libodbc.dll"
179            fi
180         ;;
181       esac
182    ;;
183    *-mingw64*)
184       case "$CC" in
185         *cl* )
186            odbclibname="odbc64.dll"
187         ;;
188         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
189            if test "$enable_odbc" = "yes"; then
190              odbclibname="libiodbc.dll"
191            else
192              odbclibname="libodbc.dll"
193            fi
194         ;;
195       esac
196    ;;
197    *-darwin*)
198       if test "$enable_odbc" = "yes"; then
199          odbclibname="libiodbc.dylib"
200       else
201          odbclibname="libodbc.dylib"
202       fi
203    ;;
204    *)
205       if test "$enable_odbc" = "yes"; then
206          odbclibname="libiodbc.so"
207       else
208          odbclibname="libodbc.so"
209       fi
210    ;;
211  esac
212
213  AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$odbclibname"], ["Set to the name of the ODBC dynamic library"])
214  AC_MSG_RESULT([$odbclibname])
215fi
216
217if test "$enable_dl" = "yes" && test "$enable_mysql" = "yes" ; then
218  AC_MSG_CHECKING([checking name of MySQL library])
219  case $build in
220    *-cygwin* |  *-mingw*)
221       case "$CC" in
222         *cl* )
223            mysqllibname="libmysql.dll"
224         ;;
225         *) #FIXME: what is the correct library name for using MySQL with gnu compiler under Windows?
226            mysqllibname="libmysqlclient.dll"
227            CFLAGS="-I/usr/include/mysql $CFLAGS"
228         ;;
229       esac
230    ;;
231    *-darwin*)
232       mysqllibname="libmysqlclient.dylib"
233       CFLAGS="-I/usr/include/mysql $CFLAGS"
234    ;;
235    *)
236       mysqllibname="libmysqlclient.so"
237       CFLAGS="-I/usr/include/mysql $CFLAGS"
238    ;;
239  esac
240
241  AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$mysqllibname"], ["Set to the name of the MySQL dynamic library"])
242  AC_MSG_RESULT([$mysqllibname])
243fi
244
245GLPKDIR=glpk
246AC_SUBST(GLPKDIR)
247
248AC_CONFIG_FILES([Makefile coinglpk.pc])
249AC_CONFIG_HEADER([config_glpk.h])
250
251AC_SUBST(GLPK_PCLIBS)
252
253AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.