summaryrefslogtreecommitdiff
blob: 77e0314886418916e63ab5d43a0b75306facaa57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
diff -u -ru uget-1.10.4-orig/configure.ac uget-1.10.4/configure.ac
--- uget-1.10.4-orig/configure.ac	2014-05-08 05:48:17.316939998 +0300
+++ uget-1.10.4/configure.ac	2014-05-08 05:48:34.668232311 +0300
@@ -145,23 +145,45 @@
 )
 
 if test "x$plugin_curl" = "xyes"; then
-    AC_DEFINE(HAVE_PLUGIN_CURL, 1, [Define to 1 to enable cURL plug-in.])
+	AC_DEFINE(HAVE_PLUGIN_CURL, 1, [Define to 1 to enable cURL plug-in.])
 fi
 
 ## ----------------
 ## GnuTLS
-AC_ARG_ENABLE(
+AC_ARG_WITH(
 	[gnutls],
-	AC_HELP_STRING([--enable-gnutls], [Enable GnuTLS support.]),
-	[enable_gnutls="$enableval"],
-	[enable_gnutls="no"]
+	AC_HELP_STRING([--with-gnutls[=@<:@no/auto/yes@:>@]], [Enable GnuTLS support.]),
+	[with_gnutls="$withval"],
+	[with_gnutls="auto"]
 )
-if test "x$enable_gnutls" = "xyes"; then
-  PKG_CHECK_MODULES(GNUTLS, gnutls)
-  AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if gnutls support is required.])
-  # for ArchLinux
-  AC_SUBST(GNUTLS_CFLAGS)
-  AC_SUBST(GNUTLS_LIBS)
+if test "x$with_gnutls" != "xno"; then
+#	AC_CHECK_HEADER(gcrypt.h, [USE_GNUTLS_GCRYPT=1], [USE_GNUTLS_GCRYPT=0])
+#	if test "$USE_GNUTLS_GCRYPT" = "1"; then
+#		LIBGCRYPT_CFLAGS=""
+#		AC_SUBST(LIBGCRYPT_CFLAGS)
+#	fi
+#	AC_CHECK_HEADER(gcrypt/gcrypt.h, [USE_GNUTLS_GCRYPT=1], [USE_GNUTLS_GCRYPT=0])
+#	if test "$USE_GNUTLS_GCRYPT" = "1"; then
+#		LIBGCRYPT_CFLAGS=""
+#		AC_SUBST(LIBGCRYPT_CFLAGS, [""])
+#	fi
+#	AC_CHECK_LIB(gcrypt, gcry_control, [USE_GNUTLS_GCRYPT=1], [USE_GNUTLS_GCRYPT=0])
+#	if test "$USE_GNUTLS_GCRYPT" = "1"; then
+#		LIBGCRYPT_LIBS="-lgcrypt"
+#		AC_SUBST(LIBGCRYPT_LIBS, ["-lgcrypt"])
+#	fi
+	AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config)
+	if test "x$LIBGCRYPT_CONFIG" = "x" ; then
+		if test "x$with_gnutls" = "xyes"; then
+			AC_MSG_ERROR(Unable to find libgcrypt-config, please install libgcrypt)
+		fi
+	else
+		LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
+		LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
+		AC_SUBST(LIBGCRYPT_CFLAGS)
+		AC_SUBST(LIBGCRYPT_LIBS)
+		AC_DEFINE(USE_GNUTLS, 1, [Define to 1 if gnutls support is required.])
+	fi
 fi
 
 ## -----------------
@@ -188,7 +210,7 @@
   PKG_CHECK_MODULES(LIBPWMD, [libpwmd-7.0 >= 7.0.0])
   AC_DEFINE(HAVE_LIBPWMD, 1, [Define to 1 if libpwmd support is required.])
 fi
-AM_CONDITIONAL([WITH_LIBPWMD],  [test "x$enable_pwmd" = "xyes"])
+AM_CONDITIONAL([WITH_LIBPWMD],  [test "x$enable_pwmd" = "xyes"])
 
 ## -----------------
 ## HIDE_TEMPORARY_FILE
