[PPL-devel] [GIT] ppl/ppl(master): The `ppl_lcdd' program can now be built and checked with cross-compilation.

Roberto Bagnara bagnara at cs.unipr.it
Fri Mar 27 18:36:35 CET 2009


Module: ppl/ppl
Branch: master
Commit: 6903cbf2427c64a4d7810286f901a363d3717cb2
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=6903cbf2427c64a4d7810286f901a363d3717cb2

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Fri Mar 27 18:34:15 2009 +0100

The `ppl_lcdd' program can now be built and checked with cross-compilation.

---

 demos/ppl_lcdd/Makefile.am             |    9 +++++----
 demos/ppl_lcdd/ppl_lcdd.1              |    5 ++++-
 demos/ppl_lcdd/ppl_lcdd.cc             |   26 +++++++++++++++++++++++++-
 demos/ppl_lcdd/ppl_lcdd_extra_man_text |    4 ++++
 4 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/demos/ppl_lcdd/Makefile.am b/demos/ppl_lcdd/Makefile.am
index 2a93f72..e038e0d 100644
--- a/demos/ppl_lcdd/Makefile.am
+++ b/demos/ppl_lcdd/Makefile.am
@@ -104,7 +104,7 @@ mit71-61.ine \
 mit90-86.ine \
 $(TOUGH_EXAMPLES_IF_ASSERTIONS_ENABLED)
 
-check-local: ppl_lcdd
+check-local: ppl_lcdd$(EXEEXT)
 	echo $(TOUGH_EXAMPLES) >tough_examples
 	echo $(ECHO_N) "$(ECHO_C)" >obtained
 	LANG=C; \
@@ -113,10 +113,11 @@ check-local: ppl_lcdd
 	  file=`basename $$path`; \
 	  $(FGREP) $$file tough_examples >/dev/null 2>&1 && continue; \
 	  echo $(ECHO_N) $$file " $(ECHO_C)" >>obtained; \
-	  echo ppl_lcdd $$path; \
-	  ./ppl_lcdd $$path | $(TEXT_MD5SUM) >>obtained; \
+	  echo ppl_lcdd$(EXEEXT) $$path; \
+	  ./ppl_lcdd$(EXEEXT) $$path | tr -d '\015' | $(TEXT_MD5SUM) \
+            >>obtained; \
 	done
-	diff -u $(srcdir)/$(EXPECTED) obtained
+	diff obtained $(srcdir)/$(EXPECTED)
 
 MOSTLYCLEANFILES = \
 tough_examples \
diff --git a/demos/ppl_lcdd/ppl_lcdd.1 b/demos/ppl_lcdd/ppl_lcdd.1
index d73a78f..f460191 100644
--- a/demos/ppl_lcdd/ppl_lcdd.1
+++ b/demos/ppl_lcdd/ppl_lcdd.1
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.36.
-.TH PPL_LCDD "1" "November 2008" "ppl_lcdd 0.10.1" "User Commands"
+.TH PPL_LCDD "1" "April 2009" "ppl_lcdd 0.10.1" "User Commands"
 .SH NAME
 ppl_lcdd \- a PPL-based program for vertex/facet enumeration of convex polyhedra
 .SH SYNOPSIS
@@ -41,6 +41,9 @@ checks if the result is equal to what is in PATH
 .SH AVAILABILITY
 The latest version of the Parma Polyhedra Library and all the documentation
 is available at \fBhttp://www.cs.unipr.it/ppl/\fR .
+.SH NOTES
+The option \fB\-CSECS\fR (\fB\-\-max\-cpu\fR=\fISECS\fR) is not available
+on some platforms.
 .SH AUTHOR
 See the file \fBCREDITS\fR in the source distribution or use the command
 \fBppl\-config \-\-credits\fR for a list of contributors.
diff --git a/demos/ppl_lcdd/ppl_lcdd.cc b/demos/ppl_lcdd/ppl_lcdd.cc
index 5439ddd..19d7889 100644
--- a/demos/ppl_lcdd/ppl_lcdd.cc
+++ b/demos/ppl_lcdd/ppl_lcdd.cc
@@ -124,6 +124,11 @@ typedef Polyhedron* POLYHEDRON_TYPE;
 # include <sys/resource.h>
 #endif
 
