]> git.lyx.org Git - lyx.git/blob - lib/reLyX/acinclude.m4
a782d07774abe05ca59520f29752108d6257a5a6
[lyx.git] / lib / reLyX / acinclude.m4
1 dnl Usage: RELYX_WARNING(message)  Displays the warning "message" and sets
2 dnl the flag lyx_warning to yes.
3 AC_DEFUN([RELYX_WARNING],[
4 relyx_warning_txt="$relyx_warning_txt
5 == $1
6 "
7 relyx_warning=yes])
8
9
10 dnl RELYX_SEARCH_PROG(VARIABLE-NAME,PROGRAMS-LIST,ACTION-IF-FOUND)
11 dnl
12 define([RELYX_SEARCH_PROG],[dnl
13 case "`uname -s 2> /dev/null`" in
14 OS/2)
15   PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'`
16   PATH_IFS=';'
17   ;;
18 *)
19   PATH_IFS=':'
20   ;;
21 esac
22 for ac_prog in $2 ; do
23 # Extract the first word of "$ac_prog", so it can be a program name with
24 # args.
25   set dummy $ac_prog ; ac_word=$[2]
26   if test ! -n "[$]$1"; then
27     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}$PATH_IFS"
28     for ac_dir in $PATH; do
29       test -z "$ac_dir" && ac_dir=.
30       if test -f [$ac_dir/$ac_word] -o -f [$ac_dir/$ac_word$ac_exeext]; then
31         $1="$ac_prog"
32         break
33       fi
34     done
35     IFS="$ac_save_ifs"
36   fi
37
38   if test -n "[$]$1"; then
39     ac_result=yes
40   else
41     ac_result=no
42   fi
43   ifelse($3,,,[$3])
44   test -n "[$]$1" && break
45 done
46 ])
47
48
49 dnl Usage RELYX_PROG_PERL_OK
50 AC_DEFUN([RELYX_PROG_PERL_OK],[
51 if echo 'require 5.002;exit' | $ac_dir/$ac_prog 2>&5
52 then
53   PERL=$ac_dir/$ac_prog
54 else
55   PERL=
56 fi])
57
58 dnl Usage RELYX_CHECK_PERL
59 AC_DEFUN([RELYX_CHECK_PERL],[
60 AC_MSG_CHECKING([for perl >= 5.002])
61 RELYX_SEARCH_PROG(PERL, perl perl5 perl5.6.1  perl5.6.0 perl5.005 perl5.004 perl5.003 perl5.002,
62 RELYX_PROG_PERL_OK
63 )
64 if test -n "$PERL" ; then
65   AC_MSG_RESULT($PERL)
66 else
67   PERL="/bin/echo reLyX has been disabled because perl version 5.002 has
68 not \
69 been found.\nTo reenable it, edit "
70   AC_MSG_RESULT(no)
71   RELYX_WARNING(dnl
72 Configure has not been able to find a version 5.002 or better of Perl.
73    reLyX has been setup to only display a warning message.
74    Set variable PERL to some value to install a working reLyX.)
75 fi
76 AC_SUBST(PERL)])
77
78 dnl Usage: RELYX_CHECK_ERRORS  Displays a warning message if a RELYX_ERROR
79 dnl   has occured previously.
80 AC_DEFUN([RELYX_CHECK_ERRORS],[
81 if test x$relyx_error = xyes; then
82 cat <<EOF
83 **** The following problems have been detected by configure.
84 **** Please check the messages below before running 'make'.
85 **** (see the section 'Problems' in the INSTALL file)
86 $relyx_error_txt
87 $relyx_warning_txt
88 deleting cache $cache_file
89 EOF
90   rm -f $cache_file
91 else
92
93 if test x$relyx_warning = xyes; then
94 cat <<EOF
95 === The following minor problems have been detected by configure.
96 === Please check the messages below before running 'make'.
97 === (see the section 'Problems' in the INSTALL file)
98 $relyx_warning_txt
99 EOF
100 fi
101 fi])