mirror of
https://github.com/rofl0r/proxychains-ng
synced 2025-01-10 15:42:57 +08:00
Add configure checks to find suitable value of _XOPEN_SOURCE
This commit is contained in:
parent
f832d1dc89
commit
881ccee066
11
configure
vendored
11
configure
vendored
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
OUR_CPPFLAGS=
|
OUR_CPPFLAGS=
|
||||||
|
C99_CFLAGS="-std=c99"
|
||||||
|
|
||||||
# Get a temporary filename
|
# Get a temporary filename
|
||||||
i=0
|
i=0
|
||||||
@ -42,7 +43,7 @@ check_compile() {
|
|||||||
printf "checking %s ... " "$1"
|
printf "checking %s ... " "$1"
|
||||||
printf "$3" > "$tmpc"
|
printf "$3" > "$tmpc"
|
||||||
local res=0
|
local res=0
|
||||||
$CC $OUR_CPPFLAGS $CPPFLAGS $2 $CFLAGS -c "$tmpc" -o /dev/null >/dev/null 2>&1 \
|
$CC $OUR_CPPFLAGS $CPPFLAGS $2 $C99_CFLAGS $CFLAGS -c "$tmpc" -o /dev/null >/dev/null 2>&1 \
|
||||||
|| res=1
|
|| res=1
|
||||||
test x$res = x0 && \
|
test x$res = x0 && \
|
||||||
{ printf "yes\n" ; test x"$2" = x || OUR_CPPFLAGS="$OUR_CPPFLAGS $2" ; } \
|
{ printf "yes\n" ; test x"$2" = x || OUR_CPPFLAGS="$OUR_CPPFLAGS $2" ; } \
|
||||||
@ -53,7 +54,7 @@ check_compile() {
|
|||||||
check_define() {
|
check_define() {
|
||||||
printf "checking whether \$CC defines %s ... " "$1"
|
printf "checking whether \$CC defines %s ... " "$1"
|
||||||
local res=1
|
local res=1
|
||||||
$CC $OUR_CPPFLAGS $CPPFLAGS $CFLAGS -dM -E - </dev/null | grep "$1" >/dev/null && res=0
|
$CC $OUR_CPPFLAGS $CPPFLAGS $C99_CFLAGS $CFLAGS -dM -E - </dev/null | grep "$1" >/dev/null && res=0
|
||||||
test x$res = x0 && printf "yes\n" || printf "no\n"
|
test x$res = x0 && printf "yes\n" || printf "no\n"
|
||||||
return $res
|
return $res
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ check_compile_run() {
|
|||||||
printf "checking %s ... " "$1"
|
printf "checking %s ... " "$1"
|
||||||
printf "$2" > "$tmpc"
|
printf "$2" > "$tmpc"
|
||||||
local res=0
|
local res=0
|
||||||
$CC $OUR_CPPFLAGS $CPPFLAGS $CFLAGS "$tmpc" -o "$tmpc".out >/dev/null 2>&1 \
|
$CC $OUR_CPPFLAGS $CPPFLAGS $C99_CFLAGS $CFLAGS "$tmpc" -o "$tmpc".out >/dev/null 2>&1 \
|
||||||
|| res=1
|
|| res=1
|
||||||
test x$res = x0 && { "$tmpc".out || res=1 ; }
|
test x$res = x0 && { "$tmpc".out || res=1 ; }
|
||||||
rm -f "$tmpc".out
|
rm -f "$tmpc".out
|
||||||
@ -141,6 +142,10 @@ if [ -z "$CC" ] ; then
|
|||||||
CC=cc
|
CC=cc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for i in 700 600; do
|
||||||
|
check_compile "whether _XOPEN_SOURCE=$i is suitable for C99 mode" "-D_XOPEN_SOURCE=$i" "#include <unistd.h>" && break
|
||||||
|
done
|
||||||
|
|
||||||
for i in 16 32; do
|
for i in 16 32; do
|
||||||
check_compile "whether netinet/in.h defines s6_addr$i" "" \
|
check_compile "whether netinet/in.h defines s6_addr$i" "" \
|
||||||
'#include <netinet/in.h>\nint main(int a, char**c){'"struct in6_addr x={.s6_addr$i[0]=a};return x.s6_addr$i[0];"' }' \
|
'#include <netinet/in.h>\nint main(int a, char**c){'"struct in6_addr x={.s6_addr$i[0]=a};return x.s6_addr$i[0];"' }' \
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#undef _POSIX_C_SOURCE
|
#undef _POSIX_C_SOURCE
|
||||||
#define _POSIX_C_SOURCE 200809L
|
#define _POSIX_C_SOURCE 200809L
|
||||||
#define _DARWIN_C_SOURCE
|
#define _DARWIN_C_SOURCE
|
||||||
#define _XOPEN_SOURCE 600
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -9,10 +9,7 @@
|
|||||||
|
|
||||||
#undef _POSIX_C_SOURCE
|
#undef _POSIX_C_SOURCE
|
||||||
#define _POSIX_C_SOURCE 200809L
|
#define _POSIX_C_SOURCE 200809L
|
||||||
#undef _XOPEN_SOURCE
|
#ifndef _XOPEN_SOURCE
|
||||||
#ifdef IS_SOLARIS /* Solaris doesn't recognize this macro greater than 600 */
|
|
||||||
#define _XOPEN_SOURCE 600
|
|
||||||
#else
|
|
||||||
#define _XOPEN_SOURCE 700
|
#define _XOPEN_SOURCE 700
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user