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

Diff of /trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 232 Revision 439
1AC_PREREQ([2.59]) 1AC_PREREQ([2.61])
2AC_INIT([sandbox], [1.2.17], [sandbox@gentoo.org]) 2AC_INIT([sandbox], [1.3.1], [sandbox@gentoo.org])
3
4AC_MSG_ERROR([SVN is dead, use GIT: http://git.overlays.gentoo.org/gitweb/?p=proj/sandbox.git;a=summary])
5
6sb_configure_opts="$*"
3AM_INIT_AUTOMAKE 7AM_INIT_AUTOMAKE
4AC_CONFIG_HEADER([config.h]) 8AC_CONFIG_HEADER([config.h])
5 9
10AC_DEFINE_UNQUOTED([SANDBOX_CONFIGURE_OPTS], ["${sb_configure_opts}"], [Arguments given to ./configure])
11
6dnl Checks for programs. 12dnl Checks for programs.
7AC_PROG_CC 13AC_PROG_CC
14AM_PROG_CC_C_O
8AC_ISC_POSIX 15AC_ISC_POSIX
9AC_PROG_INSTALL 16AC_PROG_INSTALL
10AC_PROG_MAKE_SET 17AC_PROG_MAKE_SET
11AC_PROG_AWK 18AC_PROG_AWK
12AC_CHECK_PROGS([READELF], [readelf], [false]) 19AC_CHECK_PROGS([READELF], [readelf eu-readelf], [false])
20AM_MISSING_PROG([AUTOM4TE], [autom4te])
13 21
14AC_ENABLE_SHARED 22AC_ENABLE_SHARED
15AC_DISABLE_STATIC 23AC_DISABLE_STATIC
16dnl Next four lines is a hack to prevent libtool checking for CXX/F77 24dnl Next four lines is a hack to prevent libtool checking for CXX/F77
17m4_undefine([AC_PROG_CXX]) 25m4_undefine([AC_PROG_CXX])
20m4_defun([AC_PROG_F77],[]) 28m4_defun([AC_PROG_F77],[])
21AC_PROG_LIBTOOL 29AC_PROG_LIBTOOL
22 30
23AC_PREFIX_DEFAULT([/usr]) 31AC_PREFIX_DEFAULT([/usr])
24 32
33dnl this test fills up the stack and then triggers a segfault ...
34dnl but it's hard to wrap things without a stack, so let's ignore
35dnl this test for now ...
36ac_cv_header_sigsegv_h=no
37ac_cv_lib_sigsegv_stackoverflow_install_handler=false
38
25dnl Checks for libraries. 39dnl Checks for libraries.
26dnl Checks for header files. 40dnl Checks for header files.
27AC_FUNC_ALLOCA 41AC_FUNC_ALLOCA
28AC_HEADER_DIRENT 42AC_HEADER_DIRENT
29AC_HEADER_STDC 43AC_HEADER_STDC
30AC_HEADER_SYS_WAIT 44AC_HEADER_SYS_WAIT
31AC_CHECK_HEADERS([ \ 45AC_CHECK_HEADERS_ONCE([ \
32 fcntl.h limits.h memory.h stddef.h \ 46 dirent.h \
33 stdlib.h string.h strings.h sys/file.h \ 47 dlfcn.h \
34 sys/param.h sys/time.h unistd.h utime.h \ 48 elf.h \
49 errno.h \
50 execinfo.h \
51 fcntl.h \
52 libgen.h \
53 limits.h \
54 memory.h \
55 signal.h \
56 sigsegv.h \
57 stdarg.h \
58 stdbool.h \
59 stddef.h \
60 stdio.h \
61 stdlib.h \
62 string.h \
63 strings.h \
64 syscall.h \
65 unistd.h \
66 utime.h \
67 sys/file.h \
68 sys/mman.h \
69 sys/param.h \
70 sys/stat.h \
71 sys/time.h \
72 sys/types.h \
73 sys/wait.h \
35]) 74])
36 75
37dnl Checks for typedefs, structures, and compiler characteristics. 76dnl Checks for typedefs, structures, and compiler characteristics.
38AC_C_CONST 77AC_C_CONST
39AC_TYPE_UID_T 78AC_TYPE_UID_T
46AC_FUNC_FORK 85AC_FUNC_FORK
47AC_FUNC_LSTAT 86AC_FUNC_LSTAT
48AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK 87AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
49AC_TYPE_SIGNAL 88AC_TYPE_SIGNAL
50AC_FUNC_STAT 89AC_FUNC_STAT
51AC_CHECK_FUNCS([ \ 90AC_CHECK_FUNCS_ONCE([ \
52 bzero ftruncate getcwd lchown memmove \ 91 backtrace \
53 memcpy memset mkdir pathconf realpath \ 92 ftruncate \
54 rmdir setenv strcasecmp strchr strdup \ 93 getcwd \
55 strerror strndup strrchr strspn strstr \ 94 lchown \
95 memmove \
96 memcpy \
97 memset \
98 mkdir \
99 pathconf \
100 realpath \
101 remove \
102 rmdir \
103 setenv \
104 strcasecmp \
105 strchr \
106 strdup \
107 strerror \
108 strndup \
109 strrchr \
110 strspn \
111 strstr \
112 strtok_r \
56]) 113])
114AC_CHECK_LIB([sigsegv], [stackoverflow_install_handler],
115 [HAVE_LIBSIGSEGV=true],
116 [HAVE_LIBSIGSEGV=false])
117AM_CONDITIONAL(HAVE_LIBSIGSEGV, $HAVE_LIBSIGSEGV)
118
119dnl Check if gcc provides va_copy or __va_copy (for librcutil)
120AC_MSG_CHECKING([for va_copy])
121AC_TRY_COMPILE([
122 #include <stdarg.h>
123 ], [
124 va_list ap, aq;
125 va_copy(ap, aq);
126 ],
127 [va_copy="va_copy"],
128 [AC_TRY_COMPILE([
129 #include <stdarg.h>
130 ], [
131 va_list ap, aq;
132 __va_copy(ap, aq);
133 ],
134 [va_copy="__va_copy"],
135 [AC_MSG_ERROR([Unable to determine name of va_copy macro])]
136 )]
137)
138AC_MSG_RESULT([$va_copy])
139if test x"$va_copy" != xva_copy ; then
140 AC_DEFINE_UNQUOTED([va_copy], [$va_copy],
141 [Define to name of va_copy macro proviced by gcc if its not `va_copy'.]
142 )
143fi
144
145dnl Verify people aren't doing stupid shit
146if test x"$enable_static" != xno ; then
147 AC_MSG_ERROR([dont be a Kumba, building a libsandbox.a is stupid])
148fi
149if test x"$enable_shared" != xyes ; then
150 AC_MSG_ERROR([dont be a Kumba, omitting a libsandbox.so is stupid])
151fi
152if echo $CFLAGS | $EGREP -e -static >/dev/null 2>&1; then
153 AC_MSG_ERROR([dont be a Kumba, using -static in CFLAGS is stupid])
154fi
155if echo $LDFLAGS | $EGREP -e -static >/dev/null 2>&1; then
156 AC_MSG_ERROR([dont be a Kumba, using -static in LDFLAGS is stupid])
157fi
57 158
58dnl Some libc's like those on bsd have dlopen() in libc, and not libdl 159dnl Some libc's like those on bsd have dlopen() in libc, and not libdl
59AC_CHECK_LIB([dl], [dlopen], 160AC_CHECK_LIB([dl], [dlopen],
60 [have_libdl="yes"], 161 [have_libdl="yes"],
61 [have_libdl="no"] 162 [have_libdl="no"]
62) 163)
63if test x"$have_libdl" = xyes ; then 164if test x"$have_libdl" = xyes ; then
64 LIBDL="-ldl" 165 LIBDL="-ldl"
65 AC_SUBST([LIBDL]) 166 AC_SUBST([LIBDL])
66 DL_LIB="dl" 167 DL_LIB="dl"
67else 168else
68 DL_LIB="c" 169 DL_LIB="c"
69 AC_CHECK_LIB([c], [dlopen], 170 AC_CHECK_LIB([c], [dlopen],
70 [], 171 [],
71 [AC_MSG_ERROR([Unable to determine library providing dlopen])] 172 [AC_MSG_ERROR([Unable to determine library providing dlopen])]
72 ) 173 )
73fi 174fi
74 175
75dnl uClibc doesn't currently provide dlvsym() so lets 176dnl uClibc doesn't currently provide dlvsym() so lets
76dnl verify the toolchain supports it 177dnl verify the toolchain supports it
77AC_CHECK_LIB([$DL_LIB], [dlvsym], 178AC_CHECK_LIB([$DL_LIB], [dlvsym],
78 [AC_DEFINE([HAVE_DLVSYM], [1], [libdl supports dlvsym])], 179 [AC_DEFINE([HAVE_DLVSYM], [1], [libdl supports dlvsym])],
79 [AC_DEFINE([HAVE_DLVSYM], [0], [libdl does not support dlvsym])] 180 [AC_DEFINE([HAVE_DLVSYM], [0], [libdl does not support dlvsym])]
80) 181)
81 182
82dnl when using libc5, (f)trucate's offset argument type is size_t with 183dnl when using libc5, (f)trucate's offset argument type is size_t with
83dnl libc5, but it's off_t with libc6 (glibc2). 184dnl libc5, but it's off_t with libc6 (glibc2).
84AC_MSG_CHECKING([truncate argument type]) 185AC_MSG_CHECKING([truncate argument type])
85TRUNC_ARG_TYPE=`echo '#include <unistd.h>' | $CC -E - | grep -q 'truncate.*size_t'` 186TRUNC_ARG_TYPE=`echo '#include <unistd.h>' | $CC -E - | grep -q 'truncate.*size_t'`
86if test "$TRUNC_ARG_TYPE"x != x ; then 187if test "$TRUNC_ARG_TYPE"x != x ; then
87 AC_MSG_RESULT([size_t]) 188 AC_MSG_RESULT([size_t])
88 AC_DEFINE([TRUNCATE_T], [size_t], [truncate arg type]) 189 AC_DEFINE([TRUNCATE_T], [size_t], [truncate arg type])
89else 190else
90 AC_MSG_RESULT([off_t]) 191 AC_MSG_RESULT([off_t])
91 AC_DEFINE([TRUNCATE_T], [off_t], [truncate arg type]) 192 AC_DEFINE([TRUNCATE_T], [off_t], [truncate arg type])
92fi 193fi
93 194
94dnl Check if libc provides RTLD_NEXT 195dnl Check if libc provides RTLD_NEXT
95AC_MSG_CHECKING([for RTLD_NEXT]) 196AC_MSG_CHECKING([for RTLD_NEXT])
96AC_TRY_COMPILE([ 197AC_TRY_COMPILE([
97#define _GNU_SOURCE 198 #define _GNU_SOURCE
98#include <dlfcn.h> 199 #include <dlfcn.h>
99], [ 200 ], [
100#if !defined(RTLD_NEXT) 201 #if !defined(RTLD_NEXT)
101# error no RTLD_NEXT 202 # error no RTLD_NEXT
102#endif 203 #endif
103 204 ],
104int
105main (void)
106{
107 return 0;
108}
109],
110 [have_rtld_next="yes"], 205 [have_rtld_next="yes"],
111 [have_rtld_next="no"] 206 [have_rtld_next="no"]
112) 207)
113AC_MSG_RESULT([$have_rtld_next]) 208AC_MSG_RESULT([$have_rtld_next])
114AM_CONDITIONAL([HAVE_RTLD_NEXT], [test x"$have_rtld_next" = xyes]) 209if test x"$have_rtld_next" = xyes ; then
210 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
211 AC_DEFINE([HAVE_RTLD_NEXT], [1], [Have RTLD_NEXT enabled libc])
212fi
115 213
116dnl we need to handle symbols differently based upon their version, 214dnl we need to handle symbols differently based upon their version,
117dnl but we have to know which symbols the libc supports first 215dnl but we have to know which symbols the libc supports first
118AC_MSG_CHECKING([libc path]) 216AC_MSG_CHECKING([libc path])
119echo "int main(void) { return 0; }" > libctest.c 217echo "int main(void) { return 0; }" > libctest.c
120$CC -Wall -o libctest libctest.c 218$CC $CFLAGS $CPPFLAGS $LDFLAGS -Wl,-verbose -o libctest libctest.c > libctest.log 2>&1
121LIBC_PATH=`$CC $CFLAGS -Wl,-verbose -o libctest libctest.c 2>&1 | \ 219cat libctest.log 1>&AS_MESSAGE_LOG_FD
220LIBC_PATH=$(
122 $AWK '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}'` 221 $AWK '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}' libctest.log
222)
123rm -f libctest.c 223rm -f libctest*
124if test "$LIBC_PATH"x = x || ! test -r "$LIBC_PATH"; then 224if test x"$LIBC_PATH" = x || ! test -r "$LIBC_PATH" ; then
125 AC_MSG_ERROR([Unable to determine LIBC PATH]) 225 AC_MSG_ERROR([Unable to determine LIBC PATH ($LIBC_PATH)])
126fi 226fi
127AC_MSG_RESULT([$LIBC_PATH]) 227AC_MSG_RESULT([$LIBC_PATH])
128AC_SUBST([LIBC_PATH]) 228AC_SUBST([LIBC_PATH])
129 229
130dnl when intercepting libc calls, we have to know the name of the 230dnl when intercepting libc calls, we have to know the name of the
131dnl libc to load and search with dl*() calls 231dnl libc to load and search with dl*() calls
132AC_MSG_CHECKING([libc version]) 232AC_MSG_CHECKING([libc version])
133dnl the sed script at the end here looks funny but it's ok ... 233dnl the sed script at the end here looks funny but it's ok ...
134dnl they're m4 escape sequences for left and right brackets 234echo "int main(void) { return 0; }" > libctest.c
135LIBC_VERSION=`readelf -d libctest | grep NEEDED.*libc\\.so | $AWK '{print $NF}' | sed -e 's:\@<:@::' -e 's:\@:>@::'` 235$CC $CFLAGS $CPPFLAGS $LDFLAGS -Wall -o libctest libctest.c
236LIBC_VERSION=$(
237 $READELF -d libctest | \
238 grep NEEDED.*libc\\.so | \
239 $AWK '{print $NF}' | sed -e ['s:\[::' -e 's:\]::']
240)
241rm -f libctest*
136if test "$LIBC_VERSION"x = x ; then 242if test "$LIBC_VERSION"x = x ; then
137 AC_MSG_ERROR([Unable to determine LIBC VERSION]) 243 AC_MSG_ERROR([Unable to determine LIBC VERSION])
138fi 244fi
139rm -f libctest
140AC_MSG_RESULT([$LIBC_VERSION]) 245AC_MSG_RESULT([$LIBC_VERSION])
141AC_DEFINE_UNQUOTED([LIBC_VERSION], ["$LIBC_VERSION"], [name of libc to hook into]) 246AC_DEFINE_UNQUOTED([LIBC_VERSION], ["$LIBC_VERSION"], [Name of libc to hook into])
142 247
143dnl check if we have 32bit or 64bit output 248dnl We add to CPPFLAGS rather than doing AC_DEFINE_UNQUOTED
144AC_ARG_ENABLE([multilib], 249dnl so we dont have to worry about fully expanding all of
145 AS_HELP_STRING([--enable-multilib], 250dnl the variables ($sysconfdir defaults to "$prefix/etc")
146 [enable building for multilib setups (default=disabled)]), 251SANDBOX_DEFINES='-DETCDIR="\"$(sysconfdir)\"" -DLIBSANDBOX_PATH="\"$(libdir)\"" -DSANDBOX_BASHRC_PATH="\"$(pkgdatadir)\""'
147 [enable_multilib="$enableval"], 252AC_SUBST([SANDBOX_DEFINES])
148 [enable_multilib="no"]
149)
150 253
151if test x"$enable_multilib" != xno ; then 254CPPFLAGS="$CPPFLAGS -D_REENTRANT"
152 AC_DEFINE_UNQUOTED([SB_HAVE_MULTILIB], [1], [have multilib enabled system]) 255if test "$GCC" = yes; then
256 CFLAGS="$CFLAGS -Wall"
153fi 257fi
258
259AC_CONFIG_TESTDIR([tests])
154 260
155AC_OUTPUT([ 261AC_OUTPUT([
156 Makefile 262 Makefile
157 scripts/Makefile 263 scripts/Makefile
264 etc/Makefile
158 data/Makefile 265 data/Makefile
266 libsbutil/Makefile
267 libsandbox/Makefile
159 src/Makefile 268 src/Makefile
269 tests/atlocal
270 tests/Makefile
271 tests/package.m4
160]) 272])

Legend:
Removed from v.232  
changed lines
  Added in v.439

  ViewVC Help
Powered by ViewVC 1.1.20