#!@PERL@ -w
use strict;
my $copyright = <<'EOF';
/* Copyright (C) 2007 Olly Betts
 *
 * 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; either version 2 of the
 * License, or (at your option) any later version.
 *
 * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */
EOF

my $generated_warning =
"/* Warning: This file is generated by $0 - do not modify directly! */\n";

open HDR, ">languages/allsnowballheaders.h" or die $!;

print HDR <<'EOF';
/** @file allsnowballheaders.h
 *  @brief Include the headers for all the snowball stemmers.
 */
EOF

print HDR $generated_warning;
print HDR $copyright;

print HDR <<'EOF';

#ifndef XAPIAN_INCLUDED_ALLSNOWBALLHEADERS_H
#define XAPIAN_INCLUDED_ALLSNOWBALLHEADERS_H

EOF

my @langs = ();
foreach (sort @ARGV) {
    next unless m!([^/\\]+)\.h$!;
    push @langs, $1;
    print HDR "#include \"$_\"\n";
}

print HDR "\n#define LANGSTRING \"", join(" ", @langs), "\"\n";

print HDR <<'EOF';

#endif // XAPIAN_INCLUDED_ALLSNOWBALLHEADERS_H
EOF

close HDR or die $!;
