Hi,
On Thu, Nov 04, 2010 at 07:34:39PM -0400, Robert S. Kissel wrote:
> On Thu, Nov 4, 2010 at 5:15 AM, Michal Hocko <msts...@gmail.com> wrote:
> > OK, could you try with -D_XOPEN_SOURCE_EXTENDED instead of
>
> I'm afraid -D_XOPEN_SOURCE_EXTENDED switch made no difference:
>
> $ g++ -o test -DXOPEN_SOURCE_EXTENDED -posix -std=c++98 test.c
> test.c: In function `int main()':
> test.c:4: error: `mkstemp' was not declared in this scope
>
> $ g++ -o test -DXOPEN_SOURCE_EXTENDED -posix -std=c++98 -ansi test.c
> test.c: In function `int main()':
> test.c:4: error: `mkstemp' was not declared in this scope
This is really strange and I would say that this is a bug in cygwin. The
easiest way around this is the attached patch (see attached) which
basically provides a new parameter to configure which controls all the
x/c++ standard and portability gcc parameters. This way you can add
--enable-portability-flags=no parameter to configure
and all those compiler parameters will vanish and compilation should
pass.
Please note that you have to apply patch and run autoconf to regenerate
the configure script. If you have any problems with that just let me
know and I can send the configure script directly.
Hope this helps.
--
Michal Hocko
configure: make portability and c/c++ standard compilation flags configurable
We had a report that compilation fails on some versions of Cygwin. It turned
out that the problem is in -std=c++98 parameter forces a behavior (probably
a bug) which leads that some posix functions are not defined (namely mkstemp,
fdopen and probably others).
The easiest way to fix this is to provide a way to disable those parameters.
This should not have any effect on the result of the compilation.
This patch also adds -D_XOPEN_SOURCE=500 as both function require it.
Index: pdfedit-patches/Makefile.flags.in
===================================================================
--- pdfedit-patches.orig/Makefile.flags.in 2010-11-04 10:27:21.000000000 +0100
+++ pdfedit-patches/Makefile.flags.in 2010-11-04 10:43:36.000000000 +0100
@@ -140,8 +140,8 @@ EXTRA_XPDF_CXXFLAGS = @EXTRA_XPDF_CXXFLA
# same like for compiler stuff we also define 2 levels
# CONFIG_{NAME} can be used for qmake direct {NAME} can be used
# for compilation
-CONFIG_CFLAGS = $(DEBUG) $(OPTIM) $(ARCH) $(WARN) $(C_EXTRA) @STACK_PROTECTOR_FLAGS@ -pipe -posix -ansi -std=c99 -pedantic
-CONFIG_CXXFLAGS = $(DEBUG) $(OPTIM) $(ARCH) $(WARN) $(CXX_EXTRA) $(OBSERVER_CXXFLAGS) @STACK_PROTECTOR_FLAGS@ -pipe -posix -ansi -std=c++98
+CONFIG_CFLAGS = $(DEBUG) $(OPTIM) $(ARCH) $(WARN) $(C_EXTRA) @STACK_PROTECTOR_FLAGS@ -pipe @C_PORTABILITY_FLAGS@
+CONFIG_CXXFLAGS = $(DEBUG) $(OPTIM) $(ARCH) $(WARN) $(CXX_EXTRA) $(OBSERVER_CXXFLAGS) @STACK_PROTECTOR_FLAGS@ -pipe @CXX_PORTABILITY_FLAGS@
CFLAGS = $(CONFIG_CFLAGS)
CXXFLAGS = $(CONFIG_CXXFLAGS)
Index: pdfedit-patches/README
===================================================================
--- pdfedit-patches.orig/README 2010-11-04 10:43:46.000000000 +0100
+++ pdfedit-patches/README 2010-11-04 10:45:53.000000000 +0100
@@ -223,6 +223,8 @@ uses this feature):
make install will install also header files, libraries and
pdfedit-core-dev-config helper script (see Installation directories
bellow). This option is disabled by default.
+ -poratability-flags - adds compiler flags which force c99/c++98
+ standard and posix/ansi portability. This option is enabled by default.
Default configuration process will check for the number of CPUs/cores and
use this value for make jobs parallelization (each make will use different
Index: pdfedit-patches/configure.in
===================================================================
--- pdfedit-patches.orig/configure.in 2010-11-04 10:28:09.000000000 +0100
+++ pdfedit-patches/configure.in 2010-11-04 10:59:23.000000000 +0100
@@ -128,6 +128,25 @@ AC_SUBST(EXTRA_TESTS_CXXFLAGS)
AC_SUBST(EXTRA_GUI_CXXFLAGS)
AC_SUBST(EXTRA_XPDF_CXXFLAGS)
+AC_ARG_ENABLE(portability-flags,
+ [AS_HELP_STRING([--enable-portability-flags],
+ [Turn on compilation flags which force the c/c++ standard constructs and proper portability (this includes -std=c99, -std=c++98, -ansi, -posix, -pedantic). Enabled by default])],
+ ,
+ [enable_portability_flags=yes])
+AC_MSG_CHECKING(whether c/c++ and portability flags are forced)
+if test "x$enable_portability_flags" = "xyes"
+then
+ C_PORTABILITY_FLAGS="-posix -ansi -std=c99 -pedantic -D_XOPEN_SOURCE=500"
+ CXX_PORTABILITY_FLAGS="-posix -ansi -std=c++98 -D_XOPEN_SOURCE=500"
+ AC_MSG_RESULT(yes)
+else
+ C_PORTABILITY_FLAGS=""
+ CXX_PORTABILITY_FLAGS=""
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST(C_PORTABILITY_FLAGS)
+AC_SUBST(CXX_PORTABILITY_FLAGS)
+
dnl Default (and configurable) values for libraries
CHK_OR_DEFINE_VAR(AR, "ar cqs")
CHK_OR_DEFINE_VAR(LIBPREFIX, "lib")
Index: pdfedit-patches/Changelog
===================================================================
--- pdfedit-patches.orig/Changelog 2010-11-04 11:15:04.000000000 +0100
+++ pdfedit-patches/Changelog 2010-11-04 11:15:39.000000000 +0100
@@ -2,6 +2,7 @@
- string to font encoding fixed on the library level
- C{Dict,Array,CStream}::getProperty<Type> added
- C{Dict,Array} helpers cleanup
+ - --enable-portable-flags configure option added
* Bug 328, 355, 357, 359 fixed
* Security fixes bacported from poppler (CVE-2010-3702 and
CVE-2010-3704 received also CVE numbers)
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Pdfedit-support mailing list
Pdfedit-support@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdfedit-support