aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2026-06-23 03:21:33 +0200
committerNIIBE Yutaka <[email protected]>2026-06-23 03:21:33 +0200
commit61d9a64f91aa89652265da97e32edee86d5fba45 (patch)
tree1ca9f6810208ab4e3f123e7f4cf4c1c77aca8cc1
parentFix bug reference for the 1.61 release (diff)
downloadlibgpg-error-61d9a64f91aa89652265da97e32edee86d5fba45.tar.gz
libgpg-error-61d9a64f91aa89652265da97e32edee86d5fba45.zip
build: No use of awk with gen-lock-obj.sh.
* configure.ac: For invocation of gen-lock-obj.sh, use NM instead of OBJDUMP, use no AWK. * src/gen-lock-obj.sh: Use NM with option -P and -t d for portable output in decimal. No use of AWK, simply use cut. -- Signed-off-by: Alexis LothorĂ© <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--configure.ac10
-rwxr-xr-xsrc/gen-lock-obj.sh25
2 files changed, 15 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index e3d1a19..e9abe0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,16 +635,16 @@ if test x"$gl_use_threads" = xno; then
elif test x$cross_compiling = xyes; then
case $host in
*-*-gnu* | *-*-linux-gnu* | *-*-linux-musl* | wasm*-*-emscripten)
- AC_CHECK_TOOL(OBJDUMP, [objdump])
- if test -n "$OBJDUMP"; then
+ AC_CHECK_TOOL(NM, [nm])
+ if test -n "$NM"; then
lock_obj_h_generated=yes
if test ! -d src; then mkdir src; fi
LOCK_ABI_VERSION=1 host=$host host_alias=$host_alias \
- CC=$CC OBJDUMP=$OBJDUMP \
+ CC=$CC NM=$NM \
ac_ext=$ac_ext ac_objext=$ac_objext \
- AWK=$AWK $srcdir/src/gen-lock-obj.sh \
+ $srcdir/src/gen-lock-obj.sh \
>src/lock-obj-pub.native.h
- AC_MSG_NOTICE([generated src/lock-obj-pub.native.h using $host_alias-objdump and $AWK])
+ AC_MSG_NOTICE([generated src/lock-obj-pub.native.h using $NM])
else
force_use_syscfg=yes
fi
diff --git a/src/gen-lock-obj.sh b/src/gen-lock-obj.sh
index a8d9352..dccd02b 100755
--- a/src/gen-lock-obj.sh
+++ b/src/gen-lock-obj.sh
@@ -24,8 +24,7 @@
# Following variables should be defined to invoke this script
#
# CC
-# OBJDUMP
-# AWK
+# NM
# ac_ext
# ac_object
# host
@@ -34,8 +33,8 @@
# An example:
#
# LOCK_ABI_VERSION=1 host=x86_64-pc-linux-gnu host_alias=x86_64-linux-gnu \
-# CC=$host_alias-gcc OBJDUMP=$host_alias-objdump ac_ext=c ac_objext=o \
-# AWK=gawk ./gen-lock-obj.sh
+# CC=$host_alias-gcc NM=$NM ac_ext=c ac_objext=o \
+# ./gen-lock-obj.sh
#
if test -n "`echo -n`"; then
@@ -61,23 +60,19 @@ typedef struct
#define GPGRT_LOCK_INITIALIZER {-1}
EOF
else
-AWK_VERSION_OUTPUT=$($AWK 'BEGIN { print PROCINFO["version"] }')
-if test -n "$AWK_VERSION_OUTPUT"; then
- # It's GNU awk, which supports PROCINFO.
- AWK_OPTION=--non-decimal-data
-fi
-
cat <<'EOF' >conftest.$ac_ext
#include <pthread.h>
pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
EOF
+#
+# Note: NM actually comes with the option -B, because of libtool.m4.
+# We override with the -P option (Use POSIX.2 standard format).
+#
if $CC -c conftest.$ac_ext; then :
- ac_mtx_size=$($OBJDUMP -t conftest.$ac_objext \
- | $AWK $AWK_OPTION '
-/mtx$/ { mtx_size = int("0x" $5) }
-END { print mtx_size }')
-else
+ ac_mtx_size=$($NM -P -t d conftest.$ac_objext | cut -d ' ' -f 4)
+fi
+if test -z "$ac_mtx_size"; then
echo "Can't determine mutex size"
exit 1
fi