Commit b531f8d3 authored by david.verdin's avatar david.verdin
Browse files

[*feature][Submitted by G. Rousse, INRIA] Complete reorganization of autotools...

[*feature][Submitted by G. Rousse, INRIA] Complete reorganization of autotools usage in Sympa. Better conformance to the standard usage of these tools. The Sympa configuration parameter has also been rewritten into a single hash, providing a comprehensive and unique declaration structure for these parameters.


git-svn-id: https://subversion.renater.fr/sympa/trunk@5688 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent df4b1c37
This diff is collapsed.
# check_perl_modules.pl - This script checks installed and required Perl modules
# It also does the required installations
# RCS Identication ; $Revision$ ; $Date$
#
# Sympa - SYsteme de Multi-Postage Automatique
# Copyright (c) 1997, 1998, 1999, 2000, 2001 Comite Reseau des Universites
# Copyright (c) 1997,1998, 1999 Institut Pasteur & Christophe Wolfhugel
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
use CPAN;
## assume version = 1.0 if not specified.
##
%versions = ('perl' => '5.008',
'Net::LDAP' =>, '0.27',
'perl-ldap' => '0.10',
'Mail::Internet' => '1.51',
'DBI' => '1.48',
'DBD::Pg' => '0.90',
'DBD::Sybase' => '0.90',
'DBD::mysql' => '2.0407',
'FCGI' => '0.67',
'HTML::StripScripts::Parser' => '1.0',
'MIME::Tools' => '5.423',
'File::Spec' => '0.8',
'Crypt::CipherSaber' => '0.50',
'CGI' => '3.35',
'Digest::MD5' => '2.00',
'DB_File' => '1.75',
'IO::Socket::SSL' => '0.90',
'Net::SSLeay' => '1.16',
'Archive::Zip' => '1.05',
'Bundle::LWP' => '1.09',
'SOAP::Lite' => '0.60',
'MHonArc::UTF8' => '2.6.0',
'MIME::Base64' => '3.03',
'MIME::Charset' => '0.04.1',
'MIME::EncWords' => '0.040',
'File::Copy::Recursive' => '0.36',
'Net::Netmask' => '1.9015',
'Term::ProgressBar' => '2.09',
'Time::HiRes' => '1.9719',
'MIME::Lite' => '3.024',
'MIME::Lite::HTML' => '1.23',
);
### key:left "module" used by SYMPA,
### right CPAN module.
%req_CPAN = ('DB_File' => 'DB_FILE',
'Digest::MD5' => 'Digest-MD5',
'Mail::Internet' =>, 'MailTools',
'IO::Scalar' => 'IO-stringy',
'MIME::Tools' => 'MIME-tools',
'MIME::Base64' => 'MIME-Base64',
'CGI' => 'CGI',
'File::Spec' => 'File-Spec',
'Regexp::Common' => 'Regexp-Common',
'Locale::TextDomain' => 'libintl-perl',
'Template' => 'Template-Toolkit',
'Archive::Zip' => 'Archive-Zip',
'LWP' => 'libwww-perl',
'XML::LibXML' => 'XML-LibXML',
'MHonArc::UTF8' => 'MHonArc',
'FCGI' => 'FCGI',
'DBI' => 'DBI',
'DBD::mysql' => 'Msql-Mysql-modules',
'Crypt::CipherSaber' => 'CipherSaber',
'Encode' => 'Encode',
'MIME::Charset' => 'MIME-Charset',
'MIME::EncWords' => 'MIME-EncWords',
'HTML::StripScripts::Parser' => 'HTML-StripScripts-Parser',
'File::Copy::Recursive' => 'File-Copy-Recursive',
'Net::Netmask' => 'Net-Netmask',
'HTML::TreeBuilder' => 'HTML-Tree',
'HTML::FormatText' => 'HTML-Format',
'Term::ProgressBar' => 'Term-ProgressBar',
'Time::HiRes' => 'Time-HiRes',
'MIME::Lite' => 'MIME-Lite',
'MIME::Lite::HTML' => 'MIME-Lite-HTML',
);
%opt_CPAN = ('DBD::Pg' => 'DBD-Pg',
'DBD::Oracle' => 'DBD-Oracle',
'DBD::Sybase' => 'DBD-Sybase',
'DBD::SQLite' => 'DBD-SQLite',
'Net::LDAP' => 'perl-ldap',
'CGI::Fast' => 'CGI',
'Net::SMTP' => 'libnet',
'IO::Socket::SSL' => 'IO-Socket-SSL',
'Net::SSLeay' => 'NET-SSLeay',
'Bundle::LWP' => 'LWP',
'SOAP::Lite' => 'SOAP-Lite',
'File::NFSLock' => 'File-NFSLock',
'File::Copy::Recursive' => 'File-Copy-Recursive',
);
%opt_features = ('DBI' => 'a generic Database Driver, required by Sympa to access Subscriber information and User preferences. An additional Database Driver is required for each database type you wish to connect to.',
'DBD::mysql' => 'Mysql database driver, required if you connect to a Mysql database.\nYou first need to install the Mysql server and have it started before installing the Perl DBD module.',
'DBD::Pg' => 'PostgreSQL database driver, required if you connect to a PostgreSQL database.',
'DBD::Oracle' => 'Oracle database driver, required if you connect to a Oracle database.',
'DBD::Sybase' => 'Sybase database driver, required if you connect to a Sybase database.',
'DBD::SQLite' => 'SQLite database driver, required if you connect to a SQLite database.',
'Net::LDAP' => 'required to query LDAP directories. Sympa can do LDAP-based authentication ; it can also build mailing lists with LDAP-extracted members.',
'CGI::Fast' => 'WWSympa, Sympa\'s web interface can run as a FastCGI (ie: a persistent CGI). If you install this module, you will also need to install the associated mod_fastcgi for Apache.',
'Crypt::CipherSaber' => 'this module provides reversible encryption of user passwords in the database.',
'Archive::Zip ' => 'this module provides zip/unzip for archive and shared document download/upload',
'FCGI' => 'WSympa, Sympa\'s web interface can run as a FastCGI (ie: a persistent CGI). If you install this module, you will also need to install the associated mod_fastcgi for Apache.',
'Net::SMTP' => 'this is required if you set \'list_check_smtp\' sympa.conf parameter, used to check existing aliases before mailing list creation.',
'IO::Socket::SSL' => 'required by CAS (single sign-on) and the \'include_remote_sympa_list\' feature that includes members of a list on a remote server, using X509 authentication',
'Net::SSLeay' => 'required by the \'include_remote_sympa_list\' feature that includes members of a list on a remote server, using X509 authentication',
'Bundle::LWP' => 'required by the \'include_remote_sympa_list\' feature that includes members of a list on a remote server, using X509 authentication',
'SOAP::Lite' => 'required if you want to run the Sympa SOAP server that provides ML services via a "web service"',
'File::NFSLock' => 'required to perform NFS lock ; see also lock_method sympa.conf parameter'
);
### main:
print "******* Check perl for SYMPA ********\n";
### REQ perl version
print "\nChecking for PERL version:\n-----------------------------\n";
$rpv = $versions{"perl"};
if ($] >= $versions{"perl"}){
print "your version of perl is OK ($] >= $rpv)\n";
}else {
print "Your version of perl is TOO OLD ($] < $rpv)\nPlease INSTALL a new one !\n";
}
print "\nChecking for REQUIRED modules:\n------------------------------------------\n";
&check_modules('y', %req_CPAN);
print "\nChecking for OPTIONAL modules:\n------------------------------------------\n";
&check_modules('n', %opt_CPAN);
print <<EOM;
******* NOTE *******
You can retrive all theses modules from any CPAN server
(for example ftp://ftp.pasteur.fr/pub/computing/CPAN/CPAN.html)
EOM
###--------------------------
# reports modules status
###--------------------------
sub check_modules {
my($default, %todo) = @_;
my($vs, $v, $rv, $status);
print "perl module from CPAN STATUS\n";
print "----------- --------- ------\n";
foreach $mod (sort keys %todo) {
printf ("%-20s %-15s", $mod, $todo{$mod});
$status = &test_module($mod);
if ($status == 1) {
$vs = "$mod" . "::VERSION";
$vs = 'mhonarc::VERSION' if $mod =~ /^mhonarc/i;
$v = $$vs;
$rv = $versions{$mod} || "1.0" ;
### OK: check version
if ($v ge $rv) {
printf ("OK (%-6s >= %s)\n", $v, $rv);
next;
}else {
print "version is too old ($v < $rv).\n";
print ">>>>>>> You must update \"$todo{$mod}\" to version \"$versions{$todo{$mod}}\" <<<<<<.\n";
&install_module($mod, {'default' => $default});
}
} elsif ($status eq "nofile") {
### not installed
print "was not found on this system.\n";
&install_module($mod, {'default' => $default});
} elsif ($status eq "pb_retval") {
### doesn't return 1;
print "$mod doesn't return 1 (check it).\n";
} else {
print "$status\n";
}
}
}
##----------------------
# Install a CPAN module
##----------------------
sub install_module {
my ($module, $options) = @_;
my $default = $options->{'default'};
unless ($ENV{'FTP_PASSIVE'} eq 1) {
$ENV{'FTP_PASSIVE'} = 1;
print "Setting FTP Passive mode\n";
}
## This is required on RedHat 9 for DBD::mysql installation
my $lang = $ENV{'LANG'};
$ENV{'LANG'} = 'C' if ($ENV{'LANG'} =~ /UTF\-8/);
unless ($> == 0) {
print "\#\# You need root privileges to install $module module. \#\#\n";
print "\#\# Press the Enter key to continue checking modules. \#\#\n";
my $t = <STDIN>;
return undef;
}
unless ($options->{'force'}) {
printf "Description: %s\n", $opt_features{$module};
print "Install module $module ? [$default]";
my $answer = <STDIN>; chomp $answer;
$answer ||= $default;
return unless ($answer =~ /^y$/i);
}
$CPAN::Config->{'inactivity_timeout'} = 4;
$CPAN::Config->{'colorize_output'} = 1;
#CPAN::Shell->clean($module) if ($options->{'force'});
CPAN::Shell->make($module);
if ($options->{'force'}) {
CPAN::Shell->force('test', $module);
}else {
CPAN::Shell->test($module);
}
CPAN::Shell->install($module); ## Could use CPAN::Shell->force('install') if make test failed
## Check if module has been successfuly installed
unless (&test_module($module) == 1) {
## Prevent recusive calls if already in force mode
if ($options->{'force'}) {
print "Installation of $module still FAILED. You should download the tar.gz from http://search.cpan.org and install it manually.";
my $answer = <STDIN>;
}else {
print "Installation of $module FAILED. Do you want to force the installation of this module? (y/N) ";
my $answer = <STDIN>; chomp $answer;
if ($answer =~ /^y/i) {
&install_module($module, {'force' => 1});
}
}
}
## Restore lang
$ENV{'LANG'} = $lang if (defined $lang);
}
###--------------------------
# test if module is there
# (from man perlfunc ...)
###--------------------------
sub test_module {
my($filename) = @_;
my($realfilename, $result);
$filename =~ s/::/\//g;
$filename .= ".pm";
## Exception for mhonarc
$filename = 'mhamain.pl' if $filename =~ /^mhonarc/i;
return 1 if $INC{$filename};
ITER: {
foreach $prefix (@INC) {
$realfilename = "$prefix/$filename";
if (-f $realfilename) {
$result = do $realfilename;
last ITER;
}
}
return "nofile";
}
return "pb_retval" unless $result;
return $result;
}
### EOF
......@@ -20,156 +20,276 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AC_PREREQ(2.59)
AC_INIT(sympa, 6.0a.12, sympa-authors@cru.fr)
AM_INIT_AUTOMAKE
AC_INIT(sympa, 6.0a.13, sympa-authors@cru.fr)
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AM_PO_SUBDIRS
# Setup the VERSION variable
AC_SUBST(VERSION,AC_PACKAGE_VERSION)
AC_PREFIX_DEFAULT(/home/sympa)
## Directories setup
## for main config files
## location of main config files
CONFDIR='/etc'
AC_ARG_WITH(confdir, [ --with-confdir=DIR Sympa main configuration files in DIR (default /etc)], [CONFDIR="$withval"])
AC_SUBST(CONFDIR)
## location of CGIs
CGIDIR='${prefix}/bin'
AC_ARG_WITH(cgidir, [ --with-cgidir=DIR CGIs in DIR (default ${prefix}/bin)], [CGIDIR="$withval"])
AC_SUBST(CGIDIR)
## location of user executables
BINDIR='${prefix}/bin'
AC_ARG_WITH(bindir, [ --with-bindir=DIR user executables in DIR (default ${prefix}/bin). queue and bouncequeue programs will be installed in this directory. If sendmail is configured to use smrsh (check the mailer prog definition in your sendmail.cf), this should point to /etc/smrsh. This is probably the case if you are using Linux], [BINDIR="$withval"])
AC_SUBST(BINDIR)
## location of system admin executables
SBINDIR='${prefix}/bin'
AC_ARG_WITH(sbindir, [ --with-sbindir=DIR system admin executables in DIR (default ${prefix}/bin)], [SBINDIR="$withval"])
AC_SUBST(SBINDIR)
## location of program executables
LIBEXECDIR='${prefix}/bin'
AC_ARG_WITH(libexecdir, [ --with-libexecdir=DIR program executables in DIR (default ${prefix}/bin)], [LIBEXECDIR="$withval"])
AC_SUBST(LIBEXECDIR)
## location of Perl modules
LIBDIR='${prefix}/bin'
AC_ARG_WITH(libdir, [ --with-libdir=DIR Perl modules in DIR (default ${prefix}/bin)], [LIBDIR="$withval"])
AC_SUBST(LIBDIR)
## location of default *read-only* data files
DATADIR='${prefix}/bin/etc'
AC_ARG_WITH(datadir, [ --with-datadir=DIR default *read-only* data files in DIR (default ${prefix}/bin/etc)], [DATADIR="$withval"])
AC_SUBST(DATADIR)
## location of modifiable data files
EXPLDIR='${prefix}/expl'
AC_ARG_WITH(expldir, [ --with-expldir=DIR modifiable data files in DIR (default ${prefix}/expl)], [EXPLDIR="$withval"])
AC_SUBST(EXPLDIR)
## location of documentation
MANDIR='/usr/local/man'
AC_ARG_WITH(mandir, [ --with-mandir=DIR documentation in DIR (default /usr/local/man)], [MANDIR="$withval"])
AC_SUBST(MANDIR)
## SYS V init scripts directory
INITDIR=/etc/rc.d/init.d
AC_ARG_WITH(initdir, [ --with-initdir=DIR install System V init script in DIR (default /etc/rc.d/init.d)], [INITDIR="$withval"])
AC_SUBST(INITDIR)
## Lock directory
LOCKDIR=/var/lock/subsys
AC_ARG_WITH(lockdir, [ --with-lockdir=DIR create lock files in DIR (default /var/lock/subsys)], [LOCKDIR="$withval"])
AC_SUBST(LOCKDIR)
## directory for storing .pid files
PIDDIR='${prefix}'
AC_ARG_WITH(piddir, [ --with-piddir=DIR create .pid files in DIR (default ${prefix})], [PIDDIR="$withval"])
AC_SUBST(PIDDIR)
## directory for Config directories populated by the user
ETCDIR='${prefix}/etc'
AC_ARG_WITH(etcdir, [ --with-etcdir=DIR Config directories populated by the user are in DIR (default ${prefix}/etc)], [ETCDIR="$withval"])
AC_SUBST(ETCDIR)
## directory for language files
LOCALEDIR='${prefix}/locale'
AC_ARG_WITH(localedir, [ --with-localedir=DIR create language files in DIR (default ${prefix}/locale)], [LOCALEDIR="$withval"])
AC_SUBST(LOCALEDIR)
## directory for Documentation files
DOCDIR='${prefix}/doc'
AC_ARG_WITH(docdir, [ --with-docdir=DIR create documentation files in DIR (default ${prefix}/doc)], [DOCDIR="$withval"])
AC_SUBST(DOCDIR)
## directory for script files
SCRIPTDIR='${prefix}/bin'
AC_ARG_WITH(scriptdir, [ --with-scriptdir=DIR create script files in DIR (default ${prefix}/bin)], [SCRIPTDIR="$withval"])
AC_SUBST(SCRIPTDIR)
## directory for sample files
SAMPLEDIR='${prefix}/sample'
AC_ARG_WITH(sampledir, [ --with-sampledir=DIR create sample files in DIR (default ${prefix}/sample)], [SAMPLEDIR="$withval"])
AC_SUBST(SAMPLEDIR)
## directory for sample files
SPOOLDIR='${prefix}/spool'
AC_ARG_WITH(spooldir, [ --with-spooldir=DIR spool directory is DIR (default ${prefix}/spool)], [SPOOLDIR="$withval"])
AC_SUBST(SPOOLDIR)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_AIX
# configuration
AC_ARG_WITH(
confdir,
AS_HELP_STRING(
[--with-confdir=DIR],
[obsolete option, use --sysconfdir instead]
),
[
AC_MSG_WARN([obsolete --with-confdir option used])
sysconfdir="$withval"
]
)
AC_PATH_PROG(PERL, perl, /usr/bin/perl)
AC_ARG_WITH(
[perl],
etcdir,
AS_HELP_STRING(
[--with-perl=FULLPATH],
[set full path to Perl interpreter (default /usr/bin/perl)]
[--with-etcdir=DIR],
[obsolete option, use --sysconfdir instead]
),
[PERL="$withval"]
[AC_MSG_WARN([obsolete --with-etcdir option used])]
)
# binaries
AC_ARG_WITH(
bindir,
AS_HELP_STRING(
[--with-bindir=DIR],
[obsolete option, those binaries are now installed in libexecdir]
),
[AC_MSG_WARN([obsolete --with-sampledir option used])]
)
AC_ARG_WITH(
sbindir,
AS_HELP_STRING(
[--with-sbindir=DIR],
[obsolete option, use --sbindir instead]
),
[
AC_MSG_WARN([obsolete --with-sbindir option used])
sbindir="$withval"
]
)
AC_ARG_WITH(
libexecdir,
AS_HELP_STRING(
[--with-libexecdir=DIR],
[obsolete option, use --libexecdir instead]
),
[
AC_MSG_WARN([obsolete --with-libexecdir option used])
libexecdir="$withval"
]
)
# arch-dependant files
execcgidir='${libdir}/sympa/cgi'
AC_ARG_WITH(
cgidir,
AS_HELP_STRING(
[--with-cgidir=DIR],
[CGIs in DIR (default ${libdir}/sympa/cgi)]
),
[execcgidir="$withval"]
)
AC_SUBST(execcgidir)
# arch-independant files
AC_ARG_WITH(
datadir,
AS_HELP_STRING(
[--with-datadir=DIR]
[obsolete option, use --datadir instead]
),
[
AC_MSG_WARN([obsolete --with-datadir option used])
datadir="$withval"
]
)
AC_ARG_WITH(
scriptdir,
AS_HELP_STRING(
[--with-scriptdir=DIR],
[obsolete option, scripts modules are now installed with data]
),
[AC_MSG_WARN([obsolete --with-scriptdir option used])]
)
AC_ARG_WITH(
libdir,
AS_HELP_STRING(
[--with-libdir=DIR]
[obsolete option, perl modules are now installed with data]
),
[
AC_MSG_WARN([obsolete --with-libdir option used])
]
)
# locales
AC_ARG_WITH(
localedir,
AS_HELP_STRING(
[--with-localedir=DIR],
[obsolete option, use --localedir instead]
),
[
AC_MSG_WARN([obsolete --with-localedir option used])
localedir="$withval"
]
)
# documentation
AC_ARG_WITH(
mandir,
AS_HELP_STRING(
[--with-mandir=DIR],
[obsolete option, use --mandir instead]
),
[
AC_MSG_WARN([obsolete --with-mandir option used])
mandir="$withval"
]
)
AC_ARG_WITH(
docdir,
AS_HELP_STRING(
[--with-docdir=DIR],
[obsolete option, use --docdir instead]
),
[
AC_MSG_WARN([obsolete --with-docdir option used])
docdir="$withval"
]
)
AC_ARG_WITH(
sampledir,
AS_HELP_STRING(
[--with-sampledir=DIR],
[obsolete option, samples are now installed with documentation]
),
[
AC_MSG_WARN([obsolete --with-sampledir option used])
]
)
# variable content
expldir='${prefix}/expl'
AC_ARG_WITH(
expldir,
AS_HELP_STRING(
[--with-expldir=DIR],
[variable state directory is DIR (default ${prefix}/expl)]
),
[expldir="$withval"]
)
AC_SUBST(PERL)
AC_SUBST(expldir)
AC_PATH_PROG(SUIDPERL, suidperl, /usr/bin/suidperl)
AC_SUBST(SUIDPERL)
spooldir='${prefix}/spool'
AC_ARG_WITH(
spooldir,
AS_HELP_STRING(
[--with-spooldir=DIR],
[application spool directory is DIR (default ${prefix}/spool)]
),
[spooldir="$withval"]
)
AC_SUBST(spooldir)
AC_PATH_PROG(SUDO, sudo, /usr/bin/sudo)
AC_SUBST(SUDO)
initdir='${sysconfdir}/rc.d/init.d'
AC_ARG_WITH(
initdir,
AS_HELP_STRING(
[--with-initdir=DIR],
[install System V init script in DIR (default ${sysconfdir}/rc.d/init.d)]
),
[initdir="$withval"]
)
AC_SUBST(initdir)
AC_PATH_PROG(MHONARC, mhonarc, /usr/bin/mhonarc)
lockdir='${localstatedir}/lock/subsys'
AC_ARG_WITH(
[mhonarc],
lockdir,
AS_HELP_STRING(
[--with-mhonarc=FULLPATH],
[set full path to MhOnArc mail archiving system (default /usr/bin/mhonarc)]
[--with-lockdir=DIR],
[create lock files in DIR (default ${localstatedir}/lock/subsys)]
),
[MHONARC="$withval"]
[lockdir="$withval"]
)
AC_SUBST(MHONARC)
AC_SUBST(lockdir)
AC_PATH_PROG(OPENSSL, openssl, /usr/local/ssl/bin)
piddir='${localstatedir}/run'
AC_ARG_WITH(
[openssl],
piddir,
AS_HELP_STRING(
[--with-openssl=FULLPATH],
[set path to OpenSSL (default /usr/local/ssl/bin/openssl)]
[--with-piddir=DIR],
[create .pid files in DIR (default ${localstatedir}/run)]
),
[OPENSSL="$withval"]
[piddir="$withval"]