configure.ac
author Alpar Juttner <alpar@cs.elte.hu>
Thu, 17 Mar 2011 18:12:03 +0100
changeset 939 78b9fb1f4454
parent 793 7c0ad6bd6a63
parent 929 d3b041452dd8
permissions -rw-r--r--
Merge #416
ladanyi@1
     1
dnl Process this file with autoconf to produce a configure script.
ladanyi@1
     2
ladanyi@1
     3
dnl Version information.
alpar@273
     4
m4_define([lemon_version_number],
ladanyi@680
     5
          [m4_normalize(esyscmd([echo ${LEMON_VERSION}]))])
alpar@273
     6
dnl m4_define([lemon_version_number], [])
alpar@273
     7
m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))])
ladanyi@680
     8
m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i 2> /dev/null]))])
alpar@273
     9
m4_define([lemon_version], [ifelse(lemon_version_number(),
ladanyi@680
    10
                           [],
ladanyi@680
    11
                           [ifelse(lemon_hg_revision(),
ladanyi@680
    12
                           [],
ladanyi@680
    13
                           [hg-tip],
ladanyi@680
    14
                           [lemon_hg_path().lemon_hg_revision()])],
ladanyi@680
    15
                           [lemon_version_number()])])
ladanyi@1
    16
ladanyi@1
    17
AC_PREREQ([2.59])
ladanyi@236
    18
AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon])
ladanyi@1
    19
AC_CONFIG_AUX_DIR([build-aux])
ladanyi@1
    20
AC_CONFIG_MACRO_DIR([m4])
ladanyi@64
    21
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
ladanyi@1
    22
AC_CONFIG_SRCDIR([lemon/list_graph.h])
ladanyi@1
    23
AC_CONFIG_HEADERS([config.h lemon/config.h])
ladanyi@1
    24
ladanyi@678
    25
AC_DEFINE([LEMON_VERSION], [lemon_version()], [The version string])
ladanyi@678
    26
ladanyi@296
    27
dnl Do compilation tests using the C++ compiler.
ladanyi@296
    28
AC_LANG([C++])
ladanyi@296
    29
alpar@496
    30
dnl Check the existence of long long type.
alpar@496
    31
AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
alpar@496
    32
if test x"$long_long_found" = x"yes"; then
ladanyi@511
    33
  AC_DEFINE([LEMON_HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])
alpar@496
    34
fi
alpar@496
    35
ladanyi@1
    36
dnl Checks for programs.
ladanyi@1
    37
AC_PROG_CXX
ladanyi@1
    38
AC_PROG_CXXCPP
ladanyi@1
    39
AC_PROG_INSTALL
ladanyi@1
    40
AC_DISABLE_SHARED
ladanyi@1
    41
AC_PROG_LIBTOOL
ladanyi@1
    42
ladanyi@60
    43
AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no])
alpar@744
    44
AC_CHECK_PROG([python_found],[python],[yes],[no])
ladanyi@153
    45
AC_CHECK_PROG([gs_found],[gs],[yes],[no])
ladanyi@60
    46
ladanyi@296
    47
dnl Detect Intel compiler.
ladanyi@296
    48
AC_MSG_CHECKING([whether we are using the Intel C++ compiler])
ladanyi@296
    49
