You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
5.1 KiB

3 months ago
  1. dnl Process this file with autoconf to produce a configure script
  2. AC_INIT([GLPK], [4.65], [bug-glpk@gnu.org])
  3. AC_CONFIG_SRCDIR([src/glpk.h])
  4. AC_CONFIG_MACRO_DIR([m4])
  5. AM_INIT_AUTOMAKE
  6. AC_CONFIG_HEADERS([config.h])
  7. AC_ARG_WITH(gmp,
  8. AC_HELP_STRING([--with-gmp],
  9. [use GNU MP bignum library [[default=no]]]),
  10. [case $withval in
  11. yes | no) ;;
  12. *) AC_MSG_ERROR([invalid value `$withval' for --with-gmp]);;
  13. esac],
  14. [with_gmp=no])
  15. AC_ARG_ENABLE(dl,
  16. AC_HELP_STRING([--enable-dl],
  17. [enable shared library support [[default=no]]]),
  18. [case $enableval in
  19. yes | ltdl | dlfcn | no) ;;
  20. *) AC_MSG_ERROR([invalid value `$enableval' for --enable-dl]);;
  21. esac],
  22. [enable_dl=no])
  23. AC_ARG_ENABLE(odbc,
  24. AC_HELP_STRING([--enable-odbc],
  25. [enable MathProg ODBC support [[default=no]]]),
  26. [case $enableval in
  27. yes | unix | no) ;;
  28. *) AC_MSG_ERROR([invalid value `$enableval' for --enable-odbc]);;
  29. esac],
  30. [enable_odbc=no])
  31. AC_ARG_ENABLE(mysql,
  32. AC_HELP_STRING([--enable-mysql],
  33. [enable MathProg MySQL support [[default=no]]]),
  34. [case $enableval in
  35. yes | no) ;;
  36. *) AC_MSG_ERROR([invalid value `$enableval' for --enable-mysql]);;
  37. esac],
  38. [enable_mysql=no])
  39. AC_ARG_ENABLE(reentrant,
  40. AC_HELP_STRING([--enable-reentrant],
  41. [enable reentrancy support [[default=yes]]]),
  42. [case $enableval in
  43. yes | no) ;;
  44. *) AC_MSG_ERROR(
  45. [invalid value `$enableval' for --enable-reentrant]);;
  46. esac],
  47. [enable_reentrant=yes])
  48. dnl Disable unnecessary libtool tests
  49. define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])
  50. define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
  51. define([AC_LIBTOOL_LANG_GCJ_CONFIG], [:])
  52. dnl Check for programs
  53. AC_PROG_CC
  54. AC_PROG_INSTALL
  55. AC_PROG_LIBTOOL
  56. dnl Check for math library
  57. AC_CHECK_LIB([m], [exp])
  58. dnl Check for <sys/time.h> header
  59. AC_CHECK_HEADER([sys/time.h],
  60. AC_DEFINE([HAVE_SYS_TIME_H], [1], [N/A]))
  61. dnl Check for gettimeofday function
  62. AC_CHECK_FUNC([gettimeofday],
  63. AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [N/A]))
  64. dnl Check for <gmp.h> header
  65. if test "$with_gmp" = "yes"; then
  66. AC_CHECK_HEADER([gmp.h], [],
  67. [AC_MSG_ERROR([gmp.h header not found])])
  68. fi
  69. AC_MSG_CHECKING([whether to use GNU MP bignum library])
  70. if test "$with_gmp" = "yes"; then
  71. AC_MSG_RESULT([yes])
  72. AC_DEFINE([HAVE_GMP], [1], [N/A])
  73. LIBS="-lgmp $LIBS"
  74. else
  75. AC_MSG_RESULT([no])
  76. fi
  77. AC_MSG_CHECKING([whether to enable shared library support])
  78. if test "$enable_dl" = "yes"; then
  79. AC_MSG_RESULT([ltdl])
  80. AC_DEFINE([HAVE_LTDL], [1], [N/A])
  81. LIBS="-lltdl $LIBS"
  82. elif test "$enable_dl" = "ltdl"; then
  83. AC_MSG_RESULT([ltdl])
  84. AC_DEFINE([HAVE_LTDL], [1], [N/A])
  85. LIBS="-lltdl $LIBS"
  86. elif test "$enable_dl" = "dlfcn"; then
  87. AC_MSG_RESULT([dlfcn])
  88. AC_DEFINE([HAVE_DLFCN], [1], [N/A])
  89. else
  90. AC_MSG_RESULT([no])
  91. fi
  92. case $host_os in
  93. darwin* | macosx*)
  94. LIBIODBC="libiodbc.dylib"
  95. LIBODBC="libodbc.dylib"
  96. LIBMYSQL="libmysqlclient.dylib"
  97. ;;
  98. *)
  99. LIBIODBC="libiodbc.so"
  100. LIBODBC="libodbc.so"
  101. LIBMYSQL="libmysqlclient.so"
  102. ;;
  103. esac
  104. AC_MSG_CHECKING([whether to enable MathProg ODBC support])
  105. if test "$enable_odbc" = "yes"; then
  106. if test "$enable_dl" = "no"; then
  107. AC_MSG_ERROR([--enable-odbc requires --enable-dl])
  108. fi
  109. AC_MSG_RESULT([yes])
  110. CFLAGS="$(iodbc-config --cflags) $CFLAGS"
  111. AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$LIBIODBC"], [N/A])
  112. elif test "$enable_odbc" = "unix"; then
  113. if test "$enable_dl" = "no"; then
  114. AC_MSG_ERROR([--enable-odbc requires --enable-dl])
  115. fi
  116. AC_MSG_RESULT([unix])
  117. AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$LIBODBC"], [N/A])
  118. else
  119. AC_MSG_RESULT([no])
  120. fi
  121. AC_MSG_CHECKING([whether to enable MathProg MySQL support])
  122. if test "$enable_mysql" = "yes"; then
  123. if test "$enable_dl" = "no"; then
  124. AC_MSG_ERROR([--enable-mysql requires --enable-dl])
  125. fi
  126. AC_MSG_RESULT([yes])
  127. CPPFLAGS="-I/usr/include/mysql $CPPFLAGS"
  128. AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$LIBMYSQL"], [N/A])
  129. else
  130. AC_MSG_RESULT([no])
  131. fi
  132. AC_MSG_CHECKING([whether to enable reentrancy support])
  133. if test "$enable_reentrant" = "yes"; then
  134. AC_MSG_RESULT([yes])
  135. AC_MSG_CHECKING([for thread local storage (TLS) class specifier])
  136. keywords="_Thread_local __thread __declspec(thread)"
  137. tls=none
  138. for tls_keyword in $keywords; do
  139. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  140. #include <stdlib.h>
  141. static void foo(void)
  142. { static ] $tls_keyword [ int bar;
  143. exit(1);
  144. }])], [tls=$tls_keyword; break], [])
  145. done
  146. AC_MSG_RESULT($tls)
  147. if test "$tls" != "none"; then
  148. AC_DEFINE_UNQUOTED([TLS], $tls, [N/A])
  149. else
  150. AC_MSG_ERROR([Reentrancy needs complier support for TLS])
  151. fi
  152. else
  153. AC_MSG_RESULT([no])
  154. fi
  155. AC_MSG_CHECKING(
  156. [if libtool needs -no-undefined flag to build shared libraries])
  157. case "${host}" in
  158. *-*-cygwin* | *-*-mingw* | *-*-aix*)
  159. ## Add in the -no-undefined flag to LDFLAGS for libtool.
  160. AC_MSG_RESULT([yes])
  161. NOUNDEFINED=" -no-undefined"
  162. ;;
  163. *)
  164. ## Don't add in anything.
  165. AC_MSG_RESULT([no])
  166. ;;
  167. esac
  168. AC_SUBST([NOUNDEFINED])
  169. AC_CONFIG_FILES(
  170. [src/Makefile examples/Makefile Makefile])
  171. AC_OUTPUT
  172. dnl eof