diff -u -ru uget-1.10.4-orig/uget-gtk/Makefile.am uget-1.10.4/uget-gtk/Makefile.am
--- uget-1.10.4-orig/uget-gtk/Makefile.am	2014-05-08 05:48:17.341936098 +0300
+++ uget-1.10.4/uget-gtk/Makefile.am	2014-05-08 05:48:34.668232311 +0300
@@ -1,10 +1,14 @@
 bin_PROGRAMS = uget-gtk
 
-UGET_GTK_LIBS   = @GTK_LIBS@   @GIO_LIBS@   @GTHREAD_LIBS@   @CURL_LIBS@   @GNUTLS_LIBS@   @LIBNOTIFY_LIBS@   @APP_INDICATOR_LIBS@   @GSTREAMER_LIBS@   @LIBPWMD_LIBS@
+UGET_GTK_LIBS   = @GTK_LIBS@  @GIO_LIBS@  @GTHREAD_LIBS@  \
+	@CURL_LIBS@  @LIBGCRYPT_LIBS@  \
+	@LIBNOTIFY_LIBS@  @APP_INDICATOR_LIBS@  @GSTREAMER_LIBS@  @LIBPWMD_LIBS@
 
 # set the include path found by configure
 uget_gtk_CPPFLAGS = -DDATADIR='"$(datadir)"' -I$(top_srcdir)/uglib -I$(top_srcdir)/uget-gtk
-uget_gtk_CFLAGS   = @LFS_CFLAGS@  @GTK_CFLAGS@ @GIO_CFLAGS@ @GTHREAD_CFLAGS@ @CURL_CFLAGS@ @GNUTLS_CFLAGS@ @LIBNOTIFY_CFLAGS@ @APP_INDICATOR_CFLAGS@ @GSTREAMER_CFLAGS@ @LIBPWMD_CFLAGS@
+uget_gtk_CFLAGS   = @LFS_CFLAGS@  @GTK_CFLAGS@ @GIO_CFLAGS@ @GTHREAD_CFLAGS@  \
+	@CURL_CFLAGS@ @LIBGCRYPT_CFLAGS@  \
+	@LIBNOTIFY_CFLAGS@ @APP_INDICATOR_CFLAGS@ @GSTREAMER_CFLAGS@ @LIBPWMD_CFLAGS@
 uget_gtk_LDFLAGS  = @LFS_LDFLAGS@
 uget_gtk_LDADD    = $(top_builddir)/uglib/libuglib.a $(UGET_GTK_LIBS)
 
diff -u -ru uget-1.10.4-orig/uget-gtk/UgApp-gtk-main.c uget-1.10.4/uget-gtk/UgApp-gtk-main.c
--- uget-1.10.4-orig/uget-gtk/UgApp-gtk-main.c	2014-05-08 05:48:17.341936098 +0300
+++ uget-1.10.4/uget-gtk/UgApp-gtk-main.c	2014-05-08 05:48:43.267889859 +0300
@@ -113,17 +113,17 @@
 #include <UgApp-gtk.h>
 
 // GnuTLS
-#ifdef HAVE_GNUTLS
+#ifdef USE_GNUTLS
 #include <gcrypt.h>
 #include <errno.h>
 
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
 
-void init_gnutls_locks (void)
+void init_locks (void)
 {
-	gcry_control (GCRYCTL_SET_THREAD_CBS);
+	gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
 }
-#endif // HAVE_GNUTLS
+#endif // USE_GNUTLS
 
 // GStreamer
 #ifdef HAVE_GSTREAMER
@@ -199,8 +199,8 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-#ifdef HAVE_GNUTLS
-	init_gnutls_locks ();
+#ifdef USE_GNUTLS
+	init_locks ();
 #endif
 
 	string = ug_arg_find_version (argc, argv);