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

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

move more initialization

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