+#if defined(PPL_HAVE_SYS_RESOURCE_H) \
+  && (defined(SA_ONESHOT) || defined(SA_RESETHAND))
+#define PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
+#endif
+
 namespace {
 
 #ifdef PPL_HAVE_GETOPT_H
@@ -148,7 +153,9 @@ static const char* usage_string
 "and generates a V-representation (resp., an H-representation) of\n"
 "the same polyhedron.\n\n"
 "Options:\n"
+#ifdef PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
 "  -CSECS, --max-cpu=SECS  limits CPU usage to SECS seconds\n"
+#endif
 "  -RMB, --max-memory=MB   limits memory usage to MB megabytes\n"
 "  -h, --help              prints this help text to stdout\n"
 "  -oPATH, --output=PATH   appends output to PATH\n"
@@ -173,7 +180,12 @@ static const char* usage_string
 
 const char* program_name = 0;
 
+#ifdef PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
+
 unsigned long max_seconds_of_cpu_time = 0;
+
+#endif
+
 unsigned long max_bytes_of_virtual_memory = 0;
 bool print_timings = false;
 bool verbose = false;
@@ -269,6 +281,8 @@ warning(const char* format, ...) {
   va_end(ap);
 }
 
+#ifdef PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
+
 extern "C" typedef void (*sig_handler_type)(int);
 
 void
@@ -284,7 +298,7 @@ set_alarm_on_cpu_time(const unsigned seconds, sig_handler_type handler) {
 #elif defined(SA_RESETHAND)
   s.sa_flags = SA_RESETHAND;
 #else
-  #error "Either SA_ONESHOT or SA_RESETHAND must be defined."
+#error "Either SA_ONESHOT or SA_RESETHAND must be defined."
 #endif
 
   if (sigaction(SIGXCPU, &s, 0) != 0)
@@ -301,6 +315,8 @@ set_alarm_on_cpu_time(const unsigned seconds, sig_handler_type handler) {
   }
 }
 
+#endif // PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
+
 #if PPL_HAVE_DECL_RLIMIT_AS
 void
 limit_virtual_memory(const unsigned bytes) {
@@ -367,6 +383,8 @@ process_options(int argc, char* argv[]) {
       exit(0);
       break;
 
+#ifdef PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
+
     case 'C':
       l = strtol(optarg, &endptr, 10);
       if (*endptr || l < 0)
@@ -375,6 +393,8 @@ process_options(int argc, char* argv[]) {
 	max_seconds_of_cpu_time = l;
       break;
 
+#endif
+
     case 'R':
       l = strtol(optarg, &endptr, 10);
       if (*endptr || l < 0)
@@ -1143,9 +1163,13 @@ main(int argc, char* argv[]) try {
   // Process command line options.
   process_options(argc, argv);
 
+#ifdef PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME
+
   if (max_seconds_of_cpu_time > 0)
     set_alarm_on_cpu_time(max_seconds_of_cpu_time, timeout);
 
+#endif
+
   if (max_bytes_of_virtual_memory > 0)
     limit_virtual_memory(max_bytes_of_virtual_memory);
 
diff --git a/demos/ppl_lcdd/ppl_lcdd_extra_man_text b/demos/ppl_lcdd/ppl_lcdd_extra_man_text
index 0e71ed1..c3d6891 100644
--- a/demos/ppl_lcdd/ppl_lcdd_extra_man_text
+++ b/demos/ppl_lcdd/ppl_lcdd_extra_man_text
@@ -19,6 +19,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 The latest version of the Parma Polyhedra Library and all the documentation
 is available at \fBhttp://www.cs.unipr.it/ppl/\fR .
 
+[NOTES]
+The option \fB\-CSECS\fR (\fB\-\-max\-cpu\fR=\fISECS\fR) is not available
+on some platforms.
+
 [SEE ALSO]
 .BR ppl-config(1)
 .sp




More information about the PPL-devel mailing list