Test for the 'echo' command from gnulib-tool.
[gnulib.git] / build-aux / bootstrap
index e5bcc68..b9b8e92 100755 (executable)
@@ -104,6 +104,9 @@ gnulib_extra_files="
        doc/INSTALL
 "
 
+# Additional gnulib-tool options to use.  Use "\newline" to break lines.
+gnulib_tool_option_extras=
+
 # Other locale categories that need message catalogs.
 EXTRA_LOCALE_CATEGORIES=
 
@@ -169,11 +172,16 @@ insert_sorted_if_absent() {
 }
 
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
-grep '^[        ]*AC_CONFIG_AUX_DIR('$build_aux')' configure.ac >/dev/null ||
-  {
-    echo "$0: expected line not found in configure.ac. Add the following:" >&2
-    echo "  AC_CONFIG_AUX_DIR($build_aux)" >&2.
-  }
+found_aux_dir=no
+grep '^[        ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
+    >/dev/null && found_aux_dir=yes
+grep '^[        ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
+    >/dev/null && found_aux_dir=yes
+if test $found_aux_dir = no; then
+  echo "$0: expected line not found in configure.ac. Add the following:" >&2
+  echo "  AC_CONFIG_AUX_DIR([$build_aux])" >&2
+  exit 1
+fi
 
 # If $build_aux doesn't exist, create it now, otherwise some bits
 # below will malfunction.  If creating it, also mark it as ignored.
@@ -456,6 +464,7 @@ gnulib_tool_options="\
  --source-base $bt/lib/\
  --tests-base $bt/tests\
  --local-dir gl\
+$gnulib_tool_option_extras\
 "
 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
@@ -467,13 +476,18 @@ done
 
 
 # Import from gettext.
+with_gettext=yes
+grep '^[        ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
+    with_gettext=no
 
-echo "$0: (cd $bt2; autopoint) ..."
-cp configure.ac $bt2 &&
-(cd $bt2 && autopoint && rm configure.ac) &&
-slurp $bt2 $bt || exit
+if test $with_gettext = yes; then
+  echo "$0: (cd $bt2; autopoint) ..."
+  cp configure.ac $bt2 &&
+  (cd $bt2 && autopoint && rm configure.ac) &&
+  slurp $bt2 $bt || exit
 
-rm -fr $bt $bt2 || exit
+  rm -fr $bt $bt2 || exit
+fi
 
 
 # Reconfigure, getting other files.
@@ -496,45 +510,46 @@ done
 
 
 # Get some extra files from gnulib, overriding existing files.
-
 for file in $gnulib_extra_files; do
   case $file in
   */INSTALL) dst=INSTALL;;
+  build-aux/*) dst=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;;
   *) dst=$file;;
   esac
   symlink_to_gnulib $file $dst || exit
 done
 
-
-# Create gettext configuration.
-echo "$0: Creating po/Makevars from po/Makevars.template ..."
-rm -f po/Makevars
-sed '
-  /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
-  /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
-  /^XGETTEXT_OPTIONS *=/{
-    s/$/ \\/
-    a\
-       '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
-  }
-' po/Makevars.template >po/Makevars
-
-if test -d runtime-po; then
-  # Similarly for runtime-po/Makevars, but not quite the same.
-  rm -f runtime-po/Makevars
+if test $with_gettext = yes; then
+  # Create gettext configuration.
+  echo "$0: Creating po/Makevars from po/Makevars.template ..."
+  rm -f po/Makevars
   sed '
-    /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
-    /^subdir *=.*/s/=.*/= runtime-po/
+    /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
     /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
     /^XGETTEXT_OPTIONS *=/{
       s/$/ \\/
       a\
-         '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
+         '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
     }
-  ' <po/Makevars.template >runtime-po/Makevars
+  ' po/Makevars.template >po/Makevars
+
+  if test -d runtime-po; then
+    # Similarly for runtime-po/Makevars, but not quite the same.
+    rm -f runtime-po/Makevars
+    sed '
+      /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
+      /^subdir *=.*/s/=.*/= runtime-po/
+      /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
+      /^XGETTEXT_OPTIONS *=/{
+       s/$/ \\/
+       a\
+           '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
+      }
+    ' <po/Makevars.template >runtime-po/Makevars
 
-  # Copy identical files from po to runtime-po.
-  (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
+    # Copy identical files from po to runtime-po.
+    (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
+  fi
 fi
 
 echo "$0: done.  Now you can run './configure'."