diff -ur gnutls-3.1.1.orig/doc/examples/Makefile.am gnutls-3.1.1/doc/examples/Makefile.am
--- gnutls-3.1.1.orig/doc/examples/Makefile.am	2012-04-12 22:05:11.000000000 +0200
+++ gnutls-3.1.1/doc/examples/Makefile.am	2012-09-25 02:40:26.008365388 +0200
@@ -37,8 +37,8 @@
 	../../gl/libgnu.la			\
 	$(LIBSOCKET) $(INET_NTOP_LIB) $(INET_PTON_LIB)
 
-CXX_LDADD = $(LDADD) \
-	../../lib/libgnutlsxx.la
+CXX_LDADD = ../../lib/libgnutlsxx.la \
+	$(LDADD)
 
 noinst_PROGRAMS = ex-client-resume ex-client-dtls
 noinst_PROGRAMS += ex-cert-select ex-client-x509
diff -ur gnutls-3.1.1.orig/extra/Makefile.am gnutls-3.1.1/extra/Makefile.am
--- gnutls-3.1.1.orig/extra/Makefile.am	2012-04-12 22:05:11.000000000 +0200
+++ gnutls-3.1.1/extra/Makefile.am	2012-09-25 02:42:48.353359041 +0200
@@ -53,7 +53,7 @@
 libgnutls_openssl_la_SOURCES = gnutls_openssl.c openssl_compat.h	\
 	openssl_compat.c
 
-libgnutls_openssl_la_LIBADD = ../gl/libgnu.la $(LIBSOCKET) \
+libgnutls_openssl_la_LIBADD = ../gl/libgnu.la \
 	../lib/libgnutls.la
 
 libgnutls_openssl_la_LDFLAGS += -version-info $(LT_SSL_CURRENT):$(LT_SSL_REVISION):$(LT_SSL_AGE)
@@ -61,9 +61,11 @@
 if ENABLE_MINITASN1
 libgnutls_openssl_la_LIBADD += ../lib/minitasn1/libminitasn1.la
 else
-libgnutls_openssl_la_LDFLAGS += $(LTLIBTASN1)
+libgnutls_openssl_la_LIBADD += $(LTLIBTASN1)
 endif
 
+libgnutls_openssl_la_LIBADD += $(LIBSOCKET)
+
 if HAVE_LD_OUTPUT_DEF
 libgnutls_openssl_la_LDFLAGS += \
 	-Wl,--output-def,libgnutls-openssl-$(DLL_VERSION).def
diff -ur gnutls-3.1.1.orig/lib/Makefile.am gnutls-3.1.1/lib/Makefile.am
--- gnutls-3.1.1.orig/lib/Makefile.am	2012-08-04 21:38:05.000000000 +0200
+++ gnutls-3.1.1/lib/Makefile.am	2012-09-25 02:51:50.780334853 +0200
@@ -115,15 +115,11 @@
 libgnutls_la_LDFLAGS = -no-undefined \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
 
-if WINDOWS
-libgnutls_la_LDFLAGS += -lcrypt32
-endif
-
 libgnutls_la_LIBADD = ../gl/libgnu.la x509/libgnutls_x509.la \
 	accelerated/libaccelerated.la ext/libgnutls_ext.la \
 	auth/libgnutls_auth.la algorithms/libgnutls_alg.la \
-	extras/libgnutls_extras.la \
-	$(LTLIBZ)  $(LTLIBINTL) $(LIBSOCKET) $(LTLIBDL) \
+	extras/libgnutls_extras.la
+thirdparty_libadd = $(LTLIBZ)  $(LTLIBINTL) $(LIBSOCKET) $(LTLIBDL) \
 	$(LTLIBPTHREAD) $(P11_KIT_LIBS) $(LIB_SELECT) $(TSS_LIBS)
 
 if ENABLE_OPENPGP
@@ -140,14 +136,20 @@
 if ENABLE_MINITASN1
 libgnutls_la_LIBADD += minitasn1/libminitasn1.la
 else
