/[path-sandbox]/trunk/configure.ac
Gentoo

Contents of /trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 377 - (show annotations) (download)
Sun Nov 9 11:08:25 2008 UTC (6 years ago) by vapier
File size: 5933 byte(s)
bump ver to 1.3.x and build lzma tarballs
1 AC_PREREQ([2.61])
2 AC_INIT([sandbox], [1.3.0], [sandbox@gentoo.org])
3 AM_INIT_AUTOMAKE
4 AC_CONFIG_HEADER([config.h])
5
6 dnl Checks for programs.
7 AC_PROG_CC
8 AC_ISC_POSIX
9 AC_PROG_INSTALL
10 AC_PROG_MAKE_SET
11 AC_PROG_AWK
12 AC_CHECK_PROGS([READELF], [readelf eu-readelf], [false])
13
14 AC_ENABLE_SHARED
15 AC_DISABLE_STATIC
16 dnl Next four lines is a hack to prevent libtool checking for CXX/F77
17 m4_undefine([AC_PROG_CXX])
18 m4_defun([AC_PROG_CXX],[])
19 m4_undefine([AC_PROG_F77])
20 m4_defun([AC_PROG_F77],[])
21 AC_PROG_LIBTOOL
22
23 AC_PREFIX_DEFAULT([/usr])
24
25 dnl Checks for libraries.
26 dnl Checks for header files.
27 AC_FUNC_ALLOCA
28 AC_HEADER_DIRENT
29 AC_HEADER_STDC
30 AC_HEADER_SYS_WAIT
31 AC_CHECK_HEADERS_ONCE([ \
32 dirent.h \
33 dlfcn.h \
34 errno.h \
35 fcntl.h \
36 libgen.h \
37 limits.h \
38 memory.h \
39 signal.h \
40 stdarg.h \
41 stddef.h \
42 stdio.h \
43 stdlib.h \
44 string.h \
45 strings.h \
46 unistd.h \
47 utime.h \
48 sys/file.h \
49 sys/mman.h \
50 sys/param.h \
51 sys/stat.h \
52 sys/time.h \
53 sys/types.h \
54 sys/wait.h \
55 ])
56
57 dnl Checks for typedefs, structures, and compiler characteristics.
58 AC_C_CONST
59 AC_TYPE_UID_T
60 AC_TYPE_MODE_T
61 AC_TYPE_SIZE_T
62 AC_CHECK_TYPES([ptrdiff_t])
63
64 dnl Checks for library functions.
65 AC_FUNC_CHOWN
66 AC_FUNC_FORK
67 AC_FUNC_LSTAT
68 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
69 AC_TYPE_SIGNAL
70 AC_FUNC_STAT
71 AC_CHECK_FUNCS([ \
72 bzero ftruncate getcwd lchown memmove \
73 memcpy memset mkdir pathconf realpath \
74 rmdir setenv strcasecmp strchr strdup \
75 strerror strndup strrchr strspn strstr \
76 strtok_r \
77 ])
78 dnl For librcutil
79 AC_CHECK_FUNCS([remove])
80
81 dnl Check if gcc provides va_copy or __va_copy (for librcutil)
82 AC_MSG_CHECKING([for va_copy])
83 AC_TRY_COMPILE([
84 #include <stdarg.h>
85 ], [
86 va_list ap, aq;
87 va_copy(ap, aq);
88 ],
89 [va_copy="va_copy"],
90 [AC_TRY_COMPILE([
91 #include <stdarg.h>
92 ], [
93 va_list ap, aq;
94 __va_copy(ap, aq);
95 ],
96 [va_copy="__va_copy"],
97 [AC_MSG_ERROR([Unable to determine name of va_copy macro])]
98 )]
99 )
100 AC_MSG_RESULT([$va_copy])
101 if test x"$va_copy" != xva_copy ; then
102 AC_DEFINE_UNQUOTED([va_copy], [$va_copy],
103 [Define to name of va_copy macro proviced by gcc if its not `va_copy'.]
104 )
105 fi
106
107 dnl Verify people aren't doing stupid shit
108 if test x"$enable_static" != xno ; then
109 AC_MSG_ERROR([dont be a Kumba, building a libsandbox.a is stupid])
110 fi
111 if test x"$enable_shared" != xyes ; then
112 AC_MSG_ERROR([dont be a Kumba, omitting a libsandbox.so is stupid])
113 fi
114 if echo $CFLAGS | $EGREP -e -static >/dev/null 2>&1; then
115 AC_MSG_ERROR([dont be a Kumba, using -static in CFLAGS is stupid])
116 fi
117 if echo $LDFLAGS | $EGREP -e -static >/dev/null 2>&1; then
118 AC_MSG_ERROR([dont be a Kumba, using -static in LDFLAGS is stupid])
119 fi
120
121 dnl Some libc's like those on bsd have dlopen() in libc, and not libdl
122 AC_CHECK_LIB([dl], [dlopen],
123 [have_libdl="yes"],
124 [have_libdl="no"]
125 )
126 if test x"$have_libdl" = xyes ; then
127 LIBDL="-ldl"
128 AC_SUBST([LIBDL])
129 DL_LIB="dl"
130 else
131 DL_LIB="c"
132 AC_CHECK_LIB([c], [dlopen],
133 [],
134 [AC_MSG_ERROR([Unable to determine library providing dlopen])]
135 )
136 fi
137
138 dnl uClibc doesn't currently provide dlvsym() so lets
139 dnl verify the toolchain supports it
140 AC_CHECK_LIB([$DL_LIB], [dlvsym],
141 [AC_DEFINE([HAVE_DLVSYM], [1], [libdl supports dlvsym])],
142 [AC_DEFINE([HAVE_DLVSYM], [0], [libdl does not support dlvsym])]
143 )
144
145 dnl when using libc5, (f)trucate's offset argument type is size_t with
146 dnl libc5, but it's off_t with libc6 (glibc2).
147 AC_MSG_CHECKING([truncate argument type])
148 TRUNC_ARG_TYPE=`echo '#include <unistd.h>' | $CC -E - | grep -q 'truncate.*size_t'`
149 if test "$TRUNC_ARG_TYPE"x != x ; then
150 AC_MSG_RESULT([size_t])
151 AC_DEFINE([TRUNCATE_T], [size_t], [truncate arg type])
152 else
153 AC_MSG_RESULT([off_t])
154 AC_DEFINE([TRUNCATE_T], [off_t], [truncate arg type])
155 fi
156
157 dnl Check if libc provides RTLD_NEXT
158 AC_MSG_CHECKING([for RTLD_NEXT])
159 AC_TRY_COMPILE([
160 #define _GNU_SOURCE
161 #include <dlfcn.h>
162 ], [
163 #if !defined(RTLD_NEXT)
164 # error no RTLD_NEXT
165 #endif
166 ],
167 [have_rtld_next="yes"],
168 [have_rtld_next="no"]
169 )
170 AC_MSG_RESULT([$have_rtld_next])
171 if test x"$have_rtld_next" = xyes ; then
172 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
173 AC_DEFINE([HAVE_RTLD_NEXT], [1], [Have RTLD_NEXT enabled libc])
174 fi
175
176 dnl we need to handle symbols differently based upon their version,
177 dnl but we have to know which symbols the libc supports first
178 AC_MSG_CHECKING([libc path])
179 echo "int main(void) { return 0; }" > libctest.c
180 $CC $CFLAGS $CPPFLAGS $LDFLAGS -Wl,-verbose -o libctest libctest.c > libctest.log 2>&1
181 cat libctest.log 1>&AS_MESSAGE_LOG_FD
182 LIBC_PATH=$(
183 $AWK '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}' libctest.log
184 )
185 rm -f libctest*
186 if test x"$LIBC_PATH" = x || ! test -r "$LIBC_PATH" ; then
187 AC_MSG_ERROR([Unable to determine LIBC PATH ($LIBC_PATH)])
188 fi
189 AC_MSG_RESULT([$LIBC_PATH])
190 AC_SUBST([LIBC_PATH])
191
192 dnl when intercepting libc calls, we have to know the name of the
193 dnl libc to load and search with dl*() calls
194 AC_MSG_CHECKING([libc version])
195 dnl the sed script at the end here looks funny but it's ok ...
196 echo "int main(void) { return 0; }" > libctest.c
197 $CC $CFLAGS $CPPFLAGS $LDFLAGS -Wall -o libctest libctest.c
198 LIBC_VERSION=$(
199 $READELF -d libctest | \
200 grep NEEDED.*libc\\.so | \
201 $AWK '{print $NF}' | sed -e ['s:\[::' -e 's:\]::']
202 )
203 rm -f libctest*
204 if test "$LIBC_VERSION"x = x ; then
205 AC_MSG_ERROR([Unable to determine LIBC VERSION])
206 fi
207 AC_MSG_RESULT([$LIBC_VERSION])
208 AC_DEFINE_UNQUOTED([LIBC_VERSION], ["$LIBC_VERSION"], [Name of libc to hook into])
209
210 dnl We add to CPPFLAGS rather than doing AC_DEFINE_UNQUOTED
211 dnl so we dont have to worry about fully expanding all of
212 dnl the variables ($sysconfdir defaults to "$prefix/etc")
213 SANDBOX_DEFINES='-DETCDIR="\"$(sysconfdir)\"" -DLIBSANDBOX_PATH="\"$(libdir)\"" -DSANDBOX_BASHRC_PATH="\"$(pkgdatadir)\""'
214 AC_SUBST([SANDBOX_DEFINES])
215
216 AC_OUTPUT([
217 Makefile
218 scripts/Makefile
219 etc/Makefile
220 data/Makefile
221 libsbutil/Makefile
222 libsandbox/Makefile
223 src/Makefile
224 ])

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20