Use cmakedefine01 for more trivial defines
[alexxy/gromacs.git] / src / gromacs / utility / gmxregex.cpp
index ec57d4fce4e33c698ed8849f0c8f5da976b8bfe8..4b3270eca7296f775c29dd7e26252c3e80646ffa 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
  *
  * GROMACS is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_utility
  */
+#include "gmxpre.h"
+
 #include "gmxregex.h"
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
-#if defined(HAVE_POSIX_REGEX)
+#if HAVE_POSIX_REGEX
+#    include <sys/types.h>
 // old Mac needs sys/types.h before regex.h
-#include <sys/types.h>
-#include <regex.h>
-#define USE_POSIX_REGEX
-#elif defined(HAVE_CXX11_REGEX)
-#include <regex>
-#define USE_CXX11_REGEX
+#    include <regex.h>
+#elif HAVE_CXX11_REGEX
+#    include <regex>
 #endif
 
-#include "exceptions.h"
-#include "stringutil.h"
+#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/stringutil.h"
 
 namespace gmx
 {
@@ -64,14 +62,14 @@ namespace gmx
 // static
 bool Regex::isSupported()
 {
-#if defined(USE_POSIX_REGEX) || defined(USE_CXX11_REGEX)
+#if HAVE_POSIX_REGEX || HAVE_CXX11_REGEX
     return true;
 #else
     return false;
 #endif
 }
 
-#if defined(USE_POSIX_REGEX)
+#if HAVE_POSIX_REGEX
 class Regex::Impl
 {
     public:
@@ -113,7 +111,7 @@ class Regex::Impl
 
         regex_t                 regex_;
 };
-#elif defined(USE_CXX11_REGEX)
+#elif HAVE_CXX11_REGEX
 class Regex::Impl
 {
     public:
@@ -161,19 +159,19 @@ class Regex::Impl
         explicit Impl(const char * /*value*/)
         {
             GMX_THROW(NotImplementedError(
-                              "Gromacs is compiled without regular expression support"));
+                              "GROMACS is compiled without regular expression support"));
         }
         explicit Impl(const std::string & /*value*/)
         {
             GMX_THROW(NotImplementedError(
-                              "Gromacs is compiled without regular expression support"));
+                              "GROMACS is compiled without regular expression support"));
         }
 
         bool match(const char * /*value*/) const
         {
             // Should never be reached.
             GMX_THROW(NotImplementedError(
-                              "Gromacs is compiled without regular expression support"));
+                              "GROMACS is compiled without regular expression support"));
         }
 };
 #endif