Bug 11243

Summary: Installed headers #include <config.h> in 0.5.9
Product: poppler Reporter: Axel Howind <Axel.Howind>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: cleanup installed header files

Description Axel Howind 2007-06-12 04:33:23 UTC
When I configure with --enable-xpdf-headers, the file <prefix>include/poppler/goo/gmem.h is installed which in turn tries to #include <config.h>. That one is however not installed, and compiling an application that uses libpoppler fails.

I can successfully compile poppler even when I simply remove the include from gmem.h, but I don't know if that would cause any side effects. Since this changed from 0.5.4, there possibly is a reason?

To me it seems that this file is included to obtain the correct value of the macro USE_EXCEPTIONS. But if that's something that has to be present in the installed headers, shouldn't it go into poppler-config.h instead?

Configuring with ./configure --disable-poppler-glib --enable-xpdf-headers, the following installed header files include config.h:
/usr/local/include/poppler/goo/FixedPoint.h:#include <config.h>
/usr/local/include/poppler/goo/gmem.h://#include <config.h>
/usr/local/include/poppler/SecurityHandler.h:#include <config.h>

I'd be happy to help with this, but don't know wether to simply remove the includes or do something smarter...

Steps to reproduce: #include <poppler/Object.h> in a source file an try to compile.

Workaround: copy config.h file from the poppler directory to somewhere in your include path.
Comment 1 Axel Howind 2007-06-13 03:23:35 UTC
Further investigation shows that the following macros are used in these headers:

    USE_GCC_PRAGMAS (used in SecurityHandler.h and FixedPoint.h)
    ENABLE_PLUGINS  (used in SecurityHandler.h)
    USE_EXCEPTIONS  (used in gmem.h)
    USE_FIXEDPOINT  (used in FixedPoint.h)
    DEBUG_MEM       (used in gmem.h)

Since only USE_EXCEPTIONS and USE_FIXEDPOINT are defined in config.h, I assume it's safe to duplicate these in config.h.in, and replace the includes in the headers.

USE_GCC_PRAGMAS, ENABLE_PLUGINS and DEBUG_MEM are not even mentioned in config.h.in.

I will try to create a patch.
Comment 2 Axel Howind 2007-06-13 05:56:27 UTC
Created attachment 10296 [details] [review]
cleanup installed header files

-include USE_EXCEPTIONS and USE_FIXEDPOINT in poppler-config.h.in
-fix typo (MULTITHREADED/MULTITHREADING) in poppler.config.h.in
-change installed headers to include poppler-config.h instead of config.h
-use <poppler/poppler-config.h> instead of <poppler-config.h> so that installed headers can be used without including .../include/poppler in the include path
Comment 3 Albert Astals Cid 2007-06-13 11:50:52 UTC
Patch commited, thanks a lot

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.