dist: update NEWS and dump release dates
[gtk-doc.git] / gtkdocize.in
blobd41794fa9b8d65e9048447d82fefc522ce4b2172
1 #!/bin/sh
3 progname=`echo "$0" | sed 's%^.*/%%'`
5 PROGRAM=gtkdocize
6 PACKAGE=@PACKAGE@
7 VERSION=@VERSION@
9 prefix=@prefix@
10 datarootdir=@datarootdir@
11 datadir=@datadir@
13 # options
14 docdir=.
15 copy=no
16 makefile=gtk-doc.make
18 # mini help
19 usage="\
20 usage: $progname [ --copy ] [ --docdir DIR ] [ --flavour {legacy|no-tmpl} ]"
22 while test $# -gt 0; do
23 case "$1" in
24 --help)
25 echo "$usage"
26 exit 0 ;;
27 --version)
28 echo "$PROGRAM ($PACKAGE) $VERSION"
29 exit 0 ;;
30 --copy)
31 copy=yes
32 shift ;;
33 --docdir)
34 shift
35 docdir="$1"
36 shift ;;
37 --flavour)
38 shift
39 flavour="$1"
40 case "$flavour" in
41 legacy)
43 no-tmpl)
44 makefile=gtk-doc.notmpl.make
47 echo "$progname: invalid value for --flavour" 1>&2
48 echo "$usage" 1>&2
49 exit 1 ;;
50 esac
51 shift ;;
52 -*)
53 echo "$progname: unrecognised option '$1'" 1>&2
54 echo "$usage" 1>&2
55 exit 1 ;;
57 echo "$progname: too many arguments" 1>&2
58 echo "$usage" 1>&2
59 exit 1 ;;
60 esac
61 done
63 if test -f configure.ac; then
64 configure=configure.ac
65 elif test -f configure.in; then
66 configure=configure.in
67 else
68 echo "$progname: neither configure.ac nor configure.in exist" 1>&2
69 exit 1
72 if grep '^GTK_DOC_CHECK' $configure >/dev/null 2>&1; then
74 else
75 echo "$progname: GTK_DOC_CHECK not called in $configure" 1>&2
76 exit 1
79 # If the AC_CONFIG_MACRO_DIR() macro is used, copy gtk-doc.m4 from our
80 # prefix to that directory. This makes sure that the M4 macro used
81 # matches the the automake fragment.
82 # If AC_CONFIG_MACRO_DIR is not used, the macro won't be copied, and
83 # the correct flags must be passed to aclocal for it to find the macro.
84 m4dir=`cat "$configure" | grep '^AC_CONFIG_MACRO_DIR' | sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
85 if test -n "$m4dir"; then
86 rm -f $m4dir/gtk-doc.m4
87 if test "$copy" = yes; then
88 cp -f $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
89 exit 1
90 else
91 ln -sf $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
92 cp -f $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
93 exit 1
97 rm -f $docdir/gtk-doc.make
98 if test "$copy" = yes; then
99 cp -f $datadir/gtk-doc/data/$makefile $docdir/gtk-doc.make ||
100 exit 1
101 else
102 ln -sf $datadir/gtk-doc/data/$makefile $docdir/gtk-doc.make ||
103 cp -f $datadir/gtk-doc/data/$makefile $docdir/gtk-doc.make ||
104 exit 1