diff --git a/config/configure.ac b/config/configure.ac index 9d325624..21a63b71 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -355,22 +355,36 @@ AC_DEFUN([AX_GCC_VERSION], [ AC_SUBST([GCC_VERSION]) ]) -# 1188 v0.26 uses c++98 -# 1188 v0.27 should have an option to specify versions such as c++11 -case "$host_os" in - *cygwin*) - CPPFLAGS="$CPPFLAGS -std=gnu++98" # cygwin requires gnu++98 to support snprintf - ;; - *ming*) - CPPFLAGS="$CPPFLAGS" # mingw doesn't link pthreads if you specify -std !! - ;; - *) - CPPFLAGS="$CPPFLAGS -std=c++98" - if [[ ! -z "$GCC_VERSION" ]]; then - if [[ "$GCC_VERSION" -ge 6 ]]; then CPPFLAGS="$CPPFLAGS -std=gnu++98" ; fi # // not GCC 6 - fi - ;; -esac +AC_ARG_WITH(std, + [--with-std use --with-std for c++11. options: --with-std=11|14|c++11|c++14 default/--without-std is c++98], + STD=$withval, + STD=default) + +if test "$STD" = "11"; then + CPPFLAGS="${CPPFLAGS} -std=c++11" +elif test "$STD" = "yes"; then + CPPFLAGS="${CPPFLAGS} -std=c++11" +elif test "$STD" = "14"; then + CPPFLAGS="${CPPFLAGS} -std=c++14" +elif test "$STD" = "default" -o "$STD" = "no" ; then + # 1188 v0.26 uses c++98 + case "$host_os" in + *cygwin*) + CPPFLAGS="$CPPFLAGS -std=gnu++98" # cygwin requires gnu++98 to support snprintf + ;; + *ming*) + CPPFLAGS="$CPPFLAGS" # mingw doesn't link pthreads if you specify -std !! + ;; + *) + CPPFLAGS="$CPPFLAGS -std=c++98" + if [[ ! -z "$GCC_VERSION" ]]; then + if [[ "$GCC_VERSION" -ge 6 ]]; then CPPFLAGS="$CPPFLAGS -std=gnu++98" ; fi # // not GCC 6 + fi + ;; + esac +else + CPPFLAGS="${CPPFLAGS} -std=$STD" +fi # --------------------------------------------------------------------------- # Create output files. @@ -472,6 +486,7 @@ x1) echo "-- Using Lib SSH.................. YES" ;; esac fi +echo "CPPFLAGS= " "$CPPFLAGS" echo "------------------------------------------------------------------" echo "" diff --git a/include/exiv2/config.h b/include/exiv2/config.h index 2c99145d..748e7bd6 100644 --- a/include/exiv2/config.h +++ b/include/exiv2/config.h @@ -4,6 +4,17 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ +#ifndef CPLUSPLUS11 +#define CPLUSPLUS11 201103L +#endif + +#ifdef __cplusplus +#if __cplusplus >= CPLUSPLUS11 +#ifndef EXV_USING_CPP_ELEVEN +#define EXV_USING_CPP_ELEVEN +#endif +#endif + ///// Start of Visual Studio Support ///// #ifdef _MSC_VER diff --git a/samples/Makefile b/samples/Makefile index 1ad6364d..e4d846a0 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -124,7 +124,7 @@ LINK.cc += -rpath $(PREFIX) -L$(PREFIX) # to build the samples. Some errors only show up in this scenario, e.g., errors # due to missing headers which are not installed (depending on compile-time # settings) but may be wrongly included from other headers. -COMPILE.cc += -I$(top_srcdir)/include -I$(top_srcdir)/include/exiv2 -std=gnu++98 +COMPILE.cc += -I$(top_srcdir)/include -I$(top_srcdir)/include/exiv2 # -std=gnu++98 # ****************************************************************************** # Rules diff --git a/src/version.cpp b/src/version.cpp index fad201c5..682c7e9e 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -237,7 +237,7 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) // add edition in brackets // 7.10 = 2003 8.00 = 2005 etc 12.00 = 2013 13.00 = 2015 (yet the installer labels it as 14.0!) size_t edition = (_MSC_VER-600)/100; - const char* editions[] = { "0","1","2","3","4","5","6","2003", "2005", "2008", "2010", "2012","2013","2015"}; + const char* editions[] = { "0","1","2","3","4","5","6","2003", "2005", "2008", "2010", "2012","2013","2015","2017"}; if ( edition > lengthof(editions) ) edition = 0 ; if ( edition ) sprintf(version+::strlen(version)," (%s/%s)",editions[edition],bits==64?"x64":"x86"); #define __VERSION__ version