1 dnl Usage LYX_PATH_XFORMS: Checks for xforms library and flags
2 dnl If it is found, the variable XFORMS_LIB is set to the relevant -l flags,
3 dnl and FORMS_H_LOCATION / FORMS_IMAGE_H_LOCATION is also set
4 AC_DEFUN(LYX_PATH_XFORMS,[
8 AC_CHECK_LIB(forms, fl_initialize, XFORMS_LIB="-lforms",
9 [AC_CHECK_LIB(xforms, fl_initialize, XFORMS_LIB="-lxforms",
10 [LYX_LIB_ERROR(libforms or libxforms,xforms)])])
13 ### Check for xforms headers
14 lyx_cv_forms_h_location="<forms.h>"
15 AC_CHECK_HEADER(X11/forms.h,[
16 ac_cv_header_forms_h=yes
17 lyx_cv_forms_h_location="<X11/forms.h>"],[
18 AC_CHECK_HEADER(forms.h,[],[
19 LYX_LIB_ERROR(forms.h,forms)])])
21 lyx_cv_flimage_h_location="<flimage.h>"
22 AC_CHECK_HEADER(X11/flimage.h,[
23 ac_cv_header_flimage_h=yes
24 lyx_cv_flimage_h_location="<X11/flimage.h>"],[
25 AC_CHECK_HEADER(flimage.h,[],[
26 LYX_LIB_ERROR(flimage.h,forms)])])
27 AC_DEFINE_UNQUOTED(FORMS_IMAGE_H_LOCATION,$lyx_cv_flimage_h_location)
29 AC_DEFINE_UNQUOTED(FORMS_H_LOCATION,$lyx_cv_forms_h_location)
31 if test $ac_cv_header_forms_h = yes; then
32 AC_CACHE_CHECK([xforms header version],lyx_cv_xfversion,
33 [ cat > conftest.$ac_ext <<EOF
34 #line __oline__ "configure"
37 #include FORMS_H_LOCATION
38 #if ! defined(FL_INCLUDE_VERSION)
41 "%%%"FL_VERSION.FL_REVISION.FL_FIXLEVEL"%%%"
44 lyx_cv_xfversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
45 grep '^"%%%"' 2>/dev/null | \
46 sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'`
49 XFORMS_VERSION=$lyx_cv_xfversion
50 case "$lyx_cv_xfversion" in
51 "(unknown)"|0.8[1-7]*)
53 Version $lyx_cv_xfversion of xforms is not compatible with LyX.
54 This version of LyX works best with versions 0.88 (recommended) and later.) ;;
56 0.89[01234]) LYX_WARNING(dnl
57 LyX should work ok with version $lyx_cv_xfversion of xforms[,] but
58 it is an unproven version and might still have some bugs. You should
59 probably use version 0.89.6 (or 0.88) instead) ;;
63 Version $lyx_cv_xfversion of xforms might not be compatible with LyX[,]
64 since it is newer than 0.89. You might have slight problems with it.);;
69 dnl Check whether the xforms library has a viable image loader
70 AC_DEFUN(LYX_USE_XFORMS_IMAGE_LOADER,
73 LIBS="-lflimage $XFORMS_LIB -ljpeg $LIBS"
74 lyx_use_xforms_image_loader=no
75 AC_CHECK_FUNCS(flimage_dup,[
76 AC_CHECK_FUNCS(flimage_to_pixmap,[
77 lyx_use_xforms_image_loader=yes
78 AC_CHECK_FUNCS(flimage_enable_ps)])])
80 test $lyx_use_xforms_image_loader = yes && lyx_flags="$lyx_flags xforms-image-loader" && XFORMS_IMAGE_LIB=-lflimage
81 AC_SUBST(XFORMS_IMAGE_LIB)
82 ### If the gui cannot load images itself, then we default to the
83 ### very simple one in graphics/GraphicsImageXPM.[Ch]
84 AM_CONDITIONAL(USE_BASIC_IMAGE_LOADER,
85 test $lyx_use_xforms_image_loader = no)
89 dnl Check if the image loader needs libjpeg
90 AC_DEFUN(LYX_XFORMS_IMAGE_LOADER_NEEDS_JPEG,
92 if test "$lyx_use_xforms_image_loader" = "yes" ; then
93 AC_MSG_CHECKING([whether libjpeg is needed])
96 AC_TRY_LINK([#include FORMS_H_LOCATION
97 #include FORMS_IMAGE_H_LOCATION],
99 [lyx_need_jpeg=no],[lyx_need_jpeg=yes])
101 AC_MSG_RESULT($lyx_need_jpeg)
102 if test "$lyx_need_jpeg" = "yes" ; then