@@ -97,11 +97,11 @@ enable_shared="no" enable_threads="no" enable_sockets="no" ;; *-*-mingw*) - LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition" + LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition -static-libgcc" LIBS="$LIBS -lversion" AC_SUBST(USE_SRCS_WINDOWS, '${SRCS_WINDOWS}') ;; *-psp-*) @@ -399,10 +399,16 @@ AC_MSG_ERROR(Compiler does not support properties!) ]) AC_CHECK_TOOL(AR, ar) AC_PROG_RANLIB + +case "$host_os" in +mingw*) + AC_CHECK_TOOL(RC, windres) + ;; +esac AC_ARG_ENABLE(shared, AS_HELP_STRING([--disable-shared], [do not build shared library])) AS_IF([test x"$enable_shared" != x"no"], [ BUILDSYS_SHARED_LIB @@ -477,10 +483,11 @@ defined(__NEWLIB__) || defined(__MORPHOS__) || defined(__MINT__) egrep_cpp_yes #endif ], [ AC_MSG_RESULT(yes) + CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 $CPPFLAGS" CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS" gnu_source="yes" ], [ AC_MSG_RESULT(no) ]) @@ -1049,10 +1056,14 @@ ;; m68k-*-amigaos* | powerpc-*-amigaos*) dnl Compiler TLS is broken on AmigaOS enable_compiler_tls="no" ;; + *-*-mingw*) + dnl Causes emutls to be pulled in, which pulls in winpthread. + enable_compiler_tls="no" + ;; *-*-morphos*) dnl Compiler TLS needs helpers that we don't want in the dnl .library enable_compiler_tls="no" ;; @@ -1225,10 +1236,11 @@ AC_ARG_ENABLE(files, AS_HELP_STRING([--disable-files], [disable file support])) AS_IF([test x"$enable_files" != x"no"], [ AC_DEFINE(OF_HAVE_FILES, 1, [Whether we have files]) AC_SUBST(USE_SRCS_FILES, '${SRCS_FILES}') + AC_SUBST(OBJFW_NEW, "objfw-new") AC_SUBST(OFARC, "ofarc") AC_SUBST(OFHASH, "ofhash") case "$host_os" in msdosdjgpp*) @@ -1382,27 +1394,24 @@ AC_CHECK_HEADER(sys/socket.h, [ AC_DEFINE(OF_HAVE_SYS_SOCKET_H, 1, [Whether we have sys/socket.h]) ]) + AC_CHECK_HEADER(netinet/in.h, [ AC_DEFINE(OF_HAVE_NETINET_IN_H, 1, [Whether we have netinet/in.h]) ]) AC_CHECK_HEADER(netinet/tcp.h, [ AC_DEFINE(OF_HAVE_NETINET_TCP_H, 1, [Whether we have netinet/tcp.h]) ]) - AC_CHECK_HEADERS([arpa/inet.h netdb.h]) + AC_CHECK_HEADERS([arpa/inet.h netdb.h net/if.h]) + AC_CHECK_FUNCS([if_indextoname if_nametoindex]) AC_CHECK_HEADER(sys/un.h, [ AC_DEFINE(OF_HAVE_SYS_UN_H, 1, [Whether we have sys/un.h]) ]) - AC_CHECK_HEADER(netipx/ipx.h, [ - AC_DEFINE(OF_HAVE_NETIPX_IPX_H, 1, - [Whether we have netipx/ipx.h]) - ]) - AC_CHECK_MEMBER([struct sockaddr_in6.sin6_addr], [ AC_EGREP_CPP(egrep_cpp_yes, [ #ifdef _WIN32 typedef int BOOL; #endif @@ -1485,10 +1494,14 @@ #ifdef __MINT__ # error Gives invalid argument at runtime #endif ]) + AC_CHECK_HEADER(netipx/ipx.h, [ + AC_DEFINE(OF_HAVE_NETIPX_IPX_H, 1, + [Whether we have netipx/ipx.h]) + ]) AC_CHECK_MEMBER(struct sockaddr_ipx.sipx_network, [], [ AC_CHECK_MEMBER(struct sockaddr_ipx.sa_netnum, [], [], [ #ifdef _WIN32 typedef int BOOL; #endif @@ -1556,10 +1569,101 @@ ], [ AC_DEFINE(OF_HAVE_IPX, 1, [Whether we have IPX/SPX]) AC_SUBST(USE_SRCS_IPX, '${SRCS_IPX}') ]) ]) + + AC_CHECK_HEADER(netat/appletalk.h, [ + AC_DEFINE(OF_HAVE_NETAT_APPLETALK_H, 1, + [Whether we have netat/appletalk.h]) + ]) + AC_CHECK_HEADER(netatalk/at.h, [ + AC_DEFINE(OF_HAVE_NETATALK_AT_H, 1, + [Whether we have netatalk/at.h]) + ]) + AC_CHECK_MEMBER(struct sockaddr_at.sat_addr, [], [ + AC_CHECK_MEMBER(struct sockaddr_at.sat_net, [], [], [ + #ifdef _WIN32 + typedef int BOOL; + #endif + + #ifdef OF_HAVE_SYS_TYPES_H + # include + #endif + #if defined(OF_HAVE_NETAT_APPLETALK_H) + # include + #elif defined(OF_HAVE_NETATALK_AT_H) + # include + #endif + + #ifdef _WIN32 + # ifdef __MINGW32__ + # include <_mingw.h> + # ifdef __MINGW64_VERSION_MAJOR + # include + # endif + # endif + # include + # include + #endif + ]) + ], [ + #ifdef _WIN32 + typedef int BOOL; + #endif + + #ifdef OF_HAVE_SYS_TYPES_H + # include + #endif + #if defined(OF_HAVE_NETAT_APPLETALK_H) + # include + #elif defined(OF_HAVE_NETATALK_AT_H) + # include + #endif + + #ifdef _WIN32 + # ifdef __MINGW32__ + # include <_mingw.h> + # ifdef __MINGW64_VERSION_MAJOR + # include + # endif + # endif + # include + # include + #endif + ]) + AS_IF([test x"$ac_cv_member_struct_sockaddr_at_sat_addr" = x"yes" \ + -o x"$ac_cv_member_struct_sockaddr_at_sat_net" = x"yes"], [ + AC_EGREP_CPP(egrep_cpp_yes, [ + #ifdef _WIN32 + typedef int BOOL; + #endif + + #ifdef OF_HAVE_SYS_SOCKET_H + # include + #endif + + #ifdef _WIN32 + # ifdef __MINGW32__ + # include <_mingw.h> + # ifdef __MINGW64_VERSION_MAJOR + # include + # endif + # endif + # include + # include + #endif + + #ifdef AF_APPLETALK + egrep_cpp_yes + #endif + ], [ + AC_DEFINE(OF_HAVE_APPLETALK, 1, + [Whether we have AppleTalk]) + AC_SUBST(USE_SRCS_APPLETALK, '${SRCS_APPLETALK}') + ]) + ]) AC_CHECK_FUNCS(paccept accept4, break) AC_CHECK_FUNCS(kqueue1 kqueue, [ AC_DEFINE(HAVE_KQUEUE, 1, [Whether we have kqueue]) @@ -1632,10 +1736,27 @@ ], []) LIBS="$old_LIBS" ]) ]) + + AS_IF([test x"$with_tls" = x"gnutls" \ + -o \( x"$with_tls" = x"yes" -a x"$tls_support" = x"no" \)], [ + PKG_CHECK_MODULES(gnutls, [gnutls >= 3.5.0], [ + AC_DEFINE(HAVE_GNUTLS, 1, [Whether we have GnuTLS]) + + tls_support="GnuTLS" + TLS_CPPFLAGS="$gnutls_CFLAGS $TLS_CPPFLAGS" + TLS_LIBS="$gnutls_LIBS $TLS_LIBS" + + AC_SUBST(OF_GNUTLS_TLS_STREAM_M, "OFGnuTLSTLSStream.m") + ], [ + dnl Disable default action-if-not-found, which exits + dnl configure with an error. + : + ]) + ]) AS_IF([test x"$with_tls" = x"openssl" \ -o \( x"$with_tls" = x"yes" -a x"$tls_support" = x"no" \)], [ case "$host_os" in morphos*) @@ -1660,27 +1781,10 @@ "OFOpenSSLTLSStream.m") ]) ], [], [-l$crypto]) ]) - AS_IF([test x"$with_tls" = x"gnutls" \ - -o \( x"$with_tls" = x"yes" -a x"$tls_support" = x"no" \)], [ - PKG_CHECK_MODULES(gnutls, [gnutls >= 3.5.0], [ - AC_DEFINE(HAVE_GNUTLS, 1, [Whether we have GnuTLS]) - - tls_support="GnuTLS" - TLS_CPPFLAGS="$gnutls_CFLAGS $TLS_CPPFLAGS" - TLS_LIBS="$gnutls_LIBS $TLS_LIBS" - - AC_SUBST(OF_GNUTLS_TLS_STREAM_M, "OFGnuTLSTLSStream.m") - ], [ - dnl Disable default action-if-not-found, which exits - dnl configure with an error. - : - ]) - ]) - AS_IF([test x"$tls_support" != x"no"], [ AC_SUBST(TLS, "tls") AC_SUBST(TLS_CPPFLAGS) AC_SUBST(TLS_LIBS) AC_DEFINE(HAVE_TLS_SUPPORT, 1, @@ -1993,11 +2097,12 @@ # define OF_DEALLOC_UNSUPPORTED \ [self doesNotRecognizeSelector: _cmd]; \ \ abort(); \ \ - _Pragma("clang diagnostic push ignore \ + _Pragma("clang diagnostic push"); \ + _Pragma("clang diagnostic ignored \ \"-Wunreachable-code\""); \ [super dealloc]; \ _Pragma("clang diagnostic pop"); #else # define OF_DEALLOC_UNSUPPORTED \