mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2025-08-08 12:49:36 +00:00
Remove curl's conversion of gcc flags to -isystem
On macos, clang gives priority to /usr/local/include over locations specified with -isystem for some unknown reason. In turn this causes clang to use the system's openssl, which conflicts with curl-impersonate's boringssl headers. To prevent that, disable curl's automatic conversion of -I flags to -isystem.
This commit is contained in:
@@ -423,12 +423,11 @@ $(CURL_VERSION)/.chrome: $(chrome_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)/.
|
|||||||
config_flags="$$config_flags --with-ca-path=$(with_ca_path)"; \
|
config_flags="$$config_flags --with-ca-path=$(with_ca_path)"; \
|
||||||
fi; \
|
fi; \
|
||||||
add_libs="-pthread"; \
|
add_libs="-pthread"; \
|
||||||
add_cflags="-I$(boringssl_install_dir)/include"; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Configuring curl with: $$config_flags"
|
echo "Configuring curl with: $$config_flags"
|
||||||
|
|
||||||
./configure $$config_flags CFLAGS="$$add_cflags" LIBS="$$add_libs"
|
./configure $$config_flags LIBS="$$add_libs"
|
||||||
|
|
||||||
# Remove possible leftovers from a previous compilation
|
# Remove possible leftovers from a previous compilation
|
||||||
$(MAKE) clean MAKEFLAGS=
|
$(MAKE) clean MAKEFLAGS=
|
||||||
|
@@ -2313,6 +2313,101 @@ index 9db6b0f89..14c2f23e0 100644
|
|||||||
+Libs: -L${libdir} -lcurl-impersonate-chrome @LIBCURL_NO_SHARED@
|
+Libs: -L${libdir} -lcurl-impersonate-chrome @LIBCURL_NO_SHARED@
|
||||||
Libs.private: @LIBCURL_LIBS@
|
Libs.private: @LIBCURL_LIBS@
|
||||||
Cflags: -I${includedir} @CPPFLAG_CURL_STATICLIB@
|
Cflags: -I${includedir} @CPPFLAG_CURL_STATICLIB@
|
||||||
|
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
|
||||||
|
index caa2b14cb..0a0af4361 100644
|
||||||
|
--- a/m4/curl-compilers.m4
|
||||||
|
+++ b/m4/curl-compilers.m4
|
||||||
|
@@ -373,42 +373,55 @@ AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
|
||||||
|
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
|
||||||
|
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
|
||||||
|
AC_MSG_CHECKING([convert -I options to -isystem])
|
||||||
|
- if test "$compiler_id" = "GNU_C" ||
|
||||||
|
- test "$compiler_id" = "CLANG"; then
|
||||||
|
- AC_MSG_RESULT([yes])
|
||||||
|
- tmp_has_include="no"
|
||||||
|
- tmp_chg_FLAGS="$CFLAGS"
|
||||||
|
- for word1 in $tmp_chg_FLAGS; do
|
||||||
|
- case "$word1" in
|
||||||
|
- -I*)
|
||||||
|
- tmp_has_include="yes"
|
||||||
|
- ;;
|
||||||
|
- esac
|
||||||
|
- done
|
||||||
|
- if test "$tmp_has_include" = "yes"; then
|
||||||
|
- tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
|
||||||
|
- tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
|
||||||
|
- CFLAGS="$tmp_chg_FLAGS"
|
||||||
|
- squeeze CFLAGS
|
||||||
|
- fi
|
||||||
|
- tmp_has_include="no"
|
||||||
|
- tmp_chg_FLAGS="$CPPFLAGS"
|
||||||
|
- for word1 in $tmp_chg_FLAGS; do
|
||||||
|
- case "$word1" in
|
||||||
|
- -I*)
|
||||||
|
- tmp_has_include="yes"
|
||||||
|
- ;;
|
||||||
|
- esac
|
||||||
|
- done
|
||||||
|
- if test "$tmp_has_include" = "yes"; then
|
||||||
|
- tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
|
||||||
|
- tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
|
||||||
|
- CPPFLAGS="$tmp_chg_FLAGS"
|
||||||
|
- squeeze CPPFLAGS
|
||||||
|
- fi
|
||||||
|
- else
|
||||||
|
+ case $host_os in
|
||||||
|
+ darwin*)
|
||||||
|
+ dnl curl-impersonate: On macos, clang gives priority to /usr/local/include
|
||||||
|
+ dnl over locations specified with -isystem for some unknown reason. In turn
|
||||||
|
+ dnl this causes clang to use the system's openssl, which conflicts with
|
||||||
|
+ dnl curl-impersonate's boringssl headers.
|
||||||
|
+ dnl To prevent that, disable curl's automatic conversion of -I flags to
|
||||||
|
+ dnl -isystem.
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
- fi
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ if test "$compiler_id" = "GNU_C" ||
|
||||||
|
+ test "$compiler_id" = "CLANG"; then
|
||||||
|
+ AC_MSG_RESULT([yes])
|
||||||
|
+ tmp_has_include="no"
|
||||||
|
+ tmp_chg_FLAGS="$CFLAGS"
|
||||||
|
+ for word1 in $tmp_chg_FLAGS; do
|
||||||
|
+ case "$word1" in
|
||||||
|
+ -I*)
|
||||||
|
+ tmp_has_include="yes"
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ done
|
||||||
|
+ if test "$tmp_has_include" = "yes"; then
|
||||||
|
+ tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
|
||||||
|
+ tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
|
||||||
|
+ CFLAGS="$tmp_chg_FLAGS"
|
||||||
|
+ squeeze CFLAGS
|
||||||
|
+ fi
|
||||||
|
+ tmp_has_include="no"
|
||||||
|
+ tmp_chg_FLAGS="$CPPFLAGS"
|
||||||
|
+ for word1 in $tmp_chg_FLAGS; do
|
||||||
|
+ case "$word1" in
|
||||||
|
+ -I*)
|
||||||
|
+ tmp_has_include="yes"
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ done
|
||||||
|
+ if test "$tmp_has_include" = "yes"; then
|
||||||
|
+ tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
|
||||||
|
+ tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
|
||||||
|
+ CPPFLAGS="$tmp_chg_FLAGS"
|
||||||
|
+ squeeze CPPFLAGS
|
||||||
|
+ fi
|
||||||
|
+ else
|
||||||
|
+ AC_MSG_RESULT([no])
|
||||||
|
+ fi
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||||
index f24cb6924..30b4fdb0a 100644
|
index f24cb6924..30b4fdb0a 100644
|
||||||
--- a/src/Makefile.am
|
--- a/src/Makefile.am
|
||||||
|
Reference in New Issue
Block a user