gettextize 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347
  1. #! /bin/sh
  2. #
  3. # Copyright (C) 1995-1998, 2000-2016 Free Software Foundation, Inc.
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. # This file is meant for authors or maintainers which want to
  19. # internationalize their package with the help of GNU gettext. For
  20. # further information how to use it consult the GNU gettext manual.
  21. progname=$0
  22. package=gettext-tools
  23. version=0.19.8
  24. archive_version=0.19.8
  25. # Set variables
  26. # - gettext_datadir directory where the data files are stored.
  27. prefix="/builds/community/qemu-stm32/sysroot-cross"
  28. datarootdir="${prefix}/share"
  29. : ${gettext_datadir="${datarootdir}/gettext"}
  30. : ${AUTOM4TE=autom4te}
  31. # func_tmpdir
  32. # creates a temporary directory.
  33. # Sets variable
  34. # - tmp pathname of freshly created temporary directory
  35. func_tmpdir ()
  36. {
  37. # Use the environment variable TMPDIR, falling back to /tmp. This allows
  38. # users to specify a different temporary directory, for example, if their
  39. # /tmp is filled up or too small.
  40. : ${TMPDIR=/tmp}
  41. {
  42. # Use the mktemp program if available. If not available, hide the error
  43. # message.
  44. tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
  45. test -n "$tmp" && test -d "$tmp"
  46. } ||
  47. {
  48. # Use a simple mkdir command. It is guaranteed to fail if the directory
  49. # already exists. $RANDOM is bash specific and expands to empty in shells
  50. # other than bash, ksh and zsh. Its use does not increase security;
  51. # rather, it minimizes the probability of failure in a very cluttered /tmp
  52. # directory.
  53. tmp=$TMPDIR/gt$$-$RANDOM
  54. (umask 077 && mkdir "$tmp")
  55. } ||
  56. {
  57. echo "$0: cannot create a temporary directory in $TMPDIR" >&2
  58. { (exit 1); exit 1; }
  59. }
  60. }
  61. # Support for relocatability.
  62. func_find_curr_installdir ()
  63. {
  64. # Determine curr_installdir, even taking into account symlinks.
  65. curr_executable="$0"
  66. case "$curr_executable" in
  67. */* | *\\*) ;;
  68. *) # Need to look in the PATH.
  69. save_IFS="$IFS"; IFS="${PATH_SEPARATOR=':'}"
  70. for dir in $PATH; do
  71. IFS="$save_IFS"
  72. test -z "$dir" && dir=.
  73. for exec_ext in ''; do
  74. if test -f "$dir/$curr_executable$exec_ext"; then
  75. curr_executable="$dir/$curr_executable$exec_ext"
  76. break 2
  77. fi
  78. done
  79. done
  80. IFS="$save_IFS"
  81. ;;
  82. esac
  83. # Make absolute.
  84. case "$curr_executable" in
  85. /* | ?:/* | ?:\\*) ;;
  86. *) curr_executable=`pwd`/"$curr_executable" ;;
  87. esac
  88. # Resolve symlinks.
  89. sed_dirname='s,/[^/]*$,,'
  90. sed_linkdest='s,^.* -> \(.*\),\1,p'
  91. while : ; do
  92. lsline=`LC_ALL=C ls -l "$curr_executable"`
  93. case "$lsline" in
  94. *" -> "*)
  95. linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
  96. case "$linkdest" in
  97. /* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
  98. *) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
  99. esac ;;
  100. *) break ;;
  101. esac
  102. done
  103. curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
  104. # Canonicalize.
  105. curr_installdir=`cd "$curr_installdir" && pwd`
  106. }
  107. func_find_prefixes ()
  108. {
  109. # Compute the original/current installation prefixes by stripping the
  110. # trailing directories off the original/current installation directories.
  111. orig_installprefix="$orig_installdir"
  112. curr_installprefix="$curr_installdir"
  113. while true; do
  114. orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
  115. curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
  116. if test -z "$orig_last" || test -z "$curr_last"; then
  117. break
  118. fi
  119. if test "$orig_last" != "$curr_last"; then
  120. break
  121. fi
  122. orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
  123. curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
  124. done
  125. }
  126. if test "no" = yes; then
  127. exec_prefix="${prefix}"
  128. bindir="${exec_prefix}/bin"
  129. orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
  130. func_find_curr_installdir # determine curr_installdir
  131. func_find_prefixes
  132. # Relocate the directory variables that we use.
  133. gettext_datadir=`echo "$gettext_datadir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
  134. fi
  135. # func_trace_autoconf macro configure.ac
  136. # traces an Autoconf macro call and outputs the arguments to stdout,
  137. # using autom4te.
  138. func_trace_autoconf ()
  139. {
  140. echo '\
  141. dnl replace macros which may abort autom4te with a no-op variant
  142. m4_pushdef([m4_assert])
  143. m4_pushdef([m4_fatal])
  144. m4_pushdef([m4_warn])
  145. m4_pushdef([m4_errprintn])
  146. m4_pushdef([m4_exit])
  147. m4_pushdef([m4_include])
  148. m4_pushdef([m4_esyscmd])
  149. ' \
  150. | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 \
  151. --trace="$1":\$% - "$2" 2>/dev/null
  152. }
  153. # func_trace_sed macro configure.ac
  154. # traces an Autoconf macro call and outputs the arguments to stdout,
  155. # using sed.
  156. func_trace_sed ()
  157. {
  158. sed_extract_arguments='
  159. s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
  160. /'"$1"'(/ {
  161. ta
  162. :a
  163. s/)/)/
  164. tb
  165. s/\\$//
  166. N
  167. ba
  168. :b
  169. s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p
  170. }
  171. d'
  172. sed -e "$sed_extract_arguments" "$2"
  173. }
  174. # func_usage
  175. # outputs to stdout the --help usage message.
  176. func_usage ()
  177. {
  178. echo "\
  179. Usage: gettextize [OPTION]... [package-dir]
  180. Prepares a source package to use gettext.
  181. Options:
  182. --help print this help and exit
  183. --version print version information and exit
  184. -f, --force force writing of new files even if old exist
  185. --intl install libintl in a subdirectory (deprecated)
  186. --po-dir=DIR specify directory with PO files
  187. --no-changelog don't update or create ChangeLog files
  188. --symlink make symbolic links instead of copying files
  189. -n, --dry-run print modifications but don't perform them
  190. Report bugs to <bug-gnu-gettext@gnu.org>."
  191. }
  192. # func_version
  193. # outputs to stdout the --version message.
  194. func_version ()
  195. {
  196. echo "$progname (GNU $package) $version"
  197. echo "Copyright (C) 1995-1998, 2000-2013 Free Software Foundation, Inc.
  198. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  199. This is free software: you are free to change and redistribute it.
  200. There is NO WARRANTY, to the extent permitted by law."
  201. echo "Written by" "Ulrich Drepper"
  202. }
  203. # func_fatal_error message
  204. # outputs to stderr a fatal error message, and terminates the program.
  205. func_fatal_error ()
  206. {
  207. echo "gettextize: *** $1" 1>&2
  208. echo "gettextize: *** Stop." 1>&2
  209. exit 1
  210. }
  211. # Nuisances.
  212. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  213. # Unset more variables known to interfere with behavior of common tools.
  214. CLICOLOR_FORCE= GREP_OPTIONS=
  215. unset CLICOLOR_FORCE GREP_OPTIONS
  216. # Command-line option processing.
  217. # Removes the OPTIONS from the arguments. Sets the variables:
  218. # - force 1 if --force was given, 0 otherwise
  219. # - intldir yes if --intl was given, empty otherwise
  220. # - podirs list of directories specified with --po-dir
  221. # - try_ln_s : if --symlink was given, false otherwise
  222. # - do_changelog false if --no-changelog was given, : otherwise
  223. # - doit false if --dry-run was given, : otherwise
  224. {
  225. force=0
  226. intldir=
  227. podirs=
  228. try_ln_s=false
  229. do_changelog=:
  230. doit=:
  231. while test $# -gt 0; do
  232. case "$1" in
  233. -c | --copy | --cop | --co | --c ) # accepted for backward compatibility
  234. shift ;;
  235. -n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d )
  236. shift
  237. doit=false ;;
  238. -f | --force | --forc | --for | --fo | --f )
  239. shift
  240. force=1 ;;
  241. --help | --hel | --he | --h )
  242. func_usage; exit 0 ;;
  243. --intl | --int | --in | --i )
  244. shift
  245. intldir=yes ;;
  246. --po-dir | --po-di | --po-d | --po- | --po | --p )
  247. shift
  248. if test $# = 0; then
  249. func_fatal_error "missing argument for --po-dir"
  250. fi
  251. case "$1" in
  252. -*) func_fatal_error "missing argument for --po-dir" ;;
  253. esac
  254. podirs="$podirs $1"
  255. shift ;;
  256. --po-dir=* )
  257. arg=`echo "X$1" | sed -e 's/^X--po-dir=//'`
  258. podirs="$podirs $arg"
  259. shift ;;
  260. --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
  261. shift
  262. do_changelog=false ;;
  263. --symlink | --symlin | --symli | --syml | --sym | --sy | --s )
  264. shift
  265. try_ln_s=: ;;
  266. --version | --versio | --versi | --vers | --ver | --ve | --v )
  267. func_version
  268. exit 0 ;;
  269. -- ) # Stop option prcessing
  270. shift; break ;;
  271. -* )
  272. echo "gettextize: unknown option $1" 1>&2
  273. echo "Try 'gettextize --help' for more information." 1>&2
  274. exit 1 ;;
  275. * )
  276. break ;;
  277. esac
  278. done
  279. # podirs defaults to "po".
  280. test -n "$podirs" || podirs="po"
  281. }
  282. # Warn about deprecated options.
  283. if test -n "$intldir"; then
  284. echo "gettextize: warning: the option '--intl' is deprecated and will be removed" 1>&2
  285. fi
  286. # Command-line argument processing.
  287. # Analyzes the remaining arguments.
  288. # Sets the variables
  289. # - origdir to the original directory,
  290. # - srcdir to the package directory, and cd-s into it.
  291. {
  292. if test $# -gt 1; then
  293. func_usage 1>&2
  294. exit 1
  295. fi
  296. origdir=`pwd`
  297. if test $# -eq 1; then
  298. srcdir=$1
  299. if cd "$srcdir"; then
  300. srcdir=`pwd`
  301. else
  302. func_fatal_error "Cannot change directory to '$srcdir'."
  303. fi
  304. else
  305. srcdir=$origdir
  306. fi
  307. }
  308. # The current directory is now $srcdir.
  309. # Check integrity of package: A configure.in/ac must be present. Sets variable
  310. # - configure_in name of configure.in/ac file.
  311. test -f configure.in || test -f configure.ac ||
  312. func_fatal_error "Missing configure.in or configure.ac, please cd to your package first."
  313. configure_in=NONE
  314. if test -f configure.in; then
  315. configure_in=configure.in
  316. else
  317. if test -f configure.ac; then
  318. configure_in=configure.ac
  319. fi
  320. fi
  321. # Check whether the --force option is needed but has not been specified.
  322. if test $force -eq 0; then
  323. if test -d intl; then
  324. func_fatal_error "intl/ subdirectory exists: use option -f if you really want to delete it."
  325. fi
  326. for podir in $podirs; do
  327. if test -f "$podir/Makefile.in.in"; then
  328. func_fatal_error "$podir/Makefile.in.in exists: use option -f if you really want to delete it."
  329. fi
  330. done
  331. if test -f ABOUT-NLS; then
  332. func_fatal_error "ABOUT-NLS exists: use option -f if you really want to delete it."
  333. fi
  334. fi
  335. # Select the method for Autoconf macro tracing. func_trace_autoconf
  336. # is more accurate than func_trace_sed, but it only works with
  337. # autoconf >= 2.69.
  338. if echo "AC_PREREQ([2.69])" \
  339. | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 - 2>&1; then
  340. func_trace=func_trace_autoconf
  341. else
  342. func_trace=func_trace_sed
  343. fi
  344. # Check in which directory config.rpath etc. belong.
  345. auxdir=`"$func_trace" AC_CONFIG_AUX_DIR "$configure_in"`
  346. if test -n "$auxdir"; then
  347. auxdir="$auxdir/"
  348. fi
  349. # Check in which directory gettext.m4 etc. belong.
  350. macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR_TRACE "$configure_in"`
  351. if test -z "$macrodirs"; then
  352. macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR "$configure_in"`
  353. fi
  354. for arg in $macrodirs; do
  355. m4dir="$arg"
  356. break
  357. done
  358. # For simplicity we change to the gettext source directory.
  359. cd "$gettext_datadir" ||
  360. func_fatal_error "gettext source directory '${gettext_datadir}' doesn't exist"
  361. # Variables which keep track what has been modified.
  362. added_directories=
  363. removed_directory=
  364. added_extradist=
  365. added_acoutput=
  366. removed_acoutput=" intl/intlh.inst"
  367. # Variable:
  368. # - please accumulates instructions for the user.
  369. please=
  370. # Variable:
  371. # - date current date, for use in ChangeLog entries.
  372. date=`date +%Y-%m-%d`
  373. # func_copy from to
  374. # copies a file.
  375. # 'from' is a relative pathname, relative to the current directory.
  376. # 'to' is a relative pathname, relative to $srcdir.
  377. func_copy ()
  378. {
  379. if $doit; then
  380. rm -f "$srcdir/$2"
  381. echo "Copying file $2"
  382. cp "$1" "$srcdir/$2"
  383. else
  384. echo "Copy file $2"
  385. fi
  386. }
  387. # func_linkorcopy from absfrom to
  388. # links or copies a file.
  389. # 'from' is a relative pathname, relative to the current directory.
  390. # 'absfrom' is the corresponding absolute pathname.
  391. # 'to' is a relative pathname, relative to $srcdir.
  392. func_linkorcopy ()
  393. {
  394. if $doit; then
  395. rm -f "$srcdir/$3"
  396. ($try_ln_s && ln -s "$2" "$srcdir/$3" && echo "Symlinking file $3") 2>/dev/null ||
  397. { echo "Copying file $3"; cp "$1" "$srcdir/$3"; }
  398. else
  399. if $try_ln_s; then
  400. echo "Symlink file $3"
  401. else
  402. echo "Copy file $3"
  403. fi
  404. fi
  405. }
  406. # func_backup to
  407. # makes a backup of a file that is about to be overwritten or replaced.
  408. # 'to' is a relative pathname, relative to $srcdir.
  409. func_backup ()
  410. {
  411. if $doit; then
  412. if test -f "$srcdir/$1"; then
  413. rm -f "$srcdir/$1~"
  414. cp -p "$srcdir/$1" "$srcdir/$1~"
  415. fi
  416. fi
  417. }
  418. # func_remove to
  419. # removes a file.
  420. # 'to' is a relative pathname, relative to $srcdir.
  421. func_remove ()
  422. {
  423. if $doit; then
  424. echo "Removing $1"
  425. rm -f "$srcdir/$1"
  426. else
  427. echo "Remove $1"
  428. fi
  429. }
  430. # func_ChangeLog_init
  431. # func_ChangeLog_add_entry line
  432. # func_ChangeLog_finish
  433. # manage the ChangeLog file, relative to $srcdir.
  434. func_ChangeLog_init ()
  435. {
  436. modified_ChangeLog=
  437. }
  438. func_ChangeLog_add_entry ()
  439. {
  440. if $doit; then
  441. if test -z "$modified_ChangeLog"; then
  442. echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/ChangeLog.tmp"
  443. echo >> "$srcdir/ChangeLog.tmp"
  444. modified_ChangeLog=yes
  445. fi
  446. echo "$1" >> "$srcdir/ChangeLog.tmp"
  447. else
  448. modified_ChangeLog=yes
  449. fi
  450. }
  451. func_ChangeLog_finish ()
  452. {
  453. if test -n "$modified_ChangeLog"; then
  454. if $doit; then
  455. echo >> "$srcdir/ChangeLog.tmp"
  456. if test -f "$srcdir/ChangeLog"; then
  457. echo "Adding an entry to ChangeLog (backup is in ChangeLog~)"
  458. cat "$srcdir/ChangeLog" >> "$srcdir/ChangeLog.tmp"
  459. rm -f "$srcdir/ChangeLog~"
  460. cp -p "$srcdir/ChangeLog" "$srcdir/ChangeLog~"
  461. else
  462. echo "Creating ChangeLog"
  463. fi
  464. cp "$srcdir/ChangeLog.tmp" "$srcdir/ChangeLog"
  465. rm -f "$srcdir/ChangeLog.tmp"
  466. else
  467. if test -f "$srcdir/ChangeLog"; then
  468. echo "Add an entry to ChangeLog"
  469. else
  470. echo "Create ChangeLog"
  471. fi
  472. fi
  473. fi
  474. }
  475. # func_poChangeLog_init
  476. # func_poChangeLog_add_entry line
  477. # func_poChangeLog_finish
  478. # manage the $podir/ChangeLog file, relative to $srcdir.
  479. func_poChangeLog_init ()
  480. {
  481. modified_poChangeLog=
  482. }
  483. func_poChangeLog_add_entry ()
  484. {
  485. if $doit; then
  486. if test -z "$modified_poChangeLog"; then
  487. echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/$podir/ChangeLog.tmp"
  488. echo >> "$srcdir/$podir/ChangeLog.tmp"
  489. modified_poChangeLog=yes
  490. fi
  491. echo "$1" >> "$srcdir/$podir/ChangeLog.tmp"
  492. else
  493. modified_poChangeLog=yes
  494. fi
  495. }
  496. func_poChangeLog_finish ()
  497. {
  498. if test -n "$modified_poChangeLog"; then
  499. if $doit; then
  500. echo >> "$srcdir/$podir/ChangeLog.tmp"
  501. if test -f "$srcdir/$podir/ChangeLog"; then
  502. echo "Adding an entry to $podir/ChangeLog (backup is in $podir/ChangeLog~)"
  503. cat "$srcdir/$podir/ChangeLog" >> "$srcdir/$podir/ChangeLog.tmp"
  504. rm -f "$srcdir/$podir/ChangeLog~"
  505. cp -p "$srcdir/$podir/ChangeLog" "$srcdir/$podir/ChangeLog~"
  506. else
  507. echo "Creating $podir/ChangeLog"
  508. fi
  509. cp "$srcdir/$podir/ChangeLog.tmp" "$srcdir/$podir/ChangeLog"
  510. rm -f "$srcdir/$podir/ChangeLog.tmp"
  511. else
  512. if test -f "$srcdir/$podir/ChangeLog"; then
  513. echo "Add an entry to $podir/ChangeLog"
  514. else
  515. echo "Create $podir/ChangeLog"
  516. fi
  517. fi
  518. fi
  519. }
  520. # func_m4ChangeLog_init
  521. # func_m4ChangeLog_add_entry line
  522. # func_m4ChangeLog_finish
  523. # manage the $m4dir/ChangeLog file, relative to $srcdir.
  524. func_m4ChangeLog_init ()
  525. {
  526. if test -n "$using_m4ChangeLog"; then
  527. modified_m4ChangeLog=
  528. created_m4ChangeLog=
  529. fi
  530. }
  531. func_m4ChangeLog_add_entry ()
  532. {
  533. if test -n "$using_m4ChangeLog"; then
  534. if $doit; then
  535. if test -z "$modified_m4ChangeLog"; then
  536. echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/$m4dir/ChangeLog.tmp"
  537. echo >> "$srcdir/$m4dir/ChangeLog.tmp"
  538. modified_m4ChangeLog=yes
  539. fi
  540. echo "$1" >> "$srcdir/$m4dir/ChangeLog.tmp"
  541. else
  542. modified_m4ChangeLog=yes
  543. fi
  544. else
  545. line="$1"
  546. line=`echo "$line" | sed -e "s%^ \\* % * $m4dir/%"`
  547. func_ChangeLog_add_entry "$line"
  548. fi
  549. }
  550. func_m4ChangeLog_finish ()
  551. {
  552. if test -n "$using_m4ChangeLog"; then
  553. if test -n "$modified_m4ChangeLog"; then
  554. if $doit; then
  555. echo >> "$srcdir/$m4dir/ChangeLog.tmp"
  556. if test -f "$srcdir/$m4dir/ChangeLog"; then
  557. echo "Adding an entry to $m4dir/ChangeLog (backup is in $m4dir/ChangeLog~)"
  558. cat "$srcdir/$m4dir/ChangeLog" >> "$srcdir/$m4dir/ChangeLog.tmp"
  559. rm -f "$srcdir/$m4dir/ChangeLog~"
  560. cp -p "$srcdir/$m4dir/ChangeLog" "$srcdir/$m4dir/ChangeLog~"
  561. else
  562. echo "Creating $m4dir/ChangeLog"
  563. created_m4ChangeLog=yes
  564. fi
  565. cp "$srcdir/$m4dir/ChangeLog.tmp" "$srcdir/$m4dir/ChangeLog"
  566. rm -f "$srcdir/$m4dir/ChangeLog.tmp"
  567. else
  568. if test -f "$srcdir/$m4dir/ChangeLog"; then
  569. echo "Add an entry to $m4dir/ChangeLog"
  570. else
  571. echo "Create $m4dir/ChangeLog"
  572. created_m4ChangeLog=yes
  573. fi
  574. fi
  575. fi
  576. fi
  577. }
  578. using_m4ChangeLog=yes
  579. if test ! -f "$srcdir/intl/Makefile.in" && test -n "$intldir"; then
  580. added_acoutput="$added_acoutput intl/Makefile"
  581. fi
  582. if test -f "$srcdir/intl/Makefile.in" && test -z "$intldir"; then
  583. removed_acoutput="$removed_acoutput intl/Makefile"
  584. fi
  585. if test -d "$srcdir/intl"; then
  586. # Remove everything inside intl except for RCS and CVS subdirs and invisible
  587. # files.
  588. if $doit; then
  589. echo "Wiping out intl/ subdirectory"
  590. (cd "$srcdir/intl" &&
  591. for f in *; do
  592. if test CVS != "$f" && test RCS != "$f"; then
  593. rm -rf "$f"
  594. fi
  595. done)
  596. else
  597. echo "Wipe out intl/ subdirectory"
  598. fi
  599. if test -z "$intldir"; then
  600. removed_directory=intl
  601. fi
  602. else
  603. if test -n "$intldir"; then
  604. if $doit; then
  605. echo "Creating intl/ subdirectory"
  606. mkdir "$srcdir/intl" || func_fatal_error "failed to create intl/ subdirectory"
  607. else
  608. echo "Create intl/ subdirectory"
  609. fi
  610. added_directories="$added_directories intl"
  611. fi
  612. fi
  613. $do_changelog && func_ChangeLog_init
  614. for podir in $podirs; do
  615. test -d "$srcdir/$podir" || {
  616. if $doit; then
  617. echo "Creating $podir/ subdirectory"
  618. mkdir "$srcdir/$podir" || func_fatal_error "failed to create $podir/ subdirectory"
  619. else
  620. echo "Create $podir/ subdirectory"
  621. fi
  622. added_directories="$added_directories $podir"
  623. }
  624. done
  625. # Create the directory for config.rpath, if needed.
  626. # This is for consistency with autoreconf and automake.
  627. # Note that $auxdir is either empty or ends in a slash.
  628. test -d "$srcdir/$auxdir" || {
  629. if $doit; then
  630. echo "Creating $auxdir subdirectory"
  631. mkdir "$srcdir/$auxdir" || func_fatal_error "failed to create $auxdir subdirectory"
  632. else
  633. echo "Create $auxdir subdirectory"
  634. fi
  635. }
  636. # Now copy all files. Take care for the destination directories.
  637. for file in *; do
  638. case $file in
  639. ABOUT-NLS)
  640. func_linkorcopy $file "$gettext_datadir/$file" $file
  641. ;;
  642. config.rpath)
  643. if test -f "$srcdir/$auxdir$file"; then
  644. :
  645. else
  646. added_extradist="$added_extradist $auxdir$file"
  647. fi
  648. func_linkorcopy $file "$gettext_datadir/$file" "$auxdir$file"
  649. ;;
  650. esac
  651. done
  652. # Copy files to intl/ subdirectory.
  653. if test -n "$intldir"; then
  654. cd intl
  655. for file in *; do
  656. if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
  657. if test $file != plural.c; then
  658. func_linkorcopy $file "$gettext_datadir/intl/$file" intl/$file
  659. else
  660. # plural.c is a generated file; it must be copied and touched.
  661. func_copy $file intl/$file
  662. if $doit; then
  663. (sleep 2; touch "$srcdir/intl/$file") &
  664. fi
  665. fi
  666. fi
  667. done
  668. cd ..
  669. else
  670. echo "Not copying intl/ directory."
  671. # Tell the user what to put into configure.ac, if it is not already there.
  672. external=
  673. # Need to use func_trace_sed instead of $func_trace, since
  674. # AM_GNU_GETTEXT is not a standard Autoconf trace.
  675. xargs=`func_trace_sed AM_GNU_GETTEXT "$srcdir/$configure_in"`
  676. save_IFS="$IFS"; IFS=:
  677. for arg in $xargs; do
  678. if test 'external' = "$arg"; then
  679. external=yes
  680. break
  681. fi
  682. done
  683. IFS="$save_IFS"
  684. if test -z "$external"; then
  685. please="$please
  686. Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration
  687. to look for an external libintl.
  688. "
  689. fi
  690. fi
  691. # Copy files to po/ subdirectory.
  692. cd po
  693. for podir in $podirs; do
  694. $do_changelog && func_poChangeLog_init
  695. for file in Makefile.in.in; do
  696. same=no
  697. if test -f "$srcdir/$podir/$file"; then
  698. if cmp -s $file "$srcdir/$podir/$file"; then
  699. same=yes
  700. fi
  701. else
  702. added_acoutput="$added_acoutput $podir/Makefile.in"
  703. fi
  704. if $do_changelog && test $same = no; then
  705. if test -f "$srcdir/$podir/$file"; then
  706. func_poChangeLog_add_entry " * $file: Upgrade to gettext-${version}."
  707. else
  708. func_poChangeLog_add_entry " * $file: New file, from gettext-${version}."
  709. fi
  710. fi
  711. func_backup "$podir/$file"
  712. func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
  713. done
  714. for file in *; do
  715. case $file in
  716. Makefile.in.in)
  717. # Already handled above.
  718. ;;
  719. Makevars.template)
  720. func_linkorcopy Makevars.template "$gettext_datadir/po/Makevars.template" "$podir/Makevars.template"
  721. if test -f "$srcdir/po/Makevars"; then
  722. LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/$podir/Makevars" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp1"
  723. LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/$podir/Makevars.template" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp2"
  724. missingvars=`LC_ALL=C comm -13 "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"`
  725. rm -f "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"
  726. if test -n "$missingvars"; then
  727. please="$please
  728. Please update $podir/Makevars so that it defines all the variables mentioned
  729. in $podir/Makevars.template.
  730. You can then remove $podir/Makevars.template.
  731. "
  732. fi
  733. else
  734. please="$please
  735. Please create $podir/Makevars from the template in $podir/Makevars.template.
  736. You can then remove $podir/Makevars.template.
  737. "
  738. fi
  739. ;;
  740. *)
  741. same=no
  742. if test -f "$srcdir/$podir/$file"; then
  743. if cmp -s $file "$srcdir/$podir/$file"; then
  744. same=yes
  745. fi
  746. fi
  747. if $do_changelog && test $same = no; then
  748. if test -f "$srcdir/$podir/$file"; then
  749. func_poChangeLog_add_entry " * $file: Upgrade to gettext-${version}."
  750. else
  751. func_poChangeLog_add_entry " * $file: New file, from gettext-${version}."
  752. fi
  753. fi
  754. func_backup "$podir/$file"
  755. func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
  756. ;;
  757. esac
  758. done
  759. if test -f "$srcdir/$podir/cat-id-tbl.c"; then
  760. func_remove "$podir/cat-id-tbl.c"
  761. $do_changelog && func_poChangeLog_add_entry " * cat-id-tbl.c: Remove file."
  762. fi
  763. if test -f "$srcdir/$podir/stamp-cat-id"; then
  764. func_remove "$podir/stamp-cat-id"
  765. $do_changelog && func_poChangeLog_add_entry " * stamp-cat-id: Remove file."
  766. fi
  767. if test ! -f "$srcdir/$podir/POTFILES.in"; then
  768. if $doit; then
  769. echo "Creating initial $podir/POTFILES.in"
  770. echo '# List of source files which contain translatable strings.' > "$srcdir/$podir/POTFILES.in"
  771. else
  772. echo "Create initial $podir/POTFILES.in"
  773. fi
  774. $do_changelog && func_poChangeLog_add_entry " * POTFILES.in: New file."
  775. please="$please
  776. Please fill $podir/POTFILES.in as described in the documentation.
  777. "
  778. fi
  779. $do_changelog && func_poChangeLog_finish
  780. done
  781. # Determine whether we can assume automake 1.9 or newer.
  782. have_automake19=
  783. if (aclocal --version) >/dev/null 2>/dev/null; then
  784. aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
  785. case $aclocal_version in
  786. 1.9* | 1.[1-9][0-9]* | [2-9]*) have_automake19=yes ;;
  787. esac
  788. fi
  789. m4filelist='gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4
  790. po.m4 progtest.m4'
  791. # With aclocal versions < 1.9 we need all m4 files, otherwise "aclocal -I m4"
  792. # might give an error. (aclocal < 1.9 didn't know which macros are really
  793. # needed, it looked which macros are potentially needed.)
  794. min_automake_version=1.9
  795. if test -n "$intldir" || test -z "$have_automake19"; then
  796. # Add intldir.m4, intl.m4 and its dependencies.
  797. m4filelist=$m4filelist' codeset.m4 fcntl-o.m4 glibc2.m4 glibc21.m4 intdiv0.m4
  798. intl.m4 intldir.m4 intlmacosx.m4 intmax.m4 inttypes_h.m4 inttypes-pri.m4
  799. lcmessage.m4 lock.m4 longlong.m4 printf-posix.m4 size_max.m4 stdint_h.m4
  800. threadlib.m4 uintmax_t.m4 visibility.m4 wchar_t.m4 wint_t.m4 xsize.m4'
  801. min_automake_version=1.8
  802. fi
  803. # All sorts of bugs could occur if the configure file was remade with the wrong
  804. # version of gettext.m4 et al. (because then the configure and the po/Makefile.in.in
  805. # don't fit together). It is therefore important that the package carries the
  806. # right versions of gettext.m4 et al. with it.
  807. if test -f "$srcdir/Makefile.am"; then
  808. # A package using automake.
  809. # Determine whether it's using automake 1.8 or newer.
  810. have_automake18=
  811. if (aclocal --version) >/dev/null 2>/dev/null; then
  812. aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
  813. case $aclocal_version in
  814. 1.[8-9]* | 1.[1-9][0-9]* | [2-9]*) have_automake18=yes ;;
  815. esac
  816. fi
  817. if test -z "$m4dir"; then
  818. # Extract the macro directory name from Makefile.am.
  819. aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
  820. m4dir_is_next=
  821. for arg in $aclocal_amflags; do
  822. if test -n "$m4dir_is_next"; then
  823. # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
  824. case "$arg" in
  825. /*) ;;
  826. *)
  827. test -z "$m4dir" || m4dir="$arg"
  828. macrodirs="$macrodirs $arg"
  829. ;;
  830. esac
  831. m4dir_is_next=
  832. else
  833. if test "X$arg" = "X-I"; then
  834. m4dir_is_next=yes
  835. else
  836. m4dir_is_next=
  837. fi
  838. fi
  839. done
  840. for arg in $macrodirs; do
  841. m4dir="$arg"
  842. break
  843. done
  844. fi
  845. if test -z "$m4dir"; then
  846. m4dir=m4
  847. m4dir_defaulted=yes
  848. fi
  849. # Decide whether to use $m4dir/ChangeLog, or to use ChangeLog instead.
  850. if test -d "$srcdir/$m4dir" && test -f "$srcdir/ChangeLog" && test ! -f "$srcdir/$m4dir/ChangeLog"; then
  851. # The programmer has no $m4dir/ChangeLog so far. Don't introduce one.
  852. using_m4ChangeLog=
  853. fi
  854. # Update the *.m4 files and the corresponding Makefile.am.
  855. $do_changelog && func_m4ChangeLog_init
  856. added_m4dir=
  857. added_m4files=
  858. if test -d "$srcdir/$m4dir"; then
  859. :
  860. else
  861. if $doit; then
  862. echo "Creating directory $m4dir"
  863. mkdir "$srcdir/$m4dir"
  864. else
  865. echo "Create directory $m4dir"
  866. fi
  867. added_m4dir=yes
  868. fi
  869. for file in $m4filelist; do
  870. same=no
  871. if test -f "$srcdir/$m4dir/$file"; then
  872. if cmp -s "${datarootdir}/aclocal/$file" "$srcdir/$m4dir/$file"; then
  873. same=yes
  874. fi
  875. else
  876. added_m4files="$added_m4files $file"
  877. fi
  878. if $do_changelog && test $same = no; then
  879. if test -f "$srcdir/$m4dir/$file"; then
  880. func_m4ChangeLog_add_entry " * $file: Upgrade to gettext-${version}."
  881. else
  882. func_m4ChangeLog_add_entry " * $file: New file, from gettext-${version}."
  883. fi
  884. fi
  885. func_backup "$m4dir/$file"
  886. func_linkorcopy "${datarootdir}/aclocal/$file" "${datarootdir}/aclocal/$file" "$m4dir/$file"
  887. done
  888. missing_m4Makefileam=
  889. if test -n "$added_m4files"; then
  890. if test -f "$srcdir/$m4dir/Makefile.am"; then
  891. if $doit; then
  892. echo "Updating EXTRA_DIST in $m4dir/Makefile.am (backup is in $m4dir/Makefile.am~)"
  893. func_backup "$m4dir/Makefile.am"
  894. rm -f "$srcdir/$m4dir/Makefile.am"
  895. if grep '^EXTRA_DIST[ ]*=' "$srcdir/$m4dir/Makefile.am~" > /dev/null; then
  896. sed -e "s%^\(EXTRA_DIST[ ]*=\) \\?%\\1$added_m4files %" < "$srcdir/$m4dir/Makefile.am~" > "$srcdir/$m4dir/Makefile.am"
  897. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): Add the new files."
  898. else
  899. (cat "$srcdir/$m4dir/Makefile.am~"; echo; echo "EXTRA_DIST =$added_m4files") > "$srcdir/$m4dir/Makefile.am"
  900. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): New variable."
  901. fi
  902. else
  903. echo "Update EXTRA_DIST in $m4dir/Makefile.am"
  904. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST)."
  905. fi
  906. else
  907. # $m4dir/Makefile.am is not needed any more when aclocal 1.8 or newer
  908. # is used.
  909. if test -z "$have_automake18"; then
  910. if $doit; then
  911. echo "Creating $m4dir/Makefile.am"
  912. echo "EXTRA_DIST =$added_m4files" > "$srcdir/$m4dir/Makefile.am"
  913. else
  914. echo "Create $m4dir/Makefile.am"
  915. fi
  916. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am: New file."
  917. added_acoutput="$added_acoutput $m4dir/Makefile"
  918. else
  919. missing_m4Makefileam=yes
  920. fi
  921. fi
  922. fi
  923. if test -n "$added_m4dir" && test -z "$missing_m4Makefileam"; then
  924. added_directories="$added_directories $m4dir"
  925. fi
  926. $do_changelog && func_m4ChangeLog_finish
  927. # automake will arrange for $m4dir/ChangeLog to be distributed if a
  928. # $m4dir/Makefile.am exists. If not, we need to add it to Makefile.am's
  929. # EXTRA_DIST explicitly.
  930. if test -n "$created_m4ChangeLog" && test -n "$missing_m4Makefileam"; then
  931. added_extradist="$added_extradist $m4dir/ChangeLog"
  932. fi
  933. # Update the top-level Makefile.am.
  934. modified_Makefile_am=
  935. # func_modify_Makefile_am changelog_comment
  936. # assumes a modified copy of $srcdir/Makefile.am in $srcdir/Makefile.am.tmp
  937. # and replaces the original Makefile.am file with the modified one if
  938. # the two files differ. Then it removes the modified copy.
  939. func_modify_Makefile_am ()
  940. {
  941. if cmp -s "$srcdir/Makefile.am" "$srcdir/Makefile.am.tmp"; then
  942. :
  943. else
  944. if test -z "$modified_Makefile_am"; then
  945. if $doit; then
  946. echo "Updating Makefile.am (backup is in Makefile.am~)"
  947. func_backup Makefile.am
  948. else
  949. echo "Update Makefile.am"
  950. fi
  951. fi
  952. if $doit; then
  953. rm -f "$srcdir/Makefile.am"
  954. cp "$srcdir/Makefile.am.tmp" "$srcdir/Makefile.am"
  955. fi
  956. if $do_changelog; then
  957. if test -z "$modified_Makefile_am"; then
  958. func_ChangeLog_add_entry " * Makefile.am $1"
  959. else
  960. func_ChangeLog_add_entry " $1"
  961. fi
  962. fi
  963. modified_Makefile_am=yes
  964. fi
  965. rm -f "$srcdir/Makefile.am.tmp"
  966. }
  967. if test -n "$added_directories"; then
  968. if grep '^SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  969. sed -e "s%^\(SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  970. added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
  971. func_modify_Makefile_am "(SUBDIRS): Add $added_directories_pretty."
  972. else
  973. (cat "$srcdir/Makefile.am"; echo; echo "SUBDIRS =$added_directories") > "$srcdir/Makefile.am.tmp"
  974. func_modify_Makefile_am "(SUBDIRS): New variable."
  975. fi
  976. fi
  977. if test -n "$removed_directory"; then
  978. sed -e '/^SUBDIRS[ ]*=/ {
  979. :a
  980. s%\([ ]\)'"$removed_directory"'[ ]%\1%
  981. s%[ ]'"$removed_directory"'$%%
  982. tb
  983. :b
  984. s%\\$%\\%
  985. tc
  986. bd
  987. :c
  988. n
  989. ba
  990. :d
  991. }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  992. func_modify_Makefile_am "(SUBDIRS): Remove $removed_directory."
  993. fi
  994. if test -n "$added_directories"; then
  995. if grep '^DIST_SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  996. sed -e "s%^\(DIST_SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  997. added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
  998. func_modify_Makefile_am "(DIST_SUBDIRS): Add $added_directories_pretty."
  999. fi
  1000. fi
  1001. if test -n "$removed_directory"; then
  1002. sed -e '/^DIST_SUBDIRS[ ]*=/ {
  1003. :a
  1004. s%\([ ]\)'"$removed_directory"'[ ]%\1%
  1005. s%[ ]'"$removed_directory"'$%%
  1006. tb
  1007. :b
  1008. s%\\$%\\%
  1009. tc
  1010. bd
  1011. :c
  1012. n
  1013. ba
  1014. :d
  1015. }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  1016. func_modify_Makefile_am "(DIST_SUBDIRS): Remove $removed_directory."
  1017. fi
  1018. if test -n "$m4dir_defaulted"; then
  1019. if grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  1020. sed -e "s%^\(ACLOCAL_AMFLAGS[ ]*=\) \\?%\\1 -I $m4dir %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  1021. func_modify_Makefile_am "(ACLOCAL_AMFLAGS): Add -I $m4dir."
  1022. else
  1023. (cat "$srcdir/Makefile.am"; echo; echo "ACLOCAL_AMFLAGS = -I $m4dir") > "$srcdir/Makefile.am.tmp"
  1024. func_modify_Makefile_am "(ACLOCAL_AMFLAGS): New variable."
  1025. fi
  1026. # Also update Makefile.in and, if existent, Makefile. Otherwise they
  1027. # would take into account the new flags only after a few rounds of
  1028. # "./configure", "make", "touch configure.in", "make distclean".
  1029. if $doit; then
  1030. for file in Makefile.in Makefile; do
  1031. if test -f "$srcdir/$file"; then
  1032. func_backup $file
  1033. rm -f "$srcdir/$file"
  1034. sed -e "s%(ACLOCAL)%(ACLOCAL) -I $m4dir%" < "$srcdir/$file~" > "$srcdir/$file"
  1035. fi
  1036. done
  1037. fi
  1038. fi
  1039. if test -n "$added_extradist"; then
  1040. if grep '^EXTRA_DIST[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  1041. sed -e "s%^\(EXTRA_DIST[ ]*=\)%\\1$added_extradist %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  1042. added_extradist_pretty=`echo $added_extradist | sed -e 's/ /, /g'`
  1043. func_modify_Makefile_am "(EXTRA_DIST): Add $added_extradist_pretty."
  1044. else
  1045. (cat "$srcdir/Makefile.am"; echo; echo "EXTRA_DIST =$added_extradist") > "$srcdir/Makefile.am.tmp"
  1046. func_modify_Makefile_am "(EXTRA_DIST): New variable."
  1047. fi
  1048. fi
  1049. # Extract the aclocal options name from Makefile.am.
  1050. aclocal_options=
  1051. for arg in $macrodirs; do
  1052. aclocal_options="$aclocal_options -I $arg"
  1053. done
  1054. please="$please
  1055. Please run 'aclocal$aclocal_options' to regenerate the aclocal.m4 file.
  1056. You need aclocal from GNU automake $min_automake_version (or newer) to do this.
  1057. Then run 'autoconf' to regenerate the configure file.
  1058. "
  1059. # Also create $m4dir/Makefile.in from $m4dir/Makefile.am, because automake
  1060. # doesn't do it by itself.
  1061. if $doit; then
  1062. case "$added_acoutput" in
  1063. *" $m4dir/Makefile")
  1064. (cd "$srcdir" && automake "$m4dir/Makefile") 2>/dev/null ||
  1065. please="$please
  1066. Please run 'automake $m4dir/Makefile' to create $m4dir/Makefile.in
  1067. "
  1068. ;;
  1069. esac
  1070. fi
  1071. else
  1072. please="$please
  1073. Please add the files
  1074. $m4filelist
  1075. from the ${datarootdir}/aclocal directory to your aclocal.m4 file.
  1076. "
  1077. fi
  1078. modified_configure_in=
  1079. # func_modify_configure_in changelog_comment
  1080. # assumes a modified copy of $srcdir/$configure_in in $srcdir/$configure_in.tmp
  1081. # and replaces the original configure.in/ac file with the modified one if
  1082. # the two files differ. Then it removes the modified copy.
  1083. func_modify_configure_in ()
  1084. {
  1085. if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1086. :
  1087. else
  1088. if test -z "$modified_configure_in"; then
  1089. if $doit; then
  1090. echo "Updating $configure_in (backup is in $configure_in~)"
  1091. func_backup $configure_in
  1092. else
  1093. echo "Update $configure_in"
  1094. fi
  1095. fi
  1096. if $doit; then
  1097. rm -f "$srcdir/$configure_in"
  1098. cp "$srcdir/$configure_in.tmp" "$srcdir/$configure_in"
  1099. fi
  1100. if $do_changelog; then
  1101. if test -z "$modified_configure_in"; then
  1102. func_ChangeLog_add_entry " * $configure_in $1"
  1103. else
  1104. func_ChangeLog_add_entry " $1"
  1105. fi
  1106. fi
  1107. modified_configure_in=yes
  1108. fi
  1109. rm -f "$srcdir/$configure_in.tmp"
  1110. }
  1111. if test -n "$added_acoutput"; then
  1112. if grep '^AC_CONFIG_FILES(' "$srcdir/$configure_in" > /dev/null; then
  1113. sedprog='
  1114. ta
  1115. b
  1116. :a
  1117. n
  1118. ba'
  1119. sed -e "s%^\\(AC_CONFIG_FILES([^])\\,]*\\)%\\1$added_acoutput%$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1120. added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
  1121. func_modify_configure_in "(AC_CONFIG_FILES): Add $added_acoutput_pretty."
  1122. else
  1123. if grep '^AC_OUTPUT(' "$srcdir/$configure_in" > /dev/null; then
  1124. sed -e "s%^\\(AC_OUTPUT([^])\\,]*\\)%\\1$added_acoutput%" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1125. added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
  1126. func_modify_configure_in "(AC_OUTPUT): Add $added_acoutput_pretty."
  1127. else
  1128. please="$please
  1129. Please add$added_acoutput to the AC_OUTPUT or AC_CONFIG_FILES invocation in the $configure_in file.
  1130. "
  1131. fi
  1132. fi
  1133. fi
  1134. if test -n "$removed_acoutput"; then
  1135. for file in $removed_acoutput; do
  1136. tag=
  1137. sedprog='{
  1138. s%\([[ ]\)'"$file"'[ ]%\1%
  1139. s%\([[ ]\)'"$file"'\([]),]\)%\1\2%
  1140. s%[[ ]'"$file"'$%%
  1141. :a
  1142. tb
  1143. :b
  1144. s%\\$%\\%
  1145. tc
  1146. bd
  1147. :c
  1148. n
  1149. s%\([ ]\)'"$file"'[ ]%\1%
  1150. s%\([ ]\)'"$file"'\([]),]\)%\1\2%
  1151. s%[ ]'"$file"'$%%
  1152. ba
  1153. :d
  1154. }'
  1155. sed -e '/^AC_CONFIG_FILES(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1156. if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1157. sed -e '/^AC_OUTPUT(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1158. if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1159. :
  1160. else
  1161. tag=AC_OUTPUT
  1162. fi
  1163. else
  1164. tag=AC_CONFIG_FILES
  1165. fi
  1166. if test -n "$tag"; then
  1167. func_modify_configure_in "($tag): Remove $file."
  1168. else
  1169. rm -f "$srcdir/$configure_in.tmp"
  1170. if test "$file" != intl/intlh.inst; then
  1171. please="$please
  1172. Please remove $file from the AC_OUTPUT or AC_CONFIG_FILES invocation
  1173. in the $configure_in file.
  1174. "
  1175. fi
  1176. fi
  1177. done
  1178. fi
  1179. sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *%%' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1180. func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile."
  1181. sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1182. func_modify_configure_in "(AC_LINK_FILES): Remove invocation."
  1183. # AM_GNU_GETTEXT_VERSION may not be present, when AM_GNU_GETTEXT_REQUIRE_VERSION is used.
  1184. if grep '^AM_GNU_GETTEXT_VERSION(' "$srcdir/$configure_in" 2>&1 >/dev/null; then
  1185. sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1186. func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version."
  1187. fi
  1188. $do_changelog && func_ChangeLog_finish
  1189. # Recommend replacement for deprecated Makefile variables.
  1190. use_libtool=`cat "$srcdir/$configure_in" | grep '^A[CM]_PROG_LIBTOOL'`
  1191. for file in `(cd "$srcdir"; find . -name Makefile.am -print; find . -name Makefile.in -print) | sed -e 's,^\./,,'`; do
  1192. if test -f "$srcdir/$file"; then
  1193. if test `echo "$file" | sed -e 's,^.*/,,'` = Makefile.in && grep automake "$srcdir/$file" >/dev/null 2>&1; then
  1194. continue;
  1195. fi
  1196. # INTLLIBS is deprecated because it doesn't distinguish the two
  1197. # cases: with libtool, without libtool.
  1198. if grep '@''INTLLIBS''@' "$srcdir/$file" >/dev/null 2>&1; then
  1199. if test -n "$use_libtool"; then
  1200. please="$please
  1201. Please change $file to use @""LTLIBINTL""@ or @""LIBINTL""@ instead of
  1202. @""INTLLIBS""@. Which one, depends whether it is used with libtool or not.
  1203. @""INTLLIBS""@ will go away.
  1204. "
  1205. else
  1206. please="$please
  1207. Please change $file to use @""LIBINTL""@ instead of @""INTLLIBS""@.
  1208. @""INTLLIBS""@ will go away.
  1209. "
  1210. fi
  1211. fi
  1212. # DATADIRNAME is deprecated because we install only .gmo files nowadays,
  1213. # which can be stored in the platform independent $prefix/share hierarchy.
  1214. if grep '@''DATADIRNAME''@' "$srcdir/$file" >/dev/null 2>&1; then
  1215. please="$please
  1216. Please change $file to use the constant string \"share\" instead of
  1217. @""DATADIRNAME""@. @""DATADIRNAME""@ will go away.
  1218. "
  1219. fi
  1220. # INSTOBJEXT is deprecated because we install only .gmo files nowadays,
  1221. # no catgets .cat catalogs.
  1222. if grep '@''INSTOBJEXT''@' "$srcdir/$file" >/dev/null 2>&1; then
  1223. please="$please
  1224. Please change $file to use the constant string \".mo\" instead of
  1225. @""INSTOBJEXT""@. @""INSTOBJEXT""@ will go away.
  1226. "
  1227. fi
  1228. # GENCAT is deprecated because we install no catgets catalogs anymore.
  1229. if grep '@''GENCAT''@' "$srcdir/$file" >/dev/null 2>&1; then
  1230. please="$please
  1231. Please change $file to use the constant string \"gencat\" instead of
  1232. @""GENCAT""@. @""GENCAT""@ will go away. Maybe you don't even need it any more?
  1233. "
  1234. fi
  1235. # POSUB is deprecated because it causes "./configure --disable-nls", "make",
  1236. # "make dist" to create a buggy tarfile.
  1237. if grep '@''POSUB''@' "$srcdir/$file" >/dev/null 2>&1; then
  1238. please="$please
  1239. Please change $file to use the constant string \"po\" instead of
  1240. @""POSUB""@. @""POSUB""@ will go away.
  1241. "
  1242. fi
  1243. fi
  1244. done
  1245. # Recommend replacement for deprecated configure variables.
  1246. if grep '\$nls_cv_header_' "$srcdir/$configure_in" >/dev/null 2>&1; then
  1247. please="$please
  1248. Please stop using \$nls_cv_header_intl or \$nls_cv_header_libgt in the
  1249. $configure_in file. Both will go away. Use <libintl.h> or \"gettext.h\" instead.
  1250. "
  1251. fi
  1252. # Recommend fetching config.guess and config.sub.
  1253. if test -f "$srcdir/$auxdir"config.guess && test -f "$srcdir/$auxdir"config.sub; then
  1254. :
  1255. else
  1256. please="$please
  1257. You will also need config.guess and config.sub, which you can get from the CVS
  1258. of the 'config' project at http://savannah.gnu.org/. The commands to fetch them
  1259. are
  1260. \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess'
  1261. \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub'
  1262. "
  1263. fi
  1264. if $doit; then
  1265. echo "$please"
  1266. echo "You might also want to copy the convenience header file gettext.h"
  1267. echo "from the $gettext_datadir directory into your package."
  1268. echo "It is a wrapper around <libintl.h> that implements the configure --disable-nls"
  1269. echo "option."
  1270. echo
  1271. count=`echo "$please" | grep '^$' | wc -l`
  1272. count=`echo "$count" | sed -e 's/[ ]//g'`
  1273. case "$count" in
  1274. 1) count="paragraph";;
  1275. 2) count="two paragraphs";;
  1276. 3) count="three paragraphs";;
  1277. 4) count="four paragraphs";;
  1278. 5) count="five paragraphs";;
  1279. *) count="$count paragraphs";;
  1280. esac
  1281. echo "Press Return to acknowledge the previous $count."
  1282. # Read from /dev/tty, not stdin, so that gettextize cannot be abused by
  1283. # non-interactive tools.
  1284. read dummy < /dev/tty
  1285. fi
  1286. exit 0