From d3a145655a78abac1fe9d24003ed4ed0cbad5676 Mon Sep 17 00:00:00 2001 From: gambas Date: Sat, 1 Sep 2018 20:05:44 +0200 Subject: [PATCH] Fix compilation of gb.pdf on old gcc, by checking if the '-std=c++11' flag is available. [INTERPRETER] * NEW: Write the name of optional libraries in the warning message displayed when not found. [GB.PDF] * BUG: Fix compilation of gb.pdf on old gcc, by checking if the '-std=c++11' flag is available. --- acinclude.m4 | 12 ++++++++++++ gb.pdf/src/Makefile.am | 2 +- main/configure.ac | 6 +++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 7f2513a91..a8f248d2e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -346,6 +346,17 @@ AC_DEFUN([GB_INIT], AC_DEFINE(HAVE_GCC_LTO, 1, [Whether gcc supports -flto]) fi + dnl ---- check for -std=c++11 compiler flag + + GB_CFLAGS_GCC_OPTION([-std=c++11],, + [ + GB_CXXFLAGS_STD_CPP11=" -std=c11x" + have_gcc_std_c11x=yes + ]) + + if test "$have_gcc_std_cpp11" = "yes"; then + AC_DEFINE(HAVE_GCC_STD_CPP11, 1, [Whether g++ supports -std=c++11]) + fi dnl ---- Debug flags @@ -376,6 +387,7 @@ AC_DEFUN([GB_INIT], AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS_OPT) AC_SUBST(GB_CFLAGS_LTO) + AC_SUBST(GB_CXXFLAGS_STD_CPP11) rm -f DISABLED DISABLED.* ]) diff --git a/gb.pdf/src/Makefile.am b/gb.pdf/src/Makefile.am index f23192a43..eda3f0f36 100644 --- a/gb.pdf/src/Makefile.am +++ b/gb.pdf/src/Makefile.am @@ -5,7 +5,7 @@ gblib_LTLIBRARIES = gb.pdf.la gb_pdf_la_LIBADD = @POPPLER_LIB@ gb_pdf_la_LDFLAGS = -module @LD_FLAGS@ @POPPLER_LDFLAGS@ -gb_pdf_la_CXXFLAGS = $(AM_CXXFLAGS) -std=c++11 +gb_pdf_la_CXXFLAGS = $(AM_CXXFLAGS) $(GB_CXXFLAGS_STD_CPP11) gb_pdf_la_CPPFLAGS = @POPPLER_INC@ gb_pdf_la_SOURCES = main.h main.cpp \ diff --git a/main/configure.ac b/main/configure.ac index ee06a6cb0..bd19bd3b8 100644 --- a/main/configure.ac +++ b/main/configure.ac @@ -22,7 +22,7 @@ GB_COMPONENT( [GB_FIND(libintl.$SHLIBEXT, /opt/local /usr/local /usr /, lib)], [-lintl], [], - [This library may be located inside the system C library, so you can ignore that warning...]) + [Cannot find 'libintl' library. It may be located inside the system C library, so you can ignore that warning...]) dnl ---- Remove DISABLED file that could have been generated before @@ -36,7 +36,7 @@ GB_COMPONENT( [GB_FIND(libiconv.$SHLIBEXT, /opt/local /usr/local /usr, lib)], [-liconv], [], - [This library may be located inside the system C library, so you can ignore that warning...]) + [Cannot find 'libiconv' library. It may be located inside the system C library, so you can ignore that warning...]) dnl ---- Remove DISABLED file that could have been generated before @@ -52,7 +52,7 @@ GB_COMPONENT( [GB_FIND(libgettextlib.$SHLIBEXT, /opt/local /usr/local /usr, lib)], [-lgettextlib], [], - [This library may be located inside the system C library, so you can ignore that warning...]) + [Cannot find 'libgettextlib' library. It may be located inside the system C library, so you can ignore that warning...]) fi