pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/53170: get_compiler fails to detect clang if it's not named "gcc" in $PATH



Patch updated and tested in Mac OS 10.13, it also works on OpenBSD 6.2, OpenBSD 6.3, FreeBSD and DragonflyBSD.

I had left a useless check on testcc being set which excluded the preprocessor check from being run on platforms where check_compiler and cc were both set (Drawing, IRIX).

Index: archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 archive_openssl_hmac_private.h
--- archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h	1 Aug 2017 22:21:17 -0000	1.1.1.2
+++ archivers/libarchive/files/libarchive/archive_openssl_hmac_private.h	5 May 2018 14:37:30 -0000
@@ -28,7 +28,7 @@
 #include <openssl/hmac.h>
 #include <openssl/opensslv.h>
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
 #include <stdlib.h> /* malloc, free */
 #include <string.h> /* memset */
 static inline HMAC_CTX *HMAC_CTX_new(void)
Index: bootstrap/bootstrap
===================================================================
RCS file: /cvsroot/pkgsrc/bootstrap/bootstrap,v
retrieving revision 1.248
diff -u -r1.248 bootstrap
--- bootstrap/bootstrap	7 Mar 2018 07:34:07 -0000	1.248
+++ bootstrap/bootstrap	5 May 2018 14:37:33 -0000
@@ -131,40 +131,20 @@
 get_compiler()
 {
 	testcc="${CC}"
-	# normally, we'd just use 'cc', but certain configure tools look
-	# for gcc specifically, so we have to see if that comes first
-	if [ -z "${testcc}" ]; then
-		save_IFS="${IFS}"
-		IFS=':'
-		for dir in ${PATH}; do
-			test -z "$dir" && dir=.
-			if [ -x "$dir/gcc" ]; then
-				testcc="$dir/gcc"
-				break
-			fi
-		done
-		IFS="${save_IFS}"
-	fi
-
 	# Clang compiler pretends to be GCC, so we have to check that
 	cat >${wrkdir}/$$.c <<EOF
-#ifdef __clang__
-indeed
-#endif
-EOF
-	compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed`
-	rm -f ${wrkdir}/$$.c
-
-	cat >${wrkdir}/$$.c <<EOF
-#ifdef __GNUC__
-#ifndef __clang__
-indeed
+#define GCC_COMPILER (defined(__GNUC__) && !defined(__clang__))
+#if GCC_COMPILER
+gcc
 #endif
+#ifdef __clang__
+clang
 #endif
 EOF
-	compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed`
+	compiler_is_gnu=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c gcc`
+	compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c clang`
 	rm -f ${wrkdir}/$$.c
-
+	
 }
 get_abi()
 {
@@ -776,6 +756,7 @@
 	need_awk=no
 	need_sed=no
 	set_opsys=no
+	check_compiler=yes
 	machine_arch=`arch -s`
 	;;
 OSF1)



Home | Main Index | Thread Index | Old Index