Thanks for the feedback, Lars. I start to see a little light in the darkness.

I'm going to try and explain what I think I need to see if I understand it 
myself. I'd be very grateful if you could look through this and correct me.

Angus


I see that if I added a test to configure.in:

### check whether to use the image loading facilities of the xforms
### library.
if test x$lyx_use_frontend = xxforms; then
        LYX_CHECK_DECL(flimage_dup, $lyx_cv_forms_h_location)
fi

then this would result in a variable in config.h HAVE_DECL_FLIMAGE_DUP

How does AC_CHECK_FUNCS(flimage_dup) work? How does it know what files to 
check?



Anyway, this simple test would be fine if the only place I needed the check 
was inside a .C file, but in this case I want to test whether to compile the 
.C file at all, so the test must result in a modification of a couple of 
Makefile.ams.

So, I can put the following test in configure.in or wrap it up in 
LYX_USE_XFORMS_GUI_LOADER and shove it in lyxinclude.m4. What do you prefer?

### check whether to use the image loading facilities of the xforms
### library.
if test x$lyx_use_frontend = xxforms; then
        LYX_CHECK_DECL(flimage_dup, $lyx_cv_forms_h_location)
        LYX_CHECK_DECL(flimage_to_pixmap, $lyx_cv_forms_h_location)

        if test x$lyx_cv_declare_forms_h_flimage_dup = xyes -a
                       x$lyx_cv_declare_forms_h_flimage_to_pixmap = xyes; then
                lyx_use_xforms_image_loader=yes
        else
                lyx_use_xforms_image_loader=no
        fi

        AM_CONDITIONAL(USE_XFORMS_IMAGE_LOADER,
                               test x$lyx_use_xforms_image_loader = xyes)

        if test x$lyx_use_xforms_image_loader = xyes; then
                LYX_CHECK_DECL(flimage_enable_ps, $lyx_cv_forms_h_location)
        fi
fi

This will result in variables in config.h

#define HAVE_DECL_FLIMAGE_DUP 1
#define HAVE_DECL_FLIMAGE_TO_PIXMAP 1
#define HAVE_DECL_FLIMAGE_ENABLE_PS 1

and means that I can also modify graphics/Makefile.am and 
frontends/xforms/Makefile.am so:

EXTRA_DIST = GraphicsImageXPM.C GraphicsImageXPM.h

if !USE_XFORMS_IMAGE_LOADER
GRAPHICSIMAGEXPM = GraphicsImageXPM.C GraphicsImageXPM.h
endif

libgraphics_la_SOURCES = \
        ... \
        $(GRAPHICSIMAGEXPM) GraphicsParams.C \
        ...

So one more question. Is 
        if !USE_XFORMS_IMAGE_LOADER
valid syntax in Makefile.am

Reply via email to