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

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

copy over pkg-config setup and making thirdparty projects installable projects from split branch

  • Property svn:keywords set to Author Date Id Revision
File size: 7.8 KB
Line 
1# Copyright (C) 2007-2010 Stefan Vigerske and others.
2# All Rights Reserved.
3# This file is distributed under the Common Public License.
4
5## $Id: configure.ac 1548 2010-05-08 13:54:35Z 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-2010 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# 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 != x43 ; then
65  AC_MSG_ERROR(["Incorrect GLPK version. This build system is made for GLPK 4.43. Please update by rerunning get.GLPK"])
66fi
67AC_SUBST(glpkmajorver)
68AC_SUBST(glpkminorver)
69
70###########################################################################
71#                 GNU packages and C functions                            #
72###########################################################################
73
74ADDLIBS=
75
76AC_LANG_PUSH(C)
77
78AC_COIN_CHECK_GNU_ZLIB
79if test $coin_has_zlib = "yes"; then
80  AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if GNU zlib is available])
81fi
82
83if test $coin_enable_gnu = yes; then
84  coin_has_gmp=no
85  AC_COIN_CHECK_HEADER([gmp.h],[AC_CHECK_LIB([gmp],[__gmpz_init],[coin_has_gmp=yes])])
86  if test $coin_has_gmp = yes; then
87    AC_DEFINE([HAVE_GMP],[1],[Define to 1 if GMP is available])
88    ADDLIBS="-lgmp $ADDLIBS"
89  fi
90fi
91
92AC_CHECK_FUNC([vsnprintf])
93
94AC_LANG_POP(C)
95
96###########################################################################
97#                     Database connectivity                               #
98###########################################################################
99
100#whether we have any means to load shared libraries
101enable_dl=no
102
103AC_LANG_PUSH(C)
104
105AC_COIN_CHECK_HEADER([dlfcn.h],[enable_dl=yes])
106if test "$enable_dl" = "yes"; then
107  #if dlfcn.h is there, check also if libdl is there; if so, set corresponding define for GLPK
108  AC_CHECK_LIB(dl,[dlopen],[AC_DEFINE([HAVE_DLFCN],[1],[Define to 1 if dlfcn support is available])],[enable_dl=no])
109  if test $enable_dl = yes; then
110    ADDLIBS="-ldl $ADDLIBS"
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      ADDLIBS="-lltdl $ADDLIBS"
121    fi
122  fi
123fi
124
125if test "$enable_dl" = "no"; then
126  AC_COIN_CHECK_HEADER([windows.h],[enable_dl=yes])
127  if test "$enable_dl" = "yes"; then
128    AC_DEFINE([__WOE__],[1],[Define to 1 if windows dll support is available])
129  fi
130fi
131
132AC_ARG_ENABLE(odbc,
133  AC_HELP_STRING([--enable-odbc],[enable MathProg ODBC support [[default=auto]]]),
134  [case $enableval in
135     yes | unix)
136       AC_COIN_CHECK_HEADER([sql.h],,[AC_MSG_ERROR(["need sql.h to enable ODBC support"])])
137       enable_odbc="$enableval"
138     ;;
139     no)
140       enable_odbc="no"
141     ;;
142     *)
143       AC_MSG_ERROR([invalid value '$enableval' for --enable-odbc])
144     ;;
145   esac],
146  [AC_COIN_CHECK_HEADER([sql.h],[enable_odbc=yes],[enable_odbc=no])]
147)
148
149AC_ARG_ENABLE(mysql,
150  AC_HELP_STRING([--enable-mysql],[enable MathProg MySQL support [[default=auto]]]),
151  [case $enableval in
152     yes)
153       AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],,[AC_MSG_ERROR(["need mysql.h to enable MySQL support"])])
154       enable_mysql="$enableval"
155     ;;
156     no)
157       enable_mysql="no"
158     ;;
159     *)
160       AC_MSG_ERROR([invalid value '$enableval' for --enable-mysql])
161     ;;
162   esac],
163  [AC_COIN_CHECK_HEADER([mysql.h mysql/mysql.h],[enable_mysql=yes],[enable_mysql=no])]
164)
165
166AC_LANG_POP(C)
167
168if test "$enable_dl" = "yes" && ( test "$enable_odbc" = "yes" || test "$enable_odbc" = "unix"); then
169  AC_MSG_CHECKING([checking name of ODBC library])
170  case $build in
171    *-cygwin* |  *-mingw32*)
172       case "$CC" in
173         *cl* )
174            odbclibname="odbc32.dll"
175         ;;
176         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
177            if test "$enable_odbc" = "yes"; then
178              odbclibname="libiodbc.dll"
179            else
180              odbclibname="libodbc.dll"
181            fi
182         ;;
183       esac
184    ;;
185    *-mingw64*)
186       case "$CC" in
187         *cl* )
188            odbclibname="odbc64.dll"
189         ;;
190         *) #FIXME: what are the correct library names for using ODBC with gnu compiler under Windows?
191            if test "$enable_odbc" = "yes"; then
192              odbclibname="libiodbc.dll"
193            else
194              odbclibname="libodbc.dll"
195            fi
196         ;;
197       esac
198    ;;
199    *-darwin*)
200       if test "$enable_odbc" = "yes"; then
201          odbclibname="libiodbc.dylib"
202       else
203          odbclibname="libodbc.dylib"
204       fi
205    ;;
206    *)
207       if test "$enable_odbc" = "yes"; then
208          odbclibname="libiodbc.so"
209       else
210          odbclibname="libodbc.so"
211       fi
212    ;;
213  esac
214
215  AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$odbclibname"], ["Set to the name of the ODBC dynamic library"])
216  AC_MSG_RESULT([$odbclibname])
217fi
218
219if test "$enable_dl" = "yes" && test "$enable_mysql" = "yes" ; then
220  AC_MSG_CHECKING([checking name of MySQL library])
221  case $build in
222    *-cygwin* |  *-mingw*)
223       case "$CC" in
224         *cl* )
225            mysqllibname="libmysql.dll"
226         ;;
227         *) #FIXME: what is the correct library name for using MySQL with gnu compiler under Windows?
228            mysqllibname="libmysqlclient.dll"
229            CFLAGS="-I/usr/include/mysql $CFLAGS"
230         ;;
231       esac
232    ;;
233    *-darwin*)
234       mysqllibname="libmysqlclient.dylib"
235       CFLAGS="-I/usr/include/mysql $CFLAGS"
236    ;;
237    *)
238       mysqllibname="libmysqlclient.so"
239       CFLAGS="-I/usr/include/mysql $CFLAGS"
240    ;;
241  esac
242
243  AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$mysqllibname"], ["Set to the name of the MySQL dynamic library"])
244  AC_MSG_RESULT([$mysqllibname])
245fi
246
247GLPKDIR=glpk
248AC_SUBST(GLPKDIR)
249
250AC_CONFIG_FILES([Makefile coinglpk.pc coinglpk-uninstalled.pc])
251AC_CONFIG_HEADER([config_glpk.h])
252
253AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.