Skip to content

Commit 144ead6

Browse files
ColtonWilleypadelsbach
authored andcommitted
Fix include/lib path ordering so wolfSSL paths take precedence
When --with-openssl=<prefix> contains stale wolfSSL headers, the compiler picked them up because OpenSSL's -I path appeared before wolfSSL's in CFLAGS. Swap the wolfSSL and OpenSSL detection blocks so wolfSSL's -I/-L paths are added first and take precedence. Also move AC_CHECK_HEADERS for openssl/core.h after OpenSSL paths are set so it can actually find the header.
1 parent c0c5143 commit 144ead6

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

configure.ac

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,20 @@ USER_CFLAGS="$CFLAGS"
2626
AC_PROG_CC
2727
AC_LANG(C)
2828

29-
# OpenSSL
30-
AC_CHECK_HEADERS([openssl/core.h])
29+
# wolfSSL - check first so its -I/-L paths take precedence over OpenSSL prefix
30+
# which may contain stale wolfSSL headers from a different version
31+
AX_CHECK_WOLFSSL(
32+
[have_wolfssl=yes],
33+
AC_MSG_FAILURE([could not locate wolfSSL])
34+
)
35+
36+
if test "x$have_wolfssl" = "xyes"; then
37+
LIBS="$LIBS $WOLFSSL_LIBS"
38+
CFLAGS="$CFLAGS $WOLFSSL_INCLUDES"
39+
LDFLAGS="$LDFLAGS $WOLFSSL_LDFLAGS"
40+
fi
3141

42+
# OpenSSL
3243
AX_CHECK_OPENSSL(
3344
[have_openssl=yes],
3445
AC_MSG_FAILURE([could not locate OpenSSL])
@@ -40,17 +51,7 @@ if test "x$have_openssl" = "xyes"; then
4051
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
4152
fi
4253

43-
# wolfSSL
44-
AX_CHECK_WOLFSSL(
45-
[have_wolfssl=yes],
46-
AC_MSG_FAILURE([could not locate wolfSSL])
47-
)
48-
49-
if test "x$have_wolfssl" = "xyes"; then
50-
LIBS="$LIBS $WOLFSSL_LIBS"
51-
CFLAGS="$CFLAGS $WOLFSSL_INCLUDES"
52-
LDFLAGS="$LDFLAGS $WOLFSSL_LDFLAGS"
53-
fi
54+
AC_CHECK_HEADERS([openssl/core.h])
5455

5556
# Check for required headers
5657
AC_CHECK_HEADERS([stdlib.h])

0 commit comments

Comments
 (0)