···11-diff --git a/src/gen-lock-obj.sh b/src/gen-lock-obj.sh22-index a710f0c..258eec6 10075533---- a/src/gen-lock-obj.sh44-+++ b/src/gen-lock-obj.sh55-@@ -1,136 +1,136 @@66- #! /bin/sh77- #88- # gen-lock-obj.sh - Build tool to construct the lock object.99- #1010- # Copyright (C) 2020, 2021 g10 Code GmbH1111- #1212- # This file is part of libgpg-error.1313- #1414- # libgpg-error is free software; you can redistribute it and/or1515- # modify it under the terms of the GNU Lesser General Public License1616- # as published by the Free Software Foundation; either version 2.1 of1717- # the License, or (at your option) any later version.1818- #1919- # libgpg-error is distributed in the hope that it will be useful, but2020- # WITHOUT ANY WARRANTY; without even the implied warranty of2121- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU2222- # Lesser General Public License for more details.2323- #2424- # You should have received a copy of the GNU Lesser General Public2525- # License along with this program; if not, see <https://www.gnu.org/licenses/>.2626- #2727-2828- #2929- # Following variables should be defined to invoke this script3030- #3131- # CC3232- # OBJDUMP3333- # AWK3434- # ac_ext3535- # ac_object3636- # host3737- # LOCK_ABI_VERSION3838- #3939- # An example:4040- #4141- # LOCK_ABI_VERSION=1 host=x86_64-pc-linux-gnu host_alias=x86_64-linux-gnu \4242- # CC=$host_alias-gcc OBJDUMP=$host_alias-objdump ac_ext=c ac_objext=o \4343- # AWK=gawk ./gen-lock-obj.sh4444- #4545-4646--if test -n `echo -n`; then4747-+if test -n "`echo -n`"; then4848- ECHO_C='\c'4949- ECHO_N=''5050- else5151- ECHO_C=''5252- ECHO_N='-n'5353- fi5454-5555- if test "$1" = --disable-threads; then5656- cat <<EOF5757- ## lock-obj-pub.$host.h - NO LOCK SUPPORT5858- ## File created by gen-lock-obj.sh - DO NOT EDIT5959- ## To be included by mkheader into gpg-error.h6060-6161- /* Dummy object - no locking available. */6262- typedef struct6363- {6464- long _vers;6565- } gpgrt_lock_t;6666-6767- #define GPGRT_LOCK_INITIALIZER {-1}6868- EOF6969- else7070- AWK_VERSION_OUTPUT=$($AWK 'BEGIN { print PROCINFO["version"] }')7171- if test -n "$AWK_VERSION_OUTPUT"; then7272- # It's GNU awk, which supports PROCINFO.7373- AWK_OPTION=--non-decimal-data7474- fi7575-7676- cat <<'EOF' >conftest.$ac_ext7777- #include <pthread.h>7878- pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;7979- EOF8080-8181- if $CC -c conftest.$ac_ext; then :8282- ac_mtx_size=$($OBJDUMP -j .bss -t conftest.$ac_objext \8383- | $AWK $AWK_OPTION '8484- /mtx$/ { mtx_size = int("0x" $5) }8585- END { print mtx_size }')8686- else8787- echo "Can't determine mutex size"8888- exit 18989- fi9090- rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext9191-9292- cat <<EOF9393- ## lock-obj-pub.$host.h9494- ## File created by gen-lock-obj.sh - DO NOT EDIT9595- ## To be included by mkheader into gpg-error.h9696-9797- typedef struct9898- {9999- long _vers;100100- union {101101- volatile char _priv[$ac_mtx_size];102102- long _x_align;103103- long *_xp_align;104104- } u;105105- } gpgrt_lock_t;106106-107107- EOF108108-109109- # FIXME: Support different alignment conditions of:110110- #111111- # USE_16BYTE_ALIGNMENT112112- # USE_DOUBLE_FOR_ALIGNMENT113113- # USE_LONG_DOUBLE_FOR_ALIGNMENT114114- #115115-116116- echo ${ECHO_N} "#define GPGRT_LOCK_INITIALIZER {$LOCK_ABI_VERSION,{{${ECHO_C}"117117-118118- i=0119119- while test "$i" -lt $ac_mtx_size; do120120- if test "$i" -ne 0 -a "$(( $i % 8 ))" -eq 0; then121121- echo ' \'122122- echo ${ECHO_N} " ${ECHO_C}"123123- fi124124- echo ${ECHO_N} "0${ECHO_C}"125125- if test "$i" -lt $(($ac_mtx_size - 1)); then126126- echo ${ECHO_N} ",${ECHO_C}"127127- fi128128- i=$(( i + 1 ))129129- done130130- fi131131-132132- cat <<'EOF'133133- }}}134134- ##135135- ## Local Variables:136136- ## mode: c137137- ## buffer-read-only: t138138- ## End:139139- ##140140- EOF141141-142142- exit 0