cvsuser 05/04/05 01:34:24
Modified: . Configure.pl
config/gen config_h.pl icu.pl makefiles.pl
config/gen/config_h config_h.in
config/gen/makefiles dynclasses_pl.in root.in
lib/Parrot Test.pm
src string.c string_primitives.c
Log:
Configure --without-icu
Courtesy of Jens Rieks <[EMAIL PROTECTED]>
Revision Changes Path
1.151 +3 -2 parrot/Configure.pl
Index: Configure.pl
===================================================================
RCS file: /cvs/public/parrot/Configure.pl,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -r1.150 -r1.151
--- Configure.pl 17 Jan 2005 14:01:58 -0000 1.150
+++ Configure.pl 5 Apr 2005 08:34:19 -0000 1.151
@@ -359,6 +359,7 @@
If you do not have a full ICU installation:
+ --without-icu Build parrot without ICU support
--icuheaders=(path) Location of ICU headers without /unicode
--icushared=(flags) Full linker command to create shared libraries
--icudatadir=(path) Directory to locate ICU's data file(s)
1.15 +3 -2 parrot/config/gen/config_h.pl
Index: config_h.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/config_h.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- config_h.pl 8 Mar 2005 22:52:07 -0000 1.14
+++ config_h.pl 5 Apr 2005 08:34:20 -0000 1.15
@@ -30,7 +30,8 @@
genfile('config/gen/config_h/config_h.in', 'include/parrot/config.h',
commentType => '/*',
- ignorePattern => 'PARROT_CONFIG_DATE');
+ ignorePattern => 'PARROT_CONFIG_DATE',
+ conditioned_lines => 1);
genfile('config/gen/config_h/feature_h.in', 'include/parrot/feature.h',
commentType => '/*',
1.26 +27 -22 parrot/config/gen/icu.pl
Index: icu.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/icu.pl,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- icu.pl 8 Mar 2005 22:52:07 -0000 1.25
+++ icu.pl 5 Apr 2005 08:34:20 -0000 1.26
@@ -20,11 +20,11 @@
$description="Configuring ICU if requested...";
@args=qw(buildicu verbose icudatadir icuplatform icuconfigureargs
- icushared icuheaders icu-config);
+ icushared icuheaders icu-config without-icu);
sub runstep {
my ($buildicu, $verbose, $icudatadir, $icuplatform, $icuconfigureargs,
- $icushared, $icuheaders, $icuconfig) = @_;
+ $icushared, $icuheaders, $icuconfig, $without) = @_;
my $icu_configure_command;
my @icu_headers = qw(ucnv.h utypes.h uchar.h);
my $autodetect = !defined($icudatadir)
@@ -33,29 +33,37 @@
&& !defined($icuheaders);
print "\n" if $verbose;
+ Configure::Data->set(
+ has_icu => ($without ? 0 : 1),
+ TEMP_icu_make => ""
+ );
+ if ($without) {
+ print "not using icu.\n" if $verbose;
+ return 0;
+ }
if (!$autodetect) {
print "specified a icu config parameter,\nICU autodetection disabled.\n"
if $verbose;
} elsif (!defined $icuconfig || !$icuconfig) {
my $notfound = 1;
-
+
{
# disable STDERR
open OLDERR, ">&STDERR";
open STDERR, ">d8e622ad2.log";
-
+
# check if ICU is installed
system("icu-config", "--exists");
$notfound = ($? == -1);
$notfound ||= ($? >> 8) != 0;
-
+
# reenable STDERR
close STDERR;
unlink "d8e622ad2.log";
open STDERR, ">&OLDERR";
}
-
+
if ($notfound) {
undef $icuconfig;
print "icu-config not found.\n" if $verbose;
@@ -70,7 +78,7 @@
# icu-config script to use
$icuconfig = "icu-config" if $icuconfig eq "1";
-
+
# ldflags
$icushared = `$icuconfig --ldflags`;
chomp $icushared;
@@ -81,7 +89,7 @@
$icuheaders = `$icuconfig --prefix`;
chomp $icuheaders;
$icuheaders .= "${slash}include";
-
+
# icu data dir
$icudatadir = `$icuconfig --icudatadir`;
chomp $icudatadir;
@@ -93,7 +101,7 @@
print "headers='$icuheaders'\n" if defined $icuheaders;
print "datadir='$icudatadir'\n" if defined $icudatadir;
}
-
+
if (defined($icushared) && defined($icuheaders)) {
$icuheaders =~ s![\\/]$!!;
my $c_libs = Configure::Data->get('libs');
@@ -114,15 +122,12 @@
if( !defined $icudatadir )
{
- # XXX Hack: We need some way to tell parrot where to find the
- # ICU data files, perhaps with a command-line option something
- # like perl's -I option. In the absence of any such option,
- # this absolute setting at least allows you to run parrot from
- # within various subdirectories, such as ./t or ./languages,
- # without having to set any environment variables.
- # If parrot is ever able to be installed, this will have to change!
- my $cwd = cwd();
- $icudatadir = "$cwd/blib/lib/icu/2.6.1";
+ Configure::Data->set(
+ has_icu => 0,
+ TEMP_icu_make => ""
+ );
+ print "not using icu.\n" if $verbose;
+ return 0;
}
if( defined $icuplatform )
@@ -187,7 +192,7 @@
print DSPFILE $file;
close DSPFILE;
}
-
+
# Set up makefile entries.
Configure::Data->set(
buildicu => 1,
@@ -215,7 +220,7 @@
msdev icu\source\allinone\allinone.dsw /MAKE "stubdata - Win32 Debug"
msdev icu\source\allinone\allinone.dsw /MAKE "common - Win32 Debug"
msdev icu\source\allinone\allinone.dsw /MAKE "i18n - Win32 Debug"
- xcopy /S /Y "icu\source\common" "icu\include\"
+ xcopy /S /Y "icu\source\common" "icu\include\"
msdev icu\source\allinone\allinone.dsw /MAKE "ctestfw - Win32 Debug"
msdev icu\source\allinone\allinone.dsw /MAKE "decmn - Win32 Debug"
msdev icu\source\allinone\allinone.dsw /MAKE "gencmn - Win32 Debug"
@@ -259,7 +264,7 @@
# Default to a configure line suggested by icu/README.parrot
$icuconfigureargs = "--disable-layout --disable-tests
--disable-samples --quiet '--prefix=$cwd/blib' --enable-static --disable-shared
--disable-extras '--oldincludedir=$cwd/blib/old' --with-data-packaging=archive";
}
-
+
Configure::Data->set(
buildicu => 1,
icu_headers => 'blib/include/unicode/ucnv.h
blib/include/unicode/utypes.h blib/include/unicode/uchar.h',
1.44 +2 -2 parrot/config/gen/makefiles.pl
Index: makefiles.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles.pl,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- makefiles.pl 16 Mar 2005 22:09:04 -0000 1.43
+++ makefiles.pl 5 Apr 2005 08:34:20 -0000 1.44
@@ -81,7 +81,7 @@
genfile('config/gen/makefiles/dynclasses.in', 'dynclasses/Makefile',
commentType => '#', replace_slashes => 1, conditioned_lines => 1);
genfile('config/gen/makefiles/dynclasses_pl.in', 'dynclasses/build.pl',
- commentType => '#', replace_slashes => 0);
+ commentType => '#', replace_slashes => 0, conditioned_lines => 1);
genfile('config/gen/makefiles/dynoplibs.in', 'dynoplibs/Makefile',
commentType => '#', replace_slashes => 1);
genfile('config/gen/makefiles/parrot_compiler.in',
'languages/parrot_compiler/Makefile',
1.28 +3 -2 parrot/config/gen/config_h/config_h.in
Index: config_h.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/config_h/config_h.in,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- config_h.in 23 Mar 2005 21:28:06 -0000 1.27
+++ config_h.in 5 Apr 2005 08:34:21 -0000 1.28
@@ -134,7 +134,8 @@
#define PARROT_CORE_CG_OPLIB_INIT
Parrot_DynOp_core_cg_${MAJOR}_${MINOR}_${PATCH}
#define PARROT_CORE_CGP_OPLIB_INIT
Parrot_DynOp_core_cgp_${MAJOR}_${MINOR}_${PATCH}
-#define DEFAULT_ICU_DATA_DIR "${icudatadir}"
+#define PARROT_HAS_ICU ${has_icu}
+#CONDITIONED_LINE(has_icu):#define DEFAULT_ICU_DATA_DIR "${icudatadir}"
#define INTVAL_FMT "${intvalfmt}"
#define FLOATVAL_FMT "${floatvalfmt}"
1.13 +4 -3 parrot/config/gen/makefiles/dynclasses_pl.in
Index: dynclasses_pl.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynclasses_pl.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- dynclasses_pl.in 21 Feb 2005 10:54:39 -0000 1.12
+++ dynclasses_pl.in 5 Apr 2005 08:34:22 -0000 1.13
@@ -40,8 +40,9 @@
$PATHQUOTE = '"';
# Also need various libraries in the link line.
- my $extraLibs = '${blib_lib_libparrot_a} ${blib_lib_libsicuuc_a} ' .
- '${blib_lib_libsicudata_a} ${libs}';
+ my $extraLibs = '${blib_lib_libparrot_a} '.
+#CONDITIONED_LINE(has_icu): '${blib_lib_libsicuuc_a}
${blib_lib_libsicudata_a} ' .
+ '${libs}';
$extraLibs =~ s/blib/..\\blib/g;
$extraLibs =~ s/\Q$(A)\E/.lib/g;
$LD_LOAD_FLAGS =~ s/(-def:)/$extraLibs $1..\\/;
1.290 +6 -5 parrot/config/gen/makefiles/root.in
Index: root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.289
retrieving revision 1.290
diff -u -r1.289 -r1.290
--- root.in 4 Apr 2005 20:03:45 -0000 1.289
+++ root.in 5 Apr 2005 08:34:22 -0000 1.290
@@ -318,7 +318,7 @@
# generated list of header files
GENERAL_H_FILES = $(NONGEN_HEADERS) $(GEN_HEADERS) ${TEMP_cg_h}
-ICU_H_FILES = ${icu_headers}
+#CONDITIONED_LINE(has_icu):ICU_H_FILES = ${icu_headers}
ALL_H_FILES = $(GENERAL_H_FILES)
CHARSET_O_FILES = ${TEMP_charset_o}
@@ -439,9 +439,10 @@
# libs
LIBPARROT = ${blib_lib_libparrot_a}
-LIBICUCORE = ${blib_lib_libsicuuc_a}
-LIBICUDATA = ${blib_lib_libsicudata_a}
-ALL_PARROT_LIBS = $(LIBPARROT) $(LIBICUCORE) $(LIBICUDATA) $(C_LIBS)
+#CONDITIONED_LINE(has_icu):LIBICUCORE = ${blib_lib_libsicuuc_a}
+#CONDITIONED_LINE(has_icu):LIBICUDATA = ${blib_lib_libsicudata_a}
+#CONDITIONED_LINE(has_icu):ALL_PARROT_LIBS = $(LIBPARROT) $(LIBICUCORE)
$(LIBICUDATA) $(C_LIBS)
+#INVERSE_CONDITIONED_LINE(has_icu):ALL_PARROT_LIBS = $(LIBPARROT) $(C_LIBS)
# dynamic extensions
DYNEXT_DIR = runtime/parrot/dynext
1.68 +35 -21 parrot/lib/Parrot/Test.pm
Index: Test.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Test.pm,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- Test.pm 31 Mar 2005 12:20:52 -0000 1.67
+++ Test.pm 5 Apr 2005 08:34:23 -0000 1.68
@@ -251,7 +251,7 @@
my ($package, $code_generator) = @_;
my $path_to_parrot = $INC{"Parrot/Config.pm"};
- $path_to_parrot =~ s:lib/Parrot/Config.pm$::;
+ $path_to_parrot =~ s:lib/Parrot/Config.pm$::;
$path_to_parrot = File::Spec->curdir() if $path_to_parrot eq "";
my $parrot = File::Spec->join(File::Spec->curdir(), 'parrot' .
$PConfig{exe});
@@ -358,7 +358,7 @@
}
my $meth = $parrot_test_map{$func};
- my $real_output = slurp_file($out_f);
+ my $real_output = slurp_file($out_f);
if ( $func =~ /^pir_2_pasm_/ ) {
# The parrot open '--outfile=file.pasm' seems to create
unnecessare whitespace
$real_output =~ s/^\s*$//gm;
@@ -380,7 +380,7 @@
}
return $pass;
- }
+ }
}
my %languages_test_map = (
@@ -395,13 +395,13 @@
*{$package.'::'.$func} = sub ($$$;$) {
my $language = $_[0];
$language = ucfirst($language) unless ( $language eq 'm4' );
-
+
# make sure TODO will work, by telling Test::Builder which
package
# the .t file is in (one more than usual, due to the extra layer
# of package indirection
my $level = $builder->level();
$builder->level(2);
-
+
# get modified parrot command.
require "Parrot/Test/$language.pm";
# set the builder object, and parrot config.
@@ -423,13 +423,13 @@
foreach my $func ( keys %c_test_map ) {
no strict 'refs';
-
+
*{$package.'::'.$func} = sub ($$;$ ) {
my($source, $expected, $desc) = @_;
# $test_no will be part of temporary file
my $test_no = $builder->current_test() + 1;
-
+
$expected =~ s/\cM\cJ/\n/g;
local( *SOURCE );
my $source_f = per_test('.c', $test_no);
@@ -447,7 +447,7 @@
(my $libparrot_root = $PConfig{blib_lib_libparrot_a}) =~
s/\$\(A\)//;
my $libparrot_dynamic = $libparrot_root.$PConfig{share_ext};
-
+
my $libparrot;
# use shared library version if available
@@ -457,29 +457,43 @@
$libparrot = $libparrot_root.$PConfig{a};
}
- my $iculibs = $PConfig{blib_lib_libsicuuc_a}."
".$PConfig{blib_lib_libsicudata_a};
- $iculibs =~ s/\$\(A\)/$PConfig{a}/g;
+ my $iculibs = "";
+ if ($PConfig{'has_icu'}) {
+ $iculibs = $PConfig{blib_lib_libsicuuc_a} . " " .
+ $PConfig{blib_lib_libsicudata_a};
+ $iculibs =~ s/\$\(A\)/$PConfig{a}/g;
+ }
my ($cmd, $exit_code);
- $cmd = "$PConfig{cc} $PConfig{ccflags} $PConfig{cc_debug}
-I./include -c " .
- "$PConfig{cc_o_out}$obj_f $source_f";
- $exit_code = _run_command($cmd, 'STDOUT' => $build_f, 'STDERR'
=> $build_f);
- $builder->diag("'$cmd' failed with exit code $exit_code") if
$exit_code;
+ $cmd = "$PConfig{cc} $PConfig{ccflags} $PConfig{cc_debug} " .
+ " -I./include -c " .
+ "$PConfig{cc_o_out}$obj_f $source_f";
+ $exit_code = _run_command($cmd,
+ 'STDOUT' => $build_f,
+ 'STDERR' => $build_f);
+ $builder->diag("'$cmd' failed with exit code $exit_code")
+ if $exit_code;
if (! -e $obj_f) {
- $builder->diag("Failed to build '$obj_f': " .
slurp_file($build_f));
+ $builder->diag("Failed to build '$obj_f': " .
+ slurp_file($build_f));
unlink $build_f;
$builder->ok(0,$desc);
return 0;
}
- $cmd = "$PConfig{link} $PConfig{linkflags} $PConfig{ld_debug}
$obj_f " .
- "$PConfig{ld_out}$exe_f $libparrot $iculibs $PConfig{libs}";
- $exit_code = _run_command($cmd, 'STDOUT' => $build_f, 'STDERR'
=> $build_f);
- $builder->diag("'$cmd' failed with exit code $exit_code") if
$exit_code;
+ $cmd = "$PConfig{link} $PConfig{linkflags} $PConfig{ld_debug} " .
+ "$obj_f $PConfig{ld_out}$exe_f " .
+ "$libparrot $iculibs $PConfig{libs}";
+ $exit_code = _run_command($cmd,
+ 'STDOUT' => $build_f,
+ 'STDERR' => $build_f);
+ $builder->diag("'$cmd' failed with exit code $exit_code")
+ if $exit_code;
if (! -e $exe_f) {
- $builder->diag("Failed to build '$exe_f': " .
slurp_file($build_f));
+ $builder->diag("Failed to build '$exe_f': " .
+ slurp_file($build_f));
unlink $build_f;
$builder->ok(0,$desc);
1.246 +3 -2 parrot/src/string.c
Index: string.c
===================================================================
RCS file: /cvs/public/parrot/src/string.c,v
retrieving revision 1.245
retrieving revision 1.246
diff -u -r1.245 -r1.246
--- string.c 4 Apr 2005 19:16:52 -0000 1.245
+++ string.c 5 Apr 2005 08:34:24 -0000 1.246
@@ -286,7 +286,7 @@
*/
Parrot_charsets_encodings_init(interpreter);
-
+#if PARROT_HAS_ICU
/* DEFAULT_ICU_DATA_DIR is configured at build time, or it may be
set through the $PARROT_ICU_DATA_DIR environment variable. Need
a way to specify this via the command line as well. */
@@ -315,6 +315,7 @@
no_set:
if (free_data_dir)
mem_sys_free(const_cast(data_dir));
+#endif
}
/*
1.13 +69 -1 parrot/src/string_primitives.c
Index: string_primitives.c
===================================================================
RCS file: /cvs/public/parrot/src/string_primitives.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- string_primitives.c 2 Mar 2005 15:32:59 -0000 1.12
+++ string_primitives.c 5 Apr 2005 08:34:24 -0000 1.13
@@ -20,10 +20,14 @@
*/
#include "parrot/parrot.h"
+#if PARROT_HAS_ICU
#include <unicode/ucnv.h>
#include <unicode/utypes.h>
#include <unicode/uchar.h>
#include <unicode/ustring.h>
+#else
+#include <ctype.h>
+#endif
#include <assert.h>
/*
@@ -41,6 +45,7 @@
void
string_set_data_directory(const char *dir)
{
+#if PARROT_HAS_ICU
u_setDataDirectory(dir);
/* Since u_setDataDirectory doesn't have a result code, we'll spot
@@ -54,6 +59,10 @@
"string_set_data_directory: ICU data files not found"
"(apparently) for directory [%s]", dir);
}
+#else
+ internal_exception(ICU_ERROR,
+ "string_set_data_directory: parrot compiled without ICU support" );
+#endif
}
/*
@@ -73,6 +82,7 @@
string_fill_from_buffer(Interp *interpreter, const void *buffer,
UINTVAL len, const char *encoding_name, STRING *s)
{
+#if PARROT_HAS_ICU
UErrorCode icuError = U_ZERO_ERROR;
UConverter *conv = NULL;
UChar *target = NULL;
@@ -140,6 +150,10 @@
/* temporary; need to promote to rep 4 if has non-BMP characters*/
s->bufused = (char *)target - (char *)s->strstart;
string_compute_strlen(interpreter, s);
+#else
+ internal_exception(ICU_ERROR,
+ "string_fill_from_buffer: parrot compiled without ICU support" );
+#endif
}
@@ -360,7 +374,13 @@
UINTVAL
Parrot_char_digit_value(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_charDigitValue(character);
+#else
+ if ((character >= 0x30) || (character <= 0x39))
+ return character - 0x30;
+ return -1;
+#endif
}
/*
@@ -377,7 +397,11 @@
INTVAL
Parrot_char_is_alnum(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isalnum(character);
+#else
+ return isalnum(character);
+#endif
}
/*
@@ -394,7 +418,11 @@
INTVAL
Parrot_char_is_alpha(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isalpha(character);
+#else
+ return isalpha(character);
+#endif
}
/*
@@ -429,7 +457,11 @@
INTVAL
Parrot_char_is_blank(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isblank(character);
+#else
+ return character == 0x20;
+#endif
}
/*
@@ -446,7 +478,11 @@
INTVAL
Parrot_char_is_cntrl(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_iscntrl(character);
+#else
+ return iscntrl(character);
+#endif
}
/*
@@ -463,7 +499,11 @@
INTVAL
Parrot_char_is_digit(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isdigit(character);
+#else
+ return isdigit(character);
+#endif
}
/*
@@ -481,7 +521,11 @@
INTVAL
Parrot_char_is_graph(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isgraph(character);
+#else
+ return isgraph(character);
+#endif
}
/*
@@ -498,7 +542,11 @@
INTVAL
Parrot_char_is_lower(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_islower(character);
+#else
+ return islower(character);
+#endif
}
/*
@@ -515,7 +563,11 @@
INTVAL
Parrot_char_is_print(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isprint(character);
+#else
+ return isprint(character);
+#endif
}
/*
@@ -532,7 +584,11 @@
INTVAL
Parrot_char_is_punct(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_ispunct(character);
+#else
+ return ispunct(character);
+#endif
}
/*
@@ -549,7 +605,11 @@
INTVAL
Parrot_char_is_space(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isspace(character);
+#else
+ return isspace(character);
+#endif
}
/*
@@ -566,7 +626,11 @@
INTVAL
Parrot_char_is_upper(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isupper(character);
+#else
+ return isupper(character);
+#endif
}
/*
@@ -583,7 +647,11 @@
INTVAL
Parrot_char_is_xdigit(Interp *interpreter, UINTVAL character)
{
+#if PARROT_HAS_ICU
return u_isxdigit(character);
+#else
+ return isxdigit(character);
+#endif
}
/*