]> git.lyx.org Git - lyx.git/blob - lib/reLyX/acinclude.m4
more configure fixes
[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 Usage: RELYX_ERROR(message)  Displays the error "message" and sets
11 dnl the flag lyx_error to yes.
12 AC_DEFUN([RELYX_ERROR],[
13 relyx_error_txt="$relyx_error_txt
14 == $1
15 "
16 relyx_error=yes])
17
18
19 dnl RELYX_SEARCH_PROG(VARIABLE-NAME,PROGRAMS-LIST,ACTION-IF-FOUND)
20 dnl
21 define([RELYX_SEARCH_PROG],[dnl
22 case "`uname -s 2> /dev/null`" in
23 OS/2)
24   PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'`
25   PATH_IFS=';'
26   ;;
27 *)
28   PATH_IFS=':'
29   ;;
30 esac
31 for ac_prog in $2 ; do
32 # Extract the first word of "$ac_prog", so it can be a program name with
33 # args.
34   set dummy $ac_prog ; ac_word=$[2]
35   if test ! -n "[$]$1"; then
36     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS="${IFS}$PATH_IFS"
37     for ac_dir in $PATH; do
38       test -z "$ac_dir" && ac_dir=.
39       if test -f [$ac_dir/$ac_word] -o -f [$ac_dir/$ac_word$ac_exeext]; then
40         $1="$ac_prog"
41         break
42       fi
43     done
44     IFS="$ac_save_ifs"
45   fi
46
47   if test -n "[$]$1"; then
48     ac_result=yes
49   else
50     ac_result=no
51   fi
52   ifelse($3,,,[$3])
53   test -n "[$]$1" && break
54 done
55 ])
56
57
58 dnl Usage RELYX_PROG_PERL_OK
59 AC_DEFUN([RELYX_PROG_PERL_OK],[
60 if echo 'require 5.002;exit' | $ac_dir/$ac_prog 2>&5
61 then
62   PERL=$ac_dir/$ac_prog
63 else
64   PERL=
65 fi])
66
67 dnl Usage RELYX_CHECK_PERL
68 AC_DEFUN([RELYX_CHECK_PERL],[
69 AC_MSG_CHECKING([for perl >= 5.002])
70 RELYX_SEARCH_PROG(PERL, perl perl5 perl5.6.1  perl5.6.0 perl5.005 perl5.004 perl5.003 perl5.002,
71 RELYX_PROG_PERL_OK
72 )
73 if test -n "$PERL" ; then
74   AC_MSG_RESULT($PERL)
75 else
76   PERL="/bin/echo reLyX has been disabled because perl version 5.002 has
77 not \
78 been found.\nTo reenable it, edit "
79   AC_MSG_RESULT(no)
80   RELYX_WARNING(dnl
81 Configure has not been able to find a version 5.002 or better of Perl.
82    reLyX has been setup to only display a warning message.
83    Set variable PERL to some value to install a working reLyX.)
84 fi
85 AC_SUBST(PERL)])
86
87 dnl Usage: RELYX_CHECK_ERRORS  Displays a warning message if a RELYX_ERROR
88 dnl   has occured previously.
89 AC_DEFUN([RELYX_CHECK_ERRORS],[
90 if test x$relyx_error = xyes; then
91 cat <<EOF
92 **** The following problems have been detected by configure.
93 **** Please check the messages below before running 'make'.
94 **** (see the section 'Problems' in the INSTALL file)
95 $relyx_error_txt
96 $relyx_warning_txt
97 deleting cache $cache_file
98 EOF
99   rm -f $cache_file
100 else
101
102 if test x$relyx_warning = xyes; then
103 cat <<EOF
104 === The following minor problems have been detected by configure.
105 === Please check the messages below before running 'make'.
106 === (see the section 'Problems' in the INSTALL file)
107 $relyx_warning_txt
108 EOF
109 fi
110 fi])
111
112
113 dnl Check what kind of packaging should be used at install time. 
114 dnl The default is autodetected. 
115 AC_DEFUN([RELYX_USE_PACKAGING],
116 [AC_MSG_CHECKING([what packaging should be used])
117 AC_ARG_WITH(packaging,
118   [  --with-packaging=THIS   Use THIS packaging for installation:
119                             Possible values: posix, windows, macosx],
120   [lyx_use_packaging="$withval"], [
121   case $host in
122     *-apple-darwin*) lyx_use_packaging=macosx ;;
123      *-pc-mingw32*) lyx_use_packaging=windows;;
124                   *) lyx_use_packaging=posix;;
125   esac])
126 AC_MSG_RESULT($lyx_use_packaging)
127 case $lyx_use_packaging in 
128    macosx) default_prefix="/Applications/LyX.app"
129            bindir='${prefix}/Contents/MacOS'
130            libdir='${prefix}/Contents/Resources'
131            datadir='${prefix}/Contents/Resources'
132            mandir='${prefix}/Contents/Resources/man' ;;
133   windows) default_prefix="C:/Program Files/LyX"
134            bindir='${prefix}/bin'
135            libdir='${prefix}/Resources'
136            datadir='${prefix}/Resources'
137            mandir='${prefix}/Resources/man' ;;
138     posix) default_prefix=$ac_default_prefix ;;
139     *) RELYX_ERROR([Unknown packaging type $lyx_use_packaging]) ;;
140 esac
141 ])