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

Last change on this file was 4056, checked in by lou, 4 months ago

Second try, rewriting glpk's configuration source files. Went with Stefan's
suggestion to stop trying to pass values and just add COIN macros to glpk's
configure.ac. More straightforward.

File size: 5.4 KB
Line 
1dnl Process this file with autoconf to produce a configure script
2
3AC_INIT([GLPK], [4.65], [bug-glpk@gnu.org])
4
5AC_CONFIG_SRCDIR([src/glpk.h])
6
7# Add standard COIN initialisation and build macros.
8
9AC_COIN_INITIALIZE(glpk)
10
11# Get the name of the C compiler and appropriate compiler options. If the
12# compile script is already in the cached name from ThirdParty/Glpk's
13# configure, strip it. COIN_PROG_CC will wrap it again. Quadrigraphs
14# because autoconf processing eats square brackets.
15
16if expr "$ac_cv_prog_CC" : '^.*/compile @<:@^ @:>@*$' >/dev/null 2>&1 ; then
17  ac_cv_prog_CC=`expr "$ac_cv_prog_CC" : '^.*/compile \(@<:@^ @:>@*\)$'`
18  CC=$ac_cv_prog_CC
19fi
20AC_COIN_PROG_CC
21
22# Set up libtool.
23
24AC_COIN_PROG_LIBTOOL
25
26# End of COIN macros.
27
28AC_CONFIG_HEADERS([config.h])
29
30AC_ARG_WITH(gmp,
31AC_HELP_STRING([--with-gmp],
32   [use GNU MP bignum library [[default=no]]]),
33   [case $withval in
34      yes | no) ;;
35      *) AC_MSG_ERROR([invalid value `$withval' for --with-gmp]);;
36      esac],
37   [with_gmp=no])
38
39AC_ARG_ENABLE(dl,
40AC_HELP_STRING([--enable-dl],
41   [enable shared library support [[default=no]]]),
42   [case $enableval in
43      yes | ltdl | dlfcn | no) ;;
44      *) AC_MSG_ERROR([invalid value `$enableval' for --enable-dl]);;
45      esac],
46   [enable_dl=no])
47
48AC_ARG_ENABLE(odbc,
49AC_HELP_STRING([--enable-odbc],
50   [enable MathProg ODBC support [[default=no]]]),
51   [case $enableval in
52      yes | unix | no) ;;
53      *) AC_MSG_ERROR([invalid value `$enableval' for --enable-odbc]);;
54      esac],
55   [enable_odbc=no])
56
57AC_ARG_ENABLE(mysql,
58AC_HELP_STRING([--enable-mysql],
59   [enable MathProg MySQL support [[default=no]]]),
60   [case $enableval in
61      yes | no) ;;
62      *) AC_MSG_ERROR([invalid value `$enableval' for --enable-mysql]);;
63      esac],
64   [enable_mysql=no])
65
66AC_ARG_ENABLE(reentrant,
67AC_HELP_STRING([--enable-reentrant],
68   [enable reentrancy support [[default=yes]]]),
69   [case $enableval in
70      yes | no) ;;
71      *) AC_MSG_ERROR(
72         [invalid value `$enableval' for --enable-reentrant]);;
73      esac],
74   [enable_reentrant=yes])
75
76dnl Check for math library
77AC_CHECK_LIB([m], [exp])
78
79dnl Check for <sys/time.h> header
80AC_CHECK_HEADER([sys/time.h],
81   AC_DEFINE([HAVE_SYS_TIME_H], [1], [N/A]))
82
83dnl Check for gettimeofday function
84AC_CHECK_FUNC([gettimeofday],
85   AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [N/A]))
86
87dnl Check for <gmp.h> header
88if test "$with_gmp" = "yes"; then
89   AC_CHECK_HEADER([gmp.h], [],
90      [AC_MSG_ERROR([gmp.h header not found])])
91fi
92
93AC_MSG_CHECKING([whether to use GNU MP bignum library])
94if test "$with_gmp" = "yes"; then
95   AC_MSG_RESULT([yes])
96   AC_DEFINE([HAVE_GMP], [1], [N/A])
97   LIBS="-lgmp $LIBS"
98else
99   AC_MSG_RESULT([no])
100fi
101
102AC_MSG_CHECKING([whether to enable shared library support])
103if test "$enable_dl" = "yes"; then
104   AC_MSG_RESULT([ltdl])
105   AC_DEFINE([HAVE_LTDL], [1], [N/A])
106   LIBS="-lltdl $LIBS"
107elif test "$enable_dl" = "ltdl"; then
108   AC_MSG_RESULT([ltdl])
109   AC_DEFINE([HAVE_LTDL], [1], [N/A])
110   LIBS="-lltdl $LIBS"
111elif test "$enable_dl" = "dlfcn"; then
112   AC_MSG_RESULT([dlfcn])
113   AC_DEFINE([HAVE_DLFCN], [1], [N/A])
114else
115   AC_MSG_RESULT([no])
116fi
117
118case $host_os in
119   darwin* | macosx*)
120      LIBIODBC="libiodbc.dylib"
121      LIBODBC="libodbc.dylib"
122      LIBMYSQL="libmysqlclient.dylib"
123      ;;
124   *)
125      LIBIODBC="libiodbc.so"
126      LIBODBC="libodbc.so"
127      LIBMYSQL="libmysqlclient.so"
128      ;;
129esac
130
131AC_MSG_CHECKING([whether to enable MathProg ODBC support])
132if test "$enable_odbc" = "yes"; then
133   if test "$enable_dl" = "no"; then
134      AC_MSG_ERROR([--enable-odbc requires --enable-dl])
135   fi
136   AC_MSG_RESULT([yes])
137   CFLAGS="$(iodbc-config --cflags) $CFLAGS"
138   AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$LIBIODBC"], [N/A])
139elif test "$enable_odbc" = "unix"; then
140   if test "$enable_dl" = "no"; then
141      AC_MSG_ERROR([--enable-odbc requires --enable-dl])
142   fi
143   AC_MSG_RESULT([unix])
144   AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$LIBODBC"], [N/A])
145else
146   AC_MSG_RESULT([no])
147fi
148
149AC_MSG_CHECKING([whether to enable MathProg MySQL support])
150if test "$enable_mysql" = "yes"; then
151   if test "$enable_dl" = "no"; then
152      AC_MSG_ERROR([--enable-mysql requires --enable-dl])
153   fi
154   AC_MSG_RESULT([yes])
155   CPPFLAGS="-I/usr/include/mysql $CPPFLAGS"
156   AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$LIBMYSQL"], [N/A])
157else
158   AC_MSG_RESULT([no])
159fi
160
161AC_MSG_CHECKING([whether to enable reentrancy support])
162if test "$enable_reentrant" = "yes"; then
163   AC_MSG_RESULT([yes])
164   AC_MSG_CHECKING([for thread local storage (TLS) class specifier])
165   keywords="_Thread_local __thread __declspec(thread)"
166   tls=none
167   for tls_keyword in $keywords; do
168      AC_COMPILE_IFELSE([AC_LANG_SOURCE([
169         #include <stdlib.h>
170         static void foo(void)
171         {  static ] $tls_keyword [ int bar;
172            exit(1);
173         }])], [tls=$tls_keyword; break], [])
174   done
175   AC_MSG_RESULT($tls)
176   if test "$tls" != "none"; then
177      AC_DEFINE_UNQUOTED([TLS], $tls, [N/A])
178   else
179      AC_MSG_ERROR([Reentrancy needs complier support for TLS])
180   fi
181else
182   AC_MSG_RESULT([no])
183fi
184
185AC_MSG_CHECKING(
186   [if libtool needs -no-undefined flag to build shared libraries])
187case "${host}" in
188   *-*-cygwin* | *-*-mingw* | *-*-aix*)
189      ## Add in the -no-undefined flag to LDFLAGS for libtool.
190      AC_MSG_RESULT([yes])
191      NOUNDEFINED=" -no-undefined"
192      ;;
193   *)
194      ## Don't add in anything.
195      AC_MSG_RESULT([no])
196      ;;
197esac
198AC_SUBST([NOUNDEFINED])
199
200AC_CONFIG_FILES(
201   [src/Makefile examples/Makefile Makefile])
202AC_OUTPUT
203
204dnl eof
Note: See TracBrowser for help on using the repository browser.