-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·620 lines (573 loc) · 27.1 KB
/
configure
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
#! /usr/bin/perl -w
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# GENIE configuration script
#
# For help, type ./configure --help
#
# Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
# STFC, Rutherford Appleton Laboratory
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# print out info & exit if any of the command-line arguments was --help
#
if(($match = grep(/--help/i, @ARGV)) > 0) {
print "\n";
print "*** GENIE configure script *** \n\n";
print "Usage: ./configure [option]... [flag=value]... \n\n";
print " FLAG DESCRIPTION DEFAULT\n\n";
print " --prefix installation location (for 'make install') /usr/local/\n";
print "\n enable/disable options with either --enable- or --disable- (eg --enable-lhapdf --disable-flux-drivers)\n\n";
print " profiler GENIE code profiling using Google PerfTools default: disabled \n";
print " doxygen-doc Generate doxygen documentation at build time default: disabled \n";
print " dylibversion Adds version number in library names (recommended) default: enabled \n";
print " lowlevel-mesg Disable (rather than filter out at run time) prolific default: disabled \n";
print " debug/info level messages known to slow GENIE down \n";
print " debug Adds -g in the compiler options to request debug info default: disabled \n";
print " lhapdf Use the LHAPDF parton density function library default: enabled \n";
print " cernlib Use the CERN libraries default: disabled (CERNLIBs to be phased-out. Please use LHAPDF instead)\n";
print " flux-drivers Built-in flux drivers default: enabled \n";
print " geom-drivers Built-in detector geometry drivers default: enabled \n";
print " vle-extension GENIE very low energy (1 MeV - 100 MeV) extension default: disabled (Experimental) \n";
print " vhe-extension GENIE very high energy ( > 500 GeV ) extension default: disabled (Experimental) \n";
print " validation-tools GENIE physics model validation tools (requires MySQL) default: disabled \n";
print " mueloss Muon energy loss modeling default: enabled \n";
print " test Build test programs default: disabled \n";
print " gsl Enable use of the GSL math library (via ROOT MathMore) default: disabled (Experimental. Don't use yet)\n";
print " t2k Enable T2K-specific event generation app default: disabled \n";
print " numi Enable NuMI-specific event generation app default: disabled \n";
print " atmo Enable atmospheric neutrino event generation app default: disabled \n";
print " nucleon-decay Enable nucleon decay event generation app default: disabled \n";
print " rwght Enable event reweighting tools default: disabled \n";
print " fastsim Enable fast MC apps using parameterised detector responses default: disabled \n";
print " masterclass Enable GENIE neutrino masterclass app default: disabled (Experimental) \n";
print "\n options for 3rd party software, prefix with --with- (eg --with-lhapdf-lib=/some/path/)\n\n";
print " optimiz-level Compiler optimization any of O,O2,O3,OO,Os / default: O2 \n";
print " profiler-lib Path to profiler library needed if you --enable-profiler \n";
print " doxygen-path Doxygen binary path needed if you --enable-doxygen-doc (if unset: checks for a \$DOXYGENPATH env.var.) \n";
print " pythia6-lib PYTHIA6 library path always needed (if unset: checks for a \$PYTHIA6 env.var., then tries to auto-detect it) \n";
print " cern-lib CERN libraries path needed if you --enable-cernlib (if unset: checks for a \$CERNLIB env.var., then tries to auto-detect it) \n";
print " lhapdf-inc Path to LHAPDF includes needed if you --enable-lhapdf (if unset: checks for a \$LHAPDF_INC env.var., then tries to auto-detect it) \n";
print " lhapdf-lib Path to LHAPDF libraries needed if you --enable-lhapdf (if unset: checks for a \$LHAPDF_INC env.var.. then tries to auto-detect it) \n";
print " libxml2-inc Path to libxml2 includes always needed (if unset: tries to auto-detect it) \n";
print " libxml2-lib Path to libxml2 library always needed (if unset: tries to auto-detect it) \n";
print " log4cpp-inc Path to log4cpp includes always needed (if unset: tries to auto-detect it) \n";
print " log4cpp-lib Path to log4cpp library always needed (if unset: tries to auto-detect it) \n\n";
print " roomuhisto Path to RooMUHistos needed if you --enable-roomuhistos (if unset: tries to auto-detect it) \n\n";
print "If the printout was too long then pipe it through a pager, eg: \n";
print "./configure --help | more \n";
exit 0;
}
# Check that $GENIE is set
#
$GENIE = $ENV{'GENIE'};
die ("*** Error *** The GENIE environmental variable (pointing to the top level GENIE directory) is not defined")
unless defined $GENIE;
# Check that $ROOTSYS is set
#
$ROOTSYS = $ENV{'ROOTSYS'};
die ("*** Error *** The ROOTSYS environmental variable is not defined. Is ROOT installed?")
unless defined $ROOTSYS;
# Print GENIE banner
#
$BANNER_FILE = "$GENIE/data/banner/BANNER.txt";
if(-e $BANNER_FILE) {
open(BANNER, "<$BANNER_FILE");
@hdr=<BANNER>;
print @hdr;
close(BANNER);
}
# Enable auto-detection?
#
system("find $GENIE/configure");
print "\n";
$auto_detect = ($?==0) ? 1 : 0;
if(! $auto_detect) {
print "\n*** Warning *** Path auto-detection is turned off. You need the 'find' utility to use that feature\n\n";
}
# Open Make.config to write configuration options
#
$MKCONF_FILE = "$GENIE/src/make/Make.config";
open(MKCONF, ">$MKCONF_FILE") or die("Can not write out the Make.config file!");
print MKCONF "# \n";
print MKCONF "# Make.config \n";
print MKCONF "# This file was automatically generated by the 'configure' script \n";
print MKCONF "# and is included into the project Makefiles \n";
print MKCONF "# \n";
# Create a string by joining all the command line arguments
#
my $options = join(" ", @ARGV);
# Get & save installation location (--prefix) or set default
#
my $prefix="/usr/local/";
if(($match = grep(/--prefix/i, @ARGV)) > 0) {
$options=~m/--prefix=(\S*)/i;
$prefix = $1;
if( $GENIE eq $prefix ) {
print "*** Error *** --prefix can not point to the GENIE top level directory!\n\n";
exit 1;
}
}
print MKCONF "GENIE_INSTALLATION_PATH=$prefix\n";
# Default --enable/--disable config options (for a minimal genie build)
#
my $gopt_enable_profiler = "NO";
my $gopt_enable_doxygen_doc = "NO";
my $gopt_enable_dylibversion = "YES";
my $gopt_enable_lowlevel_mesg = "NO";
my $gopt_enable_debug = "NO";
my $gopt_enable_lhapdf = "YES";
my $gopt_enable_cernlib = "NO";
my $gopt_enable_flux_drivers = "YES";
my $gopt_enable_geom_drivers = "YES";
my $gopt_enable_vle_extension = "NO";
my $gopt_enable_vhe_extension = "NO";
my $gopt_enable_validation_tools = "NO";
my $gopt_enable_mueloss = "YES";
my $gopt_enable_test = "NO";
my $gopt_enable_gsl = "NO";
my $gopt_enable_t2k = "NO";
my $gopt_enable_numi = "NO";
my $gopt_enable_atmo = "NO";
my $gopt_enable_nucleon_decay = "NO";
my $gopt_enable_rwght = "NO";
my $gopt_enable_fastsim = "NO";
my $gopt_enable_masterclass = "NO";
# RooMUHistos (optional)
#
my $gopt_enable_roomuhistos = "NO";
# Check configure's command line arguments for non-default values
#
if(($match = grep(/--enable-profiler/i, @ARGV)) > 0) { $gopt_enable_profiler = "YES"; }
if(($match = grep(/--enable-doxygen-doc/i, @ARGV)) > 0) { $gopt_enable_doxygen_doc = "YES"; }
if(($match = grep(/--disable-dylibversion/i, @ARGV)) > 0) { $gopt_enable_dylibversion = "NO"; }
if(($match = grep(/--enable-lowlevel-mesg/i, @ARGV)) > 0) { $gopt_enable_lowlevel_mesg = "YES"; }
if(($match = grep(/--enable-debug/i, @ARGV)) > 0) { $gopt_enable_debug = "YES"; }
if(($match = grep(/--disable-lhapdf/i, @ARGV)) > 0) { $gopt_enable_lhapdf = "NO"; }
if(($match = grep(/--enable-cernlib/i , @ARGV)) > 0) { $gopt_enable_cernlib = "YES"; }
if(($match = grep(/--disable-flux-drivers/i, @ARGV)) > 0) { $gopt_enable_flux_drivers = "NO"; }
if(($match = grep(/--disable-geom-drivers/i, @ARGV)) > 0) { $gopt_enable_geom_drivers = "NO"; }
if(($match = grep(/--enable-vle-extension/i, @ARGV)) > 0) { $gopt_enable_vle_extension = "YES"; }
if(($match = grep(/--enable-vhe-extension/i, @ARGV)) > 0) { $gopt_enable_vhe_extension = "YES"; }
if(($match = grep(/--enable-validation-tools/i, @ARGV)) > 0) { $gopt_enable_validation_tools = "YES"; }
if(($match = grep(/--disable-mueloss/i, @ARGV)) > 0) { $gopt_enable_mueloss = "NO"; }
if(($match = grep(/--enable-test/i, @ARGV)) > 0) { $gopt_enable_test = "YES"; }
if(($match = grep(/--enable-gsl/i, @ARGV)) > 0) { $gopt_enable_gsl = "YES"; }
if(($match = grep(/--enable-t2k/i, @ARGV)) > 0) { $gopt_enable_t2k = "YES"; }
if(($match = grep(/--enable-numi/i, @ARGV)) > 0) { $gopt_enable_numi = "YES"; }
if(($match = grep(/--enable-atmo/i, @ARGV)) > 0) { $gopt_enable_atmo = "YES"; }
if(($match = grep(/--enable-nucleon-decay/i, @ARGV)) > 0) { $gopt_enable_nucleon_decay = "YES"; }
if(($match = grep(/--enable-rwght/i, @ARGV)) > 0) { $gopt_enable_rwght = "YES"; }
if(($match = grep(/--enable-fastsim/i, @ARGV)) > 0) { $gopt_enable_fastsim = "YES"; }
if(($match = grep(/--enable-masterclass/i, @ARGV)) > 0) { $gopt_enable_masterclass = "YES"; }
my $gopt_with_cxx_debug_flag="";
if($gopt_enable_debug eq "YES") { $gopt_with_cxx_debug_flag = "-g"; }
# RooMUHistos
#
if(($match = grep(/--enable-roomuhistos/i, @ARGV)) > 0) { $gopt_enable_roomuhistos = "YES"; }
# Warnings for recently modified configuration options
#
if($options=~m/--enable-t2k-evgen/i) {
print "\n";
print "*** Warning *** Note that the option --enable-t2k-evgen has been renamed to --enable-t2k \n";
print "*** Warning *** The T2K-specific tools will not be enabled if you mis-type the configuration option.\n";
print "*** Warning *** Please see './configure --help' for all config option updates \n\n";
}
# Check whether ROOT itself was build with GSL enabled
# (GENIE uses GSL via ROOT's MathMore library.)
#
if($gopt_enable_gsl eq "YES") {
$mathmore_lib = "$ROOTSYS/lib/libMathMore.so";
if( ! -f $mathmore_lib ) {
print "*** Warning *** You can't use --enable-gsl because you didn't build ROOT with GSL/MathMore enabled.\n";
print "*** Warning *** Reverting back to the --disable-gsl option.\n";
$gopt_enable_gsl = "NO";
}
}
# Check compiler optimization level
#
my $gopt_with_cxx_optimiz_flag="O2"; # default
if( $options=~m/--with-optimiz-level=(\S*)/i ) {
$gopt_with_cxx_optimiz_flag = $1;
}
# If --enable-profiler was set then the full path to the profiler library must be specified
#
my $gopt_with_profiler_lib = "";
if($gopt_enable_profiler eq "YES") {
if(($match = grep(/--with-profiler-lib/i, @ARGV)) > 0) {
$options=~m/--with-profiler-lib=(\S*)/i;
$gopt_with_profiler_lib = $1;
}
}
# If --enable-doxygen-doc was set then the full path to the doxygen binary path must be specified
# unless it is in the $PATH
#
my $gopt_with_doxygen_path = "";
if($gopt_enable_doxygen_doc eq "YES") {
if(($match = grep(/--with-doxygen-path/i, @ARGV)) > 0) {
$options=~m/--with-doxygen-path=(\S*)/i;
$gopt_with_doxygen_path = $1;
}
# if it was not set, try to pick it up from the environment
if(! -f $gopt_with_doxygen_path && defined $ENV{'DOXYGENPATH'}) { $gopt_with_doxygen_path = $ENV{'DOXYGENPATH'}; }
# complain
if(! -f $gopt_with_doxygen_path) {
print "*** Error *** You need to specify the path to doxygen using --with-doxygen-path=/some/path/\n";
print "*** Error *** Otherwise, you should --disable-doxygen-doc\n\n";
exit 1;
}
}
# If --enable-lhapdf was set then the full path to the LHAPDF library must be specified
#
my $gopt_with_lhapdf_lib = "";
if($gopt_enable_lhapdf eq "YES") {
if(($match = grep(/--with-lhapdf-lib/i, @ARGV)) > 0) {
$options=~m/--with-lhapdf-lib=(\S*)/i;
$gopt_with_lhapdf_lib = $1;
}
if(! -d $gopt_with_lhapdf_lib) {
print "\n*** Warning *** LHAPDF has been enabled but you didn't specify the LHAPDF library path \n";
}
# if it was not set, try to pick it up from the environment
if($gopt_with_lhapdf_lib eq "" && defined $ENV{'LHAPDF_LIB'}) {
$gopt_with_lhapdf_lib = $ENV{'LHAPDF_LIB'};
print "The \$LHAPDF_LIB env var is defined. I will pick that and use --with-lhapdf-lib=$gopt_with_lhapdf_lib\n";
}
# if it still not set, try autodetecting it
if(! -d $gopt_with_lhapdf_lib && $auto_detect) {
print "Auto-detecting LHAPDF library path...\n";
$matched = auto_detect("libLHAPDF.a");
if( $matched=~m/(\S*)\/libLHAPDF.a/i ) {
$gopt_with_lhapdf_lib = $1;
}
print "Setting --with-lhapdf-inc=$gopt_with_lhapdf_lib\n";
}
# check
my $fileso = "$gopt_with_lhapdf_lib/libLHAPDF.so";
my $filedylib = "$gopt_with_lhapdf_lib/libLHAPDF.dylib";
if(! -e $fileso && ! -e $filedylib) {
print "*** Error *** You need to specify the path to libLHAPDF using --with-lhapdf-lib=/some/path/\n";
print "*** Error *** Otherwise, you should --disable-lhapdf\n\n";
exit 1;
}
}
# If --enable-lhapdf was set then the full path to the LHAPDF includes must be specified
#
my $gopt_with_lhapdf_inc = "";
if($gopt_enable_lhapdf eq "YES") {
if(($match = grep(/--with-lhapdf-inc/i, @ARGV)) > 0) {
$options=~m/--with-lhapdf-inc=(\S*)/i;
$gopt_with_lhapdf_inc = $1;
}
if(! -d $gopt_with_lhapdf_inc) {
print "\n*** Warning *** LHAPDF has been enabled but you didn't specify the LHAPDF include path \n";
}
# if it was not set, try to pick it up from the environment
if($gopt_with_lhapdf_inc eq "" && defined $ENV{'LHAPDF_INC'}) {
$gopt_with_lhapdf_inc = $ENV{'LHAPDF_INC'};
print "The \$LHAPDF_INC env var is defined. I will pick that and use --with-lhapdf-inc=$gopt_with_lhapdf_inc\n";
}
# if it still not set, try autodetecting it
if(! -d $gopt_with_lhapdf_inc && $auto_detect) {
print "Auto-detecting the LHAPDF include path...\n";
$matched = auto_detect("LHAPDF.h","LHAPDF/LHAPDF.h");
print "$gopt_with_lhapdf_inc \n";
if( $matched=~m/(\S*)\/LHAPDF\/LHAPDF.h/i ) {
$gopt_with_lhapdf_inc = $1;
}
print "Setting --with-lhapdf-inc=$gopt_with_lhapdf_inc\n";
}
# check
my $file = "$gopt_with_lhapdf_inc/LHAPDF/LHAPDF.h";
if(! -e $file) {
print "*** Error *** You need to specify the LHAPDF includes path using --with-lhapdf-inc=/some/path/\n";
print "*** Error *** Otherwise, you should --disable-lhapdf\n\n";
exit 1;
}
}
# If --enable-cernlib was set then the full path to the CERNLIBs must be specified
#
my $gopt_with_cern_lib = "";
if($gopt_enable_cernlib eq "YES") {
if($options=~m/--with-cernlib=\S*/i) {
print "*** Error *** Note that the option --with-cernlib has been renamed to --with-cern-lib \n";
print "*** Error *** Please see './configure --help' for all config option updates \n\n";
exit 1;
}
if($gopt_enable_lhapdf eq "YES") {
print "\n";
print "*** Warning *** You have already enabled the LHAPDF library: The CERNLIB library dependency is now redundant. \n";
print "*** Warning *** No action is required but it is safe for you _not_ to --enable-cernlib. \n\n";
} else {
print "\n";
print "*** Warning *** Using CERNLIB in GENIE is functional but is becoming depreciated. \n";
print "*** Warning *** Please start using LHAPDF instead. \n\n";
}
if($options=~m/--with-cern-lib=(\S*)/i) {
$gopt_with_cern_lib = $1;
}
if(! -d $gopt_with_cern_lib) {
print "\n*** Warning *** CERNLIB has been enabled but you didn't specify the CERNLIB path \n";
}
# if it was not set, try to pick it up from the environment
if(! -d $gopt_with_cern_lib && defined $ENV{'CERNLIB'}) {
$gopt_with_cern_lib = $ENV{'CERNLIB'};
print "The \$CERNLIB env var is defined. I will pick that and use --with-cern-lib=$gopt_with_cern_lib\n";
}
# if it still not set, try autodetecting it
if(! -d $gopt_with_cern_lib && $auto_detect)
{
print "Auto-detecting the CERNLIB path...\n";
$matched = auto_detect("libpdflib*.*");
if( $matched=~m/(\S*)\/libpdflib\S*/i ) {
$gopt_with_cern_lib = $1;
}
print "Setting --with-cern-lib=$gopt_with_cern_lib\n";
}
if(! -d $gopt_with_cern_lib) {
print "*** Error *** Could not locate the CERNLIB path. Please specify it using --with-cern-lib=/some/path/\n\n";
exit 1;
}
}
# Check that at least one of CERNLIB and LHAPDF is enabled
#
if($gopt_enable_lhapdf eq "NO" && $gopt_enable_cernlib eq "NO") {
print "*** Error *** You can not disable both LHAPDF and CERNLIB. \n";
print "*** Error *** Please enable one (preferably LHAPDF). \n\n";
exit 1;
}
# If --enable-validation-tools was set then ROOT must have mysql support enabled
#
if($gopt_enable_validation_tools eq "YES") {
}
# Get pythia6 library path
#
my $gopt_with_pythia6_lib = "";
if($options=~m/--with-pythia6=\S*/i) {
print "*** Error *** Note that the option --with-pythia6 has been renamed to --with-pythia6-lib \n";
print "*** Error *** Please see './configure --help' for all config option updates \n\n";
exit 1;
}
if($options=~m/--with-pythia6-lib=(\S*)/i) {
$gopt_with_pythia6_lib = $1;
} else {
print "\n*** Warning *** You didn't specify the PYTHIA6 path \n";
}
# if it was not set, try to pick it up from the environment
if(! -d $gopt_with_pythia6_lib && defined $ENV{'PYTHIA6'}) {
$gopt_with_pythia6_lib = $ENV{'PYTHIA6'};
print "The \$PYTHIA6 env var is defined. I will pick that and set --with-pythia6-lib=$gopt_with_pythia6_lib\n";
}
# if it still not set, try autodetecting it
if(! -d $gopt_with_pythia6_lib && $auto_detect)
{
print "Auto-detecting the PYTHIA6 path...\n";
$matched = auto_detect("libPythia6*");
if( $matched=~m/(\S*)\/libPythia6\S*/i ) {
$gopt_with_pythia6_lib = $1;
}
print "Setting --with-pythia6-lib=$gopt_with_pythia6_lib\n";
}
if(! -d $gopt_with_pythia6_lib) {
print "*** Error *** Could not locate the PYTHIA6 library path. Please specify it using --with-pythia6=/some/path/\n\n";
exit 1;
}
# Get libxml2 and log4cpp include and library paths
#
my $gopt_with_libxml2_inc = "";
my $gopt_with_libxml2_lib = "";
my $gopt_with_log4cpp_inc = "";
my $gopt_with_log4cpp_lib = "";
#
# --with-libxml2-inc=
#
if($options=~m/--with-libxml2-inc=(\S*)/i) {
$gopt_with_libxml2_inc = $1;
}
if(! -d $gopt_with_libxml2_inc && $auto_detect) {
print "\n*** Warning *** You didn't specify the libxml2 include path \n";
print "Auto-detecting...\n";
$matched = auto_detect("xmlmemory.h");
if( $matched=~m/(\S*)\/libxml\/xmlmemory.h/i ) {
$gopt_with_libxml2_inc = $1;
}
print "Setting --with-libxml2-inc=$gopt_with_libxml2_inc\n";
}
if(! -d $gopt_with_libxml2_inc) {
print "*** Error *** You need to specify the libxml2 include path using --with-libxml2-inc=/some/path/\n\n";
exit 1;
}
#
# --with-libxml2-lib=
#
if($options=~m/--with-libxml2-lib=(\S*)/i) {
$gopt_with_libxml2_lib = $1;
}
if(! -d $gopt_with_libxml2_lib && $auto_detect) {
print "\n*** Warning *** You didn't specify the libxml2 library path \n";
print "Auto-detecting...\n";
$matched = auto_detect("libxml2.*");
if( $matched=~m/(\S*)\/libxml2\S*/i ) {
$gopt_with_libxml2_lib = $1;
}
print "Setting --with-libxml2-lib=$gopt_with_libxml2_lib\n";
}
if(! -d $gopt_with_libxml2_lib) {
print "*** Error *** You need to specify the libxml2 library path using --with-libxml2-lib=/some/path/\n\n";
exit 1;
}
#
# --with-log4cpp-inc=
#
if($options=~m/--with-log4cpp-inc=(\S*)/i) {
$gopt_with_log4cpp_inc = $1;
}
if(! -d $gopt_with_log4cpp_inc && $auto_detect) {
print "\n*** Warning *** You didn't specify the log4cpp include path \n";
print "Auto-detecting...\n";
$matched = auto_detect("OstreamAppender.hh");
if( $matched=~m/(\S*)\/log4cpp\/OstreamAppender.hh/i ) {
$gopt_with_log4cpp_inc = $1;
}
print "Setting --with-log4cpp-inc=$gopt_with_log4cpp_inc\n";
}
if(! -d $gopt_with_log4cpp_inc) {
print "*** Error *** You need to specify the log4cpp include path using --with-log4cpp-inc=/some/path/\n\n";
exit 1;
}
#
# --with-log4cpp-lib=
#
if($options=~m/--with-log4cpp-lib=(\S*)/i) {
$gopt_with_log4cpp_lib = $1;
}
if(! -d $gopt_with_log4cpp_lib && $auto_detect) {
print "\n*** Warning *** You didn't specify the log4cpp library path \n";
print "Auto-detecting...\n";
$matched = auto_detect("liblog4cpp.*");
if( $matched=~m/(\S*)\/liblog4cpp\S*/i ) {
$gopt_with_log4cpp_lib = $1;
}
print "Setting --with-log4cpp-lib=$gopt_with_log4cpp_lib\n";
}
if(! -d $gopt_with_log4cpp_lib) {
print "*** Error *** You need to specify the log4cpp library path using --with-log4cpp-lib=/some/path/\n\n";
exit 1;
}
# RooMUHistos
#
my $gopt_with_roomuhistos_path = "";
if($gopt_enable_roomuhistos eq "YES") {
if(($match = grep(/--with-roomuhistos-path/i, @ARGV)) > 0) {
$options=~m/--with-roomuhistos-path=(\S*)/i;
$gopt_with_roomuhistos_path = $1;
}
if(! -d $gopt_with_roomuhistos_path) {
print "\n*** Warning *** RooMUHistos has been enabled but you didn't specify the RooMUHistos path \n";
}
# if it was not set, try to pick it up from the environment
if($gopt_with_roomuhistos_path eq "" && defined $ENV{'ROOMU_SYS'}) {
$gopt_with_roomuhistos_path = $ENV{'ROOMU_SYS'};
print "The \$ROOMU_SYS env var is defined. I will pick that and use --with-roomuhistos-path=$gopt_with_roomuhistos_path\n";
}
# if it still not set, try autodetecting it
if(! -d $gopt_with_roomuhistos_path && $auto_detect) {
print "Auto-detecting the RooMUHistos include path...\n";
$matched = auto_detect("PlotUtils");
print "$gopt_with_roomuhistos_path \n";
if( $matched=~m/(\S*)\/PlotUtils/i ) {
$gopt_with_roomuhistos_path = $1;
}
print "Setting --with-roomuhistos-path=$gopt_with_roomuhistos_path\n";
}
# check
my $file = "$gopt_with_roomuhistos_path/PlotUtils/MUH1D.h";
if(! -e $file) {
print "*** Error *** You need to specify the RooMUHistos path using --with-roomuhistos-path=/some/path/\n";
print "*** Error *** Otherwise, you should --disable-roomuhistos\n\n";
exit 1;
}
}
# Save config options
#
print MKCONF "GOPT_ENABLE_PROFILER=$gopt_enable_profiler\n";
print MKCONF "GOPT_ENABLE_DOXYGEN_DOC=$gopt_enable_doxygen_doc\n";
print MKCONF "GOPT_ENABLE_DYLIBVERSION=$gopt_enable_dylibversion\n";
print MKCONF "GOPT_ENABLE_LOW_LEVEL_MESG=$gopt_enable_lowlevel_mesg\n";
print MKCONF "GOPT_ENABLE_LHAPDF=$gopt_enable_lhapdf\n";
print MKCONF "GOPT_ENABLE_CERNLIB=$gopt_enable_cernlib\n";
print MKCONF "GOPT_ENABLE_FLUX_DRIVERS=$gopt_enable_flux_drivers\n";
print MKCONF "GOPT_ENABLE_GEOM_DRIVERS=$gopt_enable_geom_drivers\n";
print MKCONF "GOPT_ENABLE_VLE_EXTENSION=$gopt_enable_vle_extension\n";
print MKCONF "GOPT_ENABLE_VHE_EXTENSION=$gopt_enable_vhe_extension\n";
print MKCONF "GOPT_ENABLE_VALIDATION_TOOLS=$gopt_enable_validation_tools\n";
print MKCONF "GOPT_ENABLE_MUELOSS=$gopt_enable_mueloss\n";
print MKCONF "GOPT_ENABLE_TEST=$gopt_enable_test\n";
print MKCONF "GOPT_ENABLE_GSL=$gopt_enable_gsl\n";
print MKCONF "GOPT_ENABLE_T2K=$gopt_enable_t2k\n";
print MKCONF "GOPT_ENABLE_NUMI=$gopt_enable_numi\n";
print MKCONF "GOPT_ENABLE_ATMO=$gopt_enable_atmo\n";
print MKCONF "GOPT_ENABLE_NUCLEON_DECAY=$gopt_enable_nucleon_decay\n";
print MKCONF "GOPT_ENABLE_RWGHT=$gopt_enable_rwght\n";
print MKCONF "GOPT_ENABLE_FASTSIM=$gopt_enable_fastsim\n";
print MKCONF "GOPT_ENABLE_MASTERCLASS=$gopt_enable_masterclass\n";
print MKCONF "GOPT_WITH_CXX_DEBUG_FLAG=$gopt_with_cxx_debug_flag\n";
print MKCONF "GOPT_WITH_CXX_OPTIMIZ_FLAG=-$gopt_with_cxx_optimiz_flag\n";
print MKCONF "GOPT_WITH_PROFILER_LIB=$gopt_with_profiler_lib\n";
print MKCONF "GOPT_WITH_DOXYGEN_PATH=$gopt_with_doxygen_path\n";
print MKCONF "GOPT_WITH_PYTHIA6_LIB=$gopt_with_pythia6_lib\n";
print MKCONF "GOPT_WITH_CERN_LIB=$gopt_with_cern_lib\n";
print MKCONF "GOPT_WITH_LHAPDF_LIB=$gopt_with_lhapdf_lib\n";
print MKCONF "GOPT_WITH_LHAPDF_INC=$gopt_with_lhapdf_inc\n";
print MKCONF "GOPT_WITH_LIBXML2_INC=$gopt_with_libxml2_inc\n";
print MKCONF "GOPT_WITH_LIBXML2_LIB=$gopt_with_libxml2_lib\n";
print MKCONF "GOPT_WITH_LOG4CPP_INC=$gopt_with_log4cpp_inc\n";
print MKCONF "GOPT_WITH_LOG4CPP_LIB=$gopt_with_log4cpp_lib\n";
# RooMUHistos
#
print MKCONF "GOPT_ENABLE_ROOMUHISTOS=$gopt_enable_roomuhistos\n";
print MKCONF "GOPT_WITH_ROOMUHISTOS_PATH=$gopt_with_roomuhistos_path\n";
close(MKCONF);
print "\nYour input configuration options were: @ARGV";
if($#ARGV < 0) { print "(none)" };
print "\n\n";
if(-e $MKCONF_FILE) {
print "The $MKCONF_FILE file has been succesfully generated! \n";
print "The following config options were set: \n";
open(MKCONFR, "<$MKCONF_FILE") or die("Can not read back the $GENIE/src/make/Make.config!");
@make_conf=<MKCONFR>;
close(MKCONFR);
# print "@make_conf\n" unless ;
foreach $setting (@make_conf) {
chomp($setting);
if ($setting=~m/\=/) {print " $setting\n";}
}
# Copy only the enable/disable options, excluding paths, in a separate file for genie-config.
# This is needed for FNAL relocatable releases.
system("cat $MKCONF_FILE | grep GOPT_ENABLE_ > $MKCONF_FILE\_no_paths");
print "\n";
print "*** To continue building GENIE type: gmake ";
# Warning for SRT users
if(defined $ENV{'SRT_ENV_SET'}) {
print "(Don't forget to 'srt_setup --unsetup' first)";
}
print "\n\n";
exit 0;
}
sub auto_detect {
@search_dir = ("/usr","/opt","/lib"); # std search paths
push (@search_dir,"$ENV{'HOME'}")
if defined $ENV{'HOME'}; # add $HOME
push (@search_dir,"/hep"); # add where I add ext apps in my mac book air
push (@search_dir,"$ENV{'RSD_TOP_DIR'}")
if defined $ENV{'RSD_TOP_DIR'}; # add where RSD puts ext supporting libs
$search_file = shift;
$optional_fullpath_substr = shift; # extra help in locating the correct file
$optional_fullpath_substr = "" unless defined $optional_fullpath_substr;
foreach(@search_dir) {
$curr_dir = $_;
if(! -d $curr_dir) {next;}
@matches = `find $curr_dir -type f -maxdepth 7 -name $search_file 2> /dev/null | grep \"$optional_fullpath_substr\"`;
$nmatches = @matches;
if( $nmatches > 0) { return $matches[0]; }
}
return "";
}