File: configure.pl

package info (click to toggle)
libxtc-rats-java 1.15.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 18,580 kB
  • sloc: java: 288,962; ansic: 20,406; ml: 14,775; makefile: 1,358; cpp: 621; sh: 352; xml: 259; perl: 123
file content (190 lines) | stat: -rwxr-xr-x 4,528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/usr/bin/perl -w
# configure script for ella

use strict 'subs';

# default location of smbase relative to this package
$SMBASE = "../smbase";
$req_smcv = 1.03;            # required sm_config version number
$thisPackage = "ella";

# -------------- BEGIN common block ---------------
# do an initial argument scan to find if smbase is somewhere else
for (my $i=0; $i < @ARGV; $i++) {
  my ($d) = ($ARGV[$i] =~ m/-*smbase=(.*)/);
  if (defined($d)) {
    $SMBASE = $d;
  }
}

# try to load the sm_config module
eval {
  push @INC, ($SMBASE);
  require sm_config;
};
if ($@) {
  die("$@" .     # ends with newline, usually
      "\n" .
      "I looked for smbase in \"$SMBASE\".\n" .
      "\n" .
      "You can explicitly specify the location of smbase with the -smbase=<dir>\n" .
      "command-line argument.\n");
}

# check version number
$smcv = get_sm_config_version();
if ($smcv < $req_smcv) {
  die("This package requires version $req_smcv of sm_config, but found\n" .
      "only version $smcv.\n");
}
# -------------- END common block ---------------

# defaults
@LDFLAGS = ("-g -Wall");
$AST = "../ast";
$ELKHOUND = "../elkhound";
$ELSA = "../elsa";
$GCOV_MODS = "";


sub usage {
  standardUsage();

  print(<<"EOF");
package options:
  -prof              enable profiling
  -gcov=<mods>       enable coverage testing for modules <mods>
  -devel             add options useful while developing (-Werror)
  -ast=<dir>:        specify where the ast system is [$AST]
  -elkhound=<dir>:   specify where the elkhound system is [$ELKHOUND]
  -elsa=<dir>:       specify where the elsa system is [$ELSA]
  -useSerialNumbers: give serial numbers to some objects for debugging
EOF
}


# -------------- BEGIN common block 2 -------------
# global variables holding information about the current command-line
# option being processed
$option = "";
$value = "";

# process command-line arguments
foreach $optionAndValue (@ARGV) {
  # ignore leading '-' characters, and split at first '=' (if any)
  ($option, $value) =
    ($optionAndValue =~ m/^-*([^-][^=]*)=?(.*)$/);
                      #      option     = value

  my $arg = $option;

  if (handleStandardOption()) {
    # handled by sm_config.pm
  }
  # -------------- END common block 2 -------------

  elsif ($arg eq "prof") {
    push @CCFLAGS, "-pg";
    push @LDFLAGS, "-pg";
  }

  elsif ($arg eq "gcov") {
    $GCOV_MODS = getOptArg();
  }

  elsif ($arg eq "devel") {
    push @CCFLAGS, "-Werror";
  }

  elsif ($arg eq "ast") {
    $AST = getOptArg();
  }
  elsif ($arg eq "elkhound") {
    $ELKHOUND = getOptArg();
  }
  elsif ($arg eq "elsa") {
    $ELSA = getOptArg();
  }

  elsif ($arg eq "useSerialNumbers") {
    push @CCFLAGS, "-DUSE_SERIAL_NUMBERS=1";
  }

  else {
    die "unknown option: $arg\n";
  }
}

finishedOptionProcessing();


# ------------------ check for needed components ----------------
test_smbase_presence();

test_CXX_compiler();

# ast
if (! -f "$AST/asthelp.h") {
  die "I cannot find asthelp.h in `$AST'.\n" .
      "The ast system is required for ella.\n" .
      "If it's in a different location, use the -ast=<dir> option.\n";
}

# elkhound
if (! -f "$ELKHOUND/glr.h") {
  die "I cannot find glr.h in `$ELKHOUND'.\n" .
      "The elkhound system is required for ella.\n" .
      "If it's in a different location, use the -elkhound=<dir> option.\n";
}

#elsa
if (! -f "$ELSA/baselexer.h") {
  die "I cannot find baselexer.h in `$ELSA'.\n" .
      "The elsa system is required for ella.\n" .
      "If it's in a different location, use the -elsa=<dir> option.\n";
}

$PERL = get_PERL_variable();


# ------------------ config.summary -----------------
$summary = getStandardConfigSummary();

$summary .= <<"OUTER_EOF";
cat <<EOF
  LDFLAGS:     @LDFLAGS
  SMBASE:      $SMBASE
  AST:         $AST
  ELKHOUND:    $ELKHOUND
  ELSA:        $ELSA
EOF
OUTER_EOF

if ($GCOV_MODS) {
  $summary .= "echo \"  GCOV_MODS:   $GCOV_MODS\"\n";
}

writeConfigSummary($summary);


# ------------------- config.status ------------------
writeConfigStatus("LDFLAGS" => "@LDFLAGS",
                  "SMBASE" => "$SMBASE",
                  "AST" => "$AST",
                  "ELKHOUND" => "$ELKHOUND",
		  "ELSA" => "$ELSA",
                  "PERL" => "$PERL",
                  "GCOV_MODS" => "$GCOV_MODS");


# ----------------- final actions -----------------
# run the output file generator
run("./config.status");

print("\nYou can now run make, usually called 'make' or 'gmake'.\n");

exit(0);


# silence warnings
pretendUsed($thisPackage);