-libgnutls_la_LDFLAGS += $(LTLIBTASN1)
+thirdparty_libadd += $(LTLIBTASN1)
 endif
 
 if ENABLE_NETTLE
-libgnutls_la_LDFLAGS += $(LTLIBNETTLE)
+thirdparty_libadd += $(LTLIBNETTLE)
 libgnutls_la_LIBADD += nettle/libcrypto.la
 endif
 
+if WINDOWS
+thirdparty_libadd += -lcrypt32
+endif
+
+libgnutls_la_LIBADD += $(thirdparty_libadd)
+
 if HAVE_LD_OUTPUT_DEF
 libgnutls_la_LDFLAGS += -Wl,--output-def,libgnutls-$(DLL_VERSION).def
 libgnutls-$(DLL_VERSION).def: libgnutls.la
diff -ur gnutls-3.1.1.orig/src/Makefile.am gnutls-3.1.1/src/Makefile.am
--- gnutls-3.1.1.orig/src/Makefile.am	2012-08-15 09:54:41.000000000 +0200
+++ gnutls-3.1.1/src/Makefile.am	2012-09-25 02:57:19.306320211 +0200
@@ -63,7 +63,8 @@
   common.h common.c		\
   certtool-common.h 
 gnutls_serv_LDADD = ../lib/libgnutls.la
-gnutls_serv_LDADD += libcmd-serv.la ../gl/libgnu.la $(LIBOPTS_LDADD) $(LTLIBINTL)
+gnutls_serv_LDADD += libcmd-serv.la ../gl/libgnu.la
+gnutls_serv_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
 gnutls_serv_LDADD += $(LIBSOCKET) $(GETADDRINFO_LIB)
 noinst_LTLIBRARIES += libcmd-serv.la
 libcmd_serv_la_CFLAGS =
@@ -111,8 +112,9 @@
 gnutls_cli_debug_SOURCES = tls_test.c tests.h tests.c \
 		socket.c socket.h common.h common.c
 gnutls_cli_debug_LDADD = ../lib/libgnutls.la libcmd-cli-debug.la 
+gnutls_cli_debug_LDADD += ../gl/libgnu.la
 gnutls_cli_debug_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
-gnutls_cli_debug_LDADD += ../gl/libgnu.la $(LIBSOCKET) $(GETADDRINFO_LIB)
+gnutls_cli_debug_LDADD += $(LIBSOCKET) $(GETADDRINFO_LIB)
 noinst_LTLIBRARIES += libcmd-cli-debug.la
 libcmd_cli_debug_la_CFLAGS =
 libcmd_cli_debug_la_SOURCES = cli-debug-args.def cli-debug-args.c cli-debug-args.h
@@ -127,42 +129,42 @@
 libcmd_certtool_la_CFLAGS =
 libcmd_certtool_la_SOURCES = certtool-args.c certtool-args.def certtool-args.h	\
 	certtool-cfg.h certtool-cfg.c
-libcmd_certtool_la_LIBADD = ../gl/libgnu.la $(LTLIBREADLINE) 
+libcmd_certtool_la_LIBADD = ../gl/libgnu.la ../lib/libgnutls.la
 libcmd_certtool_la_LIBADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
-libcmd_certtool_la_LIBADD += ../lib/libgnutls.la 
-libcmd_certtool_la_LIBADD += ../gl/libgnu.la $(INET_PTON_LIB)
+libcmd_certtool_la_LIBADD += $(LTLIBREADLINE)
+libcmd_certtool_la_LIBADD += $(INET_PTON_LIB)
 
 # p11 tool
 if ENABLE_PKCS11
 
 p11tool_SOURCES = p11tool-args.def p11tool.c pkcs11.c certtool-common.c \
 	certtool-extras.c p11tool.h common.c
-p11tool_LDADD = ../lib/libgnutls.la $(LIBOPTS_LDADD) $(LTLIBINTL)
+p11tool_LDADD = ../lib/libgnutls.la
 p11tool_LDADD += libcmd-p11tool.la ../gl/libgnu.la
