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