[PATCH] Fix bashism in configure.ac

Mathias M (via Code Review) gerrit at gerrit.libreoffice.org
Sun Mar 24 16:50:00 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2978

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/78/2978/1

Fix bashism in configure.ac

Change-Id: I574e873fede3343b2384715162dcecce86563db3
---
M configure.ac
1 file changed, 27 insertions(+), 19 deletions(-)



diff --git a/configure.ac b/configure.ac
index 6a31c89..4caa919 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11356,36 +11356,44 @@
 dnl ===================================================================
 AC_MSG_CHECKING([for alternative branding images directory])
 # initialize mapped arrays
-brand_vars=(INTRO_BITMAP ABOUT_BACKGROUND_SVG FLAT_LOGO_SVG \
+brand_vars="INTRO_BITMAP ABOUT_BACKGROUND_SVG FLAT_LOGO_SVG \
     STARTCENTER_LEFT_BITMAP STARTCENTER_RIGHT_BITMAP \
     STARTCENTER_RTL_LEFT_BITMAP STARTCENTER_RTL_RIGHT_BITMAP \
-    STARTCENTER_SPACE_BITMAP)
-brand_files=(intro.png about.svg flat_logo.svg \
+    STARTCENTER_SPACE_BITMAP"
+brand_files="intro.png about.svg flat_logo.svg \
     backing_left.png backing_right.png \
     backing_rtl_left.png backing_rtl_right.png \
-    backing_space.png)
+    backing_space.png"
+brandmaxidx=0
 
-for i in $(echo ${brand_vars[[@]]})
+for i in $brand_vars
 do
-     declare $i=
+    declare $i=
+    let "brandmaxidx=$brandmaxidx + 1"
 done
 
 if test -z "$with_branding" -o "$with_branding" = "no"; then
     AC_MSG_RESULT([none])
 else
-    idx=0
-    while test $idx -lt ${#brand_vars[@]}
-    do
-        if ! test -f $with_branding/${brand_files[[$idx]]}
-        then
-            AC_MSG_WARN([Branded file $i does not exist, using the default one])
-        else
-            declare ${brand_vars[[$idx]]}="$with_branding/${brand_files[[$idx]]}"
-        fi
-        let "idx=$idx + 1"
-    done
-    check_for_progress="yes"
-    AC_MSG_RESULT([$with_branding])
+    if ! test -d $with_branding ; then
+        AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
+    else
+        AC_MSG_RESULT([$with_branding])
+        idx=1
+        while test $idx -le $brandmaxidx
+        do
+            lvar=$(echo $brand_vars | cut -f$idx -d" ")
+            lfile=$(echo $brand_files | cut -f$idx -d" ")
+            
+            if ! test -f $with_branding/$lfile ; then
+                AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
+            else
+                declare lvar="$with_branding/$lfile"
+            fi
+            let "idx=$idx + 1"
+        done
+        check_for_progress="yes"
+    fi
 fi
 AC_SUBST(INTRO_BITMAP)
 AC_SUBST(ABOUT_BACKGROUND_SVG)

-- 
To view, visit https://gerrit.libreoffice.org/2978
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I574e873fede3343b2384715162dcecce86563db3
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Mathias M <matm at gmx.fr>



More information about the LibreOffice mailing list