Commit 99739877be6e3eaa28681201019ec16788c789fe

Guillem Jover 2024-02-14T04:59:44

build: Rename ABI selection variables from need_ to abi_ This should make the purpose of these variables more clear.

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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
diff --git a/configure.ac b/configure.ac
index 806808d..c6163e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,61 +38,61 @@ LIBBSD_LINKER_VERSION_SCRIPT
 
 is_windows=no
 
-need_arc4random=yes
-need_bsd_getopt=yes
-need_err=yes
-need_errc=yes
-need_fpurge=yes
-need_funopen=yes
-need_md5=yes
-need_name_from_id=yes
-need_nlist=yes
-need_progname=yes
-need_strl=yes
-need_strmode=yes
-need_wcsl=yes
+abi_arc4random=no
+abi_bsd_getopt=no
+abi_err=no
+abi_errc=no
+abi_fpurge=no
+abi_funopen=no
+abi_md5=no
+abi_name_from_id=no
+abi_nlist=no
+abi_progname=no
+abi_strl=no
+abi_strmode=no
+abi_wcsl=no
 
 AS_CASE([$host_os],
   [*-gnu*], [
+    abi_errc=yes
     # On glibc >= 2.38, strlcpy() and strlcat() got added,
     # so these could then be dropped on the next SOVERSION bump.
-    #need_strl=no
-    need_err=no
+    #abi_strl=no
   ],
   [*-musl*], [
     # On musl >= 0.9.7, optreset got implemented, so bsd_getopt() can then
     # be dropped on the next SOVERSION bump.
-    #need_bsd_getopt=no
-    need_err=no
+    #abi_bsd_getopt=no
+    abi_err=no
     # On musl >= 1.1.19, fopencookie() got implemented, and because we were
     # checking for its presence to decide whether to build funopen(), it got
     # included in builds even when previously it had not been included, which
     # is partially an ABI issue, but given that disabling it now would be
     # worse, we'll ignore this as this is only a problem with downgrades. And
     # enable it explicitly
-    need_funopen=yes
+    abi_funopen=yes
     # On musl >= 0.5.0, strlcpy() and strlcat() were already implemented,
     # so these can then be dropped on the next SOVERSION bump.
-    #need_strl=no
+    #abi_strl=no
   ],
   [darwin*], [
     # On macOS these are provided by the system, and libbsd has never built
     # there, so we can avoid providing these with no ABI breakage.
-    need_arc4random=no
-    need_bsd_getopt=no
-    need_err=no
-    need_errc=no
-    need_fpurge=no
+    abi_arc4random=no
+    abi_bsd_getopt=no
+    abi_err=no
+    abi_errc=no
+    abi_fpurge=no
     # On macOS we do not have fopencookie(), and cannot implement it.
-    need_funopen=no
-    need_md5=no
-    need_name_from_id=no
-    need_nlist=no
-    need_progname=no
-    need_strl=no
-    need_strmode=no
-    need_transparent_libmd=no
-    need_wcsl=no
+    abi_funopen=no
+    abi_md5=no
+    abi_name_from_id=no
+    abi_nlist=no
+    abi_progname=no
+    abi_strl=no
+    abi_strmode=no
+    abi_transparent_libmd=no
+    abi_wcsl=no
   ],
   [mingw*], [
     is_windows=yes
@@ -169,17 +169,17 @@ AM_CONDITIONAL([HAVE_LIBTESTU01],
   [test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
 
 saved_LIBS="$LIBS"
-AS_IF([test "$need_md5" = "yes"], [
+AS_IF([test "$abi_md5" = "yes"], [
   AC_SEARCH_LIBS([MD5Update], [md], [
     AS_IF([test "x$ac_cv_search_MD5Update" != "xnone required"], [
       MD5_LIBS="$MD5_LIBS $ac_cv_search_MD5Update"
-      need_transparent_libmd=yes
+      abi_transparent_libmd=yes
     ])
   ], [
     AC_MSG_ERROR([cannot find required MD5 functions in libc or libmd])
   ])
 ])
-AS_IF([test "$need_arc4random" = "yes"], [
+AS_IF([test "$abi_arc4random" = "yes"], [
   AC_CHECK_FUNCS([getentropy])
 
   AS_IF([test "$ac_cv_func_getentropy" != "yes"], [
@@ -279,21 +279,23 @@ AC_CHECK_FUNCS([\
 
 AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 
-AM_CONDITIONAL([NEED_ARC4RANDOM], [test "x$need_arc4random" = "xyes"])
-AM_CONDITIONAL([NEED_BSD_GETOPT], [test "x$need_bsd_getopt" = "xyes"])
-AM_CONDITIONAL([NEED_ERR], [test "x$need_err" = "xyes"])
-AM_CONDITIONAL([NEED_ERRC], [test "x$need_errc" = "xyes"])
-AM_CONDITIONAL([NEED_PROGNAME], [test "x$need_progname" = "xyes"])
-AM_CONDITIONAL([NEED_TRANSPARENT_LIBMD], [test "x$need_transparent_libmd" = "xyes"])
-AM_CONDITIONAL([NEED_MD5], [test "x$need_md5" = "xyes"])
-AM_CONDITIONAL([NEED_NLIST], [test "x$need_nlist" = "xyes"])
-AM_CONDITIONAL([NEED_STRL], [test "x$need_strl" = "xyes"])
-AM_CONDITIONAL([NEED_WCSL], [test "x$need_wcsl" = "xyes"])
-AM_CONDITIONAL([NEED_STRMODE], [test "x$need_strmode" = "xyes"])
-AM_CONDITIONAL([NEED_NAME_FROM_ID], [test "x$need_name_from_id" = "xyes"])
-AM_CONDITIONAL([NEED_FPURGE], [test "x$need_fpurge" = "xyes"])
-AM_CONDITIONAL([NEED_FUNOPEN], [test "x$need_funopen" = "xyes"])
-AS_IF([test "x$need_funopen" = "xno" && \
+# ABI selection
+AM_CONDITIONAL([ABI_ARC4RANDOM], [test "x$abi_arc4random" = "xyes"])
+AM_CONDITIONAL([ABI_BSD_GETOPT], [test "x$abi_bsd_getopt" = "xyes"])
+AM_CONDITIONAL([ABI_ERR], [test "x$abi_err" = "xyes"])
+AM_CONDITIONAL([ABI_ERRC], [test "x$abi_errc" = "xyes"])
+AM_CONDITIONAL([ABI_PROGNAME], [test "x$abi_progname" = "xyes"])
+AM_CONDITIONAL([ABI_TRANSPARENT_LIBMD], [test "x$abi_transparent_libmd" = "xyes"])
+AM_CONDITIONAL([ABI_MD5], [test "x$abi_md5" = "xyes"])
+AM_CONDITIONAL([ABI_NLIST], [test "x$abi_nlist" = "xyes"])
+AM_CONDITIONAL([ABI_STRL], [test "x$abi_strl" = "xyes"])
+AM_CONDITIONAL([ABI_WCSL], [test "x$abi_wcsl" = "xyes"])
+AM_CONDITIONAL([ABI_STRMODE], [test "x$abi_strmode" = "xyes"])
+AM_CONDITIONAL([ABI_NAME_FROM_ID], [test "x$abi_name_from_id" = "xyes"])
+AM_CONDITIONAL([ABI_FPURGE], [test "x$abi_fpurge" = "xyes"])
+AM_CONDITIONAL([ABI_FUNOPEN], [test "x$abi_funopen" = "xyes"])
+
+AS_IF([test "x$abi_funopen" = "xno" && \
        test "x$ac_cv_func_funopen" != "xyes" && \
        test "x$ac_cv_func_fopencookie" = "xyes"], [
   AC_MSG_WARN([[can implement funopen() now based on newly added fopencooke(), report upstream]])
diff --git a/include/Makefile.am b/include/Makefile.am
index 31d86b4..46925b6 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -29,13 +29,13 @@ nobase_include_HEADERS = \
 	bsd/wchar.h \
 	# EOL
 
-if NEED_MD5
+if ABI_MD5
 nobase_include_HEADERS += \
 	bsd/md5.h \
 	# EOL
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 nobase_include_HEADERS += \
 	bsd/nlist.h \
 	# EOL
diff --git a/man/Makefile.am b/man/Makefile.am
index 51cbdd7..ed55988 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -237,37 +237,37 @@ dist_man_MANS = \
 	vis.3bsd \
 	# EOL
 
-if NEED_ERRC
+if ABI_ERRC
 dist_man_MANS += \
 	errc.3bsd \
 	# EOL
 endif
 
-if NEED_FPURGE
+if ABI_FPURGE
 dist_man_MANS += \
 	fpurge.3bsd \
 	# EOL
 endif
 
-if NEED_FUNOPEN
+if ABI_FUNOPEN
 dist_man_MANS += \
 	funopen.3bsd \
 	# EOL
 endif
 
-if NEED_MD5
+if ABI_MD5
 dist_man_MANS += \
 	md5.3bsd \
 	# EOL
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 dist_man_MANS += \
 	nlist.3bsd \
 	# EOL
 endif
 
-if NEED_PROGNAME
+if ABI_PROGNAME
 dist_man_MANS += \
 	getprogname.3bsd \
 	setprogname.3bsd \
@@ -279,27 +279,27 @@ dist_man_MANS += \
 	uid_from_user.3bsd \
 	# EOL
 
-if NEED_NAME_FROM_ID
+if ABI_NAME_FROM_ID
 dist_man_MANS += \
 	group_from_gid.3bsd \
 	user_from_uid.3bsd \
 	# EOL
 endif
 
-if NEED_STRL
+if ABI_STRL
 dist_man_MANS += \
 	strlcat.3bsd \
 	strlcpy.3bsd \
 	# EOL
 endif
 
-if NEED_STRMODE
+if ABI_STRMODE
 dist_man_MANS += \
 	strmode.3bsd \
 	# EOL
 endif
 
-if NEED_WCSL
+if ABI_WCSL
 dist_man_MANS += \
 	wcslcat.3bsd \
 	wcslcpy.3bsd \
diff --git a/src/Makefile.am b/src/Makefile.am
index b4ec241..21ed1c7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,7 +113,7 @@ libbsd_la_SOURCES = \
 	vis.c \
 	# EOL
 
-if NEED_ARC4RANDOM
+if ABI_ARC4RANDOM
 if !HAVE_GETENTROPY
 libbsd_la_SOURCES += \
 	getentropy.c \
@@ -130,75 +130,75 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
-if NEED_BSD_GETOPT
+if ABI_BSD_GETOPT
 libbsd_la_SOURCES += \
 	bsd_getopt.c \
 	# EOL
 endif
 
-if NEED_ERR
+if ABI_ERR
 libbsd_la_SOURCES += \
 	err.c \
 	# EOL
 endif
 
-if NEED_ERRC
+if ABI_ERRC
 libbsd_la_SOURCES += \
 	errc.c \
 	# EOL
 endif
 
-if NEED_FPURGE
+if ABI_FPURGE
 libbsd_la_SOURCES += \
 	fpurge.c \
 	# EOL
 endif
 
-if NEED_FUNOPEN
+if ABI_FUNOPEN
 libbsd_la_SOURCES += \
 	funopen.c \
 	# EOL
 endif
 
-if NEED_MD5
+if ABI_MD5
 libbsd_la_SOURCES += \
 	md5.c \
 	# EOL
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 libbsd_la_SOURCES += \
 	nlist.c \
 	# EOL
 endif
 
-if NEED_PROGNAME
+if ABI_PROGNAME
 libbsd_la_SOURCES += \
 	progname.c \
 	# EOL
 endif
 
-if NEED_STRL
+if ABI_STRL
 libbsd_la_SOURCES += \
 	strlcat.c \
 	strlcpy.c \
 	# EOL
 endif
 
-if NEED_STRMODE
+if ABI_STRMODE
 libbsd_la_SOURCES += \
 	strmode.c \
 	# EOL
 endif
 
-if NEED_WCSL
+if ABI_WCSL
 libbsd_la_SOURCES += \
 	wcslcat.c \
 	wcslcpy.c \
 	# EOL
 endif
 
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 CLEANFILES += \
 	format.ld \
 	# EOL
@@ -223,7 +223,7 @@ libbsd.map: libbsd.map.in
 libbsd.sym: libbsd.map
 	$(AM_V_GEN) $(SED) -ne 's/^[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\);/\1/p' libbsd.map >$@
 
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 TRANSPARENT_LIBMD_DEPENDS = format.ld
 
 format.ld:
@@ -240,7 +240,7 @@ install-exec-hook: $(TRANSPARENT_LIBMD_DEPENDS)
 		mv $(DESTDIR)$(libdir)/libbsd*.so.* \
 		   $(DESTDIR)$(runtimelibdir)/; \
 	fi
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 # The "GNU ld script" magic is required so that GNU ldconfig does not complain
 # about an unknown format file.
 	soname=`readlink $(DESTDIR)$(libdir)/libbsd.so`; \
diff --git a/test/Makefile.am b/test/Makefile.am
index 7b53bc1..64c6610 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -49,7 +49,7 @@ check_PROGRAMS = \
 	vis-openbsd \
 	# EOL
 
-if NEED_ARC4RANDOM
+if ABI_ARC4RANDOM
 if HAVE_LIBTESTU01
 check_PROGRAMS += arc4random
 
@@ -71,24 +71,24 @@ fparseln_SOURCES = \
 	fparseln.c \
 	# EOL
 
-if NEED_FPURGE
+if ABI_FPURGE
 check_PROGRAMS += fpurge
 endif
 
-if NEED_FUNOPEN
+if ABI_FUNOPEN
 check_PROGRAMS += funopen
 endif
 
-if NEED_MD5
+if ABI_MD5
 check_PROGRAMS += md5
 
-if NEED_TRANSPARENT_LIBMD
+if ABI_TRANSPARENT_LIBMD
 # On the installed system this is handled via the ld script.
 md5_LDADD = $(LDADD) $(MD5_LIBS)
 endif
 endif
 
-if NEED_NLIST
+if ABI_NLIST
 check_PROGRAMS += nlist
 endif
 
@@ -108,15 +108,15 @@ proctitle_LDFLAGS = \
 	# EOL
 endif
 
-if NEED_PROGNAME
+if ABI_PROGNAME
 check_PROGRAMS += progname
 endif
 
-if NEED_STRL
+if ABI_STRL
 check_PROGRAMS += strl
 endif
 
-if NEED_STRMODE
+if ABI_STRMODE
 check_PROGRAMS += strmode
 endif