[poppler] a few CFLAGS/LIBS improvement for configure.ac

suzuki toshiya mpsuzuki at hiroshima-u.ac.jp
Tue Apr 17 04:34:02 PDT 2012


Hi,

In these 2 weeks, Jon and I were working to compile poppler for QNX
(not by genuine SDK, but) by gcc-based SDK for BlackBerry Playbook.

Because QNX is expected to be POSIX compliant operating system,
most process is almost same with the cross building for Unix systems.
However, some libc functions standardized in recent POSIX:2004,
ISO C99 are disabled by default. Some CFLAGS are expected, but
current configure of poppler refuses or overwrites the CFLAGS passed
by environmental variables. So here I propose small 3 patches to prevent
it. Please consider the application to 0.20. I'm sorry for posting
the explanations longer than the patches.

Regards,
mpsuzuki

1) Do not append "-ansi" to CXXFLAG, if "-std=XXX" is already specified.

SplashOutputDev.cc uses isfinite() function (defined by math.h).
isfinite() was standardized in C99, and imported to C++0x in later.

In QNX header file system, isfinite() is disabled by default,
the definition of __STDC_VERSION__ > 199901 is required to enable it.
In the case of GCC, "-std=c99" (for C) or "-std=gnu++0x" (for C++)
is expected.

But, current configure of poppler appends "-ansi" flag for CXXFLAGS,
if the compiler is known to be GNU. "-ansi" is C89 or C++98, so isfinite()
is unavailable. I propose a patch NOT to "-ansi" flag, if CXXFLAGS
includes "-std=XXX" already.

2) Do not clear FREETYPE_CFLAGS, FREETYPE_LIBS before PKG_CHECK_MODULES()

Although configure --help says as if environmental variables
FREETYPE_CFLAGS and FREETYPE_LIBS will overwrite the values obtained
by pkg-config. But it is not. These help messages are automatically given
by pkg-config macro (so I guess no poppler developer designed so intentionally).

In current configure, FREETYPE_CFLAGS, FREETYPE_LIBS are cleared before
PKG_CONFIG_MODULES(), like:

	dnl Check for freetype headers
	FREETYPE_LIBS=
	FREETYPE_CFLAGS=

	PKG_CHECK_MODULES(FREETYPE, freetype2,
        	          [freetype_pkgconfig=yes], [freetype_pkgconfig=no])

	if test "x$freetype_pkgconfig" = "xyes"; then

	  AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])

	else

	  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
	[...]

Checking the history why these values are cleared, it seems that
the initial revision of poppler did not use pkg-config to detect
FREETYPE_CFLAGS, _LIBS. At that time, only freetype-config is used.
In later, when PKG_CHECK_MODULES is introduced, it was accidentally
introduced AFTER the clearning of FREETYPE_CFLAGS,_LIBS. As a result,
the inconsistency between "configure --help" and what configure does
really. I propose to move the clearance of FREETYPE_CFLAGS,_LIBS
just before AC_PATH_PROG, to make PKG_CHECK_MODULES catch the environmental
values.

3) Copying graphics library CFLAGS to cpp frontend Makefile.am.

Because poppler-image.cpp includes PNGWriter.h, JpegWriter.h, TiffWriter.h,
CFLAGS to include libpng, libjpeg and libtiff headers are expected.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config-no-ansi-if-std-is-given.diff
Type: text/x-patch
Size: 379 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120417/fb035886/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config-pass-freetype-cflags-if-pkgconfig.diff
Type: text/x-patch
Size: 590 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120417/fb035886/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config-pass-graphics-cflags-to-cpp-frontend.diff
Type: text/x-patch
Size: 656 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120417/fb035886/attachment-0002.bin>


More information about the poppler mailing list