#!/usr/bin/perl -w

=head1 NAME

dh_phpize - Call phpize in the PHP module directory

=cut

use strict;
use Cwd;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<dh_phpize> [S<I<build system options>>] [S<I<debhelper options>>]

=head1 DESCRIPTION

dh_phpize is responsible for calling phpize and creating the files needed
to successfully compile PHP 5 module.

dh_phpize accepts the -D | --sourcedirectory option of DEBHELPER.

=cut

my($opt_sourcedir);

init(options => { "D=s" => \$opt_sourcedir,
		  "sourcedirectory=s" => \$opt_sourcedir });

$opt_sourcedir = "." unless $opt_sourcedir;
if (-e "$opt_sourcedir/config.m4") {
    my $cwd = getcwd;
    chdir $opt_sourcedir;
    doit('phpize');
    chdir $cwd;
} else {
    die "Cannot find config.m4 in $opt_sourcedir/config.m4."
}

=head1 SEE ALSO

L<debhelper(7)>, L<dh_phpize_clean(1)>

=head1 AUTHOR

Ondřej Surý <ondrej@debian.org>

=cut
