configure.ac
changeset 1 c445c931472f
equal deleted inserted replaced
-1:000000000000 0:cd04420f1e7c
       
     1 dnl Process this file with autoconf to produce a configure script
       
     2 
       
     3 AC_INIT([GLPK], [4.45], [bug-glpk@gnu.org])
       
     4 
       
     5 AC_CONFIG_SRCDIR([include/glpk.h])
       
     6 
       
     7 AC_CONFIG_MACRO_DIR([m4])
       
     8 
       
     9 AM_INIT_AUTOMAKE
       
    10 
       
    11 AC_CONFIG_HEADERS([config.h])
       
    12 
       
    13 AC_ARG_WITH(gmp,
       
    14 AC_HELP_STRING([--with-gmp],
       
    15    [use GNU MP bignum library [[default=no]]]),
       
    16    [case $withval in
       
    17       yes | no) ;;
       
    18       *) AC_MSG_ERROR([invalid value `$withval' for --with-gmp]);;
       
    19       esac],
       
    20    [with_gmp=no])
       
    21 
       
    22 AC_ARG_WITH(zlib,
       
    23 AC_HELP_STRING([--with-zlib],
       
    24    [use zlib data compression library [[default=no]]]),
       
    25    [case $withval in
       
    26       yes | no) ;;
       
    27       *) AC_MSG_ERROR([invalid value `$withval' for --with-zlib]);;
       
    28       esac],
       
    29    [with_zlib=no])
       
    30 
       
    31 AC_ARG_ENABLE(dl,
       
    32 AC_HELP_STRING([--enable-dl],
       
    33    [enable shared library support [[default=no]]]),
       
    34    [case $enableval in
       
    35       yes | ltdl | dlfcn | no) ;;
       
    36       *) AC_MSG_ERROR([invalid value `$enableval' for --enable-dl]);;
       
    37       esac],
       
    38    [enable_dl=no])
       
    39 
       
    40 AC_ARG_ENABLE(odbc,
       
    41 AC_HELP_STRING([--enable-odbc],
       
    42    [enable MathProg ODBC support [[default=no]]]),
       
    43    [case $enableval in
       
    44       yes | unix | no) ;;
       
    45       *) AC_MSG_ERROR([invalid value `$enableval' for --enable-odbc]);;
       
    46       esac],
       
    47    [enable_odbc=no])
       
    48 
       
    49 AC_ARG_ENABLE(mysql,
       
    50 AC_HELP_STRING([--enable-mysql],
       
    51    [enable MathProg MySQL support [[default=no]]]),
       
    52    [case $enableval in
       
    53       yes | no) ;;
       
    54       *) AC_MSG_ERROR([invalid value `$enableval' for --enable-mysql]);;
       
    55       esac],
       
    56    [enable_mysql=no])
       
    57 
       
    58 dnl Disable unnecessary libtool tests
       
    59 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])
       
    60 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
       
    61 define([AC_LIBTOOL_LANG_GCJ_CONFIG], [:])
       
    62 
       
    63 dnl Check for programs
       
    64 AC_PROG_CC
       
    65 AC_PROG_INSTALL
       
    66 AC_PROG_LIBTOOL
       
    67 
       
    68 dnl Check for math library
       
    69 AC_CHECK_LIB([m], [exp])
       
    70 
       
    71 dnl Check for <sys/time.h> header
       
    72 AC_CHECK_HEADER([sys/time.h],
       
    73    AC_DEFINE([HAVE_SYS_TIME_H], [1], [N/A]))
       
    74 
       
    75 dnl Check for gettimeofday function
       
    76 AC_CHECK_FUNC([gettimeofday],
       
    77    AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [N/A]))
       
    78 
       
    79 AC_MSG_CHECKING([whether to use GNU MP bignum library])
       
    80 if test "$with_gmp" = "yes"; then
       
    81    AC_MSG_RESULT([yes])
       
    82    AC_DEFINE([HAVE_GMP], [1], [N/A])
       
    83    LIBS="-lgmp $LIBS"
       
    84 else
       
    85    AC_MSG_RESULT([no])
       
    86 fi
       
    87 
       
    88 AC_MSG_CHECKING([whether to use zlib data compression library])
       
    89 if test "$with_zlib" = "yes"; then
       
    90    AC_MSG_RESULT([yes])
       
    91    AC_DEFINE([HAVE_ZLIB], [1], [N/A])
       
    92    LIBS="-lz $LIBS"
       
    93 else
       
    94    AC_MSG_RESULT([no])
       
    95 fi
       
    96 
       
    97 AC_MSG_CHECKING([whether to enable shared library support])
       
    98 if test "$enable_dl" = "yes"; then
       
    99    AC_MSG_RESULT([ltdl])
       
   100    AC_DEFINE([HAVE_LTDL], [1], [N/A])
       
   101    LIBS="-lltdl $LIBS"
       
   102 elif test "$enable_dl" = "ltdl"; then
       
   103    AC_MSG_RESULT([ltdl])
       
   104    AC_DEFINE([HAVE_LTDL], [1], [N/A])
       
   105    LIBS="-lltdl $LIBS"
       
   106 elif test "$enable_dl" = "dlfcn"; then
       
   107    AC_MSG_RESULT([dlfcn])
       
   108    AC_DEFINE([HAVE_DLFCN], [1], [N/A])
       
   109 else
       
   110    AC_MSG_RESULT([no])
       
   111 fi
       
   112 
       
   113 case $host_os in
       
   114    darwin* | macosx*)
       
   115       LIBIODBC="libiodbc.dylib"
       
   116       LIBODBC="libodbc.dylib"
       
   117       LIBMYSQL="libmysqlclient.dylib"
       
   118       ;;
       
   119    *)
       
   120       LIBIODBC="libiodbc.so"
       
   121       LIBODBC="libodbc.so"
       
   122       LIBMYSQL="libmysqlclient.so"
       
   123       ;;
       
   124 esac
       
   125 
       
   126 AC_MSG_CHECKING([whether to enable MathProg ODBC support])
       
   127 if test "$enable_odbc" = "yes"; then
       
   128    if test "$enable_dl" = "no"; then
       
   129       AC_MSG_ERROR([--enable-odbc requires --enable-dl])
       
   130    fi
       
   131    AC_MSG_RESULT([yes])
       
   132    AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$LIBIODBC"], [N/A])
       
   133 elif test "$enable_odbc" = "unix"; then
       
   134    if test "$enable_dl" = "no"; then
       
   135       AC_MSG_ERROR([--enable-odbc requires --enable-dl])
       
   136    fi
       
   137    AC_MSG_RESULT([unix])
       
   138    AC_DEFINE_UNQUOTED([ODBC_DLNAME], ["$LIBODBC"], [N/A])
       
   139 else
       
   140    AC_MSG_RESULT([no])
       
   141 fi
       
   142 
       
   143 AC_MSG_CHECKING([whether to enable MathProg MySQL support])
       
   144 if test "$enable_mysql" = "yes"; then
       
   145    if test "$enable_dl" = "no"; then
       
   146       AC_MSG_ERROR([--enable-mysql requires --enable-dl])
       
   147    fi
       
   148    AC_MSG_RESULT([yes])
       
   149    CPPFLAGS="-I/usr/include/mysql $CPPFLAGS"
       
   150    AC_DEFINE_UNQUOTED([MYSQL_DLNAME], ["$LIBMYSQL"], [N/A])
       
   151 else
       
   152    AC_MSG_RESULT([no])
       
   153 fi
       
   154 
       
   155 AC_CONFIG_FILES(
       
   156    [include/Makefile src/Makefile examples/Makefile Makefile])
       
   157 AC_OUTPUT
       
   158 
       
   159 dnl eof