1 dnl some macros to test for xforms-related functionality -*- sh -*-
3 dnl Usage LYX_PATH_XFORMS: Checks for xforms library and flags
4 dnl If it is found, the variable XFORMS_LIB is set to the relevant -l flags,
5 dnl and FORMS_H_LOCATION / FLIMAGE_H_LOCATION is also set
6 AC_DEFUN(LYX_PATH_XFORMS,[
10 AC_CHECK_LIB(forms, fl_initialize, XFORMS_LIB="-lforms",
11 [AC_CHECK_LIB(xforms, fl_initialize, XFORMS_LIB="-lxforms",
12 [LYX_LIB_ERROR(libforms or libxforms,xforms)])])
15 ### Check for xforms headers
16 lyx_cv_forms_h_location="<forms.h>"
17 AC_CHECK_HEADER(X11/forms.h,[
18 ac_cv_header_forms_h=yes
19 lyx_cv_forms_h_location="<X11/forms.h>"],[
20 AC_CHECK_HEADER(forms.h,[],[
21 LYX_LIB_ERROR(forms.h,forms)])])
22 AC_DEFINE_UNQUOTED(FORMS_H_LOCATION,$lyx_cv_forms_h_location,
23 [define this to the location of forms.h to be used with #include, e.g. <forms.h>])
25 if test $ac_cv_header_forms_h = yes; then
26 AC_CACHE_CHECK([xforms header version],lyx_cv_xfversion,
27 [ cat > conftest.$ac_ext <<EOF
28 #line __oline__ "configure"
31 #include FORMS_H_LOCATION
32 #if ! defined(FL_INCLUDE_VERSION)
35 "%%%"FL_VERSION.FL_REVISION.FL_FIXLEVEL"%%%"
38 lyx_cv_xfversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
39 grep '^"%%%"' 2>/dev/null | \
40 sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'`
43 XFORMS_VERSION=$lyx_cv_xfversion
44 case "$lyx_cv_xfversion" in
45 "(unknown)"|0.8[1-7]*)
47 Version $lyx_cv_xfversion of xforms is not compatible with LyX.
48 This version of LyX works best with versions 0.88 (recommended) and later.) ;;
50 0.89[01234]) LYX_WARNING(dnl
51 LyX should work ok with version $lyx_cv_xfversion of xforms[,] but
52 it is an unproven version and might still have some bugs. You should
53 probably use version 0.89.6 (or 0.88) instead) ;;
58 Version $lyx_cv_xfversion of xforms might not be compatible with LyX[,]
59 since it is newer than 0.89. You might have slight problems with it.);;
66 dnl Check whether the xforms library has a viable image loader
67 AC_DEFUN(LYX_USE_XFORMS_IMAGE_LOADER,
70 LIBS="$XFORMS_LIB $LIBS"
71 lyx_use_xforms_image_loader=no
75 AC_CHECK_LIB(jpeg, jpeg_read_header,
76 [XFORMS_IMAGE_LIB=-ljpeg
78 AC_SEARCH_LIBS(flimage_dup, flimage,
79 [lyx_use_xforms_image_loader=yes
80 if test "$ac_cv_search_flimage_dup" != "none required" ; then
81 XFORMS_IMAGE_LIB="-lflimage $XFORMS_IMAGE_LIB"
82 LIBS="$XFORMS_IMAGE_LIB $XFORMS_LIB $LIBS"
84 AC_SUBST(XFORMS_IMAGE_LIB)
86 if test $lyx_use_xforms_image_loader = yes ; then
87 lyx_flags="$lyx_flags xforms-image-loader"
88 AC_DEFINE(USE_XFORMS_IMAGE_LOADER, 1,
89 [Define if you want to use xforms built-in image loader])
90 AC_CHECK_FUNCS(flimage_enable_ps flimage_enable_jpeg)
91 AC_CHECK_HEADERS(flimage.h X11/flimage.h, break)
94 ### If the gui cannot load images itself, then we default to the
95 ### very simple one in graphics/GraphicsImageXPM.[Ch]
96 AM_CONDITIONAL(USE_BASIC_IMAGE_LOADER,
97 test $lyx_use_xforms_image_loader = no)