Clean up mingw32 configuruation.
authorTimothy B. Terriberry <tterribe@xiph.org>
Mon, 7 Jan 2013 19:44:53 +0000 (11:44 -0800)
committerRalph Giles <giles@thaumas.net>
Thu, 28 Feb 2013 02:12:52 +0000 (18:12 -0800)
Properly check for HTTP support and handle the case where it's
 disabled.
Also fixes the include paths broken by 3e7f0ddc.

Makefile.am
configure.ac
src/http.c

index a82d770..59afa5d 100644 (file)
@@ -15,10 +15,12 @@ libopusfile_la_SOURCES = \
 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
 
index c898c30..f0913c9 100644 (file)
@@ -29,6 +29,19 @@ AC_SUBST(OP_LT_CURRENT)
 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 @@ AC_ARG_ENABLE([http],
   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}])
@@ -85,18 +107,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],
   AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
index 933ad95..83b1232 100644 (file)
@@ -226,8 +226,8 @@ static const char *op_parse_file_url(const char *_src){
 #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))