[Lemon-commits] [lemon_svn] ladanyi: r1793 - in hugo/trunk: . config src/demo src/lemon src/test

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:47:40 CET 2006


Author: ladanyi
Date: Thu Apr 14 14:02:14 2005
New Revision: 1793

Added:
   hugo/trunk/config/lp.m4
Modified:
   hugo/trunk/configure.ac
   hugo/trunk/src/demo/Makefile.am
   hugo/trunk/src/lemon/Makefile.am
   hugo/trunk/src/test/Makefile.am

Log:
 - GLPK is autodetected now


Added: hugo/trunk/config/lp.m4
==============================================================================
--- (empty file)
+++ hugo/trunk/config/lp.m4	Thu Apr 14 14:02:14 2005
@@ -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 <glpk.h>
+      }
+
+      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"])
+])

Modified: hugo/trunk/configure.ac
==============================================================================
--- hugo/trunk/configure.ac	(original)
+++ hugo/trunk/configure.ac	Thu Apr 14 14:02:14 2005
@@ -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

Modified: hugo/trunk/src/demo/Makefile.am
==============================================================================
--- hugo/trunk/src/demo/Makefile.am	(original)
+++ hugo/trunk/src/demo/Makefile.am	Thu Apr 14 14:02:14 2005
@@ -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
-lp_demo_SOURCES = lp_demo.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
\ No newline at end of file
+lp_demo_SOURCES = lp_demo.cc
+lp_demo_CXXFLAGS = $(GLPK_CFLAGS)
+lp_demo_LDFLAGS = $(GLPK_LIBS)

Modified: hugo/trunk/src/lemon/Makefile.am
==============================================================================
--- hugo/trunk/src/lemon/Makefile.am	(original)
+++ hugo/trunk/src/lemon/Makefile.am	Thu Apr 14 14:02:14 2005
@@ -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
+
+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							\
+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

Modified: hugo/trunk/src/test/Makefile.am
==============================================================================
--- hugo/trunk/src/test/Makefile.am	(original)
+++ hugo/trunk/src/test/Makefile.am	Thu Apr 14 14:02:14 2005
@@ -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)



More information about the Lemon-commits mailing list