Merge remote-tracking branch 'origin/master' into for-steve
[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         AC_SUBST(MAKEINFO)
21 ])dnl SXE_PROG_MAKEINFO
22
23
24 AC_DEFUN([SXE_PROG_AR], [dnl
25         AC_ARG_VAR([AR], [the ar command])
26         AC_CHECK_TOOL([AR], [ar], [:], [$PATH])
27         if test "$AR" = ":"; then
28                 AC_PATH_TOOL([USR_CCS_BIN_AR], [ar], [:],
29                         [$PATH:/usr/ccs/bin])
30         fi
31         if test "$AR" = ":" -a "$USR_CCS_BIN_AR" = ":"; then
32                 AC_MSG_ERROR([Uh oh, no ar is rilly bad news.])
33         elif test "$AR" = ":"; then
34                 AR=$USR_CCS_BIN_AR
35         fi
36         AC_SUBST(AR)
37 ])dnl SXE_PROG_AR
38
39
40 AC_DEFUN([SXE_PROG_BISON], [
41         AC_PROG_YACC()
42         SXE_MSG_CHECKING([for bison])
43         if test "$YACC" != "bison -y"; then
44                 AC_SUBST([BISON], [:], [location of bison])
45                 have_bison="no"
46                 sxe_cv_feat_bison="no"
47                 dnl AC_MSG_ERROR([bison not found but required])
48         else
49                 AC_SUBST([BISON], [bison], [location of bison])
50                 have_bison="yes"
51                 sxe_cv_feat_bison="yes"
52         fi
53         SXE_MSG_RESULT([${sxe_cv_feat_bison}])
54
55         ## check if bison is capable
56         if test "$sxe_cv_feat_bison" = "yes"; then
57                 SXE_MSG_CHECKING([if bison is recent enough])
58                 sxe_cv_feat_bison_version="$(${BISON} --version | head -n1)"
59                 case "$sxe_cv_feat_bison_version" in
60                 *\ 2.7* | *\ 3.*)
61                         ;;
62                 *)
63                         have_bison="no"
64                         ;;
65                 esac
66                 SXE_MSG_RESULT([${have_bison} (${sxe_cv_feat_bison_version})])
67         fi
68 ])dnl SXE_PROG_BISON
69
70
71 AC_DEFUN([SXE_CHECK_AUTOTOOL], [dnl
72         ## arg 1 tool's binary name
73         ## arg 2 sxemacs_version.m4's name
74         ## arg 3 config.h.in description
75         pushdef([autotool], [$1])
76         pushdef([AUTOTOOL], translit($1, [-a-z], [_A-Z]))
77         pushdef([v3rs1on], indir($2))
78         pushdef([descr], [$3])
79
80         AC_MSG_CHECKING([for ]autotool[ version])
81         AC_MSG_RESULT(v3rs1on)
82         AC_DEFINE_UNQUOTED(AUTOTOOL[_VERSION], "v3rs1on", descr)
83
84         popdef([descr])
85         popdef([v3rs1on])
86         popdef([AUTOTOOL])
87         popdef([autotool])
88 ])dnl SXE_CHECK_AUTOTOOL
89
90 AC_DEFUN([SXE_CHECK_AUTOTOOLS], [dnl
91         ## brag about the autotools versions
92         m4_ifdef([4UTOCONF_VERSION], [dnl
93                 SXE_CHECK_AUTOTOOL([autoconf], [4UTOCONF_VERSION],
94                         [version of autoconf used to build the configure script])])
95         m4_ifdef([4UTOHEADER_VERSION], [dnl
96                 SXE_CHECK_AUTOTOOL([autoheader], [4UTOHEADER_VERSION],
97                         [version of autoheader used to build the config.h.in])])
98         m4_ifdef([4CLOCAL_VERSION], [dnl
99                 SXE_CHECK_AUTOTOOL([aclocal], [4CLOCAL_VERSION],
100                         [version of aclocal used to incorporate m4 macros])])
101         m4_ifdef([4UTOMAKE_VERSION], [dnl
102                 SXE_CHECK_AUTOTOOL([automake], [4UTOMAKE_VERSION],
103                         [version of automake used to build the Makefiles])])
104         m4_ifdef([4IBTOOL_VERSION], [dnl
105                 SXE_CHECK_AUTOTOOL([libtool], [4IBTOOL_VERSION],
106                         [version of libtool used to provide portable linking])])
107 ])dnl SXE_CHECK_AUTOTOOLS
108
109
110 dnl recommended interface function
111 AC_DEFUN([SXE_CHECK_BUILDCHAIN], [dnl
112         AC_PROG_LN_S
113         AC_PROG_AWK
114         AC_PROG_EGREP
115         AC_PROG_FGREP
116         AC_PROG_INSTALL
117
118         SXE_CHECK_AUTOTOOLS
119         SXE_CHECK_USER_VARS
120
121 dnl     dnl Soon ...
122 dnl     dnl m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL])
123         AC_PROG_RANLIB
124         SXE_PROG_AR
125         SXE_PROG_MAKEINFO
126 ])dnl SXE_CHECK_BUILDCHAIN
127
128 dnl recommended interface macro for parser/lexer
129 AC_DEFUN([SXE_CHECK_PARSER_LEXER], [dnl
130         SXE_PROG_BISON
131         AC_PROG_LEX
132         AM_PROG_LEX
133 ])dnl SXE_CHECK_PARSER_LEXER
134
135
136 dnl sxe-bldchain-progs.m4 ends here