~peter-pearse/ubuntu/natty/libgcrypt11/prop001

« back to all changes in this revision

Viewing changes to debian/patches/20_socket_nsl_linkage.diff

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2007-09-19 13:34:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070919133442-l277lf8odne8lx89
Tags: 1.2.4-2ubuntu2
Modernise autoconf detection of socket() and gethostbyname() to
eliminate libnsl linkage on Linux.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -Nur libgcrypt11-1.2.4/configure libgcrypt11-1.2.4.new/configure
 
2
--- libgcrypt11-1.2.4/configure 2007-09-19 13:29:41.000000000 +0100
 
3
+++ libgcrypt11-1.2.4.new/configure     2007-09-19 13:30:02.000000000 +0100
 
4
@@ -23754,100 +23754,12 @@
 
5
 
 
6
 # Solaris needs -lsocket and -lnsl. Unisys system includes
 
7
 # gethostbyname in libsocket but needs libnsl for socket.
 
8
-
 
9
-{ echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
 
10
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; }
 
11
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
 
12
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 
13
-else
 
14
-  ac_check_lib_save_LIBS=$LIBS
 
15
-LIBS="-lnsl  $LIBS"
 
16
-cat >conftest.$ac_ext <<_ACEOF
 
17
-/* confdefs.h.  */
 
18
-_ACEOF
 
19
-cat confdefs.h >>conftest.$ac_ext
 
20
-cat >>conftest.$ac_ext <<_ACEOF
 
21
-/* end confdefs.h.  */
 
22
-
 
23
-/* Override any GCC internal prototype to avoid an error.
 
24
-   Use char because int might match the return type of a GCC
 
25
-   builtin and then its argument prototype would still apply.  */
 
26
-#ifdef __cplusplus
 
27
-extern "C"
 
28
-#endif
 
29
-char gethostbyname ();
 
30
-int
 
31
-main ()
 
32
-{
 
33
-return gethostbyname ();
 
34
-  ;
 
35
-  return 0;
 
36
-}
 
37
-_ACEOF
 
38
-rm -f conftest.$ac_objext conftest$ac_exeext
 
39
-if { (ac_try="$ac_link"
 
40
-case "(($ac_try" in
 
41
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 
42
-  *) ac_try_echo=$ac_try;;
 
43
-esac
 
44
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 
45
-  (eval "$ac_link") 2>conftest.er1
 
46
-  ac_status=$?
 
47
-  grep -v '^ *+' conftest.er1 >conftest.err
 
48
-  rm -f conftest.er1
 
49
-  cat conftest.err >&5
 
50
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
 
51
-  (exit $ac_status); } &&
 
52
-        { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
 
53
-  { (case "(($ac_try" in
 
54
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 
55
-  *) ac_try_echo=$ac_try;;
 
56
-esac
 
57
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 
58
-  (eval "$ac_try") 2>&5
 
59
-  ac_status=$?
 
60
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
 
61
-  (exit $ac_status); }; } &&
 
62
-        { ac_try='test -s conftest$ac_exeext'
 
63
-  { (case "(($ac_try" in
 
64
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 
65
-  *) ac_try_echo=$ac_try;;
 
66
-esac
 
67
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 
68
-  (eval "$ac_try") 2>&5
 
69
-  ac_status=$?
 
70
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
 
71
-  (exit $ac_status); }; }; then
 
72
-  ac_cv_lib_nsl_gethostbyname=yes
 
73
-else
 
74
-  echo "$as_me: failed program was:" >&5
 
75
-sed 's/^/| /' conftest.$ac_ext >&5
 
76
-
 
77
-       ac_cv_lib_nsl_gethostbyname=no
 
78
-fi
 
79
-
 
80
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 
81
-      conftest$ac_exeext conftest.$ac_ext
 
82
-LIBS=$ac_check_lib_save_LIBS
 
83
-fi
 
84
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
 
85
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; }
 
86
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
 
87
-  cat >>confdefs.h <<_ACEOF
 
88
-#define HAVE_LIBNSL 1
 
89
-_ACEOF
 
