diff --git a/config/config.h.cmake b/config/config.h.cmake index 865d8b3c..e3b5896c 100644 --- a/config/config.h.cmake +++ b/config/config.h.cmake @@ -50,9 +50,12 @@ #define EXV_ICONV_CONST #endif -// Definition to indicate if you have the header file. +// Definition to indicate if you have the header file. #cmakedefine EXV_HAVE_REGEX +// Definition to indicate if you have the header file. +#cmakedefine EXV_HAVE_REGEX_H + // Definition to indicate you have the header file. #cmakedefine EXV_HAVE_MEMORY_H diff --git a/config/config.h.in b/config/config.h.in index fdc3abf2..93873682 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -47,8 +47,11 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_REGEX + /* Define to 1 if you have the header file. */ -#define HAVE_REGEX 1 +#undef HAVE_REGEX_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H diff --git a/config/configure.ac b/config/configure.ac index 3972f4d1..bfb49f8d 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -56,7 +56,7 @@ AM_ICONV # Checks for header files. # --------------------------------------------------------------------------- AC_HEADER_STDC -AC_CHECK_HEADERS([libintl.h locale.h malloc.h stdint.h stdlib.h string.h unistd.h sys/mman.h utime.h regex.h]) +AC_CHECK_HEADERS([libintl.h locale.h malloc.h stdint.h stdlib.h string.h unistd.h sys/mman.h utime.h regex.h regex]) # --------------------------------------------------------------------------- # Checks for typedefs, structures, and compiler characteristics. @@ -401,7 +401,7 @@ if test "$ADOBE" = "2016" -o "$ADOBE" = "2014" -o "$ADOBE" = "2013" ; then if test "$ADOBE" == "2013" ; then ADOBE_SDK=XMP-Toolkit-SDK-CC201306; fi ENABLE_XMP=$ADOBE XMPSDK_CPPFLAGS="-Ixmpsdk/Adobe/$ADOBE_SDK/public/include" - XMPSDK_LDFLAGS="-Lxmpsdk/Adobe/$ADOBE_SDK" + XMPSDK_LDFLAGS="-Lxmpsdk/Adobe/$ADOBE_SDK -lXMPCore" case "$host_os" in *arwin*) EXV_DARWIN_FLAGS="-stdlib=libstdc++ -Wno-deprecated" diff --git a/config/generateConfigFile.cmake b/config/generateConfigFile.cmake index 7d925a30..827aec8e 100644 --- a/config/generateConfigFile.cmake +++ b/config/generateConfigFile.cmake @@ -43,7 +43,8 @@ check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) check_include_file( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) check_include_file( "sys/stat.h" EXV_HAVE_SYS_STAT_H ) check_include_file( "sys/types.h" EXV_HAVE_SYS_TYPES_H ) -check_include_file( "regex.h" EXV_HAVE_REGEX ) +check_include_file( "regex" EXV_HAVE_REGEX ) +check_include_file( "regex.h" EXV_HAVE_REGEX_H ) check_include_file( "inttypes.h" EXV_HAVE_INTTYPES_H ) if (NOT EXV_HAVE_LIBINTL_H) diff --git a/include/exiv2/version.hpp b/include/exiv2/version.hpp index 1fa1ccba..a9683997 100644 --- a/include/exiv2/version.hpp +++ b/include/exiv2/version.hpp @@ -37,20 +37,14 @@ // + standard includes #include -/*! - @brief CPLUSPLUS11 is the value of macro --cplusplus for C++11 -*/ -#define CPLUSPLUS11 201103L - -#if __cplusplus >= CPLUSPLUS11 +#if defined(HAVE_REGEX) # include /*! @brief exv_grep_keys_t is a vector of keys to match to strings */ typedef std::vector exv_grep_keys_t ; -#else -# ifdef EXV_HAVE_REGEX -# include +#elif defined(EXV_HAVE_REGEX_H) +# include /*! @brief exv_grep_keys_t is a vector of keys to match to strings */ @@ -76,7 +70,6 @@ @brief exv_grep_keys_t is a vector of keys to match to strings */ typedef std::vector exv_grep_keys_t ; -# endif #endif /*! diff --git a/src/actions.cpp b/src/actions.cpp index 1e16c3b6..fe14de40 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -591,11 +591,10 @@ namespace Action { for (Params::Greps::const_iterator g = Params::instance().greps_.begin(); !result && g != Params::instance().greps_.end(); ++g) { -#if __cplusplus >= CPLUSPLUS11 +#if defined(EXV_HAVE_REGEX) std::smatch m; result = std::regex_search(key,m, *g); -#else -#ifdef EXV_HAVE_REGEX +#elif defined(EXV_HAVE_REGEX_H) result = regexec( &(*g), key.c_str(), 0, NULL, 0) == 0 ; #else std::string Pattern(g->pattern_); @@ -606,7 +605,6 @@ namespace Action { std::transform(Key.begin() , Key.end() ,Key.begin() , ::tolower); } result = Key.find(Pattern) != std::string::npos; -#endif #endif } return result ; diff --git a/src/exiv2.cpp b/src/exiv2.cpp index 698b528e..46ea833c 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -47,7 +47,9 @@ EXIV2_RCSID("@(#) $Id$") #include #include -#ifdef EXV_HAVE_REGEX +#if defined(EXV_HAVE_REGEX) +#include +#elif defined(EXV_HAVE_REGEX_H) #include #endif @@ -451,10 +453,9 @@ int Params::evalGrep( const std::string& optarg) std::string pattern; std::string ignoreCase("/i"); bool bIgnoreCase = ends_with(optarg,ignoreCase,pattern); -#if __cplusplus >= CPLUSPLUS11 +#if defined(EXV_HAVE_REGEX) greps_.push_back( std::regex(pattern, bIgnoreCase ? std::regex::icase|std::regex::extended : std::regex::extended) ); -#else -#ifdef EXV_HAVE_REGEX +#elif defined(EXV_HAVE_REGEX_H) // try to compile a reg-exp from the input argument and store it in the vector const size_t i = greps_.size(); greps_.resize(i + 1); @@ -478,7 +479,6 @@ int Params::evalGrep( const std::string& optarg) } #else greps_.push_back(Exiv2_grep_key_t(pattern,bIgnoreCase)); -#endif #endif return result; } // Params::evalGrep diff --git a/src/version.cpp b/src/version.cpp index 3b92e852..a2278429 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -173,11 +173,10 @@ static bool shouldOutput(const exv_grep_keys_t& greps,const char* key,const std: !bPrint && g != greps.end() ; ++g ) { std::string Key(key); -#if __cplusplus >= CPLUSPLUS11 +#if defined(EXV_HAVE_REGEX) std::smatch m; bPrint = std::regex_search(Key,m,*g) || std::regex_search(value,m,*g); -#else -#ifdef EXV_HAVE_REGEX +#elif defined(EXV_HAVE_REGEX_H) bPrint = ( 0 == regexec( &(*g), key , 0, NULL, 0) || 0 == regexec( &(*g), value.c_str(), 0, NULL, 0) ); @@ -191,7 +190,6 @@ static bool shouldOutput(const exv_grep_keys_t& greps,const char* key,const std: std::transform(Value.begin() , Value.end() ,Value.begin() , ::tolower); } bPrint = Key.find(Pattern) != std::string::npos || Value.find(Pattern) != std::string::npos; -#endif #endif } return bPrint;