| … | |
… | |
| 27 | AC_FUNC_ALLOCA |
27 | AC_FUNC_ALLOCA |
| 28 | AC_HEADER_DIRENT |
28 | AC_HEADER_DIRENT |
| 29 | AC_HEADER_STDC |
29 | AC_HEADER_STDC |
| 30 | AC_HEADER_SYS_WAIT |
30 | AC_HEADER_SYS_WAIT |
| 31 | AC_CHECK_HEADERS([ \ |
31 | AC_CHECK_HEADERS([ \ |
| 32 | fcntl.h limits.h memory.h stddef.h \ |
32 | fcntl.h limits.h memory.h stddef.h \ |
| 33 | stdlib.h string.h strings.h sys/file.h \ |
33 | stdlib.h string.h strings.h sys/file.h \ |
| 34 | sys/param.h sys/time.h unistd.h utime.h \ |
34 | sys/param.h sys/time.h unistd.h utime.h \ |
| 35 | ]) |
35 | ]) |
| 36 | |
36 | |
| 37 | dnl Checks for typedefs, structures, and compiler characteristics. |
37 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 38 | AC_C_CONST |
38 | AC_C_CONST |
| 39 | AC_TYPE_UID_T |
39 | AC_TYPE_UID_T |
| … | |
… | |
| 47 | AC_FUNC_LSTAT |
47 | AC_FUNC_LSTAT |
| 48 | AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK |
48 | AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK |
| 49 | AC_TYPE_SIGNAL |
49 | AC_TYPE_SIGNAL |
| 50 | AC_FUNC_STAT |
50 | AC_FUNC_STAT |
| 51 | AC_CHECK_FUNCS([ \ |
51 | AC_CHECK_FUNCS([ \ |
| 52 | bzero ftruncate getcwd lchown memmove \ |
52 | bzero ftruncate getcwd lchown memmove \ |
| 53 | memcpy memset mkdir pathconf realpath \ |
53 | memcpy memset mkdir pathconf realpath \ |
| 54 | rmdir setenv strcasecmp strchr strdup \ |
54 | rmdir setenv strcasecmp strchr strdup \ |
| 55 | strerror strndup strrchr strspn strstr \ |
55 | strerror strndup strrchr strspn strstr \ |
| 56 | strtok_r \ |
56 | strtok_r \ |
| 57 | ]) |
57 | ]) |
| 58 | dnl For librcutil |
58 | dnl For librcutil |
| 59 | AC_CHECK_FUNCS([remove]) |
59 | AC_CHECK_FUNCS([remove]) |
| 60 | |
60 | |
| 61 | dnl Check if gcc provides va_copy or __va_copy (for librcutil) |
61 | dnl Check if gcc provides va_copy or __va_copy (for librcutil) |
| … | |
… | |
| 154 | |
154 | |
| 155 | dnl we need to handle symbols differently based upon their version, |
155 | dnl we need to handle symbols differently based upon their version, |
| 156 | dnl but we have to know which symbols the libc supports first |
156 | dnl but we have to know which symbols the libc supports first |
| 157 | AC_MSG_CHECKING([libc path]) |
157 | AC_MSG_CHECKING([libc path]) |
| 158 | echo "int main(void) { return 0; }" > libctest.c |
158 | echo "int main(void) { return 0; }" > libctest.c |
| 159 | $CC $CFLAGS -Wl,-verbose -o libctest libctest.c &> libctest.log |
159 | $CC $CFLAGS $CPPFLAGS $LDFLAGS -Wl,-verbose -o libctest libctest.c > libctest.log 2>&1 |
| 160 | cat libctest.log 1>&AS_MESSAGE_LOG_FD |
160 | cat libctest.log 1>&AS_MESSAGE_LOG_FD |
|
|
161 | LIBC_PATH=$( |
| 161 | LIBC_PATH=`$AWK '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}' libctest.log` |
162 | $AWK '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}' libctest.log |
|
|
163 | ) |
| 162 | rm -f libctest* |
164 | rm -f libctest* |
| 163 | if test x"$LIBC_PATH" = x || ! test -r "$LIBC_PATH" ; then |
165 | if test x"$LIBC_PATH" = x || ! test -r "$LIBC_PATH" ; then |
| 164 | AC_MSG_ERROR([Unable to determine LIBC PATH ($LIBC_PATH)]) |
166 | AC_MSG_ERROR([Unable to determine LIBC PATH ($LIBC_PATH)]) |
| 165 | fi |
167 | fi |
| 166 | AC_MSG_RESULT([$LIBC_PATH]) |
168 | AC_MSG_RESULT([$LIBC_PATH]) |
| … | |
… | |
| 168 | |
170 | |
| 169 | dnl when intercepting libc calls, we have to know the name of the |
171 | dnl when intercepting libc calls, we have to know the name of the |
| 170 | dnl libc to load and search with dl*() calls |
172 | dnl libc to load and search with dl*() calls |
| 171 | AC_MSG_CHECKING([libc version]) |
173 | AC_MSG_CHECKING([libc version]) |
| 172 | dnl the sed script at the end here looks funny but it's ok ... |
174 | dnl the sed script at the end here looks funny but it's ok ... |
| 173 | dnl they're m4 escape sequences for left and right brackets |
|
|
| 174 | echo "int main(void) { return 0; }" > libctest.c |
175 | echo "int main(void) { return 0; }" > libctest.c |
| 175 | $CC -Wall -o libctest libctest.c |
176 | $CC $CFLAGS $CPPFLAGS $LDFLAGS -Wall -o libctest libctest.c |
| 176 | LIBC_VERSION=`$READELF -d libctest | grep NEEDED.*libc\\.so | $AWK '{print $NF}' | sed -e 's:\@<:@::' -e 's:\@:>@::'` |
177 | LIBC_VERSION=$( |
|
|
178 | $READELF -d libctest | \ |
|
|
179 | grep NEEDED.*libc\\.so | \ |
|
|
180 | $AWK '{print $NF}' | sed -e ['s:\[::' -e 's:\]::'] |
|
|
181 | ) |
| 177 | rm -f libctest* |
182 | rm -f libctest* |
| 178 | if test "$LIBC_VERSION"x = x ; then |
183 | if test "$LIBC_VERSION"x = x ; then |
| 179 | AC_MSG_ERROR([Unable to determine LIBC VERSION]) |
184 | AC_MSG_ERROR([Unable to determine LIBC VERSION]) |
| 180 | fi |
185 | fi |
| 181 | AC_MSG_RESULT([$LIBC_VERSION]) |
186 | AC_MSG_RESULT([$LIBC_VERSION]) |
| 182 | AC_DEFINE_UNQUOTED([LIBC_VERSION], ["$LIBC_VERSION"], [Name of libc to hook into]) |
187 | AC_DEFINE_UNQUOTED([LIBC_VERSION], ["$LIBC_VERSION"], [Name of libc to hook into]) |
| 183 | |
188 | |
| 184 | dnl check if we have 32bit or 64bit output |
189 | dnl We add to CPPFLAGS rather than doing AC_DEFINE_UNQUOTED |
| 185 | AC_ARG_ENABLE([multilib], |
190 | dnl so we dont have to worry about fully expanding all of |
| 186 | AS_HELP_STRING([--enable-multilib], |
191 | dnl the variables ($sysconfdir defaults to "$prefix/etc") |
| 187 | [enable building for multilib setups (default=disabled)]), |
|
|
| 188 | [enable_multilib="$enableval"], |
|
|
| 189 | [enable_multilib="no"] |
|
|
| 190 | ) |
|
|
| 191 | |
|
|
| 192 | if test x"$enable_multilib" != xno ; then |
|
|
| 193 | AC_DEFINE([SB_HAVE_MULTILIB], [1], [Have multilib enabled system]) |
|
|
| 194 | fi |
|
|
| 195 | |
|
|
| 196 | SANDBOX_DEFINES='-DETCDIR="\"$(sysconfdir)\"" -DLIBSANDBOX_PATH="\"$(libdir)\"" -DSANDBOX_BASHRC_PATH="\"$(pkgdatadir)\""' |
192 | SANDBOX_DEFINES='-DETCDIR="\"$(sysconfdir)\"" -DLIBSANDBOX_PATH="\"$(libdir)\"" -DSANDBOX_BASHRC_PATH="\"$(pkgdatadir)\""' |
| 197 | AC_SUBST([SANDBOX_DEFINES]) |
193 | AC_SUBST([SANDBOX_DEFINES]) |
| 198 | |
194 | |
| 199 | AC_OUTPUT([ |
195 | AC_OUTPUT([ |
| 200 | Makefile |
196 | Makefile |
| 201 | scripts/Makefile |
197 | scripts/Makefile |
| 202 | etc/Makefile |
198 | etc/Makefile |
| 203 | data/Makefile |
199 | data/Makefile |
| 204 | libsbutil/Makefile |
200 | libsbutil/Makefile |
| 205 | libsandbox/Makefile |
201 | libsandbox/Makefile |
| 206 | src/Makefile |
202 | src/Makefile |
| 207 | ]) |
203 | ]) |