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

EXAMPLES

208       Normally, a simple
209
210         ccconfig
211
212       without arguments is enough if you want the configuration for your sys‐
213       tem compiler. While "ccconfig" is running, it will write lots of status
214       information to "stderr". When it's done, it will usually dump a Perl
215       hash table to "stdout" which can be directly used as a configuration
216       for Convert::Binary::C.
217
218       If you want the configuration for a different compiler, or "ccconfig"
219       cannot determine your system compiler automatically, use
220
221         ccconfig -c gcc32
222
223       if your compiler's name is "gcc32".
224
225       If you want to pass additional options to the compiler, you can do so
226       after a double-dash on the command line:
227
228         ccconfig -- -g -DDEBUGGING
229
230       or
231
232         ccconfig -c gcc32 -- -ansi -fshort-enums
233
234       If you'd like to interface with the Perl core, you may find a suitable
235       configuration using something like:
236
237         ccconfig --cc=`perl -MConfig -e 'print $Config{cc}'` \
238                  -- `perl -MConfig -e 'print $Config{ccflags}'`
239
241       Copyright (c) 2002-2008 Marcus Holland-Moritz. All rights reserved.
242       This program is free software; you can redistribute it and/or modify it
243       under the same terms as Perl itself.
244

SEE ALSO

246       See Convert::Binary::C.
247
248
249
250perl v5.8.8                       2008-04-15                       CCCONFIG(1)
Impressum