CCCONFIG(1p)
π CCCONFIG π
okay bestie, gather round, because this is ccconfig from the User Contributed Perl Documentation corner of the perl-verse, and she's here to do one job and do it slayfully π
πΈ NAME πΈ
ccconfig β get a Convert::Binary::C configuration for a compiler β¨
π¦ SYNOPSIS π¦
ccconfig options [-- compiler-options]
the options, in all their glory:
-c
--cc compiler compiler executable to test
default: auto-determined
-o
--output-file file output filename
default: output to stdout
-f
--output-format format output format
default: dumper
--basename name basename of the temporary test files
default: _t_e_s_t
-I
--inc-path path manually set compiler include path
--preprocess rule compiler rule for preprocessing
--compile-obj rule compiler rule for compiling objects
--compile-exe rule compiler rule for compiling executables
--c-ext ext extension of C source files
--pp-ext ext extension of preprocessor output files
--obj-ext ext extension of object files
--exe-ext ext extension of executable files
--nodelete don't delete temporary files
--norun don't try to run executables
--quiet don't display anything
--nostatus don't display status indicator
--version print version number
--debug debug mode
and the placeholders you're allowed to drop into compiler rules:
%c C source file
%o object file
%e executable file
%i preprocessor output file
| result is written to stdout (only at end of rule)
π DESCRIPTION π
so ccconfig will try to determine a usable configuration for Convert::Binary::C by straight-up testing a compiler executable. and here's the cute part: it is not necessary that the binaries your compiler generates can actually be executed, which means ccconfig also works for cross-compilers π iconic behavior honestly.
β οΈ heads up bestie β this tool is still experimental. you should neither rely on its output without checking it, nor expect it to work in your environment. it's giving "trust but verify", fr fr π
β¨ OPTIONS β¨
π --cc compiler
-c,--cccompiler β lets you explicitly name a compiler executable to test. super useful when you don't wanna use your system compiler. if you don't pass it,ccconfigwill just try to guess a compiler. lowkey brave of her.
π --output-file file
-o,--output-filefile β write the Convert::Binary::C configuration into this file. the default is writing it tostdout, no cap.
π --output-format format
-f,--output-formatformat β pick how the Convert::Binary::C configuration gets formatted. currently supported formats:
dumper Output a %config hash using Data::Dumper
require Output in a format suitable for require
the default is dumper β¨
π --basename name
--basenamename β change the base name of the temporary test files. this gets used together with the various-extoptions to build the filenames of C source files, preprocessor output files, object files and executables. teamwork makes the dream work π«Ά
π --inc-path path
-I,--inc-pathpath β manually set the compiler's include path. this is the move whenccconfigcan't figure out the include path by itself, most probably because it can't parse the preprocessor output. you can pass this option more than once, so go off π
π --preprocess rule
--preprocessrule β define the ruleccconfiguses to run the compiler and get preprocessor output. most compilers write preprocessor output to standard output when you hand them the-Eoption, i.e.
cc -E foo.c
will preprocess foo.c to standard output. so the matching rule for ccconfig would look like:
ccconfig --preprocess='-E %c |'
the %c gets swapped out for the C source filename, and that pipe symbol | signals the result is gonna be written to standard output. here are the placeholders that work in ccconfig rules:
%c C source file
%o object file
%e executable file
%i preprocessor output file
usually though, ccconfig tries to figure out the correct rules all on her own π
π --compile-obj rule
--compile-objrule β just like--preprocess, this one lets you define the rule for compiling an object file. for most compilers it'll be something like
ccconfig --compile-obj='-c -o %o %c'
π --compile-exe rule
--compile-exerule β again like--preprocess, but this one defines the rule for compiling an executable file. for most compilers it's something like
ccconfig --compile-exe='-o %e %c'
π«Ά quick note: it is sufficient to specify either--compile-objor--compile-exe. so if your compiler can only create object files, that's just fine, no stress.
π --c-ext
--c-extβ used along with--basenameto build the name of a C source file. this is usually set to.c.
π --pp-ext
--pp-extβ used along with--basenameto build the name of a preprocessor output file.
π --obj-ext
--obj-extβ used along with--basenameto build the name of an object file.
π --exe-ext
--exe-extβ used along with--basenameto build the name of an executable file.
π --nodelete
--nodeleteβ don't attempt to delete temporary files that the compiler created. normallyccconfigwill look for all files with the same basename as the temporary test file and delete them, but with this flag she leaves them alone π
π --norun
--norunβ specify this if the executables your compiler generates can't be run on your machine, i.e. if you've got a cross-compiler. that said,ccconfigwill automatically find out that it can't run the executables anyway, so she's ahead of you like that.
β οΈ when this option is set, a different set of algorithms is used to determine a couple of configuration settings. these algorithms are all based upon placing a special signature in the object file. they are less reliable than the standard algorithms, so you shouldn't use them unless you have to. periodt.
π --quiet
--quietβ don't display anything except for the final configuration. minimal, clean, aesthetic β¨
π --nostatus
--nostatusβ hide the status indicator. recommended if you wanna redirect the script output to a file:
ccconfig --nostatus >config.pl 2>ccconfig.log
π --version
--versionβ writes the program name, version and path to standard output.
π --debug
--debugβ generate tons of debug output. don't use unless you know what you're doing π
π EXAMPLES π
normally, a simple
ccconfig
with absolutely no arguments is enough if you want the configuration for your system compiler. while ccconfig is running, it will write lots of status information to stderr. when it's done, it will usually dump a Perl hash table to stdout which can be directly used as a configuration for Convert::Binary::C. no cap, that's the whole vibe β¨
if you want the configuration for a different compiler, or ccconfig cannot determine your system compiler automatically, use
ccconfig -c gcc32
if your compiler's name is gcc32 π
if you wanna pass additional options to the compiler, you can do that after a double-dash on the command line:
ccconfig -- -g -DDEBUGGING
or
ccconfig -c gcc32 -- -ansi -fshort-enums
and if you'd like to interface with the Perl core, you may find a suitable configuration using something like:
ccconfig --cc=`perl -MConfig -e 'print $Config{cc}'` \
-- `perl -MConfig -e 'print $Config{ccflags}'`
she ate that π
π COPYRIGHT π
Copyright (c) 2002-2024 Marcus Holland-Moritz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π§ SEE ALSO π§
See Convert::Binary::C.
okay that's the whole page bestie, go configure something gorgeous π¦ and just so you know: this page came from perl v5.42.3, dated 2026-08-20, and it's the CCCONFIG(1p) page. mwah π
π¦ where this page comes from
- ubuntu stonking: libconvert-binary-c-perl 0.86-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms