summaryrefslogtreecommitdiff
path: root/net-ftp/proftpd/files/proftpd-1.3.7a-no-ncurses.patch
blob: be18a9954590f1e1f8bc5648c152a57cc0facc43 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
https://github.com/proftpd/proftpd/commit/8fc570bc13e771d3ecafe53ab94ada0be2b6646a
https://bugs.gentoo.org/777531

From 8fc570bc13e771d3ecafe53ab94ada0be2b6646a Mon Sep 17 00:00:00 2001
From: TJ Saunders <tj@castaglia.org>
Date: Tue, 23 Mar 2021 19:50:49 -0700
Subject: [PATCH] Issue #1207: Properly honor the `--disable-curses`,
 `--disable-ncurses` configure options.

---
 configure    | 156 +++++++++++++++++++++++++++++++++++++++++++++++----
 configure.in |  39 +++++++++----
 2 files changed, 172 insertions(+), 23 deletions(-)

diff --git a/configure b/configure
index 86cf1360e..59df363fa 100755
--- a/configure
+++ b/configure
@@ -22970,7 +22970,7 @@ $as_echo "#define SETGRENT_VOID 1" >>confdefs.h
 fi
 
 
-if test x"$ac_cv_header_curses_h" = xyes; then
+if test x"$enable_curses" != xno ; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lcurses" >&5
 $as_echo_n "checking for initscr in -lcurses... " >&6; }
 if ${ac_cv_lib_curses_initscr+:} false; then :
@@ -23013,12 +23013,154 @@ if test "x$ac_cv_lib_curses_initscr" = xyes; then :
 $as_echo "#define HAVE_LIBCURSES 1" >>confdefs.h
 
 
+$as_echo "#define PR_USE_CURSES 1" >>confdefs.h
+
+
 fi
 
+
+          if test x"$enable_nls" = xyes ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for halfdelay in -ltinfow" >&5
+$as_echo_n "checking for halfdelay in -ltinfow... " >&6; }
+if ${ac_cv_lib_tinfow_halfdelay+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltinfow  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char halfdelay ();
+int
+main ()
+{
+return halfdelay ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tinfow_halfdelay=yes
+else
+  ac_cv_lib_tinfow_halfdelay=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfow_halfdelay" >&5
+$as_echo "$ac_cv_lib_tinfow_halfdelay" >&6; }
+if test "x$ac_cv_lib_tinfow_halfdelay" = xyes; then :
+   UTILS_LIBS="$UTILS_LIBS -ltinfow"
+
+$as_echo "#define HAVE_LIBTINFOW 1" >>confdefs.h
+
+
+else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for halfdelay in -ltinfo" >&5
+$as_echo_n "checking for halfdelay in -ltinfo... " >&6; }
+if ${ac_cv_lib_tinfo_halfdelay+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltinfo  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char halfdelay ();
+int
+main ()
+{
+return halfdelay ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tinfo_halfdelay=yes
+else
+  ac_cv_lib_tinfo_halfdelay=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_halfdelay" >&5
+$as_echo "$ac_cv_lib_tinfo_halfdelay" >&6; }
+if test "x$ac_cv_lib_tinfo_halfdelay" = xyes; then :
+   UTILS_LIBS="$UTILS_LIBS -ltinfo"
+
+$as_echo "#define HAVE_LIBTINFO 1" >>confdefs.h
+
+
+fi
+
+
+fi
+
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for halfdelay in -ltinfo" >&5
+$as_echo_n "checking for halfdelay in -ltinfo... " >&6; }
+if ${ac_cv_lib_tinfo_halfdelay+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltinfo  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char halfdelay ();
+int
+main ()
+{
+return halfdelay ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tinfo_halfdelay=yes
+else
+  ac_cv_lib_tinfo_halfdelay=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_halfdelay" >&5
+$as_echo "$ac_cv_lib_tinfo_halfdelay" >&6; }
+if test "x$ac_cv_lib_tinfo_halfdelay" = xyes; then :
+   UTILS_LIBS="$UTILS_LIBS -ltinfo"
+
+$as_echo "#define HAVE_LIBTINFO 1" >>confdefs.h
+
+
+fi
+
+  fi
+fi
+
+if test x"$enable_ncurses" != xno ; then
+  pr_have_ncursesw="no"
 
-pr_have_ncursesw="no"
-if test x"$ac_cv_header_ncurses_h" = xyes; then
 
   if test x"$enable_nls" = xyes ; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5
@@ -23160,15 +23302,7 @@ $as_echo "#define HAVE_LIBNCURSES 1" >>confdefs.h
 fi
 
   fi
-fi
 
-if test x"$enable_curses" != xno ; then
-
-$as_echo "#define PR_USE_CURSES 1" >>confdefs.h
-
-fi
-
-if test x"$enable_ncurses" != xno ; then
 
   if test x"$pr_have_ncursesw" = xyes ; then
 
diff --git a/configure.in b/configure.in
index 4bd0f7c19..01ec7863e 100644
--- a/configure.in
+++ b/configure.in
@@ -2749,17 +2749,38 @@ fi
 dnl Custom-rolled macro for checking return type of setgrent(3)
 PR_FUNC_SETGRENT_VOID
 
-dnl Perform checks for curses/ncurses libraries only if the corresponding
-dnl headers have been found.
-if test x"$ac_cv_header_curses_h" = xyes; then
+if test x"$enable_curses" != xno ; then
   AC_CHECK_LIB(curses, initscr,
     [ CURSES_LIBS="-lcurses"
       AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have curses])
+      AC_DEFINE(PR_USE_CURSES, 1, [Define if using curses support])
     ])
