--- /dev/null
+#!/bin/sh
+
+# Test awk support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-a-1.awk"
+cat <<EOF > xg-a-1.awk
+# This comment will not be extracted.
+print _"help"
+# TRANSLATORS: This is an extracted comment.
+print _"me"
+# Not extracted either.
+print _"Hey Jude"
+# TRANSLATORS:
+# Nickname of the Beatles
+print _"The Fabulous Four"
+EOF
+
+tmpfiles="$tmpfiles xg-a-1.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-a-1.awk -d xg-a-1
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-a-1.ok"
+cat <<EOF > xg-a-1.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-a-1.ok xg-a-1.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test C support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-c-9.c"
+cat <<EOF > xg-c-9.c
+// This comment will not be extracted.
+print (gettext ("help"));
+// TRANSLATORS: This is an extracted comment.
+print (gettext ("me"));
+/* Not extracted either. */
+print (gettext ("Hey Jude"));
+/* TRANSLATORS:
+ Nickname of the Beatles
+*/
+print (gettext ("The Fabulous Four"));
+EOF
+
+tmpfiles="$tmpfiles xg-c-9.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-c-9.c -d xg-c-9
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-c-9.ok"
+cat <<EOF > xg-c-9.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+#.
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-c-9.ok xg-c-9.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test EmacsLisp support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-el-1.el"
+cat <<EOF > xg-el-1.el
+; This comment will not be extracted.
+(princ (_ "help"))
+;; TRANSLATORS: This is an extracted comment.
+(princ (_ "me"))
+; Not extracted either.
+(princ (_ "Hey Jude"))
+; TRANSLATORS:
+; Nickname of the Beatles
+(princ (_ "The Fabulous Four"))
+EOF
+
+tmpfiles="$tmpfiles xg-el-1.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-el-1.el -d xg-el-1
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-el-1.ok"
+cat <<EOF > xg-el-1.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-el-1.ok xg-el-1.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test Java support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-j-5.java"
+cat <<EOF > xg-j-5.java
+// This comment will not be extracted.
+System.out.println(gettext("help"));
+// TRANSLATORS: This is an extracted comment.
+System.out.println(gettext("me"));
+/* Not extracted either. */
+System.out.println(gettext("Hey Jude"));
+/* TRANSLATORS:
+ Nickname of the Beatles
+*/
+System.out.println(gettext("The Fabulous Four"));
+EOF
+
+tmpfiles="$tmpfiles xg-j-5.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-j-5.java -d xg-j-5
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-j-5.ok"
+cat <<EOF > xg-j-5.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+#.
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-j-5.ok xg-j-5.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test librep support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-lr-1.jl"
+cat <<EOF > xg-lr-1.jl
+; This comment will not be extracted.
+(princ (_ "help"))
+;; TRANSLATORS: This is an extracted comment.
+(princ (_ "me"))
+#| Not extracted either. |#
+(princ (_ "Hey Jude"))
+#| TRANSLATORS:
+ Nickname of the Beatles
+|#
+(princ (_ "The Fabulous Four"))
+EOF
+
+tmpfiles="$tmpfiles xg-lr-1.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-lr-1.jl -d xg-lr-1
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-lr-1.ok"
+cat <<EOF > xg-lr-1.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+#.
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-lr-1.ok xg-lr-1.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test Lisp support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-ls-1.lisp"
+cat <<EOF > xg-ls-1.lisp
+; This comment will not be extracted.
+(write-line (gettext "help"))
+;; TRANSLATORS: This is an extracted comment.
+(write-line (gettext "me"))
+#| Not extracted either. |#
+(write-line (gettext "Hey Jude"))
+#| TRANSLATORS:
+ Nickname of the Beatles
+|#
+(write-line (gettext "The Fabulous Four"))
+EOF
+
+tmpfiles="$tmpfiles xg-ls-1.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-ls-1.lisp -d xg-ls-1
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-ls-1.ok"
+cat <<EOF > xg-ls-1.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+#.
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-ls-1.ok xg-ls-1.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test Perl support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-pl-5.pl"
+cat <<EOF > xg-pl-5.pl
+# This comment will not be extracted.
+print gettext "help";
+# TRANSLATORS: This is an extracted comment.
+print gettext "me";
+# Not extracted either.
+print gettext "Hey Jude";
+# TRANSLATORS:
+# Nickname of the Beatles
+print gettext "The Fabulous Four";
+EOF
+
+tmpfiles="$tmpfiles xg-pl-5.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-pl-5.pl -d xg-pl-5
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-pl-5.ok"
+cat <<EOF > xg-pl-5.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-pl-5.ok xg-pl-5.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test PHP support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-ph-1.php"
+cat <<EOF > xg-ph-1.php
+<?
+// This comment will not be extracted.
+echo _("help");
+// TRANSLATORS: This is an extracted comment.
+echo _("me");
+# TRANSLATORS: This is extracted too.
+echo _("and you");
+/* Not extracted either. */
+echo _("Hey Jude");
+/* TRANSLATORS:
+ Nickname of the Beatles
+*/
+echo _("The Fabulous Four");
+?>
+EOF
+
+tmpfiles="$tmpfiles xg-ph-1.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-ph-1.php -d xg-ph-1
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-ph-1.ok"
+cat <<EOF > xg-ph-1.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+#. TRANSLATORS: This is extracted too.
+msgid "and you"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+#.
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-ph-1.ok xg-ph-1.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test Python support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-py-2.py"
+cat <<EOF > xg-py-2.py
+# This comment will not be extracted.
+print gettext.gettext("help")
+# TRANSLATORS: This is an extracted comment.
+print gettext.gettext("me")
+# Not extracted either.
+print gettext.gettext("Hey Jude")
+# TRANSLATORS:
+# Nickname of the Beatles
+print gettext.gettext("The Fabulous Four")
+EOF
+
+tmpfiles="$tmpfiles xg-py-2.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-py-2.py -d xg-py-2
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-py-2.ok"
+cat <<EOF > xg-py-2.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-py-2.ok xg-py-2.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test Shell support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-sh-2.sh"
+cat <<EOF > xg-sh-2.sh
+# This comment will not be extracted.
+gettext "help"
+# TRANSLATORS: This is an extracted comment.
+gettext "me"
+# Not extracted either.
+gettext "Hey Jude"
+# TRANSLATORS:
+# Nickname of the Beatles
+gettext "The Fabulous Four"
+EOF
+
+tmpfiles="$tmpfiles xg-sh-2.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-sh-2.sh -d xg-sh-2
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-sh-2.ok"
+cat <<EOF > xg-sh-2.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-sh-2.ok xg-sh-2.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test Smalltalk support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-st-1.st"
+cat <<EOF > xg-st-1.st
+"This comment will not be extracted."
+Transcript showCr: (NLS ? 'help').
+" TRANSLATORS: This is an extracted comment."
+Transcript showCr: (NLS ? 'me').
+"Not extracted either."
+Transcript showCr: (NLS ? 'Hey Jude').
+"TRANSLATORS:
+ Nickname of the Beatles
+"
+Transcript showCr: (NLS ? 'The Fabulous Four').
+EOF
+
+tmpfiles="$tmpfiles xg-st-1.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-st-1.st -d xg-st-1
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-st-1.ok"
+cat <<EOF > xg-st-1.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+#.
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-st-1.ok xg-st-1.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test Tcl support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-t-2.tcl"
+cat <<EOF > xg-t-2.tcl
+# This comment will not be extracted.
+puts [_ "help"]
+# TRANSLATORS: This is an extracted comment.
+puts [_ "me"]
+# Not extracted either.
+puts [_ "Hey Jude"]
+# TRANSLATORS:
+# Nickname of the Beatles
+puts [_ "The Fabulous Four"]
+EOF
+
+tmpfiles="$tmpfiles xg-t-2.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: -k_ \
+ xg-t-2.tcl -d xg-t-2
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-t-2.ok"
+cat <<EOF > xg-t-2.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-t-2.ok xg-t-2.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
--- /dev/null
+#!/bin/sh
+
+# Test YCP support: --add-comments option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-y-2.ycp"
+cat <<EOF > xg-y-2.ycp
+// This comment will not be extracted.
+print (_("help"));
+// TRANSLATORS: This is an extracted comment.
+print (_("me"));
+# TRANSLATORS: This is extracted too.
+print (_("and you"));
+/* Not extracted either. */
+print (_("Hey Jude"));
+/* TRANSLATORS:
+ Nickname of the Beatles
+*/
+print (_("The Fabulous Four"));
+EOF
+
+tmpfiles="$tmpfiles xg-y-2.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
+ xg-y-2.ycp -d xg-y-2
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-y-2.ok"
+cat <<EOF > xg-y-2.ok
+msgid "help"
+msgstr ""
+
+#. TRANSLATORS: This is an extracted comment.
+msgid "me"
+msgstr ""
+
+#. TRANSLATORS: This is extracted too.
+msgid "and you"
+msgstr ""
+
+msgid "Hey Jude"
+msgstr ""
+
+#. TRANSLATORS:
+#. Nickname of the Beatles
+#.
+msgid "The Fabulous Four"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-y-2.ok xg-y-2.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result