I have made some changes in perl script autoscan. I have added new properties 1. have been added new three command line parameters: 'package name', 'package version' and 'bug report address'. These parameters fill the three parameters in the macro AC_INIT. 2. has been changed the function 'scan_makefile' - detection of the keywords 'lib_LIBRARIES' and 'lib_LTLIBRARIES' to generate the macros 'AC_ENABLE_SHARED', 'AC_DISABLE_SHARED', 'AC_ENABLE_STATIC', 'AC_DISABLE_STATIC', 'AC_PROG_LIBTOOL' and, may be, 'AC_LIBTOOL_WIN32_DLL'. 3. has been changed the function 'scan_file' - have been added the programs 'flex' and 'bison' 4. has been corrected the function 'output_libraries' 5. has been changed the function 'output' - have been changed the parameters in the macro 'AC_INIT' - have been added the macros 'AC_CANONICAL_SYSTEM' and 'AM_INIT_AUTOMAKE' - has been added the calling of the function 'output_kind' to generate the libtool macros 6. has been corrected the function 'check_configure_ac' 7. has been changed the main function - if the file 'configure.ac' does not exist, the script 'autoscan' generates the both files 'configure.scan' and 'configure.ac' 8. interface to the libtool macros has been added to the file 'lib/autoscan/autoscan.pre' at this moment
Milan Znamenacek -- Dipl.Ing. Znamenacek Milan [EMAIL PROTECTED] RETIA,a.s. Prazska 341 Pardubice 53002 Czech Republic
diff -Naur autoconf-2.56/bin/autoscan.in autoconf-new/bin/autoscan.in --- autoconf-2.56/bin/autoscan.in Thu Nov 7 14:22:23 2002 +++ autoconf-new/bin/autoscan.in Fri Nov 29 14:04:20 2002 @@ -39,7 +39,7 @@ # The kind of the words we are looking for. my @kinds = qw (function header identifier program - makevar librarie); + makevar librarie libtool); # For each kind, the default macro. my %generic_macro = @@ -87,6 +87,10 @@ my @prepend_include; my @include = ('@datadir@'); +my $full_package_name = "FULL-PACKAGE-NAME"; +my $package_version = "VERSION"; +my $bug_report_address = "BUG-REPORT-ADDRESS"; + # $help # ----- $help = "Usage: $0 [OPTION] ... [SRCDIR] @@ -101,6 +105,9 @@ -V, --version print version number, then exit -v, --verbose verbosely report processing -d, --debug don't remove temporary files + -p, --package=name package name + -e, --package-version=ver package version + -b, --bug-report=address bug report address Library directories: -B, --prepend-include=DIR prepend directory DIR to search path @@ -130,7 +137,10 @@ sub parse_args () { getopt ('I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include); + 'B|prepend-include=s' => \@prepend_include, + 'p|package=s' => \$full_package_name, + 'e|package-version=s' => \$package_version, + 'b|bug-report=s' => \$bug_report_address); die "$me: too many arguments Try `$me --help' for more information.\n" @@ -292,6 +302,10 @@ # ----------------------------- sub scan_makefile ($) { +# for LIBTOOL settings + my $libtool_static = 0; + my $libtool_shared = 0; + my ($filename) = @_; push @makefiles, $File::Find::name; @@ -302,6 +316,16 @@ # Strip out comments. s/#.*//; + # Static libraries. + while (s/\blib_LIBRARIES\b/ /) + { + $libtool_static = 1; + } + # Static and shared libraries. + while (s/\blib_LTLIBRARIES\b/ /) + { + $libtool_shared = 1; + } # Variable assignments. while (s/\b([a-zA-Z_]\w*)\s*=/ /) { @@ -326,6 +350,20 @@ } } + if($libtool_static || $libtool_shared) + { + used ('libtool', 'enstatic'); + if($libtool_shared) + { + used ('libtool', 'enshared'); + } + else + { + used ('libtool', 'dishared'); + } + used ('libtool', 'libtool'); + } + $file->close; } @@ -373,16 +411,36 @@ # Strip a useless leading `./'. $File::Find::name =~ s,^\./,,; - if (/\.[chlym](\.in)?$/) + if (/\.[chm](\.in)?$/) { used 'program', 'cc', $File::Find::name; scan_c_file ($_); } - elsif (/\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H|yy|ypp|ll|lpp)(\.in)?$/) + elsif (/\.l(\.in)?$/) + { + used 'program', 'flex', $File::Find::name; + scan_c_file ($_); + } + elsif (/\.y(\.in)?$/) + { + used 'program', 'bison', $File::Find::name; + scan_c_file ($_); + } + elsif (/\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H)(\.in)?$/) { used 'program', 'c++', $File::Find::name; scan_c_file ($_); } + elsif (/\.(ll|lpp)(\.in)?$/) + { + used 'program', 'flex', $File::Find::name; + scan_c_file ($_); + } + elsif (/\.(yy|ypp)(\.in)?$/) + { + used 'program', 'bison', $File::Find::name; + scan_c_file ($_); + } elsif ((/^((?:GNUm|M|m)akefile)(\.in)?$/ && ! -f "$1.am") || /^(?:GNUm|M|m)akefile(\.am)?$/) { @@ -483,6 +541,8 @@ print $file "\n# Checks for libraries.\n"; foreach my $word (sort keys %{$used{'library'}}) { + push (@{$needed_macros{"$generic_macro{'library'}([$word])"}}, + @{$used{'library'}{$word}}); print $file "# FIXME: Replace `main' with a function in `-l$word':\n"; print $file "AC_CHECK_LIB([$word], [main])\n"; } @@ -504,14 +564,17 @@ "# Process this file with autoconf to produce a configure script.\n" . "\n" . "AC_PREREQ(@VERSION@)\n" . - "AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)\n"); + "AC_INIT($full_package_name, $package_version, $bug_report_address)\n" . + "AC_CANONICAL_SYSTEM\n"); if (defined $cfiles[0]) { print $file "AC_CONFIG_SRCDIR([$cfiles[0]])\n"; print $file "AC_CONFIG_HEADER([config.h])\n"; } + print $file "AM_INIT_AUTOMAKE($full_package_name, $package_version)\n"; output_kind ($file, 'program'); + output_kind ($file, 'libtool'); output_kind ($file, 'makevar'); output_libraries ($file); output_kind ($file, 'header'); @@ -565,7 +628,7 @@ { chomp; my ($file, $line, $macro, @args) = split (/:/, $_); - if ($macro =~ /^AC_CHECK_(HEADER|FUNC|TYPE|MEMBER)S$/) + if ($macro =~ /^AC_CHECK_(HEADERS|FUNCS|TYPES|MEMBERS|LIB)$/) { # To be rigorous, we should distinguish between space and comma # separated macros. But there is no point. @@ -621,6 +684,10 @@ { check_configure_ac ($configure_ac); } + else + { + File::Copy::copy("configure.scan", "configure.ac"); + } # This close is really needed. For some reason, probably best named # a bug, it seems that the dtor of $LOG is not called automatically # at END. It results in a truncated file. diff -Naur autoconf-2.56/lib/autoscan/autoscan.pre autoconf-new/lib/autoscan/autoscan.pre --- autoconf-2.56/lib/autoscan/autoscan.pre Tue Nov 12 10:53:31 2002 +++ autoconf-new/lib/autoscan/autoscan.pre Fri Nov 29 13:27:29 2002 @@ -16,3 +16,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. +libtool: initautomake AM_INIT_AUTOMAKE(\$full_package_name, \$package_version) +libtool: enshared AC_ENABLE_SHARED +libtool: dishared AC_DISABLE_SHARED +libtool: enstatic AC_ENABLE_STATIC +libtool: distatic AC_DISABLE_STATIC +libtool: libtool AC_PROG_LIBTOOL +libtool: win32dll AC_LIBTOOL_WIN32_DLL