+
+  dnl Check for the libtinfo library, which contains the stdscr symbol,
+  dnl halfdelay curses function on some systems (e.g. Gentoo); see
+  dnl Issue #1207.  Note that on some systems, this may need to be libtinfow
+  dnl instead.
+  if test x"$enable_nls" = xyes ; then
+    AC_CHECK_LIB(tinfow, halfdelay,
+      [ UTILS_LIBS="$UTILS_LIBS -ltinfow"
+        AC_DEFINE(HAVE_LIBTINFOW, 1, [Define if you have libtinfow])
+      ],
+      [ AC_CHECK_LIB(tinfo, halfdelay,
+        [ UTILS_LIBS="$UTILS_LIBS -ltinfo"
+          AC_DEFINE(HAVE_LIBTINFO, 1, [Define if you have libtinfo])
+        ])
+      ])
+  else
+    AC_CHECK_LIB(tinfo, halfdelay,
+      [ UTILS_LIBS="$UTILS_LIBS -ltinfo"
+        AC_DEFINE(HAVE_LIBTINFO, 1, [Define if you have libtinfo])
+      ])
+  fi
 fi
 
-pr_have_ncursesw="no"
-if test x"$ac_cv_header_ncurses_h" = xyes; then
+if test x"$enable_ncurses" != xno ; then
+  pr_have_ncursesw="no"
+
   dnl If NLS support has been enabled, then check for the locale-sensitive
   dnl libncursesw library first; if not found, or if no NLS support, then
   dnl check for libncurses.
@@ -2776,19 +2797,13 @@ if test x"$ac_cv_header_ncurses_h" = xyes; then
           ])
       ])
 
-  else 
+  else
     AC_CHECK_LIB(ncurses, initscr,
       [ CURSES_LIBS="-lncurses"
         AC_DEFINE(HAVE_LIBNCURSES, 1, [Define if you have ncurses])
       ])
   fi
-fi
-
-if test x"$enable_curses" != xno ; then
-  AC_DEFINE(PR_USE_CURSES, 1, [Define if using curses support])
-fi
 
-if test x"$enable_ncurses" != xno ; then
   dnl Check for the libtinfo library, which contains the halfdelay() curses
   dnl function on some systems (e.g. OpenSuSE); see Bug#3718.  Note that on
   dnl some systems, this may need to be libtinfow instead; see Issue #1174.