aboutsummaryrefslogtreecommitdiff
blob: c638ef2dce76f4c797de5b5de6c37f51e2b1b08c (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
AC_PREREQ(2.59)
AC_INIT(sandbox, 1.2, dev-portage@gentoo.org)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_AWK

AC_ENABLE_SHARED
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

AC_PREFIX_DEFAULT([/usr])

# Checks for libraries.
# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([ \
fcntl.h limits.h memory.h stddef.h \
stdlib.h string.h strings.h sys/file.h \
sys/param.h sys/time.h unistd.h utime.h \
])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([ \
bzero ftruncate getcwd lchown memmove \
mempcpy memset mkdir pathconf realpath \
rmdir setenv strcasecmp strchr strdup \
strerror strndup strrchr strspn strstr \
])

dnl
dnl FIXME: the following needs to be made portable
dnl

dnl when using libc5, (f)trucate's offset argument type is size_t with
dnl libc5, but it's off_t with libc6 (glibc2).
AC_MSG_CHECKING(truncate argument type)
if grep -q 'truncate.*size_t' /usr/include/unistd.h ; then
	AC_MSG_RESULT(size_t)
	AC_DEFINE(TRUNCATE_T, size_t, [truncate arg type])
else
	AC_MSG_RESULT(off_t)
	AC_DEFINE(TRUNCATE_T, off_t, [truncate arg type])
fi

AC_MSG_CHECKING(Checking libc version)
echo "int main(void) { return 0; }" > libctest.c
gcc -Wall -o libctest libctest.c
LIBC_VERSION=`ldd libctest | grep libc\\.so | grep -v 'ld-uClibc' | ${AWK} '{print $1}'`
LIBC_PATH=`ldd libctest | grep libc\\.so | grep -v 'ld-uClibc' | ${AWK} '{print $3}'`
rm -f libctest
AC_SUBST(LIBC_VERSION)
AC_SUBST(LIBC_PATH)
AC_MSG_RESULT(${LIBC_VERSION})

AC_OUTPUT([Makefile])