[PPL-devel] [GIT] ppl/ppl(master): Try to accommodate non-GNU implementations of `getopt()'.

Roberto Bagnara bagnara at cs.unipr.it
Sat Mar 28 20:34:05 CET 2009


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

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sat Mar 28 20:33:52 2009 +0100

Try to accommodate non-GNU implementations of `getopt()'.

---

 demos/ppl_lcdd/ppl_lcdd.cc  |   14 ++++++++++++++
 demos/ppl_lpsol/ppl_lpsol.c |   14 ++++++++++++++
 src/ppl-config.cc.in        |   15 +++++++++++++++
 3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/demos/ppl_lcdd/ppl_lcdd.cc b/demos/ppl_lcdd/ppl_lcdd.cc
index a3af359..6a149ae 100644
--- a/demos/ppl_lcdd/ppl_lcdd.cc
+++ b/demos/ppl_lcdd/ppl_lcdd.cc
@@ -106,8 +106,22 @@ typedef Polyhedron* POLYHEDRON_TYPE;
 
 #ifdef PPL_HAVE_GETOPT_H
 #include <getopt.h>
+
+// Try to accommodate non-GNU implementations of `getopt()'.
+#if !defined(no_argument)
+#define no_argument NO_ARG
+#endif
+
+#if !defined(required_argument)
+#define required_argument REQUIRED_ARG
 #endif
 
+#if !defined(optional_argument)
+#define optional_argument OPTIONAL_ARG
+#endif
+
+#endif // defined(PPL_HAVE_GETOPT_H)
+
 #ifdef PPL_HAVE_UNISTD_H
 // Include this for `getopt()': especially important if we do not have
 // <getopt.h>.
diff --git a/demos/ppl_lpsol/ppl_lpsol.c b/demos/ppl_lpsol/ppl_lpsol.c
index 41c8d9d..b5cf668 100644
--- a/demos/ppl_lpsol/ppl_lpsol.c
+++ b/demos/ppl_lpsol/ppl_lpsol.c
@@ -41,8 +41,22 @@ site: http://www.cs.unipr.it/ppl/ . */
 
 #ifdef PPL_HAVE_GETOPT_H
 # include <getopt.h>
+
+/* Try to accommodate non-GNU implementations of `getopt()'. */
+#if !defined(no_argument)
+#define no_argument NO_ARG
+#endif
+
+#if !defined(required_argument)
+#define required_argument REQUIRED_ARG
 #endif
 
+#if !defined(optional_argument)
+#define optional_argument OPTIONAL_ARG
+#endif
+
+#endif /* defined(PPL_HAVE_GETOPT_H) */
+
 #ifdef PPL_HAVE_UNISTD_H
 /* Include this for `getopt()': especially important if we do not have
    <getopt.h>. */
diff --git a/src/ppl-config.cc.in b/src/ppl-config.cc.in
index 64b963e..629416f 100644
--- a/src/ppl-config.cc.in
+++ b/src/ppl-config.cc.in
@@ -40,14 +40,29 @@ namespace PPL = Parma_Polyhedra_Library;
 
 #ifdef PPL_HAVE_GETOPT_H
 #include <getopt.h>
+
+// Try to accommodate non-GNU implementations of `getopt()'.
+#if !defined(no_argument)
+#define no_argument NO_ARG
+#endif
+
+#if !defined(required_argument)
+#define required_argument REQUIRED_ARG
 #endif
 
+#if !defined(optional_argument)
+#define optional_argument OPTIONAL_ARG
+#endif
+
+#endif // defined(PPL_HAVE_GETOPT_H)
+
 #ifdef PPL_HAVE_UNISTD_H
 // Include this for `getopt()': especially important if we do not have
 // <getopt.h>.
 #include <unistd.h>
 #endif
 
+
 namespace {
 
 enum Format {




More information about the PPL-devel mailing list