aboutsummaryrefslogtreecommitdiff
blob: a28ff1d03b517ca4f01e0c0374ed96304b079b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
AC_INIT(eselect, 1.4.27, eselect@gentoo.org, eselect)
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR(bin/eselect.in)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE

test x$prefix = xNONE && prefix="$ac_default_prefix"
test x$datadir = xNONE && datadir="$ac_default_datadir"
test x$sysconfdir = xNONE && sysconfdir="$ac_default_sysconfdir"

# AC_PROG_SED doesn't work here, because on Gentoo FreeBSD systems it
# is confused by a wrapper script that is in the PATH at build time.
AC_CHECK_PROGS(SED, [gsed sed])
if test x$SED = x; then
    AC_MSG_ERROR([sed is required])
fi
AC_MSG_CHECKING([whether $SED is GNU sed])
if $SED 'v4.0' </dev/null >/dev/null 2>&1; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([GNU sed is required])
fi

CANONICALISE=""
# realpath is included with Coreutils since version 8.15 (2012)
AC_CHECK_PROGS(REALPATH, [grealpath realpath])
if test x$REALPATH != x; then
    CANONICALISE="$REALPATH"
else
    AC_CHECK_PROGS(READLINK, [greadlink readlink])
    if test x$READLINK != x; then
        AC_MSG_CHECKING([whether $READLINK supports -f])
        if $READLINK -f . >/dev/null 2>&1; then
            AC_MSG_RESULT(yes)
            CANONICALISE="$READLINK -f"
        else
            AC_MSG_RESULT(no)
        fi
    fi
fi
if test "x$CANONICALISE" = x; then
    AC_MSG_ERROR([Either realpath or GNU readlink is required])
fi
AC_SUBST(CANONICALISE)

# Gentoo uses rst2html.py but most other
# distros install it w/o the .py extension
AC_CHECK_PROGS(RST2HTML, [rst2html rst2html.py])

# Support for Gentoo Prefix
AC_MSG_CHECKING([if target installation is in an offset prefix])
EPREFIX=""
AS_CASE([$prefix],
  [/usr], [],
  [*/usr], [EPREFIX=`echo "$prefix" | sed 's:/usr$::'`])
AC_MSG_RESULT([${EPREFIX:-nope}])
AC_SUBST(EPREFIX)

# Include extra version information when building from git
AC_MSG_CHECKING([whether building from git])
EXTRAVERSION=""
eselect_git_dir=${GIT_DIR:-${srcdir}/.git}
if GIT_DIR="${eselect_git_dir}" git rev-parse >/dev/null 2>&1; then
    COMMIT=`GIT_DIR="${eselect_git_dir}" git describe --long --always HEAD`
    if test x$COMMIT != x; then
        EXTRAVERSION=", git commit $COMMIT"
    fi
    AC_MSG_RESULT([yes${COMMIT:+, at commit $COMMIT}])
else
    AC_MSG_RESULT(no)
fi
AC_SUBST(EXTRAVERSION)

AC_CONFIG_FILES(Makefile
		doc/Makefile
		man/Makefile
		misc/Makefile
		bin/Makefile
		libs/Makefile
		modules/Makefile)
AC_OUTPUT