ref: 1e9d7d85af27e3fc547d0f6d4725823dcf153e13
parent: 100027a36ae15400c30d7500bde79288a6e02eb0
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Mon Jan 7 06:44:53 EST 2013
Clean up mingw32 configuruation. Properly check for HTTP support and handle the case where it's disabled. Also fixes the include paths broken by 3e7f0ddc.
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,9 +15,11 @@
libopusfile_la_LIBADD = $(DEPS_LIBS)
libopusfile_la_LDFLAGS = -no-undefined \
-version-info @OP_LT_CURRENT@:@OP_LT_REVISION@:@OP_LT_AGE@
+if OP_ENABLE_HTTP
if OP_WIN32
libopusfile_la_SOURCES += src/wsockwrapper.c
libopusfile_la_LIBADD += -lws2_32
+endif
endif
noinst_PROGRAMS = examples/opusfile_example examples/seeking_example
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,19 @@
AC_SUBST(OP_LT_REVISION)
AC_SUBST(OP_LT_AGE)
+CC_CHECK_CFLAGS_APPEND(
+ [-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
+
+# Platform-specific tweaks
+case $host in
+ *-mingw*)
+ # -std=c89 causes some warnings under mingw.
+ CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
+ host_mingw=true
+ ;;
+esac
+AM_CONDITIONAL(OP_WIN32, test "x$host_mingw" = xtrue)
+
AC_ARG_ENABLE([assertions],
AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
enable_assertions=no)
@@ -41,17 +54,26 @@
AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
enable_http=yes)
-# AS_IF([test "x$enable_http" != "xno"],
-# AC_CHECK_HEADER([sys/socket.h],,
-# AC_MSG_WARN([HTTP support requires a posix socket library.])
-# enable_http=no
-# )
-# )
+AM_COND_IF(OP_WIN32,
+ AS_IF([test "x$enable_http" != "xno"],
+ AC_CHECK_HEADER([winsock2.h],,
+ AC_MSG_WARN([HTTP support requires a Winsock socket library.])
+ enable_http=no
+ )
+ ),
+ AS_IF([test "x$enable_http" != "xno"],
+ AC_CHECK_HEADER([sys/socket.h],,
+ AC_MSG_WARN([HTTP support requires a POSIX socket library.])
+ enable_http=no
+ )
+ )
+)
AS_IF([test "x$enable_http" != "xno"], [
openssl="openssl"
AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
])
+AM_CONDITIONAL(OP_ENABLE_HTTP, [test "x$enable_http" != "xno"])
AC_SUBST(openssl)
PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1 ${openssl}])
@@ -84,18 +106,6 @@
CC_ATTRIBUTE_VISIBILITY([default], [
CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
])
-
-CC_CHECK_CFLAGS_APPEND([-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
-
-# Platform-specific tweaks
-case $host in
- *-mingw*)
- # -std=c89 causes some warnings under mingw.
- CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
- host_mingw=true
- ;;
-esac
-AM_CONDITIONAL(OP_WIN32, test "x$host_mingw" = xtrue)
dnl Check for doxygen
AC_ARG_ENABLE([doc],
--- a/src/http.c
+++ b/src/http.c
@@ -226,8 +226,8 @@
#else /* _WIN32 */
#include <winsock2.h>
#include <ws2tcpip.h>
-#include "win32/winerrno.h"
-#include "win32/wsockwrapper.h"
+#include "winerrno.h"
+#include "wsockwrapper.h"
#define ERRNO() (WSAGetLastError() - WSABASEERR)
#define CLOSE(x) closesocket(x)
#define IOCTL(fd,req,arg) ioctlsocket(fd,req,(u_long*)(arg))