1 dnl sxemacs.m4 --- macros to detect ourselves
3 dnl Copyright (C) 2007 Sebastian Freundt <hroptatyr@sxemacs.org>
5 dnl This set of macros are useful for module developers since they
6 dnl want to check for (a valid version of) SXEmacs.
7 dnl As long as we do not provide pkgconfig based magics we stick
10 dnl This file is part of SXEmacs.
12 AC_DEFUN([AC_CHECK_SXEMACS], [dnl
13 ## arg #1: minimum version
14 ## call it like: AC_CHECK_SXEMACS([22.1.7])
15 pushdef([REQUIRED_VERSION], ifelse($1,[],[22.1.7],$1))
17 AC_REQUIRE([SXE_CHECK_PKGCONFIG])
18 AC_CACHE_CHECK([for sxemacs (>= ]REQUIRED_VERSION[)],
19 [sxe_cv_feat_sxemacs], [dnl
20 _AC_CHECK_SXEMACS(REQUIRED_VERSION)])
22 if test "$sxe_cv_feat_sxemacs" = "yes"; then
23 _AC_CHECK_SXEMACS_VERSION
24 _AC_CHECK_SXEMACS_CPPFLAGS
25 moduledir=$(${PKG_CONFIG} --variable="moduledir" sxemacs)
26 sitemoduledir=$(${PKG_CONFIG} --variable="sitemoduledir" sxemacs)
27 SXE_CPPFLAGS=${sxe_cv_cppflags}
31 AC_SUBST([sitemoduledir])
32 AC_SUBST([SXE_CPPFLAGS])
33 popdef([REQUIRED_VERSION])
34 ])dnl AC_CHECK_SXEMACS
36 AC_DEFUN([_AC_CHECK_SXEMACS], [dnl
37 pushdef([REQUIRED_VERSION], [$1])
39 AC_REQUIRE([SXE_CHECK_PKGCONFIG])
40 if test "$sxe_cv_prog_pkg_config" = "no" -o -z "$PKG_CONFIG"; then
41 AS_MESSAGE([*** pkg-config not found.])
42 AS_MESSAGE([*** Cannot check for sxemacs.])
43 sxe_cv_feat_sxemacs=no
44 elif $($PKG_CONFIG --atleast-version=[]REQUIRED_VERSION[] sxemacs); then
45 sxe_cv_feat_sxemacs=yes
47 sxe_cv_feat_sxemacs=no
50 popdef([REQUIRED_VERSION])
51 ])dnl _AC_CHECK_SXEMACS
53 AC_DEFUN([_AC_CHECK_SXEMACS_VERSION], [dnl
54 AC_CACHE_CHECK([for sxemacs version], [sxe_cv_version], [dnl
55 sxe_cv_version=$($PKG_CONFIG --modversion sxemacs)])
56 ])dnl _AC_CHECK_SXEMACS_VERSION
58 AC_DEFUN([_AC_CHECK_SXEMACS_CPPFLAGS], [dnl
59 AC_CACHE_CHECK([for sxemacs includes], [sxe_cv_cppflags], [dnl
60 sxe_cv_cppflags=$($PKG_CONFIG --cflags sxemacs)])
61 ])dnl _AC_CHECK_SXEMACS_CPPFLAGS
63 dnl We only install sxemacs.m4, so any macro we use is
64 dnl supposed to be defined here
65 dnl Anyway, we install sxe-pkgconfig.m4 and just define a dummy here
66 m4_ifndef([SXE_CHECK_PKGCONFIG], [
67 AC_DEFUN([SXE_CHECK_PKGCONFIG], [dnl
68 AC_MSG_ERROR([Install `m4/sxe-pkgconfig.m4' from the SXEmacs distribution.])
69 ])dnl SXE_CHECK_PKGCONFIG
72 dnl sxemacs.m4 ends here