Author: leo
Date: Thu Feb 16 16:52:37 2006
New Revision: 11607

Added:
   trunk/config/auto/readline/
   trunk/config/auto/readline.pm   (contents, props changed)
   trunk/config/auto/readline/readline.in
Modified:
   trunk/Configure.pl
   trunk/MANIFEST
Log:
add a config test for libreadline - untested so far (readline.h missing on this 
machine)

Modified: trunk/Configure.pl
==============================================================================
--- trunk/Configure.pl  (original)
+++ trunk/Configure.pl  Thu Feb 16 16:52:37 2006
@@ -423,6 +423,7 @@ my @steps = qw(
     auto::env
     auto::aio
     auto::gmp
+    auto::readline
     auto::gdbm
     auto::snprintf
     auto::perldoc

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Thu Feb 16 16:52:37 2006
@@ -126,6 +126,8 @@ config/auto/msvc/test_c.in              
 config/auto/pack.pm                               []
 config/auto/perldoc.pm                            []
 config/auto/python.pm                             []
+config/auto/readline.pm                           []
+config/auto/readline/readline.in                  []
 config/auto/signal.pm                             []
 config/auto/signal/test_1.in                      []
 config/auto/signal/test_2.in                      []

Added: trunk/config/auto/readline.pm
==============================================================================
--- (empty file)
+++ trunk/config/auto/readline.pm       Thu Feb 16 16:52:37 2006
@@ -0,0 +1,91 @@
+# Copyright: 2001-2004 The Perl Foundation.  All Rights Reserved.
+# $Id$
+
+=head1 NAME
+
+config/auto/readline.pm - Test for readline lib
+
+=head1 DESCRIPTION
+
+Determines whether the platform supports readline.
+
+=cut
+
+package auto::readline;
+
+use strict;
+use vars qw($description $result @args);
+
+use base qw(Parrot::Configure::Step::Base);
+
+use Config;
+use Parrot::Configure::Step ':auto';
+
+$description = "Determining if your platform supports readline...";
+
[EMAIL PROTECTED] = qw(verbose);
+
+sub runstep
+{
+    my ($self, $conf) = @_;
+
+    my $verbose = $conf->options->get('verbose');
+
+    my $cc        = $conf->data->get('cc');
+    my $libs      = $conf->data->get('libs');
+    my $linkflags = $conf->data->get('linkflags');
+    my $ccflags   = $conf->data->get('ccflags');
+    if ($^O =~ /mswin32/i) {
+        if ($cc =~ /^gcc/i) {
+            $conf->data->add(' ', libs => '-lreadline');
+        } else {
+            $conf->data->add(' ', libs => 'readline.lib');
+        }
+    } else {
+        $conf->data->add(' ', libs => '-lreadline');
+    }
+
+    my $archname = $Config{archname};
+    my ($cpuarch, $osname) = split('-', $archname);
+    if (!defined $osname) {
+        ($osname, $cpuarch) = ($cpuarch, "");
+    }
+
+    # On OS X check the presence of the readline header in the standard
+    # Fink location. TODO: Need a more generalized way for finding
+    # where Fink lives.
+    if ($osname =~ /darwin/) {
+        if (-f "/sw/include/readline.h") {
+            $conf->data->add(' ', linkflags => '-L/sw/lib');
+            $conf->data->add(' ', ldflags   => '-L/sw/lib');
+            $conf->data->add(' ', ccflags   => '-I/sw/include');
+        }
+    }
+
+    cc_gen('config/auto/readline/readline.in');
+    eval { cc_build(); };
+    my $has_readline = 0;
+    if (!$@) {
+       $has_readline = 1;
+       print " (yes) " if $verbose;
+       $self->set_result('yes');
+
+       $conf->data->set(
+           readline     => 'define',
+           HAS_READLINE => $has_readline,
+       );
+    }
+    unless ($has_readline) {
+
+        # The Config::Data settings might have changed for the test
+        $conf->data->set('libs',      $libs);
+        $conf->data->set('ccflags',   $ccflags);
+        $conf->data->set('linkflags', $linkflags);
+        print " (no) " if $verbose;
+        $self->set_result('no');
+    }
+
+    return $self;
+}
+
+1;

Added: trunk/config/auto/readline/readline.in
==============================================================================
--- (empty file)
+++ trunk/config/auto/readline/readline.in      Thu Feb 16 16:52:37 2006
@@ -0,0 +1,13 @@
+/* Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved. */
+/* $Id: readline.in 7858 2005-04-17 17:08:45Z boemmels $ */
+
+#include <stdio.h>
+#include <readline/readline.h>
+#include <readline/history.h>
+
+int main(int argc, char *argv[])
+{
+
+    char * r = readline ("hello polly>");
+    return 0;
+}

Reply via email to