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

Last change on this file since 3252 was 3252, checked in by stefan, 5 years ago

reenable check for gmp

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