[Buildroot] [PATCH] package/libwebsock: fix build when openssl is disabled
Thomas Petazzoni
thomas.petazzoni at free-electrons.com
Sat Jan 3 21:05:47 UTC 2015
Dear Samuel Martin,
On Sat, 3 Jan 2015 00:20:00 +0100, Samuel Martin wrote:
> +diff --git a/configure.ac b/configure.ac
> +index fc1cadc..dacd4f4 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -48,6 +48,10 @@ AS_IF([test "x$have_ssl" = "xyes"],
> + [AS_IF([test "x$with_ssl" = "xyes"],
> + [AC_MSG_ERROR([SSL support requested but not found])
> + ])])
> ++AS_IF([test "x$have_ssl" != "xyes"],
> ++ [
> ++ AC_DEFINE([WEBSOCK_HAVE_SSL], [0], [Disable SSL support])
> ++ ])
I'm sorry but this is not the right fix. Autoconf always uses undefined
vs. defined as a way of testing whether a feature is available.
The right fix seems rather to be something like:
diff --git a/src/websock.h b/src/websock.h
index 1bbd410..690c41d 100644
--- a/src/websock.h
+++ b/src/websock.h
@@ -17,6 +17,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
#include "websock_config.h"
//this bit hides differences between systems on big-endian conversions
diff --git a/src/websock_config.h.in b/src/websock_config.h.in
index a25472b..eba8f31 100644
--- a/src/websock_config.h.in
+++ b/src/websock_config.h.in
@@ -4,6 +4,5 @@
#define WEBSOCK_PACKAGE_STRING @WEBSOCK_PACKAGE_STRING@
#define WEBSOCK_PACKAGE_VERSION @WEBSOCK_PACKAGE_VERSION@
#define WEBSOCK_PACKAGE_NAME @WEBSOCK_PACKAGE_NAME@
-#define WEBSOCK_HAVE_SSL @WEBSOCK_HAVE_SSL@
#endif
Basically, the problem is that websock_config.h.in defines
WEBSOCK_HAVE_SSL unconditionally. When SSL is not available, it remains
defined to @WEBSOCK_HAVE_SSL@ in the resulting websock_config.h, which
means that for the rest of the code, WEBSOCK_HAVE_SSL is indeed defined.
The fix is to get rid of this stupid line in websock_config.h.in, and
instead make the code use config.h, which properly defines
WEBSOCK_HAVE_SSL only when SSL is available.
Could you do some testing with the above patch (I did some minimal
amount of testing, and it seemed to work), and resubmit a new version?
In the mean time, I'll mark your patch as Changes Requested in patchwork.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
More information about the buildroot
mailing list