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

Last change on this file since 3246 was 3246, checked in by stefan, 6 years ago

reorganize initialization macros

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