mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 04:08:47 +00:00
configure: Solaris detection, ld 'soname' option auto detection; other Solaris related fixes
This commit is contained in:
parent
a1f7007a46
commit
35a674bdbc
3
Makefile
3
Makefile
@ -30,6 +30,7 @@ INC =
|
|||||||
PIC = -fPIC
|
PIC = -fPIC
|
||||||
AR = $(CROSS_COMPILE)ar
|
AR = $(CROSS_COMPILE)ar
|
||||||
RANLIB = $(CROSS_COMPILE)ranlib
|
RANLIB = $(CROSS_COMPILE)ranlib
|
||||||
|
SOCKET_LIBS =
|
||||||
|
|
||||||
LDSO_SUFFIX = so
|
LDSO_SUFFIX = so
|
||||||
LD_SET_SONAME = -Wl,-soname=
|
LD_SET_SONAME = -Wl,-soname=
|
||||||
@ -82,7 +83,7 @@ src/version.o: src/version.h
|
|||||||
|
|
||||||
$(LDSO_PATHNAME): $(LOBJS)
|
$(LDSO_PATHNAME): $(LOBJS)
|
||||||
$(CC) $(LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) $(USER_LDFLAGS) \
|
$(CC) $(LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) $(USER_LDFLAGS) \
|
||||||
-shared -o $@ $(LOBJS)
|
-shared -o $@ $(LOBJS) $(SOCKET_LIBS)
|
||||||
|
|
||||||
$(ALL_TOOLS): $(OBJS)
|
$(ALL_TOOLS): $(OBJS)
|
||||||
$(CC) src/main.o src/common.o $(USER_LDFLAGS) -o $(PXCHAINS)
|
$(CC) src/main.o src/common.o $(USER_LDFLAGS) -o $(PXCHAINS)
|
||||||
|
40
configure
vendored
40
configure
vendored
@ -46,6 +46,19 @@ check_compile_run() {
|
|||||||
return $res
|
return $res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_link_silent() {
|
||||||
|
printf "$2" > "$tmpc"
|
||||||
|
$CC $OUR_CPPFLAGS $CPPFLAGS $1 $CFLAGS "$tmpc" -o /dev/null >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_link() {
|
||||||
|
printf "checking %s ... " "$1"
|
||||||
|
local res=0
|
||||||
|
check_link_silent "$2" "$3" || res=1
|
||||||
|
test x$res = x0 && printf "yes\n" || printf "no\n"
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "supported arguments"
|
echo "supported arguments"
|
||||||
echo "--prefix=/path default: $prefix"
|
echo "--prefix=/path default: $prefix"
|
||||||
@ -130,7 +143,10 @@ mac_64=false
|
|||||||
ismac64() {
|
ismac64() {
|
||||||
$mac_64
|
$mac_64
|
||||||
}
|
}
|
||||||
|
solaris_detected=false
|
||||||
|
issolaris() {
|
||||||
|
$solaris_detected
|
||||||
|
}
|
||||||
|
|
||||||
check_define __APPLE__ && {
|
check_define __APPLE__ && {
|
||||||
mac_detected=true
|
mac_detected=true
|
||||||
@ -144,6 +160,7 @@ 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;}' && \
|
'#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"
|
OUR_CPPFLAGS="$OUR_CPPFLAGS -DBROKEN_FCLOSE"
|
||||||
}
|
}
|
||||||
|
check_define __sun && check_define __SVR4 && solaris_detected=true
|
||||||
|
|
||||||
echo "CC=$CC">config.mak
|
echo "CC=$CC">config.mak
|
||||||
[ -z "$CPPFLAGS" ] || echo "CPPFLAGS=$CPPFLAGS">>config.mak
|
[ -z "$CPPFLAGS" ] || echo "CPPFLAGS=$CPPFLAGS">>config.mak
|
||||||
@ -157,9 +174,24 @@ echo includedir=$includedir>>config.mak
|
|||||||
echo sysconfdir=$sysconfdir>>config.mak
|
echo sysconfdir=$sysconfdir>>config.mak
|
||||||
[ "$ignore_cve" = "no" ] && echo "CPPFLAGS+= -DSUPER_SECURE">>config.mak
|
[ "$ignore_cve" = "no" ] && echo "CPPFLAGS+= -DSUPER_SECURE">>config.mak
|
||||||
[ -z "$OUR_CPPFLAGS" ] || echo "CPPFLAGS+= $OUR_CPPFLAGS" >>config.mak
|
[ -z "$OUR_CPPFLAGS" ] || echo "CPPFLAGS+= $OUR_CPPFLAGS" >>config.mak
|
||||||
|
|
||||||
|
check_link "whether we can use -Wl,--no-as-needed" "-Wl,--no-as-needed" \
|
||||||
|
"int main() { return 0; }" || echo NO_AS_NEEDED= >> config.mak
|
||||||
|
|
||||||
|
LD_SONAME_FLAG=
|
||||||
|
printf "checking what's the option to use in linker to set library name ... "
|
||||||
|
for o in --soname -h -soname -install_name; do
|
||||||
|
check_link_silent "-shared -Wl,$o,libconftest.so" "void test_func(int a) {}" && LD_SONAME_FLAG=$o && break
|
||||||
|
done
|
||||||
|
if [ -z "$LD_SONAME_FLAG" ]; then
|
||||||
|
printf '\ncannot find an option to set library name\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "$LD_SONAME_FLAG"
|
||||||
|
echo "LD_SET_SONAME = -Wl,$LD_SONAME_FLAG," >> config.mak
|
||||||
|
|
||||||
make_cmd=make
|
make_cmd=make
|
||||||
if ismac ; then
|
if ismac ; then
|
||||||
echo NO_AS_NEEDED=>>config.mak
|
|
||||||
echo LDSO_SUFFIX=dylib>>config.mak
|
echo LDSO_SUFFIX=dylib>>config.mak
|
||||||
echo MAC_CFLAGS+=-DIS_MAC=1>>config.mak
|
echo MAC_CFLAGS+=-DIS_MAC=1>>config.mak
|
||||||
if ismac64 && [ "$fat_binary" = 1 ] ; then
|
if ismac64 && [ "$fat_binary" = 1 ] ; then
|
||||||
@ -167,11 +199,13 @@ if ismac ; then
|
|||||||
echo MAC_CFLAGS+=-arch i386 -arch x86_64>>config.mak
|
echo MAC_CFLAGS+=-arch i386 -arch x86_64>>config.mak
|
||||||
echo LDFLAGS+=-arch i386 -arch x86_64>>config.mak
|
echo LDFLAGS+=-arch i386 -arch x86_64>>config.mak
|
||||||
fi
|
fi
|
||||||
echo LD_SET_SONAME=-Wl,-install_name,>>config.mak
|
|
||||||
elif isbsd ; then
|
elif isbsd ; then
|
||||||
echo LIBDL=>>config.mak
|
echo LIBDL=>>config.mak
|
||||||
echo "CFLAGS+=-DIS_BSD">>config.mak
|
echo "CFLAGS+=-DIS_BSD">>config.mak
|
||||||
make_cmd=gmake
|
make_cmd=gmake
|
||||||
|
elif issolaris; then
|
||||||
|
echo "CFLAGS+=-DIS_SOLARIS -D__EXTENSIONS__" >> config.mak
|
||||||
|
echo "SOCKET_LIBS=-lsocket -lnsl" >> config.mak
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Done, now run $make_cmd && $make_cmd install"
|
echo "Done, now run $make_cmd && $make_cmd install"
|
||||||
|
@ -787,8 +787,8 @@ void proxy_freeaddrinfo(struct addrinfo *res) {
|
|||||||
free(res);
|
free(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(IS_MAC) || defined(IS_OPENBSD)
|
#if defined(IS_MAC) || defined(IS_OPENBSD) || defined(IS_SOLARIS)
|
||||||
#ifdef IS_OPENBSD /* OpenBSD has its own incompatible getservbyname_r */
|
#if defined(IS_OPENBSD) || defined(IS_SOLARIS) /* OpenBSD and Solaris has its own incompatible getservbyname_r */
|
||||||
#define getservbyname_r mygetservbyname_r
|
#define getservbyname_r mygetservbyname_r
|
||||||
#endif
|
#endif
|
||||||
/* getservbyname on mac is using thread local storage, so we dont need mutex
|
/* getservbyname on mac is using thread local storage, so we dont need mutex
|
||||||
|
Loading…
Reference in New Issue
Block a user