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