The unified diff between revisions [8a2b79c6..] and [44833339..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'configure.pl'

#
#
# patch "configure.pl"
#  from [47c34d1c5e924c819aaf04bd3f0965f2d5c13121]
#    to [ddf8c9903adfd6d0b20a436b0bdeda99aba45cee]
#
============================================================
--- configure.pl	47c34d1c5e924c819aaf04bd3f0965f2d5c13121
+++ configure.pl	ddf8c9903adfd6d0b20a436b0bdeda99aba45cee
@@ -8,8 +8,8 @@ my $MAJOR_VERSION = 1;
 use File::Copy;

 my $MAJOR_VERSION = 1;
-my $MINOR_VERSION = 6;
-my $PATCH_VERSION = 2;
+my $MINOR_VERSION = 7;
+my $PATCH_VERSION = 0;

 my $VERSION_STRING = "$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION";

@@ -79,9 +79,22 @@ sub main {
     &$default_value_is('autoconfig', 1);
     &$default_value_is('debug', 0);
     &$default_value_is('shared', 'yes');
-    &$default_value_is('build-dir', 'build');
     &$default_value_is('local_config', '');

+    if(defined($$config{'build-dir'})) {
+        $$config{'botan-config'} = File::Spec->catfile($$config{'build-dir'}, 'botan-config');
+        $$config{'makefile'} = File::Spec->catfile($$config{'build-dir'}, 'Makefile');
+        $$config{'check_prefix'} = $$config{'build-dir'};
+        $$config{'lib_prefix'} = $$config{'build-dir'};
+    }
+    else { # defaults
+        $$config{'build-dir'} = 'build';
+        $$config{'botan-config'} = 'botan-config';
+        $$config{'makefile'} = 'Makefile';
+        $$config{'check_prefix'} = '';
+        $$config{'lib_prefix'} = '';
+    }
+
     choose_target($config, $target);

     my $os = $$config{'os'};
@@ -182,14 +195,12 @@ sub trace {
 sub trace {
     return unless $TRACING;

-    my (undef, undef, $line1) = caller(0);
-    my (undef, undef, $line2, $func1) = caller(1);
-    my (undef, undef, undef, $func2) = caller(2);
+    my (undef, undef, $line) = caller(0);
+    my (undef, undef, undef, $func) = caller(1);

-    $func1 =~ s/main:://;
-    $func2 =~ s/main:://;
+    $func =~ s/main:://;

-    warn with_diagnostic('trace', "at $func1:$line1 - ", @_);
+    warn with_diagnostic('trace', "at $func:$line - ", @_);
 }

 ##################################################
@@ -404,7 +415,7 @@ sub get_options {
                'prefix=s' => sub { &$save_option(@_); },
                'docdir=s' => sub { &$save_option(@_); },
                'libdir=s' => sub { &$save_option(@_); },
-               'build-dir=s' => sub { &$save_option('build', $_[0]); },
+               'build-dir=s' => sub { $$config{'build-dir'} = $_[1]; },
                'local-config=s' =>
                   sub { &$save_option('local_config', slurp_file($_[1])); },

@@ -413,8 +424,10 @@ sub get_options {
                'modules=s' => \@modules,
                'module-set=s' => \$module_set,

+               'trace' => sub { $TRACING = 1; },
                'debug' => sub { &$save_option($_[0], 1); },
                'disable-shared' => sub { $$config{'shared'} = 'no'; },
+
                'noauto' => sub { $$config{'autoconfig'} = 0; },
                'dumb-gcc|gcc295x' => sub { $$config{'gcc_bug'} = 1; }
                );
@@ -829,6 +842,9 @@ sub load_modules {

             push @defarray, split(/,/, $defs);
         }
+
+        $defines .= "\n" if(@defarray);
+
         foreach (sort @defarray) {
             die unless(defined $_ and $_ ne '');
             $defines .= "#define BOTAN_EXT_$_\n";
@@ -895,7 +911,7 @@ sub file_type {
     my ($config, $file) = @_;

     return ('sources', $$config{'src-dir'})
-        if($file =~ /\.cpp$/ or $file =~ /\.S$/);
+        if($file =~ /\.cpp$/ or $file =~ /\.c$/ or $file =~ /\.S$/);
     return ('includes', $$config{'include-dir'})
         if($file =~ /\.h$/);

@@ -1104,14 +1120,14 @@ sub get_module_info {

    my %info;
    $info{'name'} = $name;
-   $info{'external_libs'} = 0;
+   $info{'load_on'} = 'requeste'; # default unless specified
    $info{'libs'} = {};

    while($_ = &$reader()) {
        match_any_of($_, \%info, 'quoted', 'realname:note');
        match_any_of($_, \%info, 'unquoted', 'define:mp_bits');

-       $info{'external_libs'} = 1 if(/^uses_external_libs/);
+       $info{'load_on'} = $1 if(/^load_on: (.*)$/);

        read_list($_, $reader, 'arch', list_push(\@{$info{'arch'}}));
        read_list($_, $reader, 'cc', list_push(\@{$info{'cc'}}));
@@ -1262,13 +1278,15 @@ sub guess_mods {
     my $arch = $$config{'arch'};
     my $submodel = $$config{'submodel'};

+    my $asm_ok = ($$config{'debug'} == 0);
+
     my @usable_modules;

     foreach my $mod (sort keys %MODULES) {
         my %modinfo = %{ $MODULES{$mod} };

-        # If it uses external libs, the user has to request it specifically
-        next if($modinfo{'external_libs'});
+        next if($modinfo{'load_on'} eq 'request');
+        next if(!$asm_ok and $modinfo{'load_on'} eq 'asm_ok');

         my @cc_list = @{ $modinfo{'cc'} };
         next if(scalar @cc_list > 0 && !in_array($cc, \@cc_list));
@@ -1297,10 +1315,12 @@ sub write_pkg_config {

     $$config{'link_to'} = libs('-l', '', 'm', @{$$config{'mod_libs'}});

+    my $botan_config = $$config{'botan-config'};
+
     process_template(
        File::Spec->catfile($$config{'config-dir'}, 'botan-config.in'),
-       'botan-config', $config);
-    chmod 0755, 'botan-config';
+                     $botan_config, $config);
+    chmod 0755, $botan_config;

     delete $$config{'link_to'};
 }
@@ -1367,6 +1387,7 @@ sub build_cmds {
         my $obj_file = File::Spec->catfile($dir, $_);

         $obj_file =~ s/\.cpp$/.$obj_suffix/;
+        $obj_file =~ s/\.c$/.$obj_suffix/;
         $obj_file =~ s/\.S$/.$obj_suffix/;

         $output .= "$obj_file: $src_file\n$bld_line\n\n";
@@ -1505,7 +1526,7 @@ sub generate_makefile {
                             map_to($$config{'build_include_botan'},
                                    keys %{$$config{'includes'}}));

-   my $lib_objs = file_list($$config{'build_lib'}, '(\.cpp$|\.S$)',
+   my $lib_objs = file_list($$config{'build_lib'}, '(\.cpp$|\.c$|\.S$)',
                             '.' . $$config{'obj_suffix'},
                             %{$$config{'sources'}});

@@ -1562,7 +1583,7 @@ sub generate_makefile {

    trace("'$make_style' -> '$template'");

-   process_template($template, 'Makefile', $config);
+   process_template($template, $$config{'makefile'}, $config);
 }

 ##################################################