ExtUtils::CppGuess(3)
β¨ NAME β¨
okay so welcome to the ExtUtils::CppGuess(3) page, bestie β itβs from the User Contributed Perl Documentation, and the whole vibe is literally:
ExtUtils::CppGuess β guess C++ compiler and flags π
π SYNOPSIS π
With Extutils::MakeMaker:
use ExtUtils::CppGuess;
my $guess = ExtUtils::CppGuess->new;
WriteMakefile
( # MakeMaker args,
$guess->makemaker_options,
);
With Module::Build:
my $guess = ExtUtils::CppGuess->new;
my $build = Module::Build->new
( # Module::Build arguments
$guess->module_build_options,
);
$build->create_build_script;
π DESCRIPTION π
ExtUtils::CppGuess attempts to guess the systemβs C++ compiler that is compatible with the C compiler that your perl was built with. no cap, thatβs the whole mission π«Ά
It can generate the necessary options to the Module::Build constructor or to ExtUtils::MakeMakerβs WriteMakefile function. iconic behavior, honestly β¨
π ENVIRONMENT π
As of 0.24, the environment variable CXX defines the obvious value, and will be used instead of any detection. Supplied arguments to new will still win. periodt π
π¦ METHODS π¦
πΈ new
Creates a new ExtUtils::CppGuess object. Takes the path to the C compiler as the cc argument, but falls back to the value of $Config{cc}, which should be what you want anyway. slay π₯
You can specify extra_compiler_flags and extra_linker_flags (as strings) which will be merged in with the auto-detected ones. cute AND useful π
π« module_build_options
Returns the correct options to the constructor of Module::Build. These are:
extra_compiler_flagsextra_linker_flagsconfig => { cc => ... }, # as of 0.15
heads up bestie: please note the above may have problems on Perl <= 5.8 with ExtUtils::CBuilder <= 0.280230 due to a Perl RE issue. π
π makemaker_options
Returns the correct options to the WriteMakefile function of ExtUtils::MakeMaker. These are:
CCFLAGSdynamic_lib => { OTHERLDFLAGS => ... }CC # as of 0.15
If you specify the extra compiler or linker flags in the constructor, theyβll be merged into CCFLAGS or OTHERLDFLAGS respectively. iykyk π§
π is_gcc
Returns true if the detected compiler is in the gcc family. π
π is_msvc
Returns true if the detected compiler is in the MS VC family. π
π is_clang
Returns true if the detected compiler is in the Clang family. π
π is_sunstudio
Returns true if the detected compiler is in the Sun Studio family. π
π add_extra_compiler_flags
Takes a string as argument that is added to the string of extra compiler flags. stack those flags, bestie π«Ά
π add_extra_linker_flags
Takes a string as argument that is added to the string of extra linker flags. same energy, linker edition π
β compiler_command
Returns the string that can be passed to system to execute the compiler. Will include the flags returned as the Module::Build extra_compiler_flags.
Added in 0.13. π
β linker_flags
The same as returned as the Module::Build extra_linker_flags.
Added in 0.13. π
π¦ iostream_fname
Returns the filename to #include to get iostream capability.
This can be used a bit creatively to be portable in oneβs XS files, as the tests for this module need to be:
# in Makefile.PL:
$guess->add_extra_compiler_flags(
'-DINCLUDE_DOT=' .
($guess->iostream_fname =~ /\./ ? 1 : 0)
);
// in your .xs file:
#if INCLUDE_DOT
#include <string.h>
#else
#include <string>
#endif
Added in 0.15. β¨
π§ cpp_flavor_defs
Returns the text for a header that #defines __INLINE_CPP_STANDARD_HEADERS and __INLINE_CPP_NAMESPACE_STD if the standard headers and namespace are available. This is determined by trying to compile C++ with #define <iostream> β if it succeeds, the symbols will be defined, else commented.
Added in 0.15. π
π cpp_standard_flag
$guess->cpp_standard_flag( $standard_name )
Given a string $standard_name that is currently one of
"C++98""C++11""C++14""C++17""C++20""C++23"
returns a string with a flag that can be used to tell the compiler to support that version of the C++ standard or dies if version is not supported.
Added in version v0.22. π
π AUTHOR π
Mattia Barbon <mbarbon@cpan.org>
Steffen Mueller <smueller@cpan.org>
Tobias Leich <froggs@cpan.org>
π COPYRIGHT AND LICENSE π
Copyright 2010, 2011 by Mattia Barbon.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π
thatβs the whole page, bestie β brought to you by perl v5.42.2, dated 2026-07-29, and itβs the ExtUtils::CppGuess(3) manual page. bye! π
π¦ where this page comes from
- arch rolling: perl-extutils-cppguess 0.271-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms