Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2018-01-09 16:50:08 +0300
committerrofl0r <retnyg@gmx.net>2018-01-09 16:50:11 +0300
commitb299193d13c1f9f9858383d660bb810da84270da (patch)
tree65ddcee90b4016808abf47f5d1ca79ab61b2e247
parent2f3d33dd47324515041bcb10104e1bbb90b10858 (diff)
configure: remove bogus uname platform checks
calling uname in a configure script is entirely bogus, as it will return wrong results in crosscompilation scenarios. the only sensible way to detect the target platform's peculiarities is to test the preprocessor for macros defining the target.
-rwxr-xr-xconfigure46
1 files changed, 26 insertions, 20 deletions
diff --git a/configure b/configure
index 277423e..f09d69f 100755
--- a/configure
+++ b/configure
@@ -14,22 +14,6 @@ done
set +C
trap 'rm "$tmpc"' EXIT INT QUIT TERM HUP
-ismac() {
- uname -s | grep Darwin >/dev/null
-}
-
-isx86_64() {
- uname -m | grep -i X86_64 >/dev/null
-}
-
-isbsd() {
- uname -s | grep BSD >/dev/null
-}
-
-isopenbsd() {
- uname -s | grep OpenBSD >/dev/null
-}
-
check_compile() {
printf "checking %s ... " "$1"
printf "$3" > "$tmpc"
@@ -73,7 +57,7 @@ usage() {
echo "--ignore-cve default: no"
echo " if set to yes ignores CVE-2015-3887 and makes it possible"
echo " to preload from current dir (insecure)"
- ismac && isx86_64 && echo "--fat-binary : build for both i386 and x86_64 architectures on 64-bit Macs"
+ echo "--fat-binary : build for both i386 and x86_64 architectures on 64-bit Macs"
echo "--help : show this text"
exit 1
}
@@ -133,10 +117,33 @@ if [ -z "$CC" ] ; then
CC=cc
fi
-check_define __OpenBSD__ && \
+
+bsd_detected=false
+isbsd() {
+ $bsd_detected
+}
+mac_detected=false
+ismac() {
+ $mac_detected
+}
+mac_64=false
+ismac64() {
+ $mac_64
+}
+
+
+check_define __APPLE__ && {
+ mac_detected=true
+ check_define __x86_64__ && mac_64=true
+}
+check_define __FreeBSD__ && bsd_detected=true
+check_define __OpenBSD__ && {
+bsd_detected=true
+echo "CFLAGS+=-DIS_OPENBSD">>config.mak
check_compile_run 'whether OpenBSDs fclose() (illegally) calls close()' \
'#include <stdio.h>\n#include<stdlib.h>\nint close(int x){exit(0);}int main(){fclose(stdin);return 1;}' && \
OUR_CPPFLAGS="$OUR_CPPFLAGS -DBROKEN_FCLOSE"
+}
echo "CC=$CC">config.mak
[ -z "$CPPFLAGS" ] || echo "CPPFLAGS=$CPPFLAGS">>config.mak
@@ -155,7 +162,7 @@ if ismac ; then
echo NO_AS_NEEDED=>>config.mak
echo LDSO_SUFFIX=dylib>>config.mak
echo MAC_CFLAGS+=-DIS_MAC=1>>config.mak
- if isx86_64 && [ "$fat_binary" = 1 ] ; then
+ if ismac64 && [ "$fat_binary" = 1 ] ; then
echo "Configuring a fat binary for i386 and x86_64"
echo MAC_CFLAGS+=-arch i386 -arch x86_64>>config.mak
echo LDFLAGS+=-arch i386 -arch x86_64>>config.mak
@@ -164,7 +171,6 @@ if ismac ; then
elif isbsd ; then
echo LIBDL=>>config.mak
echo "CFLAGS+=-DIS_BSD">>config.mak
- isopenbsd && echo "CFLAGS+=-DIS_OPENBSD">>config.mak
make_cmd=gmake
fi