+p11tool_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
 
 noinst_LTLIBRARIES += libcmd-p11tool.la
 libcmd_p11tool_la_CFLAGS =
 libcmd_p11tool_la_SOURCES = p11tool-args.def p11tool-args.c p11tool-args.h \
 	certtool-cfg.h certtool-cfg.c
-libcmd_p11tool_la_LIBADD = ../gl/libgnu.la $(LTLIBREADLINE)
-libcmd_p11tool_la_LIBADD += ../lib/libgnutls.la
-libcmd_p11tool_la_LIBADD += ../gl/libgnu.la $(INET_PTON_LIB)
+libcmd_p11tool_la_LIBADD = ../gl/libgnu.la ../lib/libgnutls.la
+libcmd_p11tool_la_LIBADD += $(LTLIBREADLINE) $(INET_PTON_LIB)
 
 endif # ENABLE_PKCS11
 
 if ENABLE_TROUSERS
 
 tpmtool_SOURCES = tpmtool-args.def tpmtool.c certtool-common.c certtool-extras.c common.c
-tpmtool_LDADD = ../lib/libgnutls.la $(LIBOPTS_LDADD) $(LTLIBINTL)
+tpmtool_LDADD = ../lib/libgnutls.la
 tpmtool_LDADD += libcmd-tpmtool.la ../gl/libgnu.la
+tpmtool_LDADD += $(LIBOPTS_LDADD) $(LTLIBINTL)
 
 noinst_LTLIBRARIES += libcmd-tpmtool.la
 libcmd_tpmtool_la_CFLAGS =
 libcmd_tpmtool_la_SOURCES = tpmtool-args.def tpmtool-args.c tpmtool-args.h \
 	certtool-cfg.h certtool-cfg.c
-libcmd_tpmtool_la_LIBADD = ../gl/libgnu.la $(LTLIBREADLINE)
-libcmd_tpmtool_la_LIBADD += ../lib/libgnutls.la
-libcmd_tpmtool_la_LIBADD += ../gl/libgnu.la $(INET_PTON_LIB)
+libcmd_tpmtool_la_LIBADD = ../gl/libgnu.la ../lib/libgnutls.la
+libcmd_tpmtool_la_LIBADD += $(LTLIBREADLINE) $(INET_PTON_LIB)
 
 endif # ENABLE_TROUSERS
 
diff -ur gnutls-3.1.1.orig/tests/Makefile.am gnutls-3.1.1/tests/Makefile.am
--- gnutls-3.1.1.orig/tests/Makefile.am	2012-08-11 15:12:06.000000000 +0200
+++ gnutls-3.1.1/tests/Makefile.am	2012-09-25 02:57:59.329318426 +0200
@@ -77,7 +77,7 @@
 
 if ENABLE_OPENSSL
 ctests +=  openssl
-openssl_LDADD = $(LDADD) ../extra/libgnutls-openssl.la
+openssl_LDADD = ../extra/libgnutls-openssl.la $(LDADD)
 endif
 
 if ENABLE_OPENPGP
diff -ur gnutls-3.1.1.orig/tests/suite/Makefile.am gnutls-3.1.1/tests/suite/Makefile.am
--- gnutls-3.1.1.orig/tests/suite/Makefile.am	2012-04-12 22:05:11.000000000 +0200
+++ gnutls-3.1.1/tests/suite/Makefile.am	2012-09-25 02:58:25.380317265 +0200
@@ -81,7 +81,7 @@
 	ecore/src/lib/eina_unicode.c ecore/src/lib/eina_ustrbuf.c	\
 	ecore/src/lib/eina_ustringshare.c ecore/src/lib/eina_value.c
 
-eagain_cli_LDADD = $(LDADD) libecore.la -lrt -lm -ldl -lpthread
+eagain_cli_LDADD = libecore.la -lrt -lm -ldl -lpthread $(LDADD)
 nodist_eagain_cli_SOURCES = mini-eagain2.c
 
 noinst_PROGRAMS = eagain-cli
