diff --git a/Makefile.am b/Makefile.am index a82d7701463b83bcfe63fa7ab0cf663f5a3fdae0..59afa5d9bdf4c9c162153fbe64e28ac14bf6e5da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index c898c3098471848c55fc9765f88742bd51ad47e7..f0913c91b56582688bfc06b7e9a5efcb502aebe2 100644 --- a/configure.ac +++ b/configure.ac @@ -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]),, diff --git a/src/http.c b/src/http.c index 639d36f9ecb831cbc4212b687def8a64f2a30955..5aadba52ebf34df2405332b3979eb5f6299a19cc 100644 --- a/src/http.c +++ b/src/http.c @@ -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))