- GLPK is autodetected now
authorladanyi
Thu, 14 Apr 2005 12:02:14 +0000
changeset 134983388a4aa3af
parent 1348 115e42a5b0f7
child 1350 fb794edbf04b
- GLPK is autodetected now
config/lp.m4
configure.ac
src/demo/Makefile.am
src/lemon/Makefile.am
src/test/Makefile.am
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/config/lp.m4	Thu Apr 14 12:02:14 2005 +0000
     1.3 @@ -0,0 +1,71 @@
     1.4 +AC_DEFUN([LX_CHECK_GLPK],
     1.5 +[
     1.6 +  AC_ARG_WITH([glpk],
     1.7 +AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [Search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@])
     1.8 +AS_HELP_STRING([--without-glpk], [Disable checking for GLPK]),
     1.9 +              [], [with_glpk=yes])
    1.10 +
    1.11 +  AC_ARG_WITH([glpk-includedir],
    1.12 +AS_HELP_STRING([--with-glpk-includedir=DIR], [Search for GLPK headers in DIR]),
    1.13 +              [], [with_glpk_includedir=no])
    1.14 +
    1.15 +  AC_ARG_WITH([glpk-libdir],
    1.16 +AS_HELP_STRING([--with-glpk-libdir=DIR], [Search for GLPK libraries in DIR]),
    1.17 +              [], [with_glpk_libdir=no])
    1.18 +
    1.19 +  if test x"$with_glpk" != x"no"; then
    1.20 +    AC_MSG_CHECKING([for GLPK])
    1.21 +
    1.22 +    if test x"$with_glpk_includedir" != x"no"; then
    1.23 +      GLPK_CFLAGS="-I$with_glpk_includedir"
    1.24 +    elif test x"$with_glpk" != x"yes"; then
    1.25 +      GLPK_CFLAGS="-I$with_glpk/include"
    1.26 +    fi
    1.27 +
    1.28 +    if test x"$with_glpk_libdir" != x"no"; then
    1.29 +      GLPK_LDFLAGS="-L$with_glpk_libdir"
    1.30 +    elif test x"$with_glpk" != x"yes"; then
    1.31 +      GLPK_LDFLAGS="-L$with_glpk/lib"
    1.32 +    fi
    1.33 +    GLPK_LIBS="-lglpk"
    1.34 +
    1.35 +    lx_save_cxxflags="$CXXFLAGS";
    1.36 +    lx_save_ldflags="$LDFLAGS";
    1.37 +    lx_save_libs="$LIBS";
    1.38 +    CXXFLAGS="$GLPK_CFLAGS"
    1.39 +    LDFLAGS="$GLPK_LDFLAGS"
    1.40 +    LIBS="$GLPK_LIBS"
    1.41 +
    1.42 +    lx_glpk_test_prog='
    1.43 +      extern "C" {
    1.44 +      #include <glpk.h>
    1.45 +      }
    1.46 +
    1.47 +      int main(int argc, char* argv[])
    1.48 +      {
    1.49 +        LPX *lp;
    1.50 +        lp = lpx_create_prob();
    1.51 +        lpx_delete_prob(lp);
    1.52 +        return 0;
    1.53 +      }'
    1.54 +
    1.55 +    AC_LANG_PUSH(C++)
    1.56 +    AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], [])
    1.57 +    AC_LANG_POP(C++)
    1.58 +
    1.59 +    CXXFLAGS="$lx_save_cxxflags"
    1.60 +    LDFLAGS="$lx_save_ldflags"
    1.61 +    LIBS="$lx_save_libs"
    1.62 +
    1.63 +    if test x"$lx_glpk_found" = x"yes"; then
    1.64 +      AC_DEFINE([HAVE_GLPK], [1], [Define if GLPK was found])
    1.65 +      AC_MSG_RESULT([found])
    1.66 +    else
    1.67 +      AC_MSG_RESULT([not found])
    1.68 +    fi
    1.69 +  fi
    1.70 +  GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS"
    1.71 +  AC_SUBST(GLPK_CFLAGS)
    1.72 +  AC_SUBST(GLPK_LIBS)
    1.73 +  AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"])
    1.74 +])
     2.1 --- a/configure.ac	Wed Apr 13 06:49:42 2005 +0000
     2.2 +++ b/configure.ac	Thu Apr 14 12:02:14 2005 +0000
     2.3 @@ -4,7 +4,7 @@
     2.4  AM_INIT_AUTOMAKE
     2.5  AC_CONFIG_SRCDIR([src/lemon/invalid.h])
     2.6  AM_CONFIG_HEADER([config.h])
     2.7 -AC_PREREQ(2.57)
     2.8 +AC_PREREQ([2.53])
     2.9  
    2.10  dnl Checks for programs.
    2.11  AC_PROG_CXX
    2.12 @@ -12,12 +12,12 @@
    2.13  AC_DISABLE_SHARED
    2.14  AC_PROG_LIBTOOL
    2.15  
    2.16 -dnl I know this is not perfect. A better solution will come soon.
    2.17  if test $CXX != icc -a $CXX != icpc; then
    2.18 -  CXXFLAGS="$CXXFLAGS -Wall"
    2.19 +  CXXFLAGS="$CXXFLAGS -Wall -W"
    2.20  fi
    2.21  
    2.22  dnl Checks for libraries.
    2.23 +LX_CHECK_GLPK
    2.24  
    2.25  dnl Checks for header files.
    2.26  AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h unistd.h)
    2.27 @@ -45,4 +45,5 @@
    2.28  src/demo/Makefile
    2.29  src/test/Makefile
    2.30  ])
    2.31 +
    2.32  AC_OUTPUT
     3.1 --- a/src/demo/Makefile.am	Wed Apr 13 06:49:42 2005 +0000
     3.2 +++ b/src/demo/Makefile.am	Thu Apr 14 12:02:14 2005 +0000
     3.3 @@ -1,23 +1,31 @@
     3.4  AM_CPPFLAGS = -I$(top_srcdir)/src
     3.5  LDADD = $(top_builddir)/src/lemon/libemon.la
     3.6 +
     3.7  EXTRA_DIST = sub_graph_wrapper_demo.dim
     3.8  
     3.9 -noinst_PROGRAMS = 	dim_to_dot 					\
    3.10 -			sub_graph_wrapper_demo 				\
    3.11 -			graph_to_eps_demo 				\
    3.12 -			lp_demo                                         \
    3.13 -			dim_to_lgf					\
    3.14 -			min_route
    3.15 +noinst_PROGRAMS = \
    3.16 +	dim_to_dot \
    3.17 +	dim_to_lgf \
    3.18 +	graph_to_eps_demo \
    3.19 +	min_route \
    3.20 +	sub_graph_wrapper_demo
    3.21 +
    3.22 +if HAVE_GLPK
    3.23 +noinst_PROGRAMS += lp_demo
    3.24 +endif
    3.25  
    3.26  dim_to_dot_SOURCES = dim_to_dot.cc
    3.27 -min_route_SOURCES = min_route.cc
    3.28  
    3.29 -sub_graph_wrapper_demo_SOURCES = sub_graph_wrapper_demo.cc \
    3.30 -	tight_edge_filter_map.h
    3.31 +dim_to_lgf_SOURCES = dim_to_lgf.cc
    3.32  
    3.33  graph_to_eps_demo_SOURCES = graph_to_eps_demo.cc
    3.34  
    3.35 -lp_demo_LDADD = $(top_builddir)/src/lemon/libemon.la -lglpk
    3.36 +min_route_SOURCES = min_route.cc
    3.37 +
    3.38 +sub_graph_wrapper_demo_SOURCES = \
    3.39 +	sub_graph_wrapper_demo.cc \
    3.40 +	tight_edge_filter_map.h
    3.41 +
    3.42  lp_demo_SOURCES = lp_demo.cc
    3.43 -
    3.44 -dim_to_lgf_SOURCES = dim_to_lgf.cc
    3.45 \ No newline at end of file
    3.46 +lp_demo_CXXFLAGS = $(GLPK_CFLAGS)
    3.47 +lp_demo_LDFLAGS = $(GLPK_LIBS)
     4.1 --- a/src/lemon/Makefile.am	Wed Apr 13 06:49:42 2005 +0000
     4.2 +++ b/src/lemon/Makefile.am	Thu Apr 14 12:02:14 2005 +0000
     4.3 @@ -4,63 +4,69 @@
     4.4  pkgconfig_DATA = lemon.pc
     4.5  
     4.6  lib_LTLIBRARIES = libemon.la
     4.7 -libemon_la_SOURCES =							\
     4.8 -	lp_base.cc							\
     4.9 -	lp_glpk.cc							\
    4.10 +
    4.11 +libemon_la_SOURCES = \
    4.12 +	lp_base.cc \
    4.13  	lp_skeleton.cc
    4.14  
    4.15 -pkginclude_HEADERS =							\
    4.16 -	bezier.h							\
    4.17 -	bfs.h                                                           \
    4.18 -	dfs.h                                                           \
    4.19 -	bin_heap.h							\
    4.20 -	dijkstra.h							\
    4.21 -	dimacs.h							\
    4.22 -	error.h  							\
    4.23 -	fib_heap.h							\
    4.24 -	full_graph.h							\
    4.25 -	graph_wrapper.h							\
    4.26 -	graph_utils.h							\
    4.27 -	graph_to_eps.h                                                  \
    4.28 -	invalid.h							\
    4.29 -	kruskal.h							\
    4.30 -	list_graph.h							\
    4.31 -	maps.h								\
    4.32 -	max_matching.h                                                  \
    4.33 -	min_cost_flow.h                                                 \
    4.34 -	suurballe.h                                                     \
    4.35 -	preflow.h                                                       \
    4.36 -	path.h                                                          \
    4.37 -	radix_heap.h                                                    \
    4.38 -	smart_graph.h							\
    4.39 -	time_measure.h							\
    4.40 -	unionfind.h							\
    4.41 -	xy.h								\
    4.42 -	concept_check.h							\
    4.43 -	utility.h							\
    4.44 -	graph_reader.h							\
    4.45 -	graph_writer.h							\
    4.46 -	map_utils.h							\
    4.47 -	bits/alteration_notifier.h                                      \
    4.48 -	bits/map_iterator.h						\
    4.49 -	bits/array_map.h						\
    4.50 -	bits/default_map.h						\
    4.51 -	bits/extended_pair.h						\
    4.52 -	bits/vector_map.h                                               \
    4.53 -	bits/iterable_graph_extender.h					\
    4.54 -	bits/extendable_graph_extender.h				\
    4.55 -	bits/clearable_graph_extender.h					\
    4.56 -	bits/erasable_graph_extender.h					\
    4.57 -	bits/undir_graph_extender.h                                     
    4.58 +if HAVE_GLPK
    4.59 +libemon_la_SOURCES += lp_glpk.cc
    4.60 +libemon_la_CXXFLAGS = $(GLPK_CFLAGS)
    4.61 +libemon_la_LDFLAGS = $(GLPK_LIBS)
    4.62 +endif
    4.63  
    4.64 -noinst_HEADERS =							\
    4.65 -	lp_base.h							\
    4.66 -	lp_glpk.h							\
    4.67 -	lp_skeleton.h						\
    4.68 -	concept/graph.h							\
    4.69 -	concept/graph_component.h					\
    4.70 -	concept/undir_graph.h						\
    4.71 -	concept/sym_graph.h						\
    4.72 -	concept/maps.h							\
    4.73 -	concept/heap.h							\
    4.74 +pkginclude_HEADERS = \
    4.75 +	bezier.h \
    4.76 +	bfs.h \
    4.77 +	dfs.h \
    4.78 +	bin_heap.h \
    4.79 +	dijkstra.h \
    4.80 +	dimacs.h \
    4.81 +	error.h \
    4.82 +	fib_heap.h \
    4.83 +	full_graph.h \
    4.84 +	graph_wrapper.h \
    4.85 +	graph_utils.h \
    4.86 +	graph_to_eps.h \
    4.87 +	invalid.h \
    4.88 +	kruskal.h \
    4.89 +	list_graph.h \
    4.90 +	maps.h \
    4.91 +	max_matching.h \
    4.92 +	min_cost_flow.h \
    4.93 +	suurballe.h \
    4.94 +	preflow.h \
    4.95 +	path.h \
    4.96 +	radix_heap.h \
    4.97 +	smart_graph.h \
    4.98 +	time_measure.h \
    4.99 +	unionfind.h \
   4.100 +	xy.h \
   4.101 +	concept_check.h \
   4.102 +	utility.h \
   4.103 +	graph_reader.h \
   4.104 +	graph_writer.h \
   4.105 +	map_utils.h \
   4.106 +	bits/alteration_notifier.h \
   4.107 +	bits/map_iterator.h \
   4.108 +	bits/array_map.h \
   4.109 +	bits/default_map.h \
   4.110 +	bits/extended_pair.h \
   4.111 +	bits/vector_map.h \
   4.112 +	bits/iterable_graph_extender.h \
   4.113 +	bits/extendable_graph_extender.h \
   4.114 +	bits/clearable_graph_extender.h \
   4.115 +	bits/erasable_graph_extender.h \
   4.116 +	bits/undir_graph_extender.h
   4.117 +
   4.118 +noinst_HEADERS = \
   4.119 +	lp_base.h \
   4.120 +	lp_glpk.h \
   4.121 +	lp_skeleton.h \
   4.122 +	concept/graph.h \
   4.123 +	concept/graph_component.h \
   4.124 +	concept/undir_graph.h \
   4.125 +	concept/sym_graph.h \
   4.126 +	concept/maps.h \
   4.127 +	concept/heap.h \
   4.128  	concept/path.h
     5.1 --- a/src/test/Makefile.am	Wed Apr 13 06:49:42 2005 +0000
     5.2 +++ b/src/test/Makefile.am	Thu Apr 14 12:02:14 2005 +0000
     5.3 @@ -2,6 +2,7 @@
     5.4  LDADD = $(top_builddir)/src/lemon/libemon.la
     5.5  
     5.6  EXTRA_DIST = preflow_graph.dim dijkstra_test.lgf
     5.7 +
     5.8  noinst_HEADERS = \
     5.9  	test_tools.h \
    5.10  	graph_test.h \
    5.11 @@ -18,9 +19,8 @@
    5.12  	graph_wrapper_test \
    5.13  	graph_utils_test \
    5.14  	kruskal_test \
    5.15 -	lp_test \
    5.16 -        max_matching_test \
    5.17 -        maps_test \
    5.18 +	max_matching_test \
    5.19 +	maps_test \
    5.20  	min_cost_flow_test \
    5.21  	suurballe_test \
    5.22  	path_test \
    5.23 @@ -33,6 +33,10 @@
    5.24  	xy_test \
    5.25  	heap_test
    5.26  
    5.27 +if HAVE_GLPK
    5.28 +check_PROGRAMS += lp_test
    5.29 +endif
    5.30 +
    5.31  TESTS = $(check_PROGRAMS)
    5.32  XFAIL_TESTS = test_tools_fail$(EXEEXT)
    5.33  
    5.34 @@ -57,6 +61,6 @@
    5.35  undir_graph_test_SOURCES = undir_graph_test.cc
    5.36  heap_test_SOURCES = heap_test.cc
    5.37  
    5.38 -lp_test_LDADD = $(top_builddir)/src/lemon/libemon.la -lglpk
    5.39  lp_test_SOURCES = lp_test.cc
    5.40 -
    5.41 +lp_test_CXXFLAGS = $(GLPK_CFLAGS)
    5.42 +lp_test_LDFLAGS = $(GLPK_LIBS)