Build Fix -- compatibility issue with newer autoconf
[sxemacs] / m4 / sxe-bldchain-progs.m4
1 dnl sxe-bldchain-progs.m4 -- Necessary build chain stuff
2
3 AC_DEFUN([SXE_PROG_MAKEINFO], [dnl
4         AC_ARG_VAR([MAKEINFO], [the makeinfo command])
5         AC_CHECK_TOOL([MAKEINFO], [makeinfo], [:], [$PATH])
6         eval "$MAKEINFO --version > /dev/null 2>&1"
7         if  test $? != 0; then
8                 if echo $MAKEINFO | grep -q "missing --run"; then
9                         # libtool missing has a much nicer error message
10                         $MAKEINFO
11                 fi
12                 # This should be a good enough error message even in complement
13                 # to the libtool missing
14                 AC_MSG_ERROR([
15 Could not find the makeinfo program. Check your PATH or install the texinfo package.
16 For more details see the INSTALL and PROBLEMS files.
17 SXEmacs generates the documentation during the build process.])
18                 exit 1
19         fi
20         SXE_MSG_CHECKING([makeinfo version])
21         makeinfo_ver=`eval "$MAKEINFO" --version 2> /dev/null | head -n 1`
22         SXE_MSG_RESULT([${makeinfo_ver}])
23         AC_DEFINE_UNQUOTED(MAKEINFO_VERSION, "${makeinfo_ver}",
24                           [the makeinfo command version])
25         case `echo "$makeinfo_ver" | $SED -e 's/^.* \([[0-9.]]*\).*/\1/'`  in
26             [[1234]].*)
27                 AC_MSG_ERROR([
28 Your makeinfo program is too old. Please install 5.x or later.])
29                 exit 1
30             ;;
31         esac
32         AC_SUBST(MAKEINFO)
33         AC_SUBST(MAKEINFO_VERSION)
34 ])dnl SXE_PROG_MAKEINFO
35
36
37 AC_DEFUN([SXE_PROG_AR], [dnl
38         AC_ARG_VAR([AR], [the ar command])
39         AC_CHECK_TOOL([AR], [ar], [:], [$PATH])
40         if test "$AR" = ":"; then
41                 AC_PATH_TOOL([USR_CCS_BIN_AR], [ar], [:],
42                         [$PATH:/usr/ccs/bin])
43         fi
44         if test "$AR" = ":" -a "$USR_CCS_BIN_AR" = ":"; then
45                 AC_MSG_ERROR([Uh oh, no ar is rilly bad news.])
46         elif test "$AR" = ":"; then
47                 AR=$USR_CCS_BIN_AR
48         fi
49         AC_SUBST(AR)
50 ])dnl SXE_PROG_AR
51
52
53 AC_DEFUN([SXE_PROG_BISON], [
54         AC_PROG_YACC()
55         SXE_MSG_CHECKING([for bison])
56         if test "$YACC" != "bison -y"; then
57                 AC_SUBST([BISON], [:], [location of bison])
58                 have_bison="no"
59                 sxe_cv_feat_bison="no"
60                 dnl AC_MSG_ERROR([bison not found but required])
61         else
62                 AC_SUBST([BISON], [bison], [location of bison])
63                 have_bison="yes"
64                 sxe_cv_feat_bison="yes"
65         fi
66         SXE_MSG_RESULT([${sxe_cv_feat_bison}])
67
68         ## check if bison is capable
69         if test "$sxe_cv_feat_bison" = "yes"; then
70                 SXE_MSG_CHECKING([if bison is recent enough])
71                 sxe_cv_feat_bison_version="$(${BISON} --version | head -n1)"
72                 case "$sxe_cv_feat_bison_version" in
73                 *\ 2.7* | *\ 3.*)
74                         ;;
75                 *)
76                         have_bison="no"
77                         ;;
78                 esac
79                 SXE_MSG_RESULT([${have_bison} (${sxe_cv_feat_bison_version})])
80         fi
81 ])dnl SXE_PROG_BISON
82
83
84 AC_DEFUN([SXE_CHECK_AUTOTOOL], [dnl
85         ## arg 1 tool's binary name
86         ## arg 2 sxemacs_version.m4's name
87         ## arg 3 config.h.in description
88         pushdef([autotool], [$1])
89         pushdef([AUTOTOOL], translit($1, [-a-z], [_A-Z]))
90         pushdef([v3rs1on], indir($2))
91         pushdef([descr], [$3])
92
93         AC_MSG_CHECKING([for ]autotool[ version])
94         AC_MSG_RESULT(v3rs1on)
95         AC_DEFINE_UNQUOTED(AUTOTOOL[_VERSION], "v3rs1on", descr)
96
97         popdef([descr])
98         popdef([v3rs1on])
99         popdef([AUTOTOOL])
100         popdef([autotool])
101 ])dnl SXE_CHECK_AUTOTOOL
102
103 AC_DEFUN([SXE_CHECK_AUTOTOOLS], [dnl
104         ## brag about the autotools versions
105         m4_ifdef([4UTOCONF_VERSION], [dnl
106                 SXE_CHECK_AUTOTOOL([autoconf], [4UTOCONF_VERSION],
107                         [version of autoconf used to build the configure script])])
108         m4_ifdef([4UTOHEADER_VERSION], [dnl
109                 SXE_CHECK_AUTOTOOL([autoheader], [4UTOHEADER_VERSION],
110                         [version of autoheader used to build the config.h.in])])
111         m4_ifdef([4CLOCAL_VERSION], [dnl
112                 SXE_CHECK_AUTOTOOL([aclocal], [4CLOCAL_VERSION],
113                         [version of aclocal used to incorporate m4 macros])])
114         m4_ifdef([4UTOMAKE_VERSION], [dnl
115                 SXE_CHECK_AUTOTOOL([automake], [4UTOMAKE_VERSION],
116                         [version of automake used to build the Makefiles])])
117         m4_ifdef([4IBTOOL_VERSION], [dnl
118                 SXE_CHECK_AUTOTOOL([libtool], [4IBTOOL_VERSION],
119                         [version of libtool used to provide portable linking])])
120 ])dnl SXE_CHECK_AUTOTOOLS
121
122
123 dnl recommended interface function
124 AC_DEFUN([SXE_CHECK_BUILDCHAIN], [dnl
125         AC_PROG_LN_S
126         AC_PROG_AWK
127         AC_PROG_EGREP
128         AC_PROG_FGREP
129         AC_PROG_INSTALL
130
131         SXE_CHECK_AUTOTOOLS
132         SXE_CHECK_USER_VARS
133
134 dnl     dnl Soon ...
135 dnl     dnl m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL])
136         AC_PROG_RANLIB
137         SXE_PROG_AR
138         SXE_PROG_MAKEINFO
139 ])dnl SXE_CHECK_BUILDCHAIN
140
141 dnl recommended interface macro for parser/lexer
142 AC_DEFUN([SXE_CHECK_PARSER_LEXER], [dnl
143         SXE_PROG_BISON
144         AC_PROG_LEX
145         AM_PROG_LEX
146 ])dnl SXE_CHECK_PARSER_LEXER
147
148
149 dnl sxe-bldchain-progs.m4 ends here