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

Last change on this file since 3675 was 3675, checked in by stefan, 4 years ago

adjust to buildtools changes and rerun autotools

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