-
Notifications
You must be signed in to change notification settings - Fork 7
/
config.pl
98 lines (83 loc) · 2.06 KB
/
config.pl
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
# $Header$
#
# To be run with perl. This builds Makefile from Makefile.in,
# substituting things whose location varies on different systems, and
# has to be looked for.
#
# There is no #! at the top because perl isn't installed in the same
# place on all systems.
#
# COPYRIGHT
$prefix="/usr/local";
$debug=0;
$profile=0;
$mmap=1;
$plist=0;
$embed=0;
$plist=0;
while ($_ = shift @ARGV) {
if (/^--help/ || /^-h/) {
&print_help();
exit 0;
} elsif (/^--prefix=(.*)$/) {
$prefix = $1;
} elsif (/^-p/) {
$prefix = shift @ARGV;
} elsif (/^--profile$/) {
$profile = 1;
} elsif (/^--plist$/) {
$plist = 1;
} elsif (/^--debug$/) {
$debug = 1;
} elsif (/^--nommap$/) {
$mmap = 0;
} elsif (/^--embed$/) {
$embed = 1;
}
}
if ($plist) {
$defines .= " -DPLIST";
$cmafihe_ldopts=" -lPropList";
} else {
$cmafihe_ldopts="";
}
$optdebug = $debug ? " -g -Wall" : " -O2";
if ($profile) {
$optdebug .= " -pg";
}
$mmap_flag = $mmap ? " -DHAVE_MMAP=1" : "";
$defines .= $mmap_flag;
if ($debug) {
$defines .= " -DEXPOSE_SIGNALS";
}
if ($embed) {
$dictdata_c = "dictdata.c";
$defines .= " -DEMBEDDED_DICTIONARY";
} else {
$dictdata_c = "";
}
open(IN, "<Makefile.in");
open(OUT, ">Makefile");
while (<IN>)
{
s/\@\@PREFIX\@\@/$prefix/eg;
s/\@\@OPTDEBUG\@\@/$optdebug/eg;
s/\@\@CMAFIHE_LDOPTS\@\@/$cmafihe_ldopts/eg;
s/\@\@DEFINES\@\@/$defines/eg;
s/\@\@DICTDATA_C\@\@/$dictdata_c/eg;
print OUT;
}
close(IN);
close(OUT);
sub print_help {
print <<EOF;
Configuration script for jbofihe & friends
--prefix=<prefix> Set installation directory parent (default=/usr/local)
-p <prefix> Ditto
--profile Build for profiling
--debug Build a debuggable version
--nommap Don't use mmap for reading the dictionary file
--embed Embed minimal dictionary directly into jbofihe program
--plist Enable PropList output of vocabulary in cmafihe (requires libPropList from http://www.windowmaker.org)
EOF
}