try_compile_run
$success = try_compile_run(%args);
Try to compile, link, and execute a C program whose source is given. Returns true if the program compiled
and linked, and exited successfully. Returns false if any of these steps fail.
Takes the following named arguments:
source => STRING
The source code of the C program to try compiling, building, and running.
defines => HASH
Optional. A set of defines to be passed to the compiler.
extra_compiler_flags => ARRAY
Optional. If specified, pass extra flags to the compiler.
extra_linker_flags => ARRAY
Optional. If specified, pass extra flags to the linker.
include_dirs => ARRAY
Optional. If specified, pass extra include dirs to the compiler.
libraries => ARRAY
Optional. If specified, pass extra libaries to the linker.
library_dirs => ARRAY
Optional. If specified, pass extra libary directories to the linker.
quiet => BOOL
This makes "try_compile_run" run quietly.
define => STRING
Optional. If specified, then the named symbol will be defined if the program ran successfully. This
will either on the C compiler commandline (by passing an option "-DSYMBOL"), in the "defines" method,
or via the "write_defines" method.
push_args => BOOL
If true, any of "extra_compiler_flags", "extra_linker_flags", "include_dirs", "libraries",
"library_dirs" or "defines" will have its value pushed on success (e.g. "push_include_dirs" for the
"include_dirs" argument).
assert_compile_run
assert_compile_run(%args);
Calls "try_compile_run". If it fails, die with an "OS unsupported" message. Useful to call from Build.PL
or Makefile.PL.
Takes one extra optional argument:
diag => STRING
If present, this string will be appended to the failure message if one is generated. It may provide
more useful information to the user on why the OS is unsupported.
try_find_cflags_for
$success = try_find_cflags_for(%args);
Try to compile, link and execute the given source, using extra compiler flags.
When a usable combination is found, the flags are stored in the object for use in further compile
operations, or returned by "extra_compiler_flags". The method then returns true.
If no usable combination is found, it returns false.
Takes the following extra arguments:
source => STRING
Source code to compile
cflags => ARRAY of ARRAYs
Gives a list of sets of flags. Each set of flags should be strings in its own array reference.
define => STRING
Optional. If specified, then the named symbol will be defined if the program ran successfully. This
will either on the C compiler commandline (by passing an option "-DSYMBOL"), in the "defines" method,
or via the "write_defines" method.
try_find_include_dirs_for
$success = try_find_include_dirs_for(%args);
Try to compile, link and execute the given source, using extra include directories.
When a usable combination is found, the directories required are stored in the object for use in further
compile operations, or returned by "include_dirs". The method then returns true.
If no a usable combination is found, it returns false.
Takes the following arguments:
source => STRING
Source code to compile
dirs => ARRAY of ARRAYs
Gives a list of sets of dirs. Each set of dirs should be strings in its own array reference.
define => STRING
Optional. If specified, then the named symbol will be defined if the program ran successfully. This
will either on the C compiler commandline (by passing an option "-DSYMBOL"), in the "defines" method,
or via the "write_defines" method.
try_find_libraries_for
$success = try_find_libraries_for(%args);
Try to compile, link and execute the given source, when linked against a given set of extra libraries.
When a usable combination is found, the libraries required are stored in the object for use in further
link operations, or returned by "libraries". The method then returns true.
If no usable combination is found, it returns false.
Takes the following arguments:
source => STRING
Source code to compile
libs => ARRAY of STRINGs
Gives a list of sets of libraries. Each set of libraries should be space-separated.
define => STRING
Optional. If specified, then the named symbol will be defined if the program ran successfully. This
will either on the C compiler commandline (by passing an option "-DSYMBOL"), in the "defines" method,
or via the "write_defines" method.
try_find_library_dirs_for
$success = try_find_library_dirs_for(%args);
Try to compile, link and execute the given source, using extra library directories.
When a usable combination is found, the directories required are stored in the object for use in further
compile operations, or returned by "library_dirs". The method then returns true.
If no a usable combination is found, it returns false.
Takes the following arguments:
source => STRING
Source code to compile
dirs => ARRAY of ARRAYs
Gives a list of sets of dirs. Each set of dirs should be strings in its own array reference.
define => STRING
Optional. If specified, then the named symbol will be defined if the program ran successfully. This
will either on the C compiler commandline (by passing an option "-DSYMBOL"), in the "defines" method,
or via the "write_defines" method.
find_cflags_for
find_cflags_for(%args);
find_include_dirs_for
find_include_dirs_for(%args);
find_libraries_for
find_libraries_for(%args);
Calls "try_find_cflags_for", "try_find_include_dirs_for" or "try_find_libraries_for" respectively. If it
fails, die with an "OS unsupported" message.
Each method takes one extra optional argument:
diag => STRING
If present, this string will be appended to the failure message if one is generated. It may provide
more useful information to the user on why the OS is unsupported.
include_dirs
$dirs = include_dirs;
Returns the currently-configured include directories as an array.
library_dirs
$dirs = library_dirs;
Returns the currently-configured library directories as an array.
libraries
$libs = libraries;
Returns the currently-configured libraries as an array.
extra_compiler_flags
$flags = extra_compiler_flags;
Returns the currently-configured extra compiler flags as an array.
extra_linker_flags
$flags = extra_linker_flags;
Returns the currently-configured extra linker flags as an array.
push_include_dirs
push_include_dirs(@dirs);
Adds more include directories
push_library_dirs
push_library_dirs(@dirs);
Adds more library directories
push_libraries
push_libraries(@libs);
Adds more libraries
push_extra_compiler_flags
push_extra_compiler_flags(@flags);
Adds more compiler flags
push_extra_linker_flags
push_extra_linker_flags(@flags);
Adds more linker flags
define
define($symbol);
Adds a new defined symbol directly; either by appending to the compiler flags or writing it into the
defines file.