# HG changeset patch # User ladanyi # Date 1113480134 0 # Node ID 83388a4aa3af5af69005acfb1cae4a3300ec79e1 # Parent 115e42a5b0f7386d0680e52c5b58695b17673446 - GLPK is autodetected now diff -r 115e42a5b0f7 -r 83388a4aa3af config/lp.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/lp.m4 Thu Apr 14 12:02:14 2005 +0000 @@ -0,0 +1,71 @@ +AC_DEFUN([LX_CHECK_GLPK], +[ + AC_ARG_WITH([glpk], +AS_HELP_STRING([--with-glpk@<:@=PREFIX@:>@], [Search for GLPK under PREFIX or under the default search paths if PREFIX is not given @<:@default@:>@]) +AS_HELP_STRING([--without-glpk], [Disable checking for GLPK]), + [], [with_glpk=yes]) + + AC_ARG_WITH([glpk-includedir], +AS_HELP_STRING([--with-glpk-includedir=DIR], [Search for GLPK headers in DIR]), + [], [with_glpk_includedir=no]) + + AC_ARG_WITH([glpk-libdir], +AS_HELP_STRING([--with-glpk-libdir=DIR], [Search for GLPK libraries in DIR]), + [], [with_glpk_libdir=no]) + + if test x"$with_glpk" != x"no"; then + AC_MSG_CHECKING([for GLPK]) + + if test x"$with_glpk_includedir" != x"no"; then + GLPK_CFLAGS="-I$with_glpk_includedir" + elif test x"$with_glpk" != x"yes"; then + GLPK_CFLAGS="-I$with_glpk/include" + fi + + if test x"$with_glpk_libdir" != x"no"; then + GLPK_LDFLAGS="-L$with_glpk_libdir" + elif test x"$with_glpk" != x"yes"; then + GLPK_LDFLAGS="-L$with_glpk/lib" + fi + GLPK_LIBS="-lglpk" + + lx_save_cxxflags="$CXXFLAGS"; + lx_save_ldflags="$LDFLAGS"; + lx_save_libs="$LIBS"; + CXXFLAGS="$GLPK_CFLAGS" + LDFLAGS="$GLPK_LDFLAGS" + LIBS="$GLPK_LIBS" + + lx_glpk_test_prog=' + extern "C" { + #include + } + + int main(int argc, char* argv[]) + { + LPX *lp; + lp = lpx_create_prob(); + lpx_delete_prob(lp); + return 0; + }' + + AC_LANG_PUSH(C++) + AC_LINK_IFELSE([$lx_glpk_test_prog], [lx_glpk_found=yes], []) + AC_LANG_POP(C++) + + CXXFLAGS="$lx_save_cxxflags" + LDFLAGS="$lx_save_ldflags" + LIBS="$lx_save_libs" + + if test x"$lx_glpk_found" = x"yes"; then + AC_DEFINE([HAVE_GLPK], [1], [Define if GLPK was found]) + AC_MSG_RESULT([found]) + else + AC_MSG_RESULT([not found]) + fi + fi + GLPK_LIBS="$GLPK_LDFLAGS $GLPK_LIBS" + AC_SUBST(GLPK_CFLAGS) + AC_SUBST(GLPK_LIBS) + AM_CONDITIONAL([HAVE_GLPK], [test x"$lx_glpk_found" = x"yes"]) +]) diff -r 115e42a5b0f7 -r 83388a4aa3af configure.ac --- a/configure.ac Wed Apr 13 06:49:42 2005 +0000 +++ b/configure.ac Thu Apr 14 12:02:14 2005 +0000 @@ -4,7 +4,7 @@ AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/lemon/invalid.h]) AM_CONFIG_HEADER([config.h]) -AC_PREREQ(2.57) +AC_PREREQ([2.53]) dnl Checks for programs. AC_PROG_CXX @@ -12,12 +12,12 @@ AC_DISABLE_SHARED AC_PROG_LIBTOOL -dnl I know this is not perfect. A better solution will come soon. if test $CXX != icc -a $CXX != icpc; then - CXXFLAGS="$CXXFLAGS -Wall" + CXXFLAGS="$CXXFLAGS -Wall -W" fi dnl Checks for libraries. +LX_CHECK_GLPK dnl Checks for header files. AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h unistd.h) @@ -45,4 +45,5 @@ src/demo/Makefile src/test/Makefile ]) + AC_OUTPUT diff -r 115e42a5b0f7 -r 83388a4aa3af src/demo/Makefile.am --- a/src/demo/Makefile.am Wed Apr 13 06:49:42 2005 +0000 +++ b/src/demo/Makefile.am Thu Apr 14 12:02:14 2005 +0000 @@ -1,23 +1,31 @@ AM_CPPFLAGS = -I$(top_srcdir)/src LDADD = $(top_builddir)/src/lemon/libemon.la + EXTRA_DIST = sub_graph_wrapper_demo.dim -noinst_PROGRAMS = dim_to_dot \ - sub_graph_wrapper_demo \ - graph_to_eps_demo \ - lp_demo \ - dim_to_lgf \ - min_route +noinst_PROGRAMS = \ + dim_to_dot \ + dim_to_lgf \ + graph_to_eps_demo \ + min_route \ + sub_graph_wrapper_demo + +if HAVE_GLPK +noinst_PROGRAMS += lp_demo +endif dim_to_dot_SOURCES = dim_to_dot.cc -min_route_SOURCES = min_route.cc -sub_graph_wrapper_demo_SOURCES = sub_graph_wrapper_demo.cc \ - tight_edge_filter_map.h +dim_to_lgf_SOURCES = dim_to_lgf.cc graph_to_eps_demo_SOURCES = graph_to_eps_demo.cc -lp_demo_LDADD = $(top_builddir)/src/lemon/libemon.la -lglpk +min_route_SOURCES = min_route.cc + +sub_graph_wrapper_demo_SOURCES = \ + sub_graph_wrapper_demo.cc \ + tight_edge_filter_map.h + lp_demo_SOURCES = lp_demo.cc - -dim_to_lgf_SOURCES = dim_to_lgf.cc \ No newline at end of file +lp_demo_CXXFLAGS = $(GLPK_CFLAGS) +lp_demo_LDFLAGS = $(GLPK_LIBS) diff -r 115e42a5b0f7 -r 83388a4aa3af src/lemon/Makefile.am --- a/src/lemon/Makefile.am Wed Apr 13 06:49:42 2005 +0000 +++ b/src/lemon/Makefile.am Thu Apr 14 12:02:14 2005 +0000 @@ -4,63 +4,69 @@ pkgconfig_DATA = lemon.pc lib_LTLIBRARIES = libemon.la -libemon_la_SOURCES = \ - lp_base.cc \ - lp_glpk.cc \ + +libemon_la_SOURCES = \ + lp_base.cc \ lp_skeleton.cc -pkginclude_HEADERS = \ - bezier.h \ - bfs.h \ - dfs.h \ - bin_heap.h \ - dijkstra.h \ - dimacs.h \ - error.h \ - fib_heap.h \ - full_graph.h \ - graph_wrapper.h \ - graph_utils.h \ - graph_to_eps.h \ - invalid.h \ - kruskal.h \ - list_graph.h \ - maps.h \ - max_matching.h \ - min_cost_flow.h \ - suurballe.h \ - preflow.h \ - path.h \ - radix_heap.h \ - smart_graph.h \ - time_measure.h \ - unionfind.h \ - xy.h \ - concept_check.h \ - utility.h \ - graph_reader.h \ - graph_writer.h \ - map_utils.h \ - bits/alteration_notifier.h \ - bits/map_iterator.h \ - bits/array_map.h \ - bits/default_map.h \ - bits/extended_pair.h \ - bits/vector_map.h \ - bits/iterable_graph_extender.h \ - bits/extendable_graph_extender.h \ - bits/clearable_graph_extender.h \ - bits/erasable_graph_extender.h \ - bits/undir_graph_extender.h +if HAVE_GLPK +libemon_la_SOURCES += lp_glpk.cc +libemon_la_CXXFLAGS = $(GLPK_CFLAGS) +libemon_la_LDFLAGS = $(GLPK_LIBS) +endif -noinst_HEADERS = \ - lp_base.h \ - lp_glpk.h \ - lp_skeleton.h \ - concept/graph.h \ - concept/graph_component.h \ - concept/undir_graph.h \ - concept/sym_graph.h \ - concept/maps.h \ - concept/heap.h \ +pkginclude_HEADERS = \ + bezier.h \ + bfs.h \ + dfs.h \ + bin_heap.h \ + dijkstra.h \ + dimacs.h \ + error.h \ + fib_heap.h \ + full_graph.h \ + graph_wrapper.h \ + graph_utils.h \ + graph_to_eps.h \ + invalid.h \ + kruskal.h \ + list_graph.h \ + maps.h \ + max_matching.h \ + min_cost_flow.h \ + suurballe.h \ + preflow.h \ + path.h \ + radix_heap.h \ + smart_graph.h \ + time_measure.h \ + unionfind.h \ + xy.h \ + concept_check.h \ + utility.h \ + graph_reader.h \ + graph_writer.h \ + map_utils.h \ + bits/alteration_notifier.h \ + bits/map_iterator.h \ + bits/array_map.h \ + bits/default_map.h \ + bits/extended_pair.h \ + bits/vector_map.h \ + bits/iterable_graph_extender.h \ + bits/extendable_graph_extender.h \ + bits/clearable_graph_extender.h \ + bits/erasable_graph_extender.h \ + bits/undir_graph_extender.h + +noinst_HEADERS = \ + lp_base.h \ + lp_glpk.h \ + lp_skeleton.h \ + concept/graph.h \ + concept/graph_component.h \ + concept/undir_graph.h \ + concept/sym_graph.h \ + concept/maps.h \ + concept/heap.h \ concept/path.h diff -r 115e42a5b0f7 -r 83388a4aa3af src/test/Makefile.am --- a/src/test/Makefile.am Wed Apr 13 06:49:42 2005 +0000 +++ b/src/test/Makefile.am Thu Apr 14 12:02:14 2005 +0000 @@ -2,6 +2,7 @@ LDADD = $(top_builddir)/src/lemon/libemon.la EXTRA_DIST = preflow_graph.dim dijkstra_test.lgf + noinst_HEADERS = \ test_tools.h \ graph_test.h \ @@ -18,9 +19,8 @@ graph_wrapper_test \ graph_utils_test \ kruskal_test \ - lp_test \ - max_matching_test \ - maps_test \ + max_matching_test \ + maps_test \ min_cost_flow_test \ suurballe_test \ path_test \ @@ -33,6 +33,10 @@ xy_test \ heap_test +if HAVE_GLPK +check_PROGRAMS += lp_test +endif + TESTS = $(check_PROGRAMS) XFAIL_TESTS = test_tools_fail$(EXEEXT) @@ -57,6 +61,6 @@ undir_graph_test_SOURCES = undir_graph_test.cc heap_test_SOURCES = heap_test.cc -lp_test_LDADD = $(top_builddir)/src/lemon/libemon.la -lglpk lp_test_SOURCES = lp_test.cc - +lp_test_CXXFLAGS = $(GLPK_CFLAGS) +lp_test_LDFLAGS = $(GLPK_LIBS)