=== modified file 'sql/Makefile.am' --- old/sql/Makefile.am 2009-09-15 10:46:35 +0000 +++ new/sql/Makefile.am 2009-11-02 09:19:32 +0000 @@ -20,6 +20,7 @@ MYSQLBASEdir= $(prefix) MYSQLLIBdir= $(pkglibdir) pkgplugindir = $(pkglibdir)/plugin +globincldir = $(pkgincludedir)/mysql/$(VERSION) INCLUDES = @ZLIB_INCLUDES@ \ -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/regex -I$(srcdir) $(openssl_includes) \ @@ -29,6 +30,7 @@ libexec_PROGRAMS = mysqld EXTRA_PROGRAMS = gen_lex_hash bin_PROGRAMS = mysql_tzinfo_to_sql +globincl_HEADERS = mysql-glob.h noinst_LTLIBRARIES= libndb.la \ udf_example.la @@ -179,6 +181,12 @@ ./gen_lex_hash$(EXEEXT) > $@-t $(MV) $@-t $@ +mysql-glob.h: mysql_priv.h + $(CXXCPP) -x c++-header $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \ + -CC -dDI $^ | $(PERL) $(srcdir)/make-mysql-glob.pl > $@-t + $(MV) $@-t $@ + # For testing of udf_example.so udf_example_la_SOURCES= udf_example.c udf_example_la_LDFLAGS= -module -rpath $(pkglibdir) === added file 'sql/make-mysql-glob.pl' --- old/sql/make-mysql-glob.pl 1970-01-01 00:00:00 +0000 +++ new/sql/make-mysql-glob.pl 2009-11-02 09:39:43 +0000 @@ -0,0 +1,179 @@ +#!/usr/bin/perl + +use strict; + +my $current_file; +my $current_line; +my $current_path; + +my @command_line= (); + +my $until_file; +my $until_line; + +my $last_include; + +my $echo= \&echo_on; +my $echo_line; + +my $first_define; +my $define_suffix = sub { }; + +sub canon($) +{ + my ($path)= @_; + my $tmp= $path; + $tmp =~ s@/[^/]+/\.\./@/@; + return canon($tmp) if $tmp ne $path; + return $path; +} + +$first_define = sub { + my ($line) = @_; + if ($line =~ m/^#define\s+([^\s]+)/) + { + my ($e,$d)= ($echo, $1); + $first_define = sub { return 0; }; + &$e("#ifndef MYSQL_GLOB_H\n#define MYSQL_GLOB_H\n#ifdef $d\n#error cannot mix headers\n#endif\n$line\n"); + foreach (@command_line) + { + &$e($_); + } + + $define_suffix= sub + { + &$e("#endif /* MYSQL_GLOB_H / $d */\n"); + }; + + return 1; + } + return 0; +}; + +sub echo_on($) +{ + my ($line) = @_; + + return if &$first_define($line); + return if $line =~ m/^#define\s+SHOW_FUNC\s+/; + + print $echo_line if defined $echo_line; + print $line; + undef $echo_line; +} + +sub echo_off($) +{ + my ($line)= @_; + if (($current_file eq $until_file) && ($current_line == $until_line)) + { + $echo= \&echo_on; + undef $until_file; + undef $until_line; + undef $echo_line; + echo_on($line) if !($line =~ m/^# /); + } +} + +sub echo_cmdline($) +{ + my ($line)= @_; + push @command_line, $line if + ($current_file ne $until_file) || ($current_line != $until_line); + echo_off($line); +} + +sub test_builtin($$) +{ + ($until_line, $until_file)= @_ if !defined($until_file); + $echo= \&echo_off; + return 0; +} + +sub test_cmdline($$) +{ + ($until_line, $until_file)= @_ if !defined($until_file); + $echo= \&echo_cmdline; + return 0; +} + +sub test_incpath($$) +{ + if ($current_line == 1) + { + ($until_line, $until_file)= @_ if !defined($until_file); + if ($current_line == 1) + { + undef $echo_line; + &$echo($last_include); + $echo= \&echo_off; + } + } + return 0; +} + +while (<>) +{ + my ($last_line, $last_file)= ($current_line, $current_file); + my $test= sub { return 1; }; + + if (m/^# (\d+) "(.*)"/) + { + ($current_line, $current_file)= (int $1,$2); + + if ($current_file =~ m/\/$/) + { + $current_path= $`; + ($current_line, $current_file)= ($last_line,$last_file); + next; + } + + $echo_line= $_; + + $test= sub + { + my $saved_echo= $echo; + $echo= sub + { + my ($line)= @_; + $echo= $saved_echo; + echo_off($line); + }; + return 1; + }; + + $test= sub { return test_builtin($last_line, $last_file); } if + $current_file eq ''; + $test= sub { return test_cmdline($last_line, $last_file); } if + $current_file eq ''; + $test= sub { return test_incpath($last_line, $last_file); } if + $current_file =~ m/^\//; + + if (!($current_file =~ m/^\//)) + { + my $new_path= canon($current_path.$current_file); + $echo_line =~ s/"$current_file"/"$new_path"/; + } + $echo_line=~ s/^# /#line /; + + } + + if (m/^#include /) + { + $test= sub { + my $saved_echo= $echo; + $echo= sub { + ($last_include)= @_; + $echo= $saved_echo; + }; + return 1; + }; + } + + &$echo($_) if &$test(); + $current_line++; +} + +&$define_suffix(); + +exit 0;