90
-
 
91
-  LIBS="-lnsl $LIBS"
 
92
-
 
93
-fi
 
94
-
 
95
-{ echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
 
96
-echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6; }
 
97
-if test "${ac_cv_lib_socket_socket+set}" = set; then
 
98
+{ echo "$as_me:$LINENO: checking for library containing socket" >&5
 
99
+echo $ECHO_N "checking for library containing socket... $ECHO_C" >&6; }
 
100
+if test "${ac_cv_search_socket+set}" = set; then
 
101
   echo $ECHO_N "(cached) $ECHO_C" >&6
 
102
 else
 
103
-  ac_check_lib_save_LIBS=$LIBS
 
104
-LIBS="-lsocket  $LIBS"
 
105
+  ac_func_search_save_LIBS=$LIBS
 
106
 cat >conftest.$ac_ext <<_ACEOF
 
107
 /* confdefs.h.  */
 
108
 _ACEOF
 
109
@@ -23870,7 +23782,14 @@
 
110
   return 0;
 
111
 }
 
112
 _ACEOF
 
113
-rm -f conftest.$ac_objext conftest$ac_exeext
 
114
+for ac_lib in '' socket; do
 
115
+  if test -z "$ac_lib"; then
 
116
+    ac_res="none required"
 
117
+  else
 
118
+    ac_res=-l$ac_lib
 
119
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 
120
+  fi
 
121
+  rm -f conftest.$ac_objext conftest$ac_exeext
 
122
 if { (ac_try="$ac_link"
 
123
 case "(($ac_try" in
 
124
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 
125
@@ -23904,37 +23823,42 @@
 
126
   ac_status=$?
 
127
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
 
128
   (exit $ac_status); }; }; then
 
129
-  ac_cv_lib_socket_socket=yes
 
130
+  ac_cv_search_socket=$ac_res
 
131
 else
 
132
   echo "$as_me: failed program was:" >&5
 
133
 sed 's/^/| /' conftest.$ac_ext >&5
 
134
 
 
135
-       ac_cv_lib_socket_socket=no
 
136
+
 
137
 fi
 
138
 
 
139
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 
140
-      conftest$ac_exeext conftest.$ac_ext
 
141
-LIBS=$ac_check_lib_save_LIBS
 
142
+      conftest$ac_exeext
 
143
+  if test "${ac_cv_search_socket+set}" = set; then
 
144
+  break
 
145
 fi
 
146
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
 
147
-echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6; }
 
148
-if test $ac_cv_lib_socket_socket = yes; then
 
149
-  ac_need_libsocket=1
 
150
+done
 
151
+if test "${ac_cv_search_socket+set}" = set; then
 
152
+  :
 
153
 else
 
154
-  ac_try_nsl=1
 
155
+  ac_cv_search_socket=no
 
156
 fi
 
157
+rm conftest.$ac_ext
 
158
+LIBS=$ac_func_search_save_LIBS
 
159
+fi
 
160
+{ echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5
 
161
+echo "${ECHO_T}$ac_cv_search_socket" >&6; }
 
162
+ac_res=$ac_cv_search_socket
 
163
+if test "$ac_res" != no; then
 
164
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
165
 
 
166
-if test x$ac_need_libsocket = x1; then
 
167
-    LIBS="$LIBS -lsocket"
 
168
 fi
 
169
-if test x$ac_try_nsl = x1; then
 
170
-    { echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
 
171
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; }
 
172
-if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
 
173
+
 
174
+{ echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5
 
175
+echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6; }
 
176
+if test "${ac_cv_search_gethostbyname+set}" = set; then
 
177
   echo $ECHO_N "(cached) $ECHO_C" >&6
 
178
 else
 
179
-  ac_check_lib_save_LIBS=$LIBS
 
180
-LIBS="-lnsl  $LIBS"
 
181
+  ac_func_search_save_LIBS=$LIBS
 
182
 cat >conftest.$ac_ext <<_ACEOF
 
183
 /* confdefs.h.  */
 
184
 _ACEOF
 
185
@@ -23957,7 +23881,14 @@
 
