File: gtkdocize.in

package info (click to toggle)
gtk-doc 1.15-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,576 kB
  • ctags: 266
  • sloc: xml: 16,117; sh: 10,619; perl: 7,967; ansic: 509; makefile: 434; lisp: 137
file content (136 lines) | stat: -rw-r--r-- 3,306 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/sh

progname=`echo "$0" | sed 's%^.*/%%'`

PROGRAM=gtkdocize
PACKAGE=@PACKAGE@
VERSION=@VERSION@

prefix=@prefix@
datarootdir=@datarootdir@
datadir=@datadir@

# options
docdir=.
copy=no
makefile=gtk-doc.make
flavour=legacy

# mini help
usage="\
usage: $progname [ --copy ] [ --docdir DIR ] [ --flavour {legacy|no-tmpl} ]"

# detect configure script
no_configure_found=0
if test -f configure.ac; then
  configure=configure.ac
elif test -f configure.in; then
  configure=configure.in
else
  no_configure_found=1
fi

# check configure script for GTK_DOC_CHECK macro
no_gtk_doc_check_found=0
if test $no_configure_found -eq 0; then
  macro=`grep '^GTK_DOC_CHECK' $configure 2>/dev/null`
  if test $? -eq 0; then
    # GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
    params=`echo $macro | sed -e 's/^GTK_DOC_CHECK(\ *\(.*\))/\1/'`
    if echo $params | grep -q '^.*\,\ *\[\{0,1\}'; then
      extra_options=`echo $params | sed -e 's/^.*\,\ *\[\{0,1\}\([^]]*\)\]\{0,1\}\ *$/\1/'`
      #echo >&2 "DEBUG: adding extra options [$extra_options] to [$*]"
      set - $* $GTKDOCIZE_FLAGS $extra_options
    else
      set - $* $GTKDOCIZE_FLAGS
    fi
  else
    no_gtk_doc_check_found=1;
  fi
fi

while test $# -gt 0; do
  #echo >&2 "DEBUG: parsing args [$1]";
  case "$1" in
  --help)
    echo "$usage"
    exit 0 ;;
  --version)
    echo "$PROGRAM ($PACKAGE) $VERSION"
    exit 0 ;;
  --copy)
    copy=yes
    shift ;;
  --docdir)
    shift
    docdir="$1"
    shift ;;
  --docdir=*)
    docdir=`expr "X$1" : '[^=]*=\(.*\)'`
    shift ;;
  --flavour)
    shift
    flavour="$1"
    shift ;;
  --flavour=*)
    flavour=`expr "X$1" : '[^=]*=\(.*\)'`
    shift ;;
  -*)
    echo "$progname: unrecognised option '$1'" 1>&2
    echo "$usage" 1>&2
    exit 1 ;;
  *)
    echo "$progname: too many arguments" 1>&2
    echo "$usage" 1>&2
    exit 1 ;;
  esac
done

case "$flavour" in
  legacy)
    ;;
  no-tmpl)
    makefile=gtk-doc.notmpl.make
    ;;
  *)
    echo "$progname: invalid value for --flavour" 1>&2
    echo "$usage" 1>&2
    exit 1 ;;
esac

if test $no_configure_found -eq 1; then
  echo "$progname: neither configure.ac nor configure.in exist" 1>&2
  exit 1
fi
if test $no_gtk_doc_check_found -eq 1; then
  echo "$progname: GTK_DOC_CHECK not called in $configure" 1>&2
  exit 1
fi

# If the AC_CONFIG_MACRO_DIR() macro is used, copy gtk-doc.m4 from our
# prefix to that directory.  This makes sure that the M4 macro used
# matches the the automake fragment.
# If AC_CONFIG_MACRO_DIR is not used, the macro won't be copied, and
# the correct flags must be passed to aclocal for it to find the macro.
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`
if test -n "$m4dir"; then
  rm -f $m4dir/gtk-doc.m4
  if test "$copy" = yes; then
    cp -f $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
      exit 1
  else
    ln -sf $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
      cp -f $datadir/aclocal/gtk-doc.m4 $m4dir/ ||
      exit 1
  fi
fi

rm -f $docdir/gtk-doc.make
if test "$copy" = yes; then
  cp -f $datadir/gtk-doc/data/$makefile $docdir/gtk-doc.make ||
    exit 1
else
  ln -sf $datadir/gtk-doc/data/$makefile $docdir/gtk-doc.make ||
    cp -f $datadir/gtk-doc/data/$makefile $docdir/gtk-doc.make ||
    exit 1
fi