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_DEFINE_UNQUOTED(FORMS_IMAGE_H_LOCATION,$lyx_cv_flimage_h_location)
27 AC_DEFINE_UNQUOTED(FORMS_H_LOCATION,$lyx_cv_forms_h_location)
29 if test $ac_cv_header_forms_h = yes; then
30 AC_CACHE_CHECK([xforms header version],lyx_cv_xfversion,
31 [ cat > conftest.$ac_ext <<EOF
32 #line __oline__ "configure"
35 #include FORMS_H_LOCATION
36 #if ! defined(FL_INCLUDE_VERSION)
39 "%%%"FL_VERSION.FL_REVISION.FL_FIXLEVEL"%%%"
42 lyx_cv_xfversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
43 grep '^"%%%"' 2>/dev/null | \
44 sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'`
47 XFORMS_VERSION=$lyx_cv_xfversion
48 case "$lyx_cv_xfversion" in
49 "(unknown)"|0.8[1-7]*)
51 Version $lyx_cv_xfversion of xforms is not compatible with LyX.
52 This version of LyX works best with versions 0.88 (recommended) and later.) ;;
54 0.89[01234]) LYX_WARNING(dnl
55 LyX should work ok with version $lyx_cv_xfversion of xforms[,] but
56 it is an unproven version and might still have some bugs. You should
57 probably use version 0.89.6 (or 0.88) instead) ;;
61 Version $lyx_cv_xfversion of xforms might not be compatible with LyX[,]
62 since it is newer than 0.89. You might have slight problems with it.);;
67 dnl Check whether the xforms library has a viable image loader
68 AC_DEFUN(LYX_USE_XFORMS_IMAGE_LOADER,
71 LIBS="-lflimage $XFORMS_LIB -ljpeg $LIBS"
72 lyx_use_xforms_image_loader=no
73 AC_CHECK_FUNCS(flimage_dup,[
74 AC_CHECK_FUNCS(flimage_to_pixmap,[
75 lyx_use_xforms_image_loader=yes
76 AC_CHECK_FUNCS(flimage_enable_ps)])])
78 test $lyx_use_xforms_image_loader = yes && lyx_flags="$lyx_flags xforms-image-loader" && XFORMS_IMAGE_LIB=-lflimage
81 if test $lyx_use_xforms_image_loader = no ; then
82 LIBS="$XFORMS_LIB -ljpeg $LIBS"
83 lyx_use_xforms_image_loader=no
84 AC_CHECK_FUNCS(flimage_dup,[
85 AC_CHECK_FUNCS(flimage_to_pixmap,[
86 lyx_use_xforms_image_loader=yes
87 AC_CHECK_FUNCS(flimage_enable_ps)])])
91 if test $lyx_use_xforms_image_loader = no ; then
92 LIBS="$XFORMS_LIB $LIBS"
93 lyx_use_xforms_image_loader=no
94 AC_CHECK_FUNCS(flimage_dup,[
95 AC_CHECK_FUNCS(flimage_to_pixmap,[
96 lyx_use_xforms_image_loader=yes
97 AC_CHECK_FUNCS(flimage_enable_ps)])])
103 AC_SUBST(XFORMS_IMAGE_LIB)
105 ### If the gui cannot load images itself, then we default to the
106 ### very simple one in graphics/GraphicsImageXPM.[Ch]
107 AM_CONDITIONAL(USE_BASIC_IMAGE_LOADER,
108 test $lyx_use_xforms_image_loader = no)
112 dnl Check if the image loader needs libjpeg
113 AC_DEFUN(LYX_XFORMS_IMAGE_LOADER_NEEDS_JPEG,
115 if test "$lyx_use_xforms_image_loader" = "yes" ; then
116 AC_MSG_CHECKING([whether libjpeg is needed])
119 AC_TRY_LINK([#include FORMS_H_LOCATION
120 #include FORMS_IMAGE_H_LOCATION],
122 [lyx_need_jpeg=no],[lyx_need_jpeg=yes])
124 AC_MSG_RESULT($lyx_need_jpeg)
125 if test "$lyx_need_jpeg" = "yes" ; then