]> git.lyx.org Git - lyx.git/blob - config/xforms.m4
uses references instead of returning vectors
[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  
8 LIBS="$XPM_LIB $LIBS"
9  
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)])])
13 AC_SUBST(XFORMS_LIB)
14  
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>])
24
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"
29 #include "confdefs.h"
30
31 #include FORMS_H_LOCATION
32 #if ! defined(FL_INCLUDE_VERSION)
33 "%%%"(unknown)"%%%"
34 #else
35 "%%%"FL_VERSION.FL_REVISION.FL_FIXLEVEL"%%%"
36 #endif
37 EOF
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'`
41 rm -f conftest*])
42  
43 XFORMS_VERSION=$lyx_cv_xfversion
44 case "$lyx_cv_xfversion" in
45   "(unknown)"|0.8[1-7]*)
46          LYX_ERROR(dnl
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.) ;;
49     0.88*) ;;
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) ;;
54     0.89*) ;;
55     0.9999*) ;;
56     1.0*) ;;
57        *) LYX_WARNING(dnl
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.);;
60 esac
61 fi
62 ])
63
64
65  
66 dnl Check whether the xforms library has a viable image loader
67 AC_DEFUN(LYX_USE_XFORMS_IMAGE_LOADER,
68 [
69 save_LIBS=$LIBS
70 LIBS="$XFORMS_LIB $LIBS"
71 lyx_use_xforms_image_loader=no
72 AC_LANG_SAVE
73 AC_LANG_C
74
75 AC_CHECK_LIB(jpeg, jpeg_read_header, 
76   [XFORMS_IMAGE_LIB=-ljpeg
77    LIBS="$LIBS -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"
83   fi])
84 AC_SUBST(XFORMS_IMAGE_LIB)
85
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)
92 fi
93
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)
98 AC_LANG_RESTORE
99 LIBS=$save_LIBS])
100