| … | |
… | |
| 79 | AC_MSG_CHECKING(libc path) |
79 | AC_MSG_CHECKING(libc path) |
| 80 | echo "int main(void) { return 0; }" > libctest.c |
80 | echo "int main(void) { return 0; }" > libctest.c |
| 81 | $CC -Wall -o libctest libctest.c |
81 | $CC -Wall -o libctest libctest.c |
| 82 | LIBC_PATH=`$CC $CFLAGS -Wl,-verbose -o libctest libctest.c 2>&1 | \ |
82 | LIBC_PATH=`$CC $CFLAGS -Wl,-verbose -o libctest libctest.c 2>&1 | \ |
| 83 | $AWK '/attempt to open/ { if (($4 ~ /libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}'` |
83 | $AWK '/attempt to open/ { if (($4 ~ /libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}'` |
|
|
84 | rm -f libctest.c |
| 84 | if test "$LIBC_PATH"x = x ; then |
85 | if test "$LIBC_PATH"x = x ; then |
| 85 | AC_MSG_ERROR(Unable to determine LIBC PATH) |
86 | AC_MSG_ERROR(Unable to determine LIBC PATH) |
| 86 | fi |
87 | fi |
| 87 | AC_MSG_RESULT($LIBC_PATH) |
88 | AC_MSG_RESULT($LIBC_PATH) |
| 88 | AC_SUBST(LIBC_PATH) |
89 | AC_SUBST(LIBC_PATH) |
| … | |
… | |
| 91 | dnl libc to load and search with dl*() calls |
92 | dnl libc to load and search with dl*() calls |
| 92 | AC_MSG_CHECKING(libc version) |
93 | AC_MSG_CHECKING(libc version) |
| 93 | dnl the sed script at the end here looks funny but it's ok ... |
94 | dnl the sed script at the end here looks funny but it's ok ... |
| 94 | dnl they're m4 escape sequences for left and right brackets |
95 | dnl they're m4 escape sequences for left and right brackets |
| 95 | LIBC_VERSION=`readelf -d libctest | grep NEEDED.*libc\\.so | $AWK '{print $NF}' | sed -e 's:\@<:@::' -e 's:\@:>@::'` |
96 | LIBC_VERSION=`readelf -d libctest | grep NEEDED.*libc\\.so | $AWK '{print $NF}' | sed -e 's:\@<:@::' -e 's:\@:>@::'` |
|
|
97 | rm -f libctest |
| 96 | if test "$LIBC_VERSION"x = x ; then |
98 | if test "$LIBC_VERSION"x = x ; then |
| 97 | AC_MSG_ERROR(Unable to determine LIBC VERSION) |
99 | AC_MSG_ERROR(Unable to determine LIBC VERSION) |
| 98 | fi |
100 | fi |
| 99 | AC_MSG_RESULT($LIBC_VERSION) |
101 | AC_MSG_RESULT($LIBC_VERSION) |
| 100 | AC_DEFINE_UNQUOTED(LIBC_VERSION, "$LIBC_VERSION", [name of libc to hook into]) |
102 | AC_DEFINE_UNQUOTED(LIBC_VERSION, "$LIBC_VERSION", [name of libc to hook into]) |
| 101 | rm -f libctest |
|
|
| 102 | |
103 | |
| 103 | AC_OUTPUT([Makefile]) |
104 | AC_OUTPUT([Makefile]) |