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, --cc compiler β€” 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, ccconfig will just try to guess a compiler. lowkey brave of her.

πŸ’œ --output-file file

  • -o, --output-file file β€” write the Convert::Binary::C configuration into this file. the default is writing it to stdout, no cap.

πŸ’œ --output-format format

  • -f, --output-format format β€” 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

  • --basename name β€” change the base name of the temporary test files. this gets used together with the various -ext options 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-path path β€” manually set the compiler's include path. this is the move when ccconfig can'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

  • --preprocess rule β€” define the rule ccconfig uses to run the compiler and get preprocessor output. most compilers write preprocessor output to standard output when you hand them the -E option, 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-obj rule β€” 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-exe rule β€” 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-obj or --compile-exe. so if your compiler can only create object files, that's just fine, no stress.

πŸ’œ --c-ext

  • --c-ext β€” used along with --basename to build the name of a C source file. this is usually set to .c.

πŸ’œ --pp-ext

  • --pp-ext β€” used along with --basename to build the name of a preprocessor output file.

πŸ’œ --obj-ext

  • --obj-ext β€” used along with --basename to build the name of an object file.

πŸ’œ --exe-ext

  • --exe-ext β€” used along with --basename to build the name of an executable file.

πŸ’œ --nodelete

  • --nodelete β€” don't attempt to delete temporary files that the compiler created. normally ccconfig will 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, ccconfig will 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 (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