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
RevLine 
[1548]1# Copyright (C) 2007-2010 Stefan Vigerske and others.
[430]2# All Rights Reserved.
[1983]3# This file is distributed under the Eclipse Public License.
[430]4
[941]5## $Id: configure.ac 3675 2016-09-07 15:27:44Z stefan $
[430]6
7#############################################################################
8#                       Names and other basic things                        #
9#############################################################################
10
[2652]11AC_INIT([ThirdPartyGlpk],[trunk],[http://projects.coin-or.org/BuildTools/newticket])
[430]12
13AC_COPYRIGHT([
[1548]14Copyright 2007-2010 Stefan Vigerske and others.
[430]15All Rights Reserved.
[3193]16This file is part of the open source package ThirdParty/Glpk which is distributed
[1983]17under the Eclipse Public License.])
[430]18
19# List one file in the package so that the configure script can test
20# whether the package is actually there
[2639]21AC_CONFIG_SRCDIR(glpk/src/glpk.h)
[430]22
[3250]23# Do some generic initialization work.
[3624]24AC_COIN_INITIALIZE(Glpk)
[430]25
26#############################################################################
27#                         Standard build tool stuff                         #
28#############################################################################
29
30# Get the name of the C compiler
[3675]31AC_COIN_PROG_CC
[430]32
[3675]33# Initialize libtool
34AC_COIN_PROG_LIBTOOL
35
[430]36###########################################################################
[1548]37#                            check GLPK version                           #
[430]38###########################################################################
39
[1548]40AC_MSG_CHECKING([GLPK version])
[2639]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`
[1548]43AC_MSG_RESULT([${glpkmajorver}.${glpkminorver}])
[2711]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"])
[1411]46fi
[1548]47AC_SUBST(glpkmajorver)
48AC_SUBST(glpkminorver)
[430]49
[1321]50###########################################################################
[2425]51#                 Other packages and C functions                          #
[1321]52###########################################################################
53
54AC_LANG_PUSH(C)
55
[3252]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
[1321]60
61AC_CHECK_FUNC([vsnprintf])
62
63AC_LANG_POP(C)
64
[3252]65#Does Glpk needs -lm? AC_COIN_CHECK_LIBM(Glpk)
[3056]66
[1321]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
[3193]76AC_CHECK_HEADER([dlfcn.h],[enable_dl=yes])
[1321]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
[1681]81    GLPK_LIBS="-ldl $GLPK_LIBS"
[1321]82  fi
83fi
84
85if test "$enable_dl" = "no"; then
[3193]86  AC_CHECK_HEADER([ltdl.h],[enable_dl=yes])
[1321]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
[1681]91      GLPK_LIBS="-lltdl $GLPK_LIBS"
[1321]92    fi
93  fi
94fi
95
96if test "$enable_dl" = "no"; then
[3193]97  AC_CHECK_HEADER([windows.h],[enable_dl=yes])
[1321]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,
[1548]104  AC_HELP_STRING([--enable-odbc],[enable MathProg ODBC support [[default=auto]]]),
105  [case $enableval in
106     yes | unix)
[3193]107       AC_CHECK_HEADER([sql.h],,[AC_MSG_ERROR(["need sql.h to enable ODBC support"])])
[1321]108       enable_odbc="$enableval"
109     ;;
110     no)
111       enable_odbc="no"
112     ;;
[1548]113     *)
114       AC_MSG_ERROR([invalid value '$enableval' for --enable-odbc])
115     ;;
[1321]116   esac],
[3193]117  [AC_CHECK_HEADER([sql.h],[enable_odbc=yes],[enable_odbc=no])]
[1321]118)
119
120AC_ARG_ENABLE(mysql,
[1548]121  AC_HELP_STRING([--enable-mysql],[enable MathProg MySQL support [[default=auto]]]),
122  [case $enableval in
123     yes)
[3193]124       AC_CHECK_HEADER([mysql.h mysql/mysql.h],,[AC_MSG_ERROR(["need mysql.h to enable MySQL support"])])
[1321]125       enable_mysql="$enableval"
126     ;;
127     no)
128       enable_mysql="no"
129     ;;
[1548]130     *)
131       AC_MSG_ERROR([invalid value '$enableval' for --enable-mysql])
132     ;;
[1321]133   esac],
[3193]134  [AC_CHECK_HEADER([mysql.h mysql/mysql.h],[enable_mysql=yes],[enable_mysql=no])]
[1321]135)
136
137AC_LANG_POP(C)
[1548]138
[1321]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
[430]218GLPKDIR=glpk
219AC_SUBST(GLPKDIR)
220
[3193]221AC_CONFIG_FILES([Makefile coinglpk.pc])
[1321]222AC_CONFIG_HEADER([config_glpk.h])
[430]223
[3250]224AC_SUBST(GLPK_LIBS)
[1681]225
[430]226AC_COIN_FINALIZE
Note: See TracBrowser for help on using the repository browser.