bootstrap captive-0_1
authorshort <>
Thu, 31 Oct 2002 17:37:52 +0000 (17:37 +0000)
committershort <>
Thu, 31 Oct 2002 17:37:52 +0000 (17:37 +0000)
AutoGen.pm [new file with mode: 0644]
Makefile-gtk-doc.am [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
gtk-doc.m4 [new file with mode: 0644]

diff --git a/AutoGen.pm b/AutoGen.pm
new file mode 100644 (file)
index 0000000..d5c3822
--- /dev/null
@@ -0,0 +1,453 @@
+#! /usr/bin/perl
+# 
+# $Id$
+# Module to generate all the initial makefiles etc.
+# Copyright (C) 2002 Jan Kratochvil <project-macros@jankratochvil.net>
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+package AutoGen;
+use vars qw($VERSION);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+use strict;
+use warnings;
+
+BEGIN {
+       my @missing;
+       for (split "\n",<<'HERE') {
+               use Carp qw(cluck confess);
+               use Getopt::Long;       # &GetOptions, $Getopt::Long::*
+               use File::Basename;     # &basename
+               use File::Grep qw(fgrep);
+               use File::HomeDir;      # &home
+               use File::Remove qw(remove);
+               use File::NCopy qw(copy);
+               use File::chdir;        # $CWD
+               use File::Touch;        # &touch
+               use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG);
+HERE
+               eval "$_\n; 1;" or push @missing,(/^\s*use\s+([^\s;]+)/)[0];
+               }
+       die "You are missing some modules - install them by:\n"
+                                       ."\tperl -MCPAN -e 'install qw(".join(" ",@missing).")'\n"
+                       if @missing;
+       }
+
+our %Options;
+
+sub _help
+{
+       return '
+Beware: '.basename($0).' is a tool only for maintainers!
+
+Supported parameters:
+ --rpm       Build RPM packages locally (needs /usr/src/(redhat|packages)/ access)
+ --rpmtest   Build RPM like "rpm" but w/o gpg/pgp signing
+ --clean     Standard cleanup method
+ --fullclean Like clean but even the .cvsignore files are removed
+ --copy      Behave exactly like in default mode but copy all instead of symlinks
+ -h|--help   Print this help message.
+'.($Options{"help"} || "");
+}
+
+sub _readfile
+{
+my($filename)=@_;
+
+       local $/=undef();
+       local *F;
+       open F,$filename or confess "Open \"$filename\": $!";
+       my $r=<F>;
+       close F or cluck "Close \"$filename\": $!";
+       return $r;
+}
+
+sub _writefile
+{
+my($filename,@content)=@_;
+
+       local *F;
+       open F,">".$filename or confess "rewrite \"$filename\": $!";
+       print F @content;
+       close F or cluck "close \"$filename\": $!";
+}
+
+my %_rpmeval_cache;
+sub _rpmeval
+{
+my(@names)=@_;
+
+       my @r=map({
+               my $name=$_;
+               my $nameref=\$_rpmeval_cache{$name};
+               $$nameref=_readfile('rpm --eval %'.$name.'|') if !defined $$nameref;
+               chomp $$nameref;
+               $$nameref;
+               } @names);
+       return @r if wantarray();
+       confess "Scalar return for ".scalar(@r)." values" if 1!=@r;
+       return $r[0];
+}
+
+sub _system
+{
+my(@args)=@_;
+
+       system(@args) and confess join(" ",@args).": $?=".join(",",
+                       (!WIFEXITED($?)   ? () : ("EXITSTATUS(".WEXITSTATUS($?).")")),
+                       (!WIFSIGNALED($?) ? () : ("TERMSIG("   .WTERMSIG($?)   .")")),
+                       (!WIFSTOPPED($?)  ? () : ("STOPSIG("   .WSTOPSIG($?)   .")")),
+                       );
+}
+
+# Assumed wildcard pattern expansion to exactly one item if !$nocheck
+sub _copy
+{
+my(@files)=@_;
+
+       my $nocheck=shift @files if $files[0] eq "nocheck";
+       my $dest=pop @files;
+       @files==copy @files,$dest or $nocheck or confess "$!";
+}
+
+# Assumed wildcard pattern expansion to exactly one item if !$nocheck
+sub _remove
+{
+my(@files)=@_;
+
+       my $nocheck=shift @files if $files[0] eq "nocheck";
+       my $flag=shift @files if ref $files[0];
+       @files==remove((!$flag ? () : $flag),@files) or $nocheck or confess "$!";
+}
+
+# FIXME: File::NCopy exists but File::NMove doesn't
+sub _move
+{
+my(@files)=@_;
+
+       my $dest=pop @files;
+       _copy @files,$dest;
+       _remove @files;
+}
+
+# $args{
+#      "sign"=>bool,
+#      },
+sub _rpmbuild
+{
+my($class,%args)=@_;
+
+       my $name=$Options{"name"};
+       _remove "nocheck",\1,
+                       _rpmeval("_tmppath" )."/$name-*-root",
+                       _rpmeval("_builddir")."/$name-*";
+       my($specsrc)=map((-e $_ ? $_ : "$name.spec.in"),"$name.spec.m4.in");
+       my $spec=_readfile $specsrc;
+       $spec=~s/\\\n/ /gs;
+       $class->run(%Options,
+                       "ARGV"=>["--copy"],
+                       "configure_args"=>[split /\s+/,($spec=~/^%configure\s+(.*)$/m)[0]],
+                       );
+       _system "make dist $name.spec";
+       _copy "$name-*.tar.gz",_rpmeval("_sourcedir");
+       _system(join(" ","rpm",
+                       "-ba",
+                       (!$args{"sign"} ? () : "--sign"),
+                       "$name.spec",
+                       ));
+       _system "make dist-tarZ" if $Options{"dist-tarZ"};
+       _remove _rpmeval{"_sourcedir"}."/$name-*.tar.gz";
+       _move _rpmeval{"_srcrpmdir"}."/$name-*.src.rpm",".";
+       _move "nocheck",_rpmeval{"_rpmdir"}."/"._rpmeval{"_arch"}."/$name-*."._rpmeval{"_arch"}.".rpm",".";
+  _system "ls -l $name-*";
+       # NOTREACHED
+}
+
+# WARNING: doesn't respect %Options change!
+my @_cleanfiles_cache;
+sub _cleanfiles
+{
+       # maintainer-clean hack is not safe, please list all files for 'rm'.
+       # When the filename doesn't contain '/', it is applied to ALL directories.
+       # Please note that files exactly in root dir MUST have ./ in the front
+       #   (to not to be considered as ALL-directories files).
+
+       if (!@_cleanfiles_cache) {
+               @_cleanfiles_cache=map({
+                                               local $_=$_;    # Prevent: Modification of a read-only value attempted
+                                               s/\Q<name>\E/$Options{"name"}/ego;
+                                               s#/+#/#g;
+                                               # "*xyzzy" basename -> "*xyzzy",".*xyzzy" for proper cleaning
+                                               (!m#^((?:.*/)?)([*][^/]*)$# ? ($_) : ("$1$2","$1.$2"));
+                                               }
+                               (
+                               ".#*",  # Possible attempt to put comments in qw() list
+                               qw(
+                                               *~
+                                               *.orig *.rej
+                                               core
+                                               Makefile Makefile.in
+                                               TAGS tags ID
+                                               .deps .libs
+                                               *.[oa] *.l[oa]
+                                               .cvsignore
+
+                                               ./errs*
+                                               ./intl
+                                               ./configure ./configure.scan
+                                               ./config.guess ./config.status ./config.sub ./config.log ./config.cache
+                                               ./config.h ./config.h.in
+                                               ./confdefs.h ./conftest* ./autoh[0-9]* ./confcache
+                                               ./config.rpath
+                                               ./depcomp
+                                               ./stamp-h ./stamp-h.in ./stamp-h1
+                                               ./install-sh
+                                               ./aclocal.m4
+                                               ./autom4te-*.cache
+                                               ./m4
+                                               ./missing
+                                               ./mkinstalldirs
+                                               ./libtool ./ltconfig ./ltmain.sh
+                                               ./ChangeLog
+                                               ./ABOUT-NLS
+                                               ./<name>-[0-9]* ./<name>-devel-[0-9]*
+                                               ./<name>.spec ./<name>.m4 ./<name>.spec.m4
+                                               ./macros/macros.dep
+                                               ./po/Makefile.in.in ./po/POTFILES* ./po/cat-id-tbl.c ./po/cat-id-tbl.tmp
+                                               ./po/*.gmo ./po/*.mo ./po/stamp-cat-id ./po/<name>.pot ./po/ChangeLog
+                                               ./po/Makevars ./po/Makevars.template ./po/Rules-quot ./po/*.sed ./po/*.sin ./po/*.header
+                                               ),
+                               map((!$_ ? () : do { my $dir=$_; map("$dir/$_",qw(
+                                               *.stamp
+                                               sgml*
+                                               tmpl*
+                                               html*
+                                               *.txt
+                                               *.txt.bak
+                                               *.args
+                                               *.hierarchy
+                                               *.signals
+                                               )); }),$Options{"gtk-doc-dir"}),
+                               map((!$_ ? () : do { my $dir=$_; map("$dir/$_",qw(
+                                               *.html
+                                               *.info*
+                                               *.txt
+                                               *.tex
+                                               *.sgml
+                                               )); }),$Options{"docbook-lite-dir"}),
+                               map((!$_ ? () : @$_),$Options{"clean"}),
+                               ));
+               # sanity check
+               for (@_cleanfiles_cache) {
+                               confess "dir-specific 'clean'-pattern must start with './': $_" if m#^(?!\Q./\E).*/#;
+                               };
+               }
+       return @_cleanfiles_cache;
+}
+
+sub _cleanfilesfordir
+{
+my($dir)=@_;
+
+       return map({
+                          if (m#^\Q$dir\E/([^/]+)$#) { # this-dir: "./this-dir/file-name.c"
+                                       ($1);
+                                       }
+                       elsif (m#^[^/]+$#) {    # all-dirs: "file-name.c"; the same as "./*/file-name.c"
+                                       ($&);
+                                       }
+                       elsif (do {     # all-subdirs: "./parent-of-this-dir/*/file-name.c"
+                                                       m#/[*]/([^/]+)$#;
+                                                       ($_=$1) && $dir=~m#^\Q$`\E(?:/|$)#;
+                                                       }) {
+                                       ($_);
+                                       }
+                       else {
+                                       ();
+                                       }
+                       } _cleanfiles());
+}
+
+sub _cvsdirs
+{
+my(@startdirs)=@_;
+
+       my @r=();
+       my @todo=(@startdirs);
+       while (defined(my $dir=shift @todo)) {
+               local *ENTRIES;
+               my $entries_filename="$dir/CVS/Entries";
+               open ENTRIES,$entries_filename or (cluck "open \"$entries_filename\": $!" and next);
+               push @r,$dir;
+               local $/="\n";
+               my %local=();
+               local $_;
+               while (<ENTRIES>) {
+                       chomp;
+                       next if !m#^D/([^/]+)/#;
+                       $local{$1}=1;
+                       }
+               close ENTRIES or cluck "close \"$entries_filename\": $!";
+               if (-e (my $entries_log_filename=$dir."/CVS/Entries.Log")) {
+                       local *ENTRIES_LOG;
+                       if (open ENTRIES_LOG,$entries_log_filename or cluck "open \"$entries_log_filename\": $!") {
+                               local $_;
+                               while (<ENTRIES_LOG>) {
+                                       chomp;
+                                                if (m#^A D/([^/]*)/#) {
+                                               $local{$1}=1;
+                                               }
+                                       elsif (m#^R D/([^/]*)/#) {
+                                               delete $local{$1};
+                                               }
+                                       else {
+                                               cluck "$entries_log_filename: Unrecognized line $.: $_";
+                                               }
+                                       }
+                               close ENTRIES_LOG or cluck "close \"$entries_log_filename\": $!";
+                               }
+                       }
+               push @todo,map(("$dir/$_"),keys(%local));
+               }
+       return @r;
+}
+
+sub _expandclass
+{
+my($patt)=@_;
+
+       return $patt if $patt!~/\Q[\E(.*?)\Q]\E/;
+       my($pre,$post)=($`,$'); # FIXME: local($`,$') doesn't work - why?
+       return map({ _expandclass("$pre$_$post"); } split("",$1));
+}
+
+sub run
+{
+my($class,%options)=@_;
+
+       local %Options=%options;
+       do { require $_ if -e; } for (home()."/.".$Options{"name"}.".autogen.pl");
+       do { $$_=1 if !defined($$_) && fgrep { /^\s*AUTOMAKE_OPTIONS\s*=[^#]*\bdist-tarZ\b/m; } "Makefile.am"; }
+                       for (\$Options{"dist-tarZ"});
+       Getopt::Long::Configure('noignorecase','prefix_pattern=(--|-|\+|)');
+       local @ARGV=@{$Options{"ARGV"}};
+       print _help() and confess if !GetOptions(
+                         "rpm"      ,sub { $class->_rpmbuild("sign"=>1); return; },
+                         "rpmtest"  ,sub { $class->_rpmbuild("sign"=>0); return; },
+                         "dist"     ,\$Options{"ARGV_dist"},
+                         "copy!"    ,\$Options{"ARGV_copy"},
+                         "fullclean",\$Options{"ARGV_fullclean"},
+                         "clean"    ,\$Options{"ARGV_clean"},
+                       "h|help"     ,sub { print _help(); exit 0; },
+                       $Options{"GetOptions_args"},
+                       ) || @ARGV;
+
+       for my $subdir (map((!$_ ? () : @$_),$Options{"subdirs"})) {
+               local $CWD=$subdir;
+               _system "./autogen.pl",@{$Options{"ARGV"}},"--dist";    # use "--dist" just as fallback!
+               }
+
+       for my $dir (_cvsdirs(".")) {
+               my @cleanfilesfordir=_cleanfilesfordir $dir;
+               _writefile $dir."/.cvsignore",map("$_\n",@cleanfilesfordir) if !$Options{"ARGV_fullclean"};
+               _remove "nocheck",\1,map({ _expandclass("$dir/$_"); } grep({
+                               $Options{"ARGV_fullclean"} or $_ ne ".cvsignore";
+                               } @cleanfilesfordir));
+               }
+       return if $Options{"ARGV_clean"} || $Options{"ARGV_fullclean"};
+
+       $Options{"aclocal_args"}=[qw(-I macros),map((!$_ ? () : @$_),$Options{"aclocal_args"})];
+       my $configure_in=_readfile("configure.in");
+       do { $$_=1 if !defined($$_) && $configure_in=~/^AM_GNU_GETTEXT\b/m; }
+                       for (\$Options{"want-gettextize"});
+       do { $$_=1 if !defined($$_) && $configure_in=~/^AM_PROG_LIBTOOL\b/m; }
+                       for (\$Options{"want-libtoolize"}); 
+       do { $$_=1 if !defined($$_) && $configure_in=~/^A[CM]_CONFIG_HEADER\b/m; }
+                       for (\$Options{"want-autoheader"});
+       my @copy_arg=(!$Options{"ARGV_copy"} ? () : "--copy");
+
+       do { &$_ if $_; } for ($Options{"prep"});
+       touch "po/POTFILES.in" if -d "po";
+       if ($Options{"want-gettextize"}) {
+               # don't use multi-arg system() here as it would reject "</dev/null" redirection etc.
+               for ("expect -c '"
+                               .'spawn gettextize --intl --no-changelog '.join(" ",@copy_arg).';'
+                               .'expect -timeout -1 "Press Return to acknowledge" {send "\r";exp_continue;} eof;'
+                               ."'") {
+                       _system $_ and confess $_;
+                       }
+               for ("configure.in","Makefile.am") {
+                       STDERR->printflush("gettextize recovery rename \"$_~\"->\"$_\"... ");
+                       rename "$_~","$_" or confess "$!";
+                       STDERR->printflush("ok\n");
+                       }
+               if (!-e "po/Makevars") {
+                       my $Makevars_template="po/Makevars.template";
+                       my $makevars=_readfile $Makevars_template;
+                       $makevars=~s/^(COPYRIGHT_HOLDER)\b.*$/"$1=".$Options{"COPYRIGHT_HOLDER"}/meg
+                                       or confess "COPYRIGHT_HOLDER not found in $Makevars_template";
+                       _writefile "po/Makevars",$makevars;
+                       }
+               # Prevent updating of contents during touch of any source file;
+               # change the .po contents only when some data get updated
+               for my $Makefile_in_in ("po/Makefile.in.in") {
+                       my $file=_readfile $Makefile_in_in;
+                       $file=~s%(\$\Q(MSGMERGE_UPDATE)\E) (\$\$\Q{lang}.po \E\$\Q(DOMAIN).pot\E)$%
+                                       $1.q< --backup=simple --suffix="~" >.$2.q<;>
+                                                       .q< if test `diff -u $${lang}.po~ $${lang}.po>
+                                                                                       .q< | sed>
+                                                                                                       .q< -e '1,/^@@.*@@$$/d'>
+                                                                                                       .q< -e '/^[+-]"POT-Creation-Date:/d'>
+                                                                                                       .q< -e '/^[^+-]/d'>
+                                                                                       .q< | wc -l` -eq 0;then>
+                                                                       .q< touch --reference=$${lang}.po $${lang}.po~;>
+                                                                                       .q< mv -f $${lang}.po~ $${lang}.po;>
+                                                       .q< else>
+                                                                       .q< rm -f $${lang}.po~;>
+                                                       .q< fi>
+                                       %me or confess;
+                       unlink $Makefile_in_in or confess "$!";
+                       _writefile $Makefile_in_in,$file;
+                       }
+               }
+       _system "aclocal",map((!$_ ? () : @$_),$Options{"aclocal_args"});
+       _system qw(libtoolize),@copy_arg if $Options{"want-libtoolize"};
+       _system qw(autoheader) if $Options{"want-autoheader"};
+       # "ChangeLog" is reqd by automake(1)
+       # Don't remove it afterwards as it may still be needed during automatic automake Makefile rebuilds
+       File::Touch->new("atime_only"=>1)->touch("ChangeLog");
+       _system qw(automake --add-missing),@copy_arg;
+       _system qw(autoconf);
+       # Why it is left there after RedHat autoconf-2.53-8 ?
+       _remove "nocheck",\1,"autom4te-*.cache";
+
+       return if $Options{"ARGV_dist"};
+
+       # shared/static switching cannot be based on maintainer-mode in configure
+       _system(qw(./configure --enable-maintainer-mode),
+                       ($Options{"want-libtoolize"} && qw(--enable-shared --disable-static)),
+                       map((!$_ ? () : @$_),$Options{"configure_args"}),
+                       );
+}
+
+1;
+__END__
+
+Tested with:
+       RedHat autoconf-2.53-8
+       RedHat automake-1.6.3-1
+       RedHat gettext-0.11.4-3
+       RedHat libtool-1.4.2-12
+       RedHat perl-5.8.0-48
diff --git a/Makefile-gtk-doc.am b/Makefile-gtk-doc.am
new file mode 100644 (file)
index 0000000..e05bf09
--- /dev/null
@@ -0,0 +1,232 @@
+# $Id$
+# automake include file for gtk-doc, define your '#%' lines
+# from gtk-doc-0.9-5/usr/share/doc/gtk-doc-0.9/examples/Makefile.am
+# Copyright (C) 2002 Jan Kratochvil <project-macros@jankratochvil.net>
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+# local diff:
+# s/EXTRA_DIST =/EXTRA_DIST +=/
+# s/tmpl-build.stamp:/tmpl-build.stamp $(srcdir)/tmpl/*.sgml:/
+#      Prevent: No rule to make target `tmpl/*.sgml', needed by `sgml-build.stamp'.  Stop.
+#      Fixes gtk-doc-0.9/setting-up.txt/:
+#              (Note that due to make being awkward the build
+#              may fail the first time, but if you run make again it should work.)
+# s/gtkdoc-scanobj/gtkdoc-scangobj/
+#      Note that if your project is targeted at GTK+ 2.0 rather
+#      than GTK+ 1.2.x, then you will have to change it so it
+#      runs gtkdoc-scangobj rather than gtkdoc-scanobj.
+# s/: scan-build.stamp/ $(DOC_MODULE)-sections.txt &/
+#      Prevent: No rule to make target `$(DOC_MODULE)-sections.txt', needed by `distdir'.  Stop.
+# s/gtkdoc-scan --module=/rm -f $(SCANOBJ_FILES) \&\& &/
+#      Do not forget to rebuild some files.
+
+
+# Create sgml/sgml/ to satisfy sgml/-based includes from sgml/MODULE-doc.top
+# Prevent: sgml.stamp defined both conditionally and unconditionally
+if ENABLE_GTK_DOC
+sgml.stamp: sgml/sgml
+sgml/sgml:
+       @$(LN_S) ./ $@
+endif
+
+
+#% ## Process this file with automake to produce Makefile.in
+#% 
+#% # This is a blank Makefile.am for using gtk-doc.
+#% # Copy this to your project's API docs directory and modify the variables to
+#% # suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
+#% # of using the various options.
+#% 
+#% # The name of the module, e.g. 'glib'.
+#% DOC_MODULE=
+#% 
+#% # The top-level SGML file. Change it if you want.
+#% DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+#% 
+#% # The directory containing the source code. Relative to $(srcdir).
+#% # gtk-doc will search all .c & .h files beneath here for inline comments
+#% # documenting functions and macros.
+#% DOC_SOURCE_DIR=
+#% 
+#% # Extra options to pass to gtkdoc-scangobj or gtkdoc-scangobj.
+#% SCANOBJ_OPTIONS=
+#% 
+#% # Extra options to supply to gtkdoc-scan.
+#% SCAN_OPTIONS=
+#% 
+#% # Extra options to supply to gtkdoc-mkdb.
+#% MKDB_OPTIONS=
+#% 
+#% # Extra options to supply to gtkdoc-fixref.
+#% FIXXREF_OPTIONS=
+#% 
+#% # Used for dependencies.
+#% HFILE_GLOB=
+#% CFILE_GLOB=
+#% 
+#% # Header files to ignore when scanning.
+#% IGNORE_HFILES=
+#% 
+#% # Images to copy into HTML directory.
+#% HTML_IMAGES =
+#% 
+#% # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+#% content_files =
+#% 
+#% # Other files to distribute.
+#% extra_files =
+#% 
+#% # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
+#% # contains GtkObjects/GObjects and you want to document signals and properties.
+#% GTKDOC_CFLAGS =
+#% GTKDOC_LIBS =
+#% 
+#% GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
+#% GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
+#% 
+#% # If you need to override some of the declarations, place them in the
+#% # $(DOC_MODULE)-overrides.txt file and uncomment the second line here.
+#% DOC_OVERRIDES =
+#% #DOC_OVERRIDES = $(DOC_MODULE)-overrides.txt
+
+
+
+###########################################################################
+# Everything below here is generic and you shouldn't need to change it.
+###########################################################################
+
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+EXTRA_DIST +=                          \
+       $(content_files)                \
+       $(extra_files)                  \
+       $(HTML_IMAGES)                  \
+       $(DOC_MAIN_SGML_FILE)           \
+       $(DOC_MODULE).types             \
+       $(DOC_MODULE)-sections.txt      \
+       $(DOC_OVERRIDES)
+
+DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
+          $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp
+
+SCANOBJ_FILES =                \
+       $(DOC_MODULE).args      \
+       $(DOC_MODULE).hierarchy \
+       $(DOC_MODULE).signals
+
+if ENABLE_GTK_DOC
+all-local: html-build.stamp
+
+#### scan ####
+
+scan-build.stamp: $(HFILE_GLOB)
+       @echo '*** Scanning header files ***'
+       if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
+           CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
+       else \
+           cd $(srcdir) ; \
+           for i in $(SCANOBJ_FILES) ; do \
+               test -f $$i || touch $$i ; \
+           done \
+       fi
+       cd $(srcdir) && \
+         rm -f $(SCANOBJ_FILES) && gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
+       touch scan-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt : scan-build.stamp
+       @true
+
+#### templates ####
+
+tmpl-build.stamp $(srcdir)/tmpl/*.sgml: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
+       @echo '*** Rebuilding template files ***'
+       cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
+       touch tmpl-build.stamp
+
+tmpl.stamp: tmpl-build.stamp
+       @true
+
+#### sgml ####
+
+sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
+       @echo '*** Building SGML ***'
+       cd $(srcdir) && \
+       gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
+       touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+       @true
+
+#### html ####
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
+       @echo '*** Building HTML ***'
+       test -d $(srcdir)/html || mkdir $(srcdir)/html
+       cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
+       test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
+       @echo '-- Fixing Crossreferences' 
+       cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+       touch html-build.stamp
+endif
+
+##############
+
+clean-local:
+       rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS)
+
+maintainer-clean-local: clean
+       cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
+       (installfiles=`echo $(srcdir)/html/*.html`; \
+       if test "$$installfiles" = '$(srcdir)/html/*.html'; \
+       then echo '-- Nothing to install' ; \
+       else \
+         for i in $$installfiles; do \
+           echo '-- Installing '$$i ; \
+           $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+         done; \
+         echo '-- Installing $(srcdir)/html/index.sgml' ; \
+         $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
+       fi)
+
+#
+# Require gtk-doc when making dist
+#
+if ENABLE_GTK_DOC
+dist-check-gtkdoc:
+else
+dist-check-gtkdoc:
+       @echo "*** gtk-doc must be installed and enabled in order to make dist"
+       @false
+endif
+
+dist-hook: dist-check-gtkdoc dist-hook-local
+       mkdir $(distdir)/tmpl
+       mkdir $(distdir)/sgml
+       mkdir $(distdir)/html
+       -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
+       -cp $(srcdir)/sgml/*.sgml $(distdir)/sgml
+       -cp $(srcdir)/html/index.sgml $(distdir)/html
+       -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
+
+       images=$(HTML_IMAGES) ;               \
+       for i in $$images ; do                \
+         cp $(srcdir)/$$i $(distdir)/html ;  \
+       done
+
+.PHONY : dist-hook-local
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..689b238
--- /dev/null
@@ -0,0 +1,31 @@
+# $Id$
+# automake source for the Makefile of package non-specific control macros
+# Copyright (C) 2002 Jan Kratochvil <project-macros@jankratochvil.net>
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+## Please update this variable if any new macros are created
+MACROS= \
+               AutoGen.pm \
+               Makefile-gtk-doc.am \
+               gtk-doc.m4
+
+EXTRA_DIST+=$(MACROS) macros.dep
+MAINTAINERCLEANFILES+=macros.dep
+
+@MAINT@macros.dep: Makefile.am
+@MAINT@        @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@
diff --git a/gtk-doc.m4 b/gtk-doc.m4
new file mode 100644 (file)
index 0000000..ee5c8bc
--- /dev/null
@@ -0,0 +1,76 @@
+# $Id$
+# Macros for gtk-doc
+# from gtk-doc-0.9-5/usr/share/doc/gtk-doc-0.9/examples/configure.in
+# Copyright (C) 2002 Jan Kratochvil <project-macros@jankratochvil.net>
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; exactly version 2 of June 1991 is required
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+# local diff:
+# s/if test x$GTKDOC = xtrue ; then/if test x$GTKDOC = xtrue -o x$USE_MAINTAINER_MODE = xyes ; then/
+
+
+AC_DEFUN([GTK_DOC_CHECK],
+[
+
+# This is a check for gtk-doc which you can insert into your configure.in.
+# You shouldn't need to change it at all.
+
+
+##################################################
+# Check for gtk-doc.
+##################################################
+
+AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
+
+if test "x$with_html_dir" = "x" ; then
+  HTML_DIR='${datadir}/gtk-doc/html'
+else
+  HTML_DIR=$with_html_dir
+fi
+
+AC_SUBST(HTML_DIR)
+
+AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
+
+gtk_doc_min_version=0.6
+if $GTKDOC ; then 
+    gtk_doc_version=`gtkdoc-mkdb --version`
+    AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])
+    if perl <<EOF ; then
+      exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) &&
+            ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1);
+EOF
+      AC_MSG_RESULT(yes)
+   else
+      AC_MSG_RESULT(no)
+      GTKDOC=false
+   fi
+fi
+
+dnl Let people disable the gtk-doc stuff.
+AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
+
+if test x$enable_gtk_doc = xauto ; then
+  if test x$GTKDOC = xtrue -o x$USE_MAINTAINER_MODE = xyes ; then
+    enable_gtk_doc=yes
+  else
+    enable_gtk_doc=no 
+  fi
+fi
+
+AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
+
+
+])