Add AppleWM and WindowsWM proto components to build
[xorg-util-modular.git] / addconfigh.awk
blob55c041b31d478881a4552aff75bc55f7d72b8fe8
1 #!/usr/bin/awk -f
3 # This script adds
5 # #include <config.h>
7 # before the first #include line it finds.
9 function do_writeout ()
11 if (output && writeout)
12 system ("mv " output " " input );
16 if (FNR == 1)
18 do_writeout();
20 # beginning of a file
22 input = FILENAME;
23 output = FILENAME "-new";
24 n_includes = 0;
25 writeout = 1;
26 done = 0;
30 /\#include/ {
31 if (n_includes == 0 && /\#include <config.h>/)
33 print "skipping " FILENAME
34 writeout = 0;
36 nextfile;
39 ++n_includes;
40 if (!done) {
41 print "#ifdef HAVE_CONFIG_H" > output;
42 print "#include <config.h>" > output;
43 print "#endif" > output;
45 done = 1;
50 print > output
54 END {
55 do_writeout();