]> git.lyx.org Git - lyx.git/blob - config/xforms.m4
fix some document dialog ui and add some FIXMEs
[lyx.git] / config / xforms.m4
1 dnl some macros to test for xforms-related functionality  -*- sh -*-
2
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,[
7 AC_REQUIRE([LYX_PATH_XPM])
8
9 AC_CHECK_LIB(forms, fl_initialize, XFORMS_LIB="-lforms",
10   [AC_CHECK_LIB(xforms, fl_initialize, XFORMS_LIB="-lxforms",
11     [LYX_LIB_ERROR(libforms or libxforms,xforms)], $XPM_LIB)], $XPM_LIB)
12 AC_SUBST(XFORMS_LIB)
13
14 ### Check for xforms headers
15 lyx_cv_forms_h_location="<forms.h>"
16 AC_CHECK_HEADER(X11/forms.h,[
17   ac_cv_header_forms_h=yes
18   lyx_cv_forms_h_location="<X11/forms.h>"],[
19 AC_CHECK_HEADER(forms.h,[],[
20 LYX_LIB_ERROR(forms.h,forms)])])
21 AC_DEFINE_UNQUOTED(FORMS_H_LOCATION,$lyx_cv_forms_h_location,
22    [define this to the location of forms.h to be used with #include, e.g. <forms.h>])
23
24 if test $ac_cv_header_forms_h = yes; then
25   AC_CACHE_CHECK([xforms header version],lyx_cv_xfversion,
26   [ cat > conftest.$ac_ext <<EOF
27 #line __oline__ "configure"
28 #include "confdefs.h"
29
30 #include FORMS_H_LOCATION
31 #if ! defined(FL_INCLUDE_VERSION)
32 "%%%"(unknown)"%%%"
33 #else
34 "%%%"FL_VERSION.FL_REVISION.FL_FIXLEVEL"%%%"
35 #endif
36 EOF
37 lyx_cv_xfversion=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \
38   grep '^"%%%"'  2>/dev/null | \
39   sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'`
40 rm -f conftest*])
41
42 XFORMS_VERSION=$lyx_cv_xfversion
43 case "$lyx_cv_xfversion" in
44   "(unknown)"|0.8[1-7]*)
45          LYX_ERROR(dnl
46 Version $lyx_cv_xfversion of xforms is not compatible with LyX.
47    This version of LyX works best with versions 0.88 (recommended) and later.) ;;
48     0.88*) ;;
49     0.89[01234]) LYX_WARNING(dnl
50 LyX should work ok with version $lyx_cv_xfversion of xforms[,] but
51 it is an unproven version and might still have some bugs. You should
52 probably use version 0.89.6 (or 0.88) instead) ;;
53     0.89*) ;;
54     0.9999*) ;;
55     1.0*) ;;
56        *) LYX_WARNING(dnl
57 Version $lyx_cv_xfversion of xforms might not be compatible with LyX[,]
58  since it is newer than 0.89. You might have slight problems with it.);;
59 esac
60 fi
61 ])
62
63
64
65 dnl Check whether the xforms library has a viable image loader
66 AC_DEFUN(LYX_USE_XFORMS_IMAGE_LOADER,
67 [AC_REQUIRE([LYX_PATH_XFORMS])
68 save_LIBS=$LIBS
69 LIBS="$XFORMS_LIB $XPM_LIB $LIBS"
70 lyx_use_xforms_image_loader=no
71 AC_LANG_SAVE
72 AC_LANG_C
73
74 AC_CHECK_LIB(jpeg, jpeg_read_header,
75   [XFORMS_IMAGE_LIB=-ljpeg
76    LIBS="$LIBS -ljpeg"])
77 AC_SEARCH_LIBS(flimage_dup, flimage,
78   [lyx_use_xforms_image_loader=yes
79    if test "$ac_cv_search_flimage_dup" != "none required" ; then
80      XFORMS_IMAGE_LIB="-lflimage $XFORMS_IMAGE_LIB"
81      LIBS="$XFORMS_IMAGE_LIB $LIBS"
82   fi])
83 AC_SUBST(XFORMS_IMAGE_LIB)
84
85 if test $lyx_use_xforms_image_loader = yes ; then
86   lyx_flags="$lyx_flags xforms-image-loader"
87   AC_DEFINE(USE_XFORMS_IMAGE_LOADER, 1,
88             [Define if you want to use xforms built-in image loader])
89   AC_CHECK_FUNCS(flimage_enable_ps flimage_enable_jpeg)
90   AC_CHECK_HEADERS(flimage.h X11/flimage.h, break)
91 fi
92
93 ### If the gui cannot load images itself, then we default to the
94 ### very simple one in graphics/GraphicsImageXPM.[Ch]
95 #AM_CONDITIONAL(USE_BASIC_IMAGE_LOADER,
96 #              test x$lyx_use_xforms_image_loader = xno)
97
98 AC_LANG_RESTORE
99 LIBS=$save_LIBS])