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

Last change on this file since 1396 was 1396, checked in by stefan, 12 years ago

add pkgconfig files

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