taken from eutils.eclass as of 06/29/04: have_NPTL() { cat > ${T}/test-nptl.c <<-"END" #define _XOPEN_SOURCE #include <unistd.h> #include <stdio.h> int main() { char buf[255]; char *str = buf; confstr(_CS_GNU_LIBPTHREAD_VERSION, str, 255); if (NULL != str) { printf("%s\n", str); if (NULL != strstr(str, "NPTL")) return 0; } return 1; } END einfon "Checking for _CS_GNU_LIBPTHREAD_VERSION support in glibc ... " if gcc -o ${T}/nptl ${T}/test-nptl.c &> /dev/null then echo "yes" einfon "Checking what PTHREADS implementation we have ... " if ${T}/nptl then return 0 else return 1 fi else echo "no" fi return 1 } source /${PORTDIR}/eclass/eutils; declare -f | which --read-functions have_NPTL results in int main() { char buf[255]; char *str = buf; confstr(_CS_GNU_LIBPTHREAD_VERSION, str, 255); if (NULL != str) { printf("%s\n", str); if (NULL != strstr(str, "NPTL")) return 0; } return 1; } Which isn't valid bash (and was a pita to track down) :) The issue is how declare is outputting the code- have_NPTL () { cat >${T}/test-nptl.c <<-'END' #define _XOPEN_SOURCE #include <unistd.h> #include <stdio.h> int main() { char buf[255]; char *str = buf; confstr(_CS_GNU_LIBPTHREAD_VERSION, str, 255); if (NULL != str) { printf("%s\n", str); if (NULL != strstr(str, "NPTL")) return 0; } return 1; } END einfon "Checking for _CS_GNU_LIBPTHREAD_VERSION support in glibc ... "; if gcc -o ${T}/nptl ${T}/test-nptl.c >&/dev/null; then echo "yes"; einfon "Checking what PTHREADS implementation we have ... "; if ${T}/nptl; then return 0; else return 1; fi; else echo "no"; fi; return 1 } I'm guessing which is just hunting for the function definition '^[^ ] \(\)[[:space:]]{\n', and then matching till '^}$', which isn't valid (or at least is an unexepected 'feature'). Work around is type has_NPTL which has it's own issues in isolating the function.
Haven't tested it w/ v2.12, but 2.16 I've verified as failing.
e-mailed upstream ... the problem lays in the code block in which.c around line ~550
bugs going no where, wrote filter-env to get around this...