1CCCONFIG(1)           User Contributed Perl Documentation          CCCONFIG(1)
2
3
4

NAME

6       ccconfig - Get Convert::Binary::C configuration for a compiler
7

SYNOPSIS

9       ccconfig options [-- compiler-options]
10
11       options:
12
13         -c
14         --cc             compiler   compiler executable to test
15                                     default: auto-determined
16
17         -o
18         --output-file    file       output filename
19                                     default: output to stdout
20
21         -f
22         --output-format  format     output format
23                                     default: dumper
24
25         --basename       name       basename of the temporary test files
26                                     default: _t_e_s_t
27
28         -I
29         --inc-path       path       manually set compiler include path
30
31         --preprocess     rule       compiler rule for preprocessing
32         --compile-obj    rule       compiler rule for compiling objects
33         --compile-exe    rule       compiler rule for compiling executables
34
35         --c-ext          ext        extension of C source files
36         --pp-ext         ext        extension of preprocessor output files
37         --obj-ext        ext        extension of object files
38         --exe-ext        ext        extension of executable files
39
40         --nodelete                  don't delete temporary files
41         --norun                     don't try to run executables
42         --quiet                     don't display anything
43         --nostatus                  don't display status indicator
44
45         --version                   print version number
46
47         --debug                     debug mode
48
49       Placeholders allowed in compiler rules:
50
51         %c    C source file
52         %o    object file
53         %e    executable file
54         %i    preprocessor output file
55         |     result is written to stdout (only at end of rule)
56

DESCRIPTION

58       "ccconfig" will try to determine a usable configuration for
59       Convert::Binary::C from testing a compiler executable. It is not
60       necessary that the binaries generated by the compiler can be executed,
61       so "ccconfig" can also be used for cross-compilers.
62
63       This tool is still experimental, and you should neither rely on its
64       output without checking, nor expect it to work in your environment.
65

OPTIONS

67   "--cc" compiler
68       This option allows you to explicitly specify a compiler executable.
69       This is especially useful if you don't want to use your system
70       compiler. If this options is not given, "ccconfig" tries to guess a
71       compiler.
72
73   "--output-file" file
74       Write Convert::Binary::C configuration to the specified file. The
75       default is to write the configuration to "stdout".
76
77   "--output-format" format
78       Specify the output format of the Convert::Binary::C configuration.  The
79       following formats are currently supported:
80
81         dumper      Output a %config hash using Data::Dumper
82         require     Output in a format suitable for require
83
84       The default is "dumper".
85
86   "--basename" name
87       Allows you to change the base name of the temporary test files.  This
88       is used along with the various "-ext" options to build the filenames of
89       C source files, preprocessor output files, object files and
90       executables.
91
92   "--inc-path" path
93       This option allows you to manually set the include path of the
94       compiler. This is useful if "ccconfig" cannot determine the include
95       path automatically, most probably because it cannot parse the
96       preprocessor output. This option can be specified more than once.
97
98   "--preprocess" rule
99       Using this option, you can specify a rule that "ccconfig" uses to run
100       the compiler to get preprocessor output. Most compilers write the
101       preprocessor output to standard output when given the "-E" option, i.e.
102
103         cc -E foo.c
104
105       will preprocess foo.c to standard output. The corresponding rule for
106       "ccconfig" would be:
107
108         ccconfig --preprocess='-E %c |'
109
110       The <%c> will be replaced with the C source filename, and the pipe
111       symbol signals that the result will be written to standard output.
112
113       The following placeholders can be used in "ccconfig" rules:
114
115         %c    C source file
116         %o    object file
117         %e    executable file
118         %i    preprocessor output file
119
120       Usually, "ccconfig" tries to figure out the correct rules on its own.
121
122   "--compile-obj" rule
123       Like "--preprocess", this option allows you to define a rule for how to
124       compile an object file. For most compilers, this rule will be something
125       like
126
127         ccconfig --compile-obj='-c -o %o %c'
128
129   "--compile-exe" rule
130       Like "--preprocess", this option allows you to define a rule for how to
131       compile an executable file. For most compilers, this rule will be
132       something like
133
134         ccconfig --compile-exe='-o %e %c'
135
136       Note that it is sufficient to specify either "--compile-obj" or
137       "--compile-exe". So if your compiler can only create object files,
138       that's just fine.
139
140   "--c-ext"
141       This option is used along with "--basename" to build the name of a C
142       source file. This is usually set to ".c".
143
144   "--pp-ext"
145       This option is used along with "--basename" to build the name of a
146       preprocessor output file.
147
148   "--obj-ext"
149       This option is used along with "--basename" to build the name of an
150       object file.
151
152   "--exe-ext"
153       This option is used along with "--basename" to build the name of an
154       executable file.
155
156   "--nodelete"
157       Don't attempt to delete temporary files that have been created by the
158       compiler. Normally, "ccconfig" will look for all files with the same
159       basename as the temporary test file and delete them.
160
161   "--norun"
162       You can specify this option if the executables generated by your
163       compiler cannot be run on your machine, i.e. if you have a cross-
164       compiler. However, "ccconfig" will automatically find out that it
165       cannot run the executables.
166
167       When this option is set, a different set of algorithms is used to
168       determine a couple of configuration settings. These algorithms are all
169       based upon placing a special signature in the object file. They are
170       less reliable that the standard algorithms, so you shouldn't use them
171       unless you have to.
172
173   "--quiet"
174       Don't display anything except for the final configuration.
175
176   "--nostatus"
177       Hide the status indicator. Recommended if you want to redirect the
178       script output to a file:
179
180         ccconfig --nostatus >config.pl 2>ccconfig.log
181
182   "--version"
183       Writes the program name, version and path to standard output.
184
185   "--debug"
186       Generate tons of debug output. Don't use unless you know what you're
187       doing.
188

EXAMPLES

190       Normally, a simple
191
192         ccconfig
193
194       without arguments is enough if you want the configuration for your
195       system compiler. While "ccconfig" is running, it will write lots of
196       status information to "stderr". When it's done, it will usually dump a
197       Perl hash table to "stdout" which can be directly used as a
198       configuration for Convert::Binary::C.
199
200       If you want the configuration for a different compiler, or "ccconfig"
201       cannot determine your system compiler automatically, use
202
203         ccconfig -c gcc32
204
205       if your compiler's name is "gcc32".
206
207       If you want to pass additional options to the compiler, you can do so
208       after a double-dash on the command line:
209
210         ccconfig -- -g -DDEBUGGING
211
212       or
213
214         ccconfig -c gcc32 -- -ansi -fshort-enums
215
216       If you'd like to interface with the Perl core, you may find a suitable
217       configuration using something like:
218
219         ccconfig --cc=`perl -MConfig -e 'print $Config{cc}'` \
220                  -- `perl -MConfig -e 'print $Config{ccflags}'`
221
223       Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved.
224       This program is free software; you can redistribute it and/or modify it
225       under the same terms as Perl itself.
226

SEE ALSO

228       See Convert::Binary::C.
229
230
231
232perl v5.38.0                      2023-07-20                       CCCONFIG(1)
Impressum