Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix get_compiler() to make pkgsrc bootstrap on OpenBSD 6.2+ #23

Closed
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 9 additions & 28 deletions bootstrap/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -131,40 +131,20 @@ echo_msg()
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()
{
Expand Down Expand Up @@ -776,6 +756,7 @@ OpenBSD)
need_awk=no
need_sed=no
set_opsys=no
check_compiler=yes
machine_arch=`arch -s`
;;
OSF1)
Expand Down