186
   return 0;
 
187
 }
 
188
 _ACEOF
 
189
-rm -f conftest.$ac_objext conftest$ac_exeext
 
190
+for ac_lib in '' nsl; do
 
191
+  if test -z "$ac_lib"; then
 
192
+    ac_res="none required"
 
193
+  else
 
194
+    ac_res=-l$ac_lib
 
195
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
 
196
+  fi
 
197
+  rm -f conftest.$ac_objext conftest$ac_exeext
 
198
 if { (ac_try="$ac_link"
 
199
 case "(($ac_try" in
 
200
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 
201
@@ -23991,30 +23922,37 @@
 
202
   ac_status=$?
 
203
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
 
204
   (exit $ac_status); }; }; then
 
205
-  ac_cv_lib_nsl_gethostbyname=yes
 
206
+  ac_cv_search_gethostbyname=$ac_res
 
207
 else
 
208
   echo "$as_me: failed program was:" >&5
 
209
 sed 's/^/| /' conftest.$ac_ext >&5
 
210
 
 
211
-       ac_cv_lib_nsl_gethostbyname=no
 
212
+
 
213
 fi
 
214
 
 
215
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 
216
-      conftest$ac_exeext conftest.$ac_ext
 
217
-LIBS=$ac_check_lib_save_LIBS
 
218
+      conftest$ac_exeext
 
219
+  if test "${ac_cv_search_gethostbyname+set}" = set; then
 
220
+  break
 
221
 fi
 
222
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
 
223
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; }
 
224
-if test $ac_cv_lib_nsl_gethostbyname = yes; then
 
225
-  ac_need_libnsl=1
 
226
+done
 
227
+if test "${ac_cv_search_gethostbyname+set}" = set; then
 
228
+  :
 
229
+else
 
230
+  ac_cv_search_gethostbyname=no
 
231
 fi
 
232
+rm conftest.$ac_ext
 
233
+LIBS=$ac_func_search_save_LIBS
 
234
+fi
 
235
+{ echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname" >&5
 
236
+echo "${ECHO_T}$ac_cv_search_gethostbyname" >&6; }
 
237
+ac_res=$ac_cv_search_gethostbyname
 
238
+if test "$ac_res" != no; then
 
239
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
240
 
 
241
-    if test x$ac_need_libnsl = x1
 
242
-    then
 
243
-        LIBS="$LIBS -lnsl"
 
244
-    fi
 
245
 fi
 
246
 
 
247
+
 
248
 ##################################
 
249
 #### Checks for header files. ####
 
250
 ##################################
 
251
diff -Nur libgcrypt11-1.2.4/configure.ac libgcrypt11-1.2.4.new/configure.ac
 
252
--- libgcrypt11-1.2.4/configure.ac      2007-02-01 18:41:06.000000000 +0000
 
253
+++ libgcrypt11-1.2.4.new/configure.ac  2007-09-19 13:29:43.000000000 +0100
 
254
@@ -442,18 +442,8 @@
 
255
 
 
256
 # Solaris needs -lsocket and -lnsl. Unisys system includes
 
257
 # gethostbyname in libsocket but needs libnsl for socket.
 
258
-AC_CHECK_LIB(nsl, gethostbyname)
 
259
-AC_CHECK_LIB(socket, socket, ac_need_libsocket=1, ac_try_nsl=1)
 
260
-if test x$ac_need_libsocket = x1; then
 
261
-    LIBS="$LIBS -lsocket"
 
262
-fi
 
263
-if test x$ac_try_nsl = x1; then
 
264
-    AC_CHECK_LIB(nsl, gethostbyname, ac_need_libnsl=1)
 
265
-    if test x$ac_need_libnsl = x1
 
266
-    then
 
267
-        LIBS="$LIBS -lnsl"
 
268
-    fi
 
269
-fi
 
270
+AC_SEARCH_LIBS([socket], [socket])
 
271
+AC_SEARCH_LIBS([gethostbyname], [nsl])
 
272
 
 
273
 ##################################
 
274
 #### Checks for header files. ####