AC_COMPILE_IFELSE([#ifndef __INTEL_COMPILER
ladanyi@296
    50
choke me
ladanyi@296
    51
#endif], [ICC=[yes]], [ICC=[no]])
ladanyi@296
    52
if test x"$ICC" = x"yes"; then
ladanyi@296
    53
  AC_MSG_RESULT([yes])
ladanyi@296
    54
else
ladanyi@296
    55
  AC_MSG_RESULT([no])
ladanyi@296
    56
fi
ladanyi@296
    57
alpar@225
    58
dnl Set custom compiler flags when using g++.
ladanyi@363
    59
if test "$GXX" = yes -a "$ICC" = no; then
ladanyi@363
    60
  WARNINGCXXFLAGS="-Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
ladanyi@1
    61
fi
ladanyi@363
    62
AC_SUBST([WARNINGCXXFLAGS])
ladanyi@1
    63
ladanyi@1
    64
dnl Checks for libraries.
deba@458
    65
LX_CHECK_GLPK
deba@458
    66
LX_CHECK_CPLEX
deba@458
    67
LX_CHECK_SOPLEX
ladanyi@568
    68
LX_CHECK_COIN
ladanyi@1
    69
alpar@457
    70
AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"])
alpar@457
    71
AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"])
ladanyi@1
    72
alpar@225
    73
dnl Disable/enable building the binary tools.
ladanyi@1
    74
AC_ARG_ENABLE([tools],
ladanyi@1
    75
AS_HELP_STRING([--enable-tools], [build additional tools @<:@default@:>@])
ladanyi@1
    76
AS_HELP_STRING([--disable-tools], [do not build additional tools]),
ladanyi@1
    77
              [], [enable_tools=yes])
ladanyi@1
    78
AC_MSG_CHECKING([whether to build the additional tools])
ladanyi@1
    79
if test x"$enable_tools" != x"no"; then
ladanyi@1
    80
  AC_MSG_RESULT([yes])
ladanyi@1
    81
else
ladanyi@1
    82
  AC_MSG_RESULT([no])
ladanyi@1
    83
fi
ladanyi@1
    84
AM_CONDITIONAL([WANT_TOOLS], [test x"$enable_tools" != x"no"])
ladanyi@1
    85
ladanyi@793
    86
dnl Support for running test cases using valgrind.
ladanyi@793
    87
use_valgrind=no
ladanyi@793
    88
AC_ARG_ENABLE([valgrind],
ladanyi@793
    89
AS_HELP_STRING([--enable-valgrind], [use valgrind when running tests]),
ladanyi@793
    90
              [use_valgrind=yes])
ladanyi@793
    91
ladanyi@793
    92
if [[ "$use_valgrind" = "yes" ]]; then
ladanyi@793
    93
  AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
ladanyi@793
    94
ladanyi@793
    95
  if [[ "$HAVE_VALGRIND" = "no" ]]; then
ladanyi@793
    96
    AC_MSG_ERROR([Valgrind not found in PATH.])
ladanyi@793
    97
  fi
ladanyi@793
    98
fi
ladanyi@793
    99
AM_CONDITIONAL(USE_VALGRIND, [test "$use_valgrind" = "yes"])
ladanyi@793
   100
ladanyi@1
   101
dnl Checks for header files.
ladanyi@1
   102
AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h unistd.h)
ladanyi@1
   103
ladanyi@1
   104
dnl Checks for typedefs, structures, and compiler characteristics.
ladanyi@1
   105
AC_C_CONST
ladanyi@1
   106
AC_C_INLINE
ladanyi@1
   107
AC_TYPE_SIZE_T
ladanyi@1
   108
AC_HEADER_TIME
ladanyi@1
   109
AC_STRUCT_TM
ladanyi@1
   110
ladanyi@1
   111
dnl Checks for library functions.
ladanyi@1
   112
AC_HEADER_STDC
ladanyi@1
   113
AC_CHECK_FUNCS(gettimeofday times ctime_r)
ladanyi@1
   114
alpar@219
   115
dnl Add dependencies on files generated by configure.
alpar@219
   116
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
alpar@929
   117
  ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/doc/mainpage.dox.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
alpar@219
   118
ladanyi@1
   119
AC_CONFIG_FILES([
ladanyi@1
   120
Makefile
ladanyi@564
   121
demo/Makefile
alpar@480
   122
cmake/version.cmake
ladanyi@1
   123
doc/Doxyfile
alpar@929
   124
doc/mainpage.dox
ladanyi@1
   125
lemon/lemon.pc
ladanyi@1
   126
])
ladanyi@1
   127
ladanyi@1
   128
AC_OUTPUT
ladanyi@1
   129
ladanyi@1
   130
echo
ladanyi@1
   131
echo '****************************** SUMMARY ******************************'
ladanyi@1
   132
echo
ladanyi@1
   133
echo Package version............... : $PACKAGE-$VERSION
ladanyi@1
   134
echo
ladanyi@1
   135
echo C++ compiler.................. : $CXX
ladanyi@363
   136
echo C++ compiles flags............ : $WARNINGCXXFLAGS $CXXFLAGS
ladanyi@1
   137
echo
alpar@496
   138
echo Compiler supports long long... : $long_long_found
alpar@496
   139
echo
deba@458
   140
echo GLPK support.................. : $lx_glpk_found
deba@458
   141
echo CPLEX support................. : $lx_cplex_found
deba@458
   142
echo SOPLEX support................ : $lx_soplex_found
deba@459
   143
echo CLP support................... : $lx_clp_found
deba@567
   144
echo CBC support................... : $lx_cbc_found
deba@458
   145
echo
alpar@55
   146
echo Build additional tools........ : $enable_tools
ladanyi@793
   147
echo Use valgrind for tests........ : $use_valgrind
ladanyi@1
   148
echo
ladanyi@1
   149
echo The packace will be installed in
ladanyi@1
   150
echo -n '  '
ladanyi@1
   151
echo $prefix.
ladanyi@1
   152
echo
ladanyi@1
   153
echo '*********************************************************************'
ladanyi@1
   154
ladanyi@1
   155
echo
alpar@55
   156
echo Configure complete, now type \'make\' and then \'make install\'.
ladanyi@1
   157
echo