This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove trailing whitespace on meta-lines in unit files
[metaconfig.git] / dist / U / Compile.U
1 ?RCS: $Id$
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS:
5 ?RCS: You may redistribute only under the terms of the Artistic License,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic License; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS:
11 ?RCS: Copyright (c) 1998 Andy Dougherty
12 ?RCS:
13 ?RCS: You may distribute under the terms of either the GNU General Public
14 ?RCS: License or the Artistic License, as specified in the README file.
15 ?RCS:
16 ?RCS:
17 ?X:
18 ?X:     This unit is just a quick shorthand for the compile command
19 ?X:     to be used in all the other metaconfig units.
20 ?X:
21 ?MAKE:Compile: +cc +optimize +ccflags +ldflags +libs
22 ?MAKE:  -pick add $@ %<
23 ?LINT:define compile compile_ok
24 ?V:compile compile_ok mc_file
25 ?S:compile:
26 ?S:     This shell variable is used internally by Configure to provide
27 ?S:     a convenient shorthand for the typical compile command, namely
28 ?S:     $cc $optimize $ccflags $ldflags -o $1 $1.c $libs > /dev/null 2>&1
29 ?S:     Note that the output filename does _not_ include the _exe
30 ?S:     extension.  Instead we assume that the linker will be
31 ?S:     "helpful" and automatically appending the correct suffix.
32 ?S:     OS/2 users will apparently need to supply the -Zexe flag to
33 ?S:     get this behavior.
34 ?S:
35 ?S:     To use this variable, say something like:
36 ?S:             echo 'int main() { exit(0); }' > try.c
37 ?S:             set try
38 ?S:             if eval $compile; then
39 ?S:                     echo "success"   # and do whatever . . .
40 ?S:             else
41 ?S:                     echo "failure"   # and do whatever . . .
42 ?S:             fi
43 ?S:     To add extra flags cc flags (e.g. -DWHATEVER) just put them
44 ?S:     in $*, e.g.
45 ?S:             set try -DTRY_THIS_FLAG
46 ?S:.
47 ?S:compile_ok:
48 ?S:     This shell variable is used internally by Configure to provide
49 ?S:     a convenient shorthand for the typical compile command that you
50 ?S:     expect to work ok.  It is the same as $compile, except we
51 ?S:     deliberately let the user see any error messages.
52 ?S:.
53 : define a shorthand compile call
54 compile='
55 mc_file=$1;
56 shift;
57 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
58 : define a shorthand compile call for compilations that should be ok.
59 compile_ok='
60 mc_file=$1;
61 shift;
62 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
63