From: rjones Date: Wed, 6 Feb 2008 15:12:20 +0000 (+0000) Subject: Patch from Brecht Sanders to fix xdr_float.c on Windows. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=1e3125e83dfe9c78631c7ea4344bdf8f72c03ee9;p=portablexdr.git Patch from Brecht Sanders to fix xdr_float.c on Windows. Add the right flags to build a DLL on Windows. --- diff --git a/Makefile.am b/Makefile.am index e64f401..d7decfa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,4 +2,5 @@ lib_LTLIBRARIES = libportablexdr.la libportablexdr_la_SOURCES = xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c \ xdr.c xdr_intXX_t.c xdr_rec.c xdr_stdio.c \ rpc/rpc.h rpc/types.h rpc/xdr.h -libportablexdr_la_CFLAGS = -Wall -Werror \ No newline at end of file +libportablexdr_la_CFLAGS = -Wall -Werror +libportablexdr_la_LDFLAGS = @MINGW_EXTRA_LDFLAGS@ diff --git a/configure.ac b/configure.ac index 6c617a7..d3c27dc 100644 --- a/configure.ac +++ b/configure.ac @@ -3,11 +3,20 @@ AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([config.h]) +AC_CANONICAL_HOST AC_PROG_CC AC_CHECK_PROGS(AR, ar) AC_PROG_INSTALL AC_PROG_LIBTOOL +MINGW_EXTRA_LDFLAGS= +case "$host" in + *-*-mingw*) + MINGW_EXTRA_LDFLAGS="-no-undefined -lws2_32" + ;; +esac +AC_SUBST(MINGW_EXTRA_LDFLAGS) + AC_CHECK_HEADERS([arpa/inet.h winsock2.h]) AC_OUTPUT(Makefile) diff --git a/xdr_float.c b/xdr_float.c index eefcbee..5425af9 100644 --- a/xdr_float.c +++ b/xdr_float.c @@ -118,7 +118,7 @@ xdr_float(xdrs, fp) is.mantissa = (vs.mantissa1 << 16) | vs.mantissa2; shipit: is.sign = vs.sign; - return (XDR_PUTLONG(xdrs, (long *)&is)); + return (XDR_PUTLONG(xdrs, (long *)(void *)&is)); #endif case XDR_DECODE: @@ -126,7 +126,7 @@ xdr_float(xdrs, fp) return (XDR_GETLONG(xdrs, (long *)fp)); #else vsp = (struct vax_single *)fp; - if (!XDR_GETLONG(xdrs, (long *)&is)) + if (!XDR_GETLONG(xdrs, (long *)(void *)&is)) return (FALSE); for (i = 0, lim = sgl_limits; i < sizeof(sgl_limits)/sizeof(struct sgl_limits); @@ -230,7 +230,7 @@ xdr_double(xdrs, dp) ((vd.mantissa4 >> 3) & MASK(13)); shipit: id.sign = vd.sign; - lp = (long *)&id; + lp = (long *)(void *)&id; #endif #if defined(__CYGWIN32__) || defined(__MINGW32__) return (XDR_PUTLONG(xdrs, lp+1) && XDR_PUTLONG(xdrs, lp)); @@ -247,7 +247,7 @@ xdr_double(xdrs, dp) return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp)); #endif #else - lp = (long *)&id; + lp = (long *)(void *)&id; if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp)) return (FALSE); for (i = 0, lim = dbl_limits; @@ -268,7 +268,7 @@ xdr_double(xdrs, dp) vd.mantissa4 = (id.mantissa2 << 3); doneit: vd.sign = id.sign; - *dp = *((double *)&vd); + *dp = *((double *)(void *)&vd); return (TRUE); #endif