-
-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Bugzilla 24725 - core.sys.linux: feature detect glibc functions a…
…t build time Signed-off-by: Andrei Horodniceanu <[email protected]>
- Loading branch information
Showing
7 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ trace.log | |
/msvc*.obj | ||
make | ||
*.lst | ||
|
||
# generated during the build | ||
/src/core/sys/linux/config.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
SED:=sed | ||
ifeq ($(OS),$(filter $(OS),freebsd osx)) | ||
SED_INPLACE:=-i '' | ||
else | ||
SED_INPLACE:=-i'' | ||
endif | ||
|
||
export FEATURE_TMPDIR:=$(CURDIR)/features/tmp | ||
export CC | ||
|
||
src/core/sys/linux/config.d: src/core/sys/linux/config.d.in | ||
@cp $< $@ | ||
@if [ "$(OS)" = linux ] \ | ||
&& ./features/cc_has_function.sh 'closefrom' '#include <unistd.h>'; \ | ||
then \ | ||
$(SED) $(SED_INPLACE) "s/@HAVE_CLOSEFROM@/true/" $@; \ | ||
else \ | ||
$(SED) $(SED_INPLACE) "s/@HAVE_CLOSEFROM@/false/" $@; \ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
|
||
die () { | ||
[ $# -ne 0 ] && echo "${@}" | ||
exit 1 | ||
} | ||
|
||
usage () { | ||
echo "Usage: $0 <function_name> <header>" | ||
} | ||
|
||
[ $# -ne 2 ] && usage && die "Invalid usage!" | ||
|
||
tmp="${FEATURE_TMPDIR}" | ||
|
||
mkdir -p "${tmp}" || die "Could not create temp directory" | ||
outfile="${tmp}/check_${1}.c" | ||
|
||
# Check taken from the meson build system | ||
cat > "${outfile}" <<DRUNTIME_CHECK_EOF || die "Could not generate sample C program" | ||
${2} | ||
int main(void) {{ | ||
void *a = (void*) &${1}; | ||
long long b = (long long) a; | ||
return (int) b; | ||
}} | ||
DRUNTIME_CHECK_EOF | ||
|
||
echo -n "Checking for the existence of '${1}'... " | ||
${CC} -o "${outfile}.prog" "${outfile}" > /dev/null 2>&1 | ||
res=$? | ||
[ "${res}" -eq 0 ] && echo "found" || echo "NOT found" | ||
|
||
rm -f "${outfile}" "${outfile}.prog" | ||
exit "${res}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters