Changes to autotools to support C++11 (work in progress)
This commit is contained in:
parent
df53123cfb
commit
2e816165ea
@ -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 ""
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user