gettextize 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312
  1. #! /bin/sh
  2. #
  3. # Copyright (C) 1995-1998, 2000-2020 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 <https://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.21
  24. archive_version=0.21
  25. # Set variables
  26. # - gettext_datadir directory where the data files are stored.
  27. prefix="/mingw64"
  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 "yes" = 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. --po-dir=DIR specify directory with PO files
  186. --no-changelog don't update or create ChangeLog files
  187. --symlink make symbolic links instead of copying files
  188. -n, --dry-run print modifications but don't perform them
  189. Report bugs in the bug tracker at <https://savannah.gnu.org/projects/gettext>
  190. or by email to <bug-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-2020 Free Software Foundation, Inc.
  198. License GPLv3+: GNU GPL version 3 or later <https://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. func_fatal_error "The option '--intl' is no longer available."
  285. fi
  286. # Require automake 1.9 or newer.
  287. have_automake19=
  288. if (aclocal --version) >/dev/null 2>/dev/null; then
  289. aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
  290. case $aclocal_version in
  291. 1.9* | 1.[1-9][0-9]* | [2-9]*) have_automake19=yes ;;
  292. esac
  293. fi
  294. if test -z "$have_automake19"; then
  295. func_fatal_error "You need the 'aclocal' program from automake 1.9 or newer."
  296. fi
  297. min_automake_version=1.9
  298. # Command-line argument processing.
  299. # Analyzes the remaining arguments.
  300. # Sets the variables
  301. # - origdir to the original directory,
  302. # - srcdir to the package directory, and cd-s into it.
  303. {
  304. if test $# -gt 1; then
  305. func_usage 1>&2
  306. exit 1
  307. fi
  308. origdir=`pwd`
  309. if test $# -eq 1; then
  310. srcdir=$1
  311. if cd "$srcdir"; then
  312. srcdir=`pwd`
  313. else
  314. func_fatal_error "Cannot change directory to '$srcdir'."
  315. fi
  316. else
  317. srcdir=$origdir
  318. fi
  319. }
  320. # The current directory is now $srcdir.
  321. # Check integrity of package: A configure.in/ac must be present. Sets variable
  322. # - configure_in name of configure.in/ac file.
  323. test -f configure.in || test -f configure.ac ||
  324. func_fatal_error "Missing configure.in or configure.ac, please cd to your package first."
  325. configure_in=NONE
  326. if test -f configure.in; then
  327. configure_in=configure.in
  328. else
  329. if test -f configure.ac; then
  330. configure_in=configure.ac
  331. fi
  332. fi
  333. # Check whether the --force option is needed but has not been specified.
  334. if test $force -eq 0; then
  335. if test -d intl; then
  336. func_fatal_error "intl/ subdirectory exists: use option -f if you really want to delete it."
  337. fi
  338. for podir in $podirs; do
  339. if test -f "$podir/Makefile.in.in"; then
  340. func_fatal_error "$podir/Makefile.in.in exists: use option -f if you really want to delete it."
  341. fi
  342. done
  343. if test -f ABOUT-NLS; then
  344. func_fatal_error "ABOUT-NLS exists: use option -f if you really want to delete it."
  345. fi
  346. fi
  347. # Select the method for Autoconf macro tracing. func_trace_autoconf
  348. # is more accurate than func_trace_sed, but it only works with
  349. # autoconf >= 2.69.
  350. if echo "AC_PREREQ([2.69])" \
  351. | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 - 2>&1; then
  352. func_trace=func_trace_autoconf
  353. else
  354. func_trace=func_trace_sed
  355. fi
  356. # Check in which directory config.rpath etc. belong.
  357. auxdir=`"$func_trace" AC_CONFIG_AUX_DIR "$configure_in"`
  358. if test -n "$auxdir"; then
  359. auxdir="$auxdir/"
  360. fi
  361. # Check in which directory gettext.m4 etc. belong.
  362. macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR_TRACE "$configure_in"`
  363. if test -z "$macrodirs"; then
  364. macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR "$configure_in"`
  365. fi
  366. for arg in $macrodirs; do
  367. m4dir="$arg"
  368. break
  369. done
  370. # For simplicity we change to the gettext source directory.
  371. cd "$gettext_datadir" ||
  372. func_fatal_error "gettext source directory '${gettext_datadir}' doesn't exist"
  373. # Variables which keep track what has been modified.
  374. added_directories=
  375. removed_directory=
  376. added_extradist=
  377. added_acoutput=
  378. removed_acoutput=" intl/intlh.inst"
  379. # Variable:
  380. # - please accumulates instructions for the user.
  381. please=
  382. # Variable:
  383. # - date current date, for use in ChangeLog entries.
  384. date=`date +%Y-%m-%d`
  385. # func_copy from to
  386. # copies a file.
  387. # 'from' is a relative pathname, relative to the current directory.
  388. # 'to' is a relative pathname, relative to $srcdir.
  389. func_copy ()
  390. {
  391. if $doit; then
  392. rm -f "$srcdir/$2"
  393. echo "Copying file $2"
  394. cp "$1" "$srcdir/$2"
  395. else
  396. echo "Copy file $2"
  397. fi
  398. }
  399. # func_linkorcopy from absfrom to
  400. # links or copies a file.
  401. # 'from' is a relative pathname, relative to the current directory.
  402. # 'absfrom' is the corresponding absolute pathname.
  403. # 'to' is a relative pathname, relative to $srcdir.
  404. func_linkorcopy ()
  405. {
  406. if $doit; then
  407. rm -f "$srcdir/$3"
  408. ($try_ln_s && ln -s "$2" "$srcdir/$3" && echo "Symlinking file $3") 2>/dev/null ||
  409. { echo "Copying file $3"; cp "$1" "$srcdir/$3"; }
  410. else
  411. if $try_ln_s; then
  412. echo "Symlink file $3"
  413. else
  414. echo "Copy file $3"
  415. fi
  416. fi
  417. }
  418. # func_backup to
  419. # makes a backup of a file that is about to be overwritten or replaced.
  420. # 'to' is a relative pathname, relative to $srcdir.
  421. func_backup ()
  422. {
  423. if $doit; then
  424. if test -f "$srcdir/$1"; then
  425. rm -f "$srcdir/$1~"
  426. cp -p "$srcdir/$1" "$srcdir/$1~"
  427. fi
  428. fi
  429. }
  430. # func_remove to
  431. # removes a file.
  432. # 'to' is a relative pathname, relative to $srcdir.
  433. func_remove ()
  434. {
  435. if $doit; then
  436. echo "Removing $1"
  437. rm -f "$srcdir/$1"
  438. else
  439. echo "Remove $1"
  440. fi
  441. }
  442. # func_ChangeLog_init
  443. # func_ChangeLog_add_entry line
  444. # func_ChangeLog_finish
  445. # manage the ChangeLog file, relative to $srcdir.
  446. func_ChangeLog_init ()
  447. {
  448. modified_ChangeLog=
  449. }
  450. func_ChangeLog_add_entry ()
  451. {
  452. if $doit; then
  453. if test -z "$modified_ChangeLog"; then
  454. echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/ChangeLog.tmp"
  455. echo >> "$srcdir/ChangeLog.tmp"
  456. modified_ChangeLog=yes
  457. fi
  458. echo "$1" >> "$srcdir/ChangeLog.tmp"
  459. else
  460. modified_ChangeLog=yes
  461. fi
  462. }
  463. func_ChangeLog_finish ()
  464. {
  465. if test -n "$modified_ChangeLog"; then
  466. if $doit; then
  467. echo >> "$srcdir/ChangeLog.tmp"
  468. if test -f "$srcdir/ChangeLog"; then
  469. echo "Adding an entry to ChangeLog (backup is in ChangeLog~)"
  470. cat "$srcdir/ChangeLog" >> "$srcdir/ChangeLog.tmp"
  471. rm -f "$srcdir/ChangeLog~"
  472. cp -p "$srcdir/ChangeLog" "$srcdir/ChangeLog~"
  473. else
  474. echo "Creating ChangeLog"
  475. fi
  476. cp "$srcdir/ChangeLog.tmp" "$srcdir/ChangeLog"
  477. rm -f "$srcdir/ChangeLog.tmp"
  478. else
  479. if test -f "$srcdir/ChangeLog"; then
  480. echo "Add an entry to ChangeLog"
  481. else
  482. echo "Create ChangeLog"
  483. fi
  484. fi
  485. fi
  486. }
  487. # func_poChangeLog_init
  488. # func_poChangeLog_add_entry line
  489. # func_poChangeLog_finish
  490. # manage the $podir/ChangeLog file, relative to $srcdir.
  491. func_poChangeLog_init ()
  492. {
  493. modified_poChangeLog=
  494. }
  495. func_poChangeLog_add_entry ()
  496. {
  497. if $doit; then
  498. if test -z "$modified_poChangeLog"; then
  499. echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/$podir/ChangeLog.tmp"
  500. echo >> "$srcdir/$podir/ChangeLog.tmp"
  501. modified_poChangeLog=yes
  502. fi
  503. echo "$1" >> "$srcdir/$podir/ChangeLog.tmp"
  504. else
  505. modified_poChangeLog=yes
  506. fi
  507. }
  508. func_poChangeLog_finish ()
  509. {
  510. if test -n "$modified_poChangeLog"; then
  511. if $doit; then
  512. echo >> "$srcdir/$podir/ChangeLog.tmp"
  513. if test -f "$srcdir/$podir/ChangeLog"; then
  514. echo "Adding an entry to $podir/ChangeLog (backup is in $podir/ChangeLog~)"
  515. cat "$srcdir/$podir/ChangeLog" >> "$srcdir/$podir/ChangeLog.tmp"
  516. rm -f "$srcdir/$podir/ChangeLog~"
  517. cp -p "$srcdir/$podir/ChangeLog" "$srcdir/$podir/ChangeLog~"
  518. else
  519. echo "Creating $podir/ChangeLog"
  520. fi
  521. cp "$srcdir/$podir/ChangeLog.tmp" "$srcdir/$podir/ChangeLog"
  522. rm -f "$srcdir/$podir/ChangeLog.tmp"
  523. else
  524. if test -f "$srcdir/$podir/ChangeLog"; then
  525. echo "Add an entry to $podir/ChangeLog"
  526. else
  527. echo "Create $podir/ChangeLog"
  528. fi
  529. fi
  530. fi
  531. }
  532. # func_m4ChangeLog_init
  533. # func_m4ChangeLog_add_entry line
  534. # func_m4ChangeLog_finish
  535. # manage the $m4dir/ChangeLog file, relative to $srcdir.
  536. func_m4ChangeLog_init ()
  537. {
  538. if test -n "$using_m4ChangeLog"; then
  539. modified_m4ChangeLog=
  540. created_m4ChangeLog=
  541. fi
  542. }
  543. func_m4ChangeLog_add_entry ()
  544. {
  545. if test -n "$using_m4ChangeLog"; then
  546. if $doit; then
  547. if test -z "$modified_m4ChangeLog"; then
  548. echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/$m4dir/ChangeLog.tmp"
  549. echo >> "$srcdir/$m4dir/ChangeLog.tmp"
  550. modified_m4ChangeLog=yes
  551. fi
  552. echo "$1" >> "$srcdir/$m4dir/ChangeLog.tmp"
  553. else
  554. modified_m4ChangeLog=yes
  555. fi
  556. else
  557. line="$1"
  558. line=`echo "$line" | sed -e "s%^ \\* % * $m4dir/%"`
  559. func_ChangeLog_add_entry "$line"
  560. fi
  561. }
  562. func_m4ChangeLog_finish ()
  563. {
  564. if test -n "$using_m4ChangeLog"; then
  565. if test -n "$modified_m4ChangeLog"; then
  566. if $doit; then
  567. echo >> "$srcdir/$m4dir/ChangeLog.tmp"
  568. if test -f "$srcdir/$m4dir/ChangeLog"; then
  569. echo "Adding an entry to $m4dir/ChangeLog (backup is in $m4dir/ChangeLog~)"
  570. cat "$srcdir/$m4dir/ChangeLog" >> "$srcdir/$m4dir/ChangeLog.tmp"
  571. rm -f "$srcdir/$m4dir/ChangeLog~"
  572. cp -p "$srcdir/$m4dir/ChangeLog" "$srcdir/$m4dir/ChangeLog~"
  573. else
  574. echo "Creating $m4dir/ChangeLog"
  575. created_m4ChangeLog=yes
  576. fi
  577. cp "$srcdir/$m4dir/ChangeLog.tmp" "$srcdir/$m4dir/ChangeLog"
  578. rm -f "$srcdir/$m4dir/ChangeLog.tmp"
  579. else
  580. if test -f "$srcdir/$m4dir/ChangeLog"; then
  581. echo "Add an entry to $m4dir/ChangeLog"
  582. else
  583. echo "Create $m4dir/ChangeLog"
  584. created_m4ChangeLog=yes
  585. fi
  586. fi
  587. fi
  588. fi
  589. }
  590. using_m4ChangeLog=yes
  591. if test -f "$srcdir/intl/Makefile.in"; then
  592. removed_acoutput="$removed_acoutput intl/Makefile"
  593. fi
  594. if test -d "$srcdir/intl"; then
  595. # Remove everything inside intl except for RCS and CVS subdirs and invisible
  596. # files.
  597. if $doit; then
  598. echo "Wiping out intl/ subdirectory"
  599. (cd "$srcdir/intl" &&
  600. for f in *; do
  601. if test CVS != "$f" && test RCS != "$f"; then
  602. rm -rf "$f"
  603. fi
  604. done)
  605. else
  606. echo "Wipe out intl/ subdirectory"
  607. fi
  608. removed_directory=intl
  609. fi
  610. $do_changelog && func_ChangeLog_init
  611. for podir in $podirs; do
  612. test -d "$srcdir/$podir" || {
  613. if $doit; then
  614. echo "Creating $podir/ subdirectory"
  615. mkdir "$srcdir/$podir" || func_fatal_error "failed to create $podir/ subdirectory"
  616. else
  617. echo "Create $podir/ subdirectory"
  618. fi
  619. added_directories="$added_directories $podir"
  620. }
  621. done
  622. # Create the directory for config.rpath, if needed.
  623. # This is for consistency with autoreconf and automake.
  624. # Note that $auxdir is either empty or ends in a slash.
  625. test -d "$srcdir/$auxdir" || {
  626. if $doit; then
  627. echo "Creating $auxdir subdirectory"
  628. mkdir "$srcdir/$auxdir" || func_fatal_error "failed to create $auxdir subdirectory"
  629. else
  630. echo "Create $auxdir subdirectory"
  631. fi
  632. }
  633. # Now copy all files. Take care for the destination directories.
  634. for file in *; do
  635. case $file in
  636. ABOUT-NLS)
  637. func_linkorcopy $file "$gettext_datadir/$file" $file
  638. ;;
  639. config.rpath)
  640. func_linkorcopy $file "$gettext_datadir/$file" "$auxdir$file"
  641. ;;
  642. esac
  643. done
  644. # Tell the user what to put into configure.ac, if it is not already there.
  645. external=
  646. # Need to use func_trace_sed instead of $func_trace, since
  647. # AM_GNU_GETTEXT is not a standard Autoconf trace.
  648. xargs=`func_trace_sed AM_GNU_GETTEXT "$srcdir/$configure_in"`
  649. save_IFS="$IFS"; IFS=:
  650. for arg in $xargs; do
  651. if test 'external' = "$arg"; then
  652. external=yes
  653. break
  654. fi
  655. done
  656. IFS="$save_IFS"
  657. if test -z "$external"; then
  658. please="$please
  659. Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration
  660. to look for an external libintl.
  661. "
  662. fi
  663. # Tell the user to remove invocations of macros that no longer exist.
  664. if sed -e 's,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,' "$srcdir/$configure_in" | grep AM_GNU_GETTEXT_INTL_SUBDIR >/dev/null; then
  665. please="$please
  666. Please remove the invocation of AM_GNU_GETTEXT_INTL_SUBDIR.
  667. "
  668. fi
  669. # Copy files to po/ subdirectory.
  670. cd po
  671. for podir in $podirs; do
  672. $do_changelog && func_poChangeLog_init
  673. for file in Makefile.in.in; do
  674. same=no
  675. if test -f "$srcdir/$podir/$file"; then
  676. if cmp -s $file "$srcdir/$podir/$file"; then
  677. same=yes
  678. fi
  679. else
  680. added_acoutput="$added_acoutput $podir/Makefile.in"
  681. fi
  682. if $do_changelog && test $same = no; then
  683. if test -f "$srcdir/$podir/$file"; then
  684. func_poChangeLog_add_entry " * $file: Upgrade to gettext-${version}."
  685. else
  686. func_poChangeLog_add_entry " * $file: New file, from gettext-${version}."
  687. fi
  688. fi
  689. func_backup "$podir/$file"
  690. func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
  691. done
  692. for file in *; do
  693. case $file in
  694. Makefile.in.in)
  695. # Already handled above.
  696. ;;
  697. Makevars.template)
  698. func_linkorcopy Makevars.template "$gettext_datadir/po/Makevars.template" "$podir/Makevars.template"
  699. if test -f "$srcdir/po/Makevars"; then
  700. LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/$podir/Makevars" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp1"
  701. LC_ALL=C sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$gettext_datadir/po/Makevars.template" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp2"
  702. missingvars=`LC_ALL=C comm -13 "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"`
  703. rm -f "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"
  704. if test -n "$missingvars"; then
  705. please="$please
  706. Please update $podir/Makevars so that it defines all the variables mentioned
  707. in $podir/Makevars.template.
  708. You can then remove $podir/Makevars.template.
  709. "
  710. fi
  711. else
  712. please="$please
  713. Please create $podir/Makevars from the template in $podir/Makevars.template.
  714. You can then remove $podir/Makevars.template.
  715. "
  716. fi
  717. ;;
  718. *)
  719. same=no
  720. if test -f "$srcdir/$podir/$file"; then
  721. if cmp -s $file "$srcdir/$podir/$file"; then
  722. same=yes
  723. fi
  724. fi
  725. if $do_changelog && test $same = no; then
  726. if test -f "$srcdir/$podir/$file"; then
  727. func_poChangeLog_add_entry " * $file: Upgrade to gettext-${version}."
  728. else
  729. func_poChangeLog_add_entry " * $file: New file, from gettext-${version}."
  730. fi
  731. fi
  732. func_backup "$podir/$file"
  733. func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
  734. ;;
  735. esac
  736. done
  737. if test -f "$srcdir/$podir/cat-id-tbl.c"; then
  738. func_remove "$podir/cat-id-tbl.c"
  739. $do_changelog && func_poChangeLog_add_entry " * cat-id-tbl.c: Remove file."
  740. fi
  741. if test -f "$srcdir/$podir/stamp-cat-id"; then
  742. func_remove "$podir/stamp-cat-id"
  743. $do_changelog && func_poChangeLog_add_entry " * stamp-cat-id: Remove file."
  744. fi
  745. if test ! -f "$srcdir/$podir/POTFILES.in"; then
  746. if $doit; then
  747. echo "Creating initial $podir/POTFILES.in"
  748. echo '# List of source files which contain translatable strings.' > "$srcdir/$podir/POTFILES.in"
  749. else
  750. echo "Create initial $podir/POTFILES.in"
  751. fi
  752. $do_changelog && func_poChangeLog_add_entry " * POTFILES.in: New file."
  753. please="$please
  754. Please fill $podir/POTFILES.in as described in the documentation.
  755. "
  756. fi
  757. $do_changelog && func_poChangeLog_finish
  758. done
  759. m4filelist='
  760. gettext.m4
  761. host-cpu-c-abi.m4
  762. iconv.m4
  763. intlmacosx.m4
  764. lib-ld.m4 lib-link.m4 lib-prefix.m4
  765. nls.m4
  766. po.m4 progtest.m4'
  767. # All sorts of bugs could occur if the configure file was remade with the wrong
  768. # version of gettext.m4 et al. (because then the configure and the po/Makefile.in.in
  769. # don't fit together). It is therefore important that the package carries the
  770. # right versions of gettext.m4 et al. with it.
  771. if test -f "$srcdir/Makefile.am"; then
  772. # A package using automake.
  773. # Determine whether it's using automake 1.8 or newer.
  774. have_automake18=
  775. if (aclocal --version) >/dev/null 2>/dev/null; then
  776. aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
  777. case $aclocal_version in
  778. 1.[8-9]* | 1.[1-9][0-9]* | [2-9]*) have_automake18=yes ;;
  779. esac
  780. fi
  781. if test -z "$m4dir"; then
  782. # Extract the macro directory name from Makefile.am.
  783. aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
  784. m4dir_is_next=
  785. for arg in $aclocal_amflags; do
  786. if test -n "$m4dir_is_next"; then
  787. # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
  788. case "$arg" in
  789. /*) ;;
  790. *)
  791. test -z "$m4dir" || m4dir="$arg"
  792. macrodirs="$macrodirs $arg"
  793. ;;
  794. esac
  795. m4dir_is_next=
  796. else
  797. if test "X$arg" = "X-I"; then
  798. m4dir_is_next=yes
  799. else
  800. m4dir_is_next=
  801. fi
  802. fi
  803. done
  804. for arg in $macrodirs; do
  805. m4dir="$arg"
  806. break
  807. done
  808. fi
  809. if test -z "$m4dir"; then
  810. m4dir=m4
  811. m4dir_defaulted=yes
  812. fi
  813. # Decide whether to use $m4dir/ChangeLog, or to use ChangeLog instead.
  814. if test -d "$srcdir/$m4dir" && test -f "$srcdir/ChangeLog" && test ! -f "$srcdir/$m4dir/ChangeLog"; then
  815. # The programmer has no $m4dir/ChangeLog so far. Don't introduce one.
  816. using_m4ChangeLog=
  817. fi
  818. # Update the *.m4 files and the corresponding Makefile.am.
  819. $do_changelog && func_m4ChangeLog_init
  820. added_m4dir=
  821. added_m4files=
  822. if test -d "$srcdir/$m4dir"; then
  823. :
  824. else
  825. if $doit; then
  826. echo "Creating directory $m4dir"
  827. mkdir "$srcdir/$m4dir"
  828. else
  829. echo "Create directory $m4dir"
  830. fi
  831. added_m4dir=yes
  832. fi
  833. for file in $m4filelist; do
  834. same=no
  835. if test -f "$srcdir/$m4dir/$file"; then
  836. if cmp -s "${datarootdir}/aclocal/$file" "$srcdir/$m4dir/$file"; then
  837. same=yes
  838. fi
  839. else
  840. added_m4files="$added_m4files $file"
  841. fi
  842. if $do_changelog && test $same = no; then
  843. if test -f "$srcdir/$m4dir/$file"; then
  844. func_m4ChangeLog_add_entry " * $file: Upgrade to gettext-${version}."
  845. else
  846. func_m4ChangeLog_add_entry " * $file: New file, from gettext-${version}."
  847. fi
  848. fi
  849. func_backup "$m4dir/$file"
  850. func_linkorcopy "${datarootdir}/aclocal/$file" "${datarootdir}/aclocal/$file" "$m4dir/$file"
  851. done
  852. missing_m4Makefileam=
  853. if test -n "$added_m4files"; then
  854. if test -f "$srcdir/$m4dir/Makefile.am"; then
  855. if $doit; then
  856. echo "Updating EXTRA_DIST in $m4dir/Makefile.am (backup is in $m4dir/Makefile.am~)"
  857. func_backup "$m4dir/Makefile.am"
  858. rm -f "$srcdir/$m4dir/Makefile.am"
  859. if grep '^EXTRA_DIST[ ]*=' "$srcdir/$m4dir/Makefile.am~" > /dev/null; then
  860. sed -e "s%^\(EXTRA_DIST[ ]*=\) \\?%\\1$added_m4files %" < "$srcdir/$m4dir/Makefile.am~" > "$srcdir/$m4dir/Makefile.am"
  861. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): Add the new files."
  862. else
  863. (cat "$srcdir/$m4dir/Makefile.am~"; echo; echo "EXTRA_DIST =$added_m4files") > "$srcdir/$m4dir/Makefile.am"
  864. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): New variable."
  865. fi
  866. else
  867. echo "Update EXTRA_DIST in $m4dir/Makefile.am"
  868. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST)."
  869. fi
  870. else
  871. # $m4dir/Makefile.am is not needed any more when aclocal 1.8 or newer
  872. # is used.
  873. if test -z "$have_automake18"; then
  874. if $doit; then
  875. echo "Creating $m4dir/Makefile.am"
  876. echo "EXTRA_DIST =$added_m4files" > "$srcdir/$m4dir/Makefile.am"
  877. else
  878. echo "Create $m4dir/Makefile.am"
  879. fi
  880. $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am: New file."
  881. added_acoutput="$added_acoutput $m4dir/Makefile"
  882. else
  883. missing_m4Makefileam=yes
  884. fi
  885. fi
  886. fi
  887. if test -n "$added_m4dir" && test -z "$missing_m4Makefileam"; then
  888. added_directories="$added_directories $m4dir"
  889. fi
  890. $do_changelog && func_m4ChangeLog_finish
  891. # automake will arrange for $m4dir/ChangeLog to be distributed if a
  892. # $m4dir/Makefile.am exists. If not, we need to add it to Makefile.am's
  893. # EXTRA_DIST explicitly.
  894. if test -n "$created_m4ChangeLog" && test -n "$missing_m4Makefileam"; then
  895. added_extradist="$added_extradist $m4dir/ChangeLog"
  896. fi
  897. # Update the top-level Makefile.am.
  898. modified_Makefile_am=
  899. # func_modify_Makefile_am changelog_comment
  900. # assumes a modified copy of $srcdir/Makefile.am in $srcdir/Makefile.am.tmp
  901. # and replaces the original Makefile.am file with the modified one if
  902. # the two files differ. Then it removes the modified copy.
  903. func_modify_Makefile_am ()
  904. {
  905. if cmp -s "$srcdir/Makefile.am" "$srcdir/Makefile.am.tmp"; then
  906. :
  907. else
  908. if test -z "$modified_Makefile_am"; then
  909. if $doit; then
  910. echo "Updating Makefile.am (backup is in Makefile.am~)"
  911. func_backup Makefile.am
  912. else
  913. echo "Update Makefile.am"
  914. fi
  915. fi
  916. if $doit; then
  917. rm -f "$srcdir/Makefile.am"
  918. cp "$srcdir/Makefile.am.tmp" "$srcdir/Makefile.am"
  919. fi
  920. if $do_changelog; then
  921. if test -z "$modified_Makefile_am"; then
  922. func_ChangeLog_add_entry " * Makefile.am $1"
  923. else
  924. func_ChangeLog_add_entry " $1"
  925. fi
  926. fi
  927. modified_Makefile_am=yes
  928. fi
  929. rm -f "$srcdir/Makefile.am.tmp"
  930. }
  931. if test -n "$added_directories"; then
  932. if grep '^SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  933. sed -e "s%^\(SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  934. added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
  935. func_modify_Makefile_am "(SUBDIRS): Add $added_directories_pretty."
  936. else
  937. (cat "$srcdir/Makefile.am"; echo; echo "SUBDIRS =$added_directories") > "$srcdir/Makefile.am.tmp"
  938. func_modify_Makefile_am "(SUBDIRS): New variable."
  939. fi
  940. fi
  941. if test -n "$removed_directory"; then
  942. sed -e '/^SUBDIRS[ ]*=/ {
  943. :a
  944. s%\([ ]\)'"$removed_directory"'[ ]%\1%
  945. s%[ ]'"$removed_directory"'$%%
  946. tb
  947. :b
  948. s%\\$%\\%
  949. tc
  950. bd
  951. :c
  952. n
  953. ba
  954. :d
  955. }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  956. func_modify_Makefile_am "(SUBDIRS): Remove $removed_directory."
  957. fi
  958. if test -n "$added_directories"; then
  959. if grep '^DIST_SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  960. sed -e "s%^\(DIST_SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  961. added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
  962. func_modify_Makefile_am "(DIST_SUBDIRS): Add $added_directories_pretty."
  963. fi
  964. fi
  965. if test -n "$removed_directory"; then
  966. sed -e '/^DIST_SUBDIRS[ ]*=/ {
  967. :a
  968. s%\([ ]\)'"$removed_directory"'[ ]%\1%
  969. s%[ ]'"$removed_directory"'$%%
  970. tb
  971. :b
  972. s%\\$%\\%
  973. tc
  974. bd
  975. :c
  976. n
  977. ba
  978. :d
  979. }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  980. func_modify_Makefile_am "(DIST_SUBDIRS): Remove $removed_directory."
  981. fi
  982. if test -n "$m4dir_defaulted"; then
  983. if grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  984. sed -e "s%^\(ACLOCAL_AMFLAGS[ ]*=\) \\?%\\1 -I $m4dir %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  985. func_modify_Makefile_am "(ACLOCAL_AMFLAGS): Add -I $m4dir."
  986. else
  987. (cat "$srcdir/Makefile.am"; echo; echo "ACLOCAL_AMFLAGS = -I $m4dir") > "$srcdir/Makefile.am.tmp"
  988. func_modify_Makefile_am "(ACLOCAL_AMFLAGS): New variable."
  989. fi
  990. # Also update Makefile.in and, if existent, Makefile. Otherwise they
  991. # would take into account the new flags only after a few rounds of
  992. # "./configure", "make", "touch configure.in", "make distclean".
  993. if $doit; then
  994. for file in Makefile.in Makefile; do
  995. if test -f "$srcdir/$file"; then
  996. func_backup $file
  997. rm -f "$srcdir/$file"
  998. sed -e "s%(ACLOCAL)%(ACLOCAL) -I $m4dir%" < "$srcdir/$file~" > "$srcdir/$file"
  999. fi
  1000. done
  1001. fi
  1002. fi
  1003. if test -n "$added_extradist"; then
  1004. if grep '^EXTRA_DIST[ ]*=' "$srcdir/Makefile.am" > /dev/null; then
  1005. sed -e "s%^\(EXTRA_DIST[ ]*=\)%\\1$added_extradist %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
  1006. added_extradist_pretty=`echo $added_extradist | sed -e 's/ /, /g'`
  1007. func_modify_Makefile_am "(EXTRA_DIST): Add $added_extradist_pretty."
  1008. else
  1009. (cat "$srcdir/Makefile.am"; echo; echo "EXTRA_DIST =$added_extradist") > "$srcdir/Makefile.am.tmp"
  1010. func_modify_Makefile_am "(EXTRA_DIST): New variable."
  1011. fi
  1012. fi
  1013. # Extract the aclocal options name from Makefile.am.
  1014. aclocal_options=
  1015. for arg in $macrodirs; do
  1016. aclocal_options="$aclocal_options -I $arg"
  1017. done
  1018. please="$please
  1019. Please run 'aclocal$aclocal_options' to regenerate the aclocal.m4 file.
  1020. You need aclocal from GNU automake $min_automake_version (or newer) to do this.
  1021. Then run 'autoconf' to regenerate the configure file.
  1022. "
  1023. # Also create $m4dir/Makefile.in from $m4dir/Makefile.am, because automake
  1024. # doesn't do it by itself.
  1025. if $doit; then
  1026. case "$added_acoutput" in
  1027. *" $m4dir/Makefile")
  1028. (cd "$srcdir" && automake "$m4dir/Makefile") 2>/dev/null ||
  1029. please="$please
  1030. Please run 'automake $m4dir/Makefile' to create $m4dir/Makefile.in
  1031. "
  1032. ;;
  1033. esac
  1034. fi
  1035. else
  1036. please="$please
  1037. Please add the files
  1038. $m4filelist
  1039. from the ${datarootdir}/aclocal directory to your aclocal.m4 file.
  1040. "
  1041. fi
  1042. modified_configure_in=
  1043. # func_modify_configure_in changelog_comment
  1044. # assumes a modified copy of $srcdir/$configure_in in $srcdir/$configure_in.tmp
  1045. # and replaces the original configure.in/ac file with the modified one if
  1046. # the two files differ. Then it removes the modified copy.
  1047. func_modify_configure_in ()
  1048. {
  1049. if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1050. :
  1051. else
  1052. if test -z "$modified_configure_in"; then
  1053. if $doit; then
  1054. echo "Updating $configure_in (backup is in $configure_in~)"
  1055. func_backup $configure_in
  1056. else
  1057. echo "Update $configure_in"
  1058. fi
  1059. fi
  1060. if $doit; then
  1061. rm -f "$srcdir/$configure_in"
  1062. cp "$srcdir/$configure_in.tmp" "$srcdir/$configure_in"
  1063. fi
  1064. if $do_changelog; then
  1065. if test -z "$modified_configure_in"; then
  1066. func_ChangeLog_add_entry " * $configure_in $1"
  1067. else
  1068. func_ChangeLog_add_entry " $1"
  1069. fi
  1070. fi
  1071. modified_configure_in=yes
  1072. fi
  1073. rm -f "$srcdir/$configure_in.tmp"
  1074. }
  1075. if test -n "$added_acoutput"; then
  1076. if grep '^AC_CONFIG_FILES(' "$srcdir/$configure_in" > /dev/null; then
  1077. sedprog='
  1078. ta
  1079. b
  1080. :a
  1081. n
  1082. ba'
  1083. sed -e "s%^\\(AC_CONFIG_FILES([^])\\,]*\\)%\\1$added_acoutput%$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1084. added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
  1085. func_modify_configure_in "(AC_CONFIG_FILES): Add $added_acoutput_pretty."
  1086. else
  1087. if grep '^AC_OUTPUT(' "$srcdir/$configure_in" > /dev/null; then
  1088. sed -e "s%^\\(AC_OUTPUT([^])\\,]*\\)%\\1$added_acoutput%" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1089. added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
  1090. func_modify_configure_in "(AC_OUTPUT): Add $added_acoutput_pretty."
  1091. else
  1092. please="$please
  1093. Please add$added_acoutput to the AC_OUTPUT or AC_CONFIG_FILES invocation in the $configure_in file.
  1094. "
  1095. fi
  1096. fi
  1097. fi
  1098. if test -n "$removed_acoutput"; then
  1099. for file in $removed_acoutput; do
  1100. tag=
  1101. sedprog='{
  1102. s%\([[ ]\)'"$file"'[ ]%\1%
  1103. s%\([[ ]\)'"$file"'\([]),]\)%\1\2%
  1104. s%[[ ]'"$file"'$%%
  1105. :a
  1106. tb
  1107. :b
  1108. s%\\$%\\%
  1109. tc
  1110. bd
  1111. :c
  1112. n
  1113. s%\([ ]\)'"$file"'[ ]%\1%
  1114. s%\([ ]\)'"$file"'\([]),]\)%\1\2%
  1115. s%[ ]'"$file"'$%%
  1116. ba
  1117. :d
  1118. }'
  1119. sed -e '/^AC_CONFIG_FILES(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1120. if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1121. sed -e '/^AC_OUTPUT(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1122. if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
  1123. :
  1124. else
  1125. tag=AC_OUTPUT
  1126. fi
  1127. else
  1128. tag=AC_CONFIG_FILES
  1129. fi
  1130. if test -n "$tag"; then
  1131. func_modify_configure_in "($tag): Remove $file."
  1132. else
  1133. rm -f "$srcdir/$configure_in.tmp"
  1134. if test "$file" != intl/intlh.inst; then
  1135. please="$please
  1136. Please remove $file from the AC_OUTPUT or AC_CONFIG_FILES invocation
  1137. in the $configure_in file.
  1138. "
  1139. fi
  1140. fi
  1141. done
  1142. fi
  1143. sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *%%' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1144. func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile."
  1145. sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1146. func_modify_configure_in "(AC_LINK_FILES): Remove invocation."
  1147. # AM_GNU_GETTEXT_VERSION may not be present, when AM_GNU_GETTEXT_REQUIRE_VERSION is used.
  1148. if grep '^AM_GNU_GETTEXT_VERSION(' "$srcdir/$configure_in" >/dev/null; then
  1149. sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
  1150. func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version."
  1151. fi
  1152. $do_changelog && func_ChangeLog_finish
  1153. # Recommend replacement for deprecated Makefile variables.
  1154. use_libtool=`cat "$srcdir/$configure_in" | grep '^A[CM]_PROG_LIBTOOL'`
  1155. for file in `(cd "$srcdir"; find . -name Makefile.am -print; find . -name Makefile.in -print) | sed -e 's,^\./,,'`; do
  1156. if test -f "$srcdir/$file"; then
  1157. if test `echo "$file" | sed -e 's,^.*/,,'` = Makefile.in && grep automake "$srcdir/$file" >/dev/null 2>&1; then
  1158. continue;
  1159. fi
  1160. # INTLLIBS is deprecated because it doesn't distinguish the two
  1161. # cases: with libtool, without libtool.
  1162. if grep '@''INTLLIBS''@' "$srcdir/$file" >/dev/null; then
  1163. if test -n "$use_libtool"; then
  1164. please="$please
  1165. Please change $file to use @""LTLIBINTL""@ or @""LIBINTL""@ instead of
  1166. @""INTLLIBS""@. Which one, depends whether it is used with libtool or not.
  1167. @""INTLLIBS""@ will go away.
  1168. "
  1169. else
  1170. please="$please
  1171. Please change $file to use @""LIBINTL""@ instead of @""INTLLIBS""@.
  1172. @""INTLLIBS""@ will go away.
  1173. "
  1174. fi
  1175. fi
  1176. # DATADIRNAME is deprecated because we install only .gmo files nowadays,
  1177. # which can be stored in the platform independent $prefix/share hierarchy.
  1178. if grep '@''DATADIRNAME''@' "$srcdir/$file" >/dev/null; then
  1179. please="$please
  1180. Please change $file to use the constant string \"share\" instead of
  1181. @""DATADIRNAME""@. @""DATADIRNAME""@ will go away.
  1182. "
  1183. fi
  1184. # INSTOBJEXT is deprecated because we install only .gmo files nowadays,
  1185. # no catgets .cat catalogs.
  1186. if grep '@''INSTOBJEXT''@' "$srcdir/$file" >/dev/null; then
  1187. please="$please
  1188. Please change $file to use the constant string \".mo\" instead of
  1189. @""INSTOBJEXT""@. @""INSTOBJEXT""@ will go away.
  1190. "
  1191. fi
  1192. # GENCAT is deprecated because we install no catgets catalogs anymore.
  1193. if grep '@''GENCAT''@' "$srcdir/$file" >/dev/null; then
  1194. please="$please
  1195. Please change $file to use the constant string \"gencat\" instead of
  1196. @""GENCAT""@. @""GENCAT""@ will go away. Maybe you don't even need it any more?
  1197. "
  1198. fi
  1199. # POSUB is deprecated because it causes "./configure --disable-nls", "make",
  1200. # "make dist" to create a buggy tarfile.
  1201. if grep '@''POSUB''@' "$srcdir/$file" >/dev/null; then
  1202. please="$please
  1203. Please change $file to use the constant string \"po\" instead of
  1204. @""POSUB""@. @""POSUB""@ will go away.
  1205. "
  1206. fi
  1207. fi
  1208. done
  1209. # Recommend replacement for deprecated configure variables.
  1210. if grep '\$nls_cv_header_' "$srcdir/$configure_in" >/dev/null; then
  1211. please="$please
  1212. Please stop using \$nls_cv_header_intl or \$nls_cv_header_libgt in the
  1213. $configure_in file. Both will go away. Use <libintl.h> or \"gettext.h\" instead.
  1214. "
  1215. fi
  1216. # Recommend fetching config.guess and config.sub.
  1217. if test -f "$srcdir/$auxdir"config.guess && test -f "$srcdir/$auxdir"config.sub; then
  1218. :
  1219. else
  1220. please="$please
  1221. You will also need config.guess and config.sub, which you can get from the CVS
  1222. of the 'config' project at https://savannah.gnu.org/. The commands to fetch them
  1223. are
  1224. \$ wget 'https://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess'
  1225. \$ wget 'https://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub'
  1226. "
  1227. fi
  1228. if $doit; then
  1229. echo "$please"
  1230. echo "You might also want to copy the convenience header file gettext.h"
  1231. echo "from the $gettext_datadir directory into your package."
  1232. echo "It is a wrapper around <libintl.h> that implements the configure --disable-nls"
  1233. echo "option."
  1234. echo
  1235. count=`echo "$please" | grep '^$' | wc -l`
  1236. count=`echo "$count" | sed -e 's/[ ]//g'`
  1237. case "$count" in
  1238. 1) count="paragraph";;
  1239. 2) count="two paragraphs";;
  1240. 3) count="three paragraphs";;
  1241. 4) count="four paragraphs";;
  1242. 5) count="five paragraphs";;
  1243. *) count="$count paragraphs";;
  1244. esac
  1245. echo "Press Return to acknowledge the previous $count."
  1246. # Read from /dev/tty, not stdin, so that gettextize cannot be abused by
  1247. # non-interactive tools.
  1248. read dummy < /dev/tty
  1249. fi
  1250. exit 0