X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=scripts%2Ftrylink;h=48c487bcd30f92f3029bf7f18a704da15a498264;hb=e1603156ff96672375970f460716d37a50c63fae;hp=85095235c8af13c4047455bc7cafff59ab5c9774;hpb=5fd3ddfb243f8f3a8ef471ff8c323a76cf815574;p=oweals%2Fbusybox.git diff --git a/scripts/trylink b/scripts/trylink index 85095235c..48c487bcd 100755 --- a/scripts/trylink +++ b/scripts/trylink @@ -46,19 +46,19 @@ try() { } check_cc() { - local tempname="/tmp/temp.$$.$RANDOM" + local tempname="$(mktemp)" # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :( # "-xc": C language. "/dev/null" is an empty source file. - if $CC $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then + if $CC $CPPFLAGS $CFLAGS $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then echo "$1"; else echo "$2"; fi - rm "$tempname".o 2>/dev/null + rm -f "$tempname" "$tempname".o } check_libc_is_glibc() { - local tempname="/tmp/temp.$$.$RANDOM" + local tempname="$(mktemp)" echo "\ #include /* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */ @@ -66,12 +66,12 @@ check_libc_is_glibc() { syntax error here #endif " >"$tempname".c - if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then + if $CC $CPPFLAGS $CFLAGS "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then echo "$2"; else echo "$1"; fi - rm "$tempname".c "$tempname".o 2>/dev/null + rm -f "$tempname" "$tempname".[co] } EXE="$1" @@ -300,6 +300,8 @@ int main(int argc, char **argv) } rm -- "$sharedlib_dir/applet.c" $EXE.out $STRIP -s --remove-section=.note --remove-section=.comment $EXE + # Let user see that we do something - list the names of created binaries: + echo "$EXE" done