2002-04-02 05:56:13 -05:00
|
|
|
require 'mkmf'
|
2002-05-01 11:21:34 -04:00
|
|
|
|
|
|
|
begin # for the exception SystemExit
|
|
|
|
|
2002-04-02 05:56:13 -05:00
|
|
|
$:.unshift File.dirname(__FILE__)
|
|
|
|
require 'type'
|
|
|
|
|
|
|
|
if( ARGV.include?("--help") )
|
|
|
|
print <<EOF
|
|
|
|
--help print this messages
|
|
|
|
--with-type-char strictly use type 'char'
|
|
|
|
--with-type-short strictly use type 'short'
|
|
|
|
--with-type-float strictly use type 'float'
|
2002-06-09 13:47:34 -04:00
|
|
|
--with-args=<max_arg>
|
|
|
|
--with-callback=<max_callback>
|
2002-05-11 19:30:40 -04:00
|
|
|
--enable-asm use the embedded assembler for passing arguments.
|
|
|
|
(this option is available for i386 machine now.)
|
2002-05-20 05:38:23 -04:00
|
|
|
--enable-dlstack use a stack emulation for constructing function call.
|
2002-04-02 05:56:13 -05:00
|
|
|
EOF
|
|
|
|
exit(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
($CPPFLAGS || $CFLAGS) << " -I."
|
|
|
|
|
2002-04-03 06:59:01 -05:00
|
|
|
if (Config::CONFIG['CC'] =~ /gcc/) # from Win32API
|
2002-04-02 05:56:13 -05:00
|
|
|
$CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer"
|
|
|
|
end
|
|
|
|
|
|
|
|
if (Config::CONFIG['CC'] =~ /gcc/) && (Config::CONFIG['arch'] =~ /i.86/)
|
|
|
|
$with_asm = true
|
|
|
|
else
|
|
|
|
$with_asm = false
|
|
|
|
end
|
2002-05-20 05:38:23 -04:00
|
|
|
$with_dlstack = ! $with_asm
|
2002-04-02 05:56:13 -05:00
|
|
|
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:03:46 -04:00
|
|
|
$with_type_int = try_cpp(<<EOF)
|
|
|
|
#include "config.h"
|
|
|
|
#if SIZEOF_INT == SIZEOF_LONG
|
|
|
|
#error int not needed
|
|
|
|
#endif
|
2002-04-02 05:56:13 -05:00
|
|
|
EOF
|
|
|
|
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:03:46 -04:00
|
|
|
$with_type_float = try_cpp(<<EOF)
|
|
|
|
#include "config.h"
|
|
|
|
#if SIZEOF_FLOAT == SIZEOF_DOUBLE
|
|
|
|
#error float not needed
|
|
|
|
#endif
|
2002-04-02 05:56:13 -05:00
|
|
|
EOF
|
|
|
|
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:03:46 -04:00
|
|
|
$with_type_voidp = try_cpp(<<EOF)
|
|
|
|
#include "config.h"
|
|
|
|
#if SIZEOF_VOIDP == SIZEOF_INT || SIZEOF_VOIDP == SIZEOF_LONG
|
|
|
|
#error void* not needed
|
|
|
|
#endif
|
2002-04-02 05:56:13 -05:00
|
|
|
EOF
|
|
|
|
|
|
|
|
$with_type_char = DLTYPE[CHAR][:sym]
|
|
|
|
$with_type_short = DLTYPE[SHORT][:sym]
|
|
|
|
$with_type_long = DLTYPE[LONG][:sym]
|
|
|
|
$with_type_double= DLTYPE[DOUBLE][:sym]
|
|
|
|
$with_type_int &= DLTYPE[INT][:sym]
|
|
|
|
$with_type_float &= DLTYPE[FLOAT][:sym]
|
|
|
|
$with_type_voidp &= DLTYPE[VOIDP][:sym]
|
|
|
|
|
2002-04-03 06:59:01 -05:00
|
|
|
$with_type_char = enable_config("type-char", $with_type_char)
|
|
|
|
$with_type_short = enable_config("type-short", $with_type_short)
|
|
|
|
$with_type_float = enable_config("type-float", $with_type_float)
|
2002-04-02 05:56:13 -05:00
|
|
|
|
2002-04-03 06:59:01 -05:00
|
|
|
$with_asm = enable_config("asm", $with_asm)
|
2002-05-11 19:13:34 -04:00
|
|
|
$with_dlstack = enable_config("dlstack", $with_dlstack)
|
2002-04-02 05:56:13 -05:00
|
|
|
|
|
|
|
args = with_config("args")
|
2002-06-09 13:47:34 -04:00
|
|
|
max_arg = nil
|
2002-05-11 19:13:34 -04:00
|
|
|
if( $with_asm || $with_dlstack )
|
2002-04-02 05:56:13 -05:00
|
|
|
$with_type_char = true
|
|
|
|
$with_type_short = true
|
|
|
|
$with_type_float = true
|
|
|
|
max_arg = 0
|
|
|
|
end
|
|
|
|
if( args )
|
2002-06-09 13:47:34 -04:00
|
|
|
max_arg = args.to_i
|
|
|
|
if( !max_arg )
|
|
|
|
print("--with-args=<max_arg>\n")
|
2002-04-02 05:56:13 -05:00
|
|
|
exit(1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
max_arg ||= 6
|
|
|
|
|
2002-06-09 13:47:34 -04:00
|
|
|
max_callback = with_config("callback","10").to_i
|
|
|
|
callback_types = DLTYPE.keys.length
|
2002-04-02 05:56:13 -05:00
|
|
|
|
|
|
|
|
|
|
|
$dlconfig_h = <<EOF
|
2002-06-09 13:47:34 -04:00
|
|
|
#define MAX_ARG #{max_arg}
|
2002-04-02 05:56:13 -05:00
|
|
|
EOF
|
|
|
|
|
|
|
|
def dlc_define(const)
|
|
|
|
$dlconfig_h << "#if !defined(#{const})\n" +
|
|
|
|
"# define #{const}\n" +
|
|
|
|
"#endif\n"
|
|
|
|
end
|
|
|
|
|
2002-06-09 13:47:34 -04:00
|
|
|
$dlconfig_h << "#define MAX_CALLBACK #{max_callback}\n"
|
|
|
|
$dlconfig_h << "#define CALLBACK_TYPES #{callback_types}\n"
|
2002-05-11 19:13:34 -04:00
|
|
|
if( $with_dlstack )
|
|
|
|
$dlconfig_h << "#define USE_DLSTACK\n"
|
|
|
|
else
|
|
|
|
if( $with_asm )
|
|
|
|
$dlconfig_h << "#define USE_INLINE_ASM\n"
|
|
|
|
end
|
2002-04-02 05:56:13 -05:00
|
|
|
end
|
|
|
|
if( $with_type_char )
|
|
|
|
$dlconfig_h << "#define WITH_TYPE_CHAR\n"
|
|
|
|
end
|
|
|
|
if( $with_type_short )
|
|
|
|
$dlconfig_h << "#define WITH_TYPE_SHORT\n"
|
|
|
|
end
|
|
|
|
if( $with_type_long )
|
|
|
|
$dlconfig_h << "#define WITH_TYPE_LONG\n"
|
|
|
|
end
|
|
|
|
if( $with_type_double )
|
|
|
|
$dlconfig_h << "#define WITH_TYPE_DOUBLE\n"
|
|
|
|
end
|
|
|
|
if( $with_type_float )
|
|
|
|
$dlconfig_h << "#define WITH_TYPE_FLOAT\n"
|
|
|
|
end
|
|
|
|
if( $with_type_int )
|
|
|
|
$dlconfig_h << "#define WITH_TYPE_INT\n"
|
|
|
|
end
|
|
|
|
if( $with_type_voidp )
|
|
|
|
$dlconfig_h << "#define WITH_TYPE_VOIDP\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
if( have_header("dlfcn.h") )
|
|
|
|
dlc_define("HAVE_DLFCN_H")
|
|
|
|
have_library("dl")
|
|
|
|
have_func("dlopen")
|
|
|
|
have_func("dlclose")
|
|
|
|
have_func("dlsym")
|
|
|
|
if( have_func("dlerror") )
|
|
|
|
dlc_define("HAVE_DLERROR")
|
|
|
|
end
|
|
|
|
elsif( have_header("windows.h") )
|
|
|
|
dlc_define("HAVE_WINDOWS_H")
|
|
|
|
have_func("LoadLibrary")
|
|
|
|
have_func("FreeLibrary")
|
|
|
|
have_func("GetProcAddress")
|
|
|
|
else
|
|
|
|
exit(0)
|
|
|
|
end
|
|
|
|
|
|
|
|
def File.update(file, str)
|
|
|
|
begin
|
|
|
|
open(file){|f|f.read} == str
|
|
|
|
rescue Errno::ENOENT
|
|
|
|
false
|
|
|
|
end or open(file, "w"){|f|f.print(str)}
|
|
|
|
end
|
|
|
|
|
|
|
|
File.update("dlconfig.h", <<EOF)
|
|
|
|
#ifndef DLCONFIG_H
|
|
|
|
#define DLCONFIG_H
|
|
|
|
#{$dlconfig_h}
|
|
|
|
#endif /* DLCONFIG_H */
|
|
|
|
EOF
|
|
|
|
|
|
|
|
File.update("dlconfig.rb", <<EOF)
|
|
|
|
MAX_ARG = #{max_arg}
|
2002-06-09 13:47:34 -04:00
|
|
|
MAX_CALLBACK = #{max_callback}
|
|
|
|
CALLBACK_TYPES = #{callback_types}
|
2002-04-02 05:56:13 -05:00
|
|
|
DLTYPE[CHAR][:sym] = #{$with_type_char}
|
|
|
|
DLTYPE[SHORT][:sym] = #{$with_type_short}
|
|
|
|
DLTYPE[INT][:sym] = #{$with_type_int}
|
|
|
|
DLTYPE[LONG][:sym] = #{$with_type_long}
|
|
|
|
DLTYPE[FLOAT][:sym] = #{$with_type_float}
|
|
|
|
DLTYPE[DOUBLE][:sym]= #{$with_type_double}
|
|
|
|
DLTYPE[VOIDP][:sym] = #{$with_type_voidp}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
$INSTALLFILES = [
|
|
|
|
["./dlconfig.h", "$(archdir)$(target_prefix)", "."],
|
|
|
|
["dl.h", "$(archdir)$(target_prefix)", ""],
|
|
|
|
]
|
|
|
|
|
|
|
|
create_makefile('dl')
|
2002-05-01 11:21:34 -04:00
|
|
|
rescue SystemExit
|
|
|
|
# do nothing
|
|
|
|
end
|