Add more test cases.
[gtk-doc.git] / gtkdocize.in
blob8e1c89ef1cea8d32bfa172087004ac5553af6f6e
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
17 while test $# -gt 0; do
18 case "$1" in
19 --help)
20 echo "usage: $progname [ --copy ] [ --docdir DIR ]" 1>&2
21 exit 1 ;;
22 --version)
23 echo "$PROGRAM ($PACKAGE) $VERSION"
24 exit 0 ;;
25 --copy)
26 copy=yes
27 shift ;;
28 --docdir)
29 shift
30 docdir="$1"
31 shift ;;
32 -*)
33 echo "$progname: unrecognised option '$1'" 1>&2
34 echo "usage: $progname [ --copy ] [ --docdir DIR ]" 1>&2
35 exit 1 ;;
37 echo "$progname: too many arguments" 1>&2
38 echo "usage: $progname [ --copy ] [ --docdir DIR ]" 1>&2
39 exit 1 ;;
40 esac
41 done
43 if test -f configure.ac; then
44 configure=configure.ac
45 elif test -f configure.in; then
46 configure=configure.in
47 else
48 echo "$progname: neither configure.ac nor configure.in exist" 1>&2
49 exit 1
52 if grep '^GTK_DOC_CHECK' $configure >/dev/null 2>&1; then
54 else
55 echo "$progname: GTK_DOC_CHECK not called in $configure" 1>&2
56 exit 1
59 # If the AC_CONFIG_MACRO_DIR() macro is used, copy gtk-doc.m4 from our
60 # prefix to that directory. This makes sure that the M4 macro used
61 # matches the the automake fragment.
62 # If AC_CONFIG_MACRO_DIR is not used, the macro won't be copied, and
63 # the correct flags must be passed to aclocal for it to find the macro.
64 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`
65 if test -n "$m4dir"; then
66 rm -f $m4dir/gtk-doc.m4
67 if test "$copy" = yes; then
68 cp -f $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
69 exit 1
70 else
71 ln -sf $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
72 cp -f $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
73 exit 1
77 rm -f $docdir/gtk-doc.make
78 if test "$copy" = yes; then
79 cp -f $datadir/gtk-doc/data/gtk-doc.make $docdir/ ||
80 exit 1
81 else
82 ln -sf $datadir/gtk-doc/data/gtk-doc.make $docdir/ ||
83 cp -f $datadir/gtk-doc/data/gtk-doc.make $docdir/ ||
84 exit 1