#! /usr/bin/perl -w # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # GENIE configuration script # # For help, type ./configure --help # # Costas Andreopoulos # University of Liverpool & STFC Rutherford Appleton Lab # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 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-lhapdf5 --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 " lhapdf5 Use the LHAPDF5 parton density function library default: enabled \n"; print " lhapdf6 Use the LHAPDF6 parton density function library default: disabled \n"; print " t2k T2K-specific event generation app default: disabled \n"; print " fnal FNAL-specific event generation app default: disabled \n"; print " atmo Atmospheric neutrino event generation app default: disabled \n"; print " nucleon-decay Nucleon decay simulation default: disabled \n"; print " nnbar-oscillation Simulation of nbar annihilation [n-nbar oscillation] default: disabled \n"; print " boosted-dark-matter Boosted dark matter simulation default: disabled \n"; print " flux-drivers Built-in flux drivers default: enabled \n"; print " geom-drivers Built-in detector geometry drivers default: enabled \n"; print " masterclass Enable GENIE neutrino masterclass app default: disabled (Experimental) \n"; print " test Build test programs default: disabled \n"; print " apfel Use APFEL to compute NLO structure functions default: disabled \n"; print "\n options for 3rd party software, prefix with --with- (eg --with-lhapdf5-lib=/some/path/)\n\n"; print " compiler Compiler to use (any of clang,gcc) default: gcc \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 " lhapdf5-inc Path to LHAPDF5 includes needed if you --enable-lhapdf5 (if unset: checks for a \$LHAPDF5_INC env.var., then tries to auto-detect it) \n"; print " lhapdf5-lib Path to LHAPDF5 libraries needed if you --enable-lhapdf5 (if unset: checks for a \$LHAPDF5_INC env.var.. then tries to auto-detect it) \n"; print " lhapdf6-inc Path to LHAPDF6 includes needed if you --enable-lhapdf6 (if unset: checks for a \$LHAPDF6_INC env.var., then tries to auto-detect it) \n"; print " lhapdf6-lib Path to LHAPDF6 libraries needed if you --enable-lhapdf6 (if unset: checks for a \$LHAPDF6_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"; print " apfel-inc Path to APFEL includes needed if you --enable-apfel \n"; print " apfel-lib Path to APFEL library needed if you --enable-apfel \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; # Print GENIE banner # $BANNER_FILE = "$GENIE/data/logo/genie_banner_short.txt"; if(-e $BANNER_FILE) { open(BANNER, "<$BANNER_FILE"); @hdr=; print @hdr; close(BANNER); } # Check that $ROOTSYS is set # $ROOTSYS = $ENV{'ROOTSYS'}; die ("*** Error *** The ROOTSYS environmental variable is not defined. Is ROOT installed?") unless defined $ROOTSYS; # Check whether ROOT itself was build with GSL enabled # (GENIE uses GSL via ROOT's MathMore library.) # { $mathmore_lib = "$ROOTSYS/lib/libMathMore.so"; if( ! -f $mathmore_lib ) { die ("*** Error *** ROOT needs to be built with GSL/MathMore enabled."); } } # 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_lhapdf5 = "YES"; my $gopt_enable_lhapdf6 = "NO"; my $gopt_enable_flux_drivers = "YES"; my $gopt_enable_geom_drivers = "YES"; my $gopt_enable_test = "NO"; my $gopt_enable_t2k = "NO"; my $gopt_enable_fnal = "NO"; my $gopt_enable_atmo = "NO"; my $gopt_enable_nucleon_decay = "NO"; my $gopt_enable_nnbar_oscillation = "NO"; my $gopt_enable_boosted_dark_mat = "NO"; my $gopt_enable_masterclass = "NO"; my $gopt_enable_apfel = "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(/--enable-lhapdf5/i, @ARGV)) > 0) { $gopt_enable_lhapdf5 = "YES"; } if(($match = grep(/--disable-lhapdf5/i, @ARGV)) > 0) { $gopt_enable_lhapdf5 = "NO"; } if(($match = grep(/--enable-lhapdf6/i, @ARGV)) > 0) { $gopt_enable_lhapdf6 = "YES"; } if(($match = grep(/--disable-lhapdf6/i, @ARGV)) > 0) { $gopt_enable_lhapdf6 = "NO"; } 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-test/i, @ARGV)) > 0) { $gopt_enable_test = "YES"; } if(($match = grep(/--enable-t2k/i, @ARGV)) > 0) { $gopt_enable_t2k = "YES"; } if(($match = grep(/--enable-fnal/i, @ARGV)) > 0) { $gopt_enable_fnal = "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-nnbar-oscillation/i, @ARGV)) > 0) { $gopt_enable_nnbar_oscillation = "YES"; } if(($match = grep(/--enable-boosted-dark-matter/i, @ARGV)) > 0) { $gopt_enable_boosted_dark_mat = "YES"; } if(($match = grep(/--enable-masterclass/i, @ARGV)) > 0) { $gopt_enable_masterclass = "YES"; } if(($match = grep(/--enable-apfel/i, @ARGV)) > 0) { $gopt_enable_apfel = "YES"; } # LHAPDF6 and 5 are mutually exlusive if ($gopt_enable_lhapdf6 eq "YES") { $gopt_enable_lhapdf5 = "NO";} my $gopt_with_cxx_debug_flag=""; if($gopt_enable_debug eq "YES") { $gopt_with_cxx_debug_flag = "-g"; } # Check compiler # my $gopt_with_compiler="gcc"; # default if( $options=~m/--with-compiler=(\S*)/i ) { $gopt_with_compiler = $1; } # 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(! -d $gopt_with_doxygen_path && defined $ENV{'DOXYGENPATH'}) { $gopt_with_doxygen_path = $ENV{'DOXYGENPATH'}; } # complain if(! -d $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-lhapdf5 was set then the full path to the LHAPDF5 library must be specified # my $gopt_with_lhapdf5_lib = ""; if($gopt_enable_lhapdf5 eq "YES") { if(($match = grep(/--with-lhapdf5-lib/i, @ARGV)) > 0) { $options=~m/--with-lhapdf5-lib=(\S*)/i; $gopt_with_lhapdf5_lib = $1; } if(! -d $gopt_with_lhapdf5_lib) { print "\n*** Warning *** LHAPDF5 has been enabled but you didn't specify the LHAPDF5 library path \n"; } # if it was not set, try to pick it up from the environment if($gopt_with_lhapdf5_lib eq "" && defined $ENV{'LHAPDF5_LIB'}) { $gopt_with_lhapdf5_lib = $ENV{'LHAPDF5_LIB'}; print "The \$LHAPDF5_LIB env var is defined. I will pick that and use --with-lhapdf5-lib=$gopt_with_lhapdf5_lib\n"; } # if it still not set, try autodetecting it if(! -d $gopt_with_lhapdf5_lib && $auto_detect) { print "Auto-detecting LHAPDF5 library path...\n"; $matched = auto_detect("libLHAPDF.a"); if( $matched=~m/(\S*)\/libLHAPDF.a/i ) { $gopt_with_lhapdf5_lib = $1; } print "Setting --with-lhapdf5-inc=$gopt_with_lhapdf5_lib\n"; } # check my $fileso = "$gopt_with_lhapdf5_lib/libLHAPDF.so"; my $filedylib = "$gopt_with_lhapdf5_lib/libLHAPDF.dylib"; if(! -e $fileso && ! -e $filedylib) { print "*** Error *** You need to specify the path to LHAPDF5 library using --with-lhapdf5-lib=/some/path/\n"; print "*** Error *** Otherwise, you should --disable-lhapdf5\n\n"; exit 1; } } # If --enable-lhapdf5 was set then the full path to the LHAPDF5 includes must be specified # my $gopt_with_lhapdf5_inc = ""; if($gopt_enable_lhapdf5 eq "YES") { if(($match = grep(/--with-lhapdf5-inc/i, @ARGV)) > 0) { $options=~m/--with-lhapdf5-inc=(\S*)/i; $gopt_with_lhapdf5_inc = $1; } if(! -d $gopt_with_lhapdf5_inc) { print "\n*** Warning *** LHAPDF5 has been enabled but you didn't specify the LHAPDF5 include path \n"; } # if it was not set, try to pick it up from the environment if($gopt_with_lhapdf5_inc eq "" && defined $ENV{'LHAPDF5_INC'}) { $gopt_with_lhapdf5_inc = $ENV{'LHAPDF5_INC'}; print "The \$LHAPDF5_INC env var is defined. I will pick that and use --with-lhapdf5-inc=$gopt_with_lhapdf5_inc\n"; } # if it still not set, try autodetecting it if(! -d $gopt_with_lhapdf5_inc && $auto_detect) { print "Auto-detecting the LHAPDF5 include path...\n"; $matched = auto_detect("LHAPDF.h","LHAPDF/LHAPDF.h"); print "$gopt_with_lhapdf5_inc \n"; if( $matched=~m/(\S*)\/LHAPDF\/LHAPDF.h/i ) { $gopt_with_lhapdf5_inc = $1; } print "Setting --with-lhapdf5-inc=$gopt_with_lhapdf5_inc\n"; } # check my $file = "$gopt_with_lhapdf5_inc/LHAPDF/LHAPDF.h"; if(! -e $file) { print "*** Error *** You need to specify the LHAPDF5 includes path using --with-lhapdf5-inc=/some/path/\n"; print "*** Error *** Otherwise, you should --disable-lhapdf5\n\n"; exit 1; } } # If --enable-lhapdf6 was set then the full path to the LHAPDF6 library must be specified # my $gopt_with_lhapdf6_lib = ""; if($gopt_enable_lhapdf6 eq "YES") { if(($match = grep(/--with-lhapdf6-lib/i, @ARGV)) > 0) { $options=~m/--with-lhapdf6-lib=(\S*)/i; $gopt_with_lhapdf6_lib = $1; } if(! -d $gopt_with_lhapdf6_lib) { print "\n*** Warning *** LHAPDF6 has been enabled but you didn't specify the LHAPDF6 library path \n"; } # if it was not set, try to pick it up from the environment if($gopt_with_lhapdf6_lib eq "" && defined $ENV{'LHAPDF6_LIB'}) { $gopt_with_lhapdf6_lib = $ENV{'LHAPDF6_LIB'}; print "The \$LHAPDF6_LIB env var is defined. I will pick that and use --with-lhapdf6-lib=$gopt_with_lhapdf6_lib\n"; } # if it still not set, try autodetecting it if(! -d $gopt_with_lhapdf6_lib && $auto_detect) { print "Auto-detecting LHAPDF6 library path...\n"; $matched = auto_detect("libLHAPDF.a"); if( $matched=~m/(\S*)\/libLHAPDF.a/i ) { $gopt_with_lhapdf6_lib = $1; } print "Setting --with-lhapdf6-inc=$gopt_with_lhapdf6_lib\n"; } # check my $fileso = "$gopt_with_lhapdf6_lib/libLHAPDF.so"; my $filedylib = "$gopt_with_lhapdf6_lib/libLHAPDF.dylib"; if(! -e $fileso && ! -e $filedylib) { print "*** Error *** You need to specify the path to LHAPDF6 library using --with-lhapdf6-lib=/some/path/\n"; print "*** Error *** Otherwise, you should --disable-lhapdf6\n\n"; exit 1; } } # If --enable-lhapdf6 was set then the full path to the LHAPDF6 includes must be specified # my $gopt_with_lhapdf6_inc = ""; if($gopt_enable_lhapdf6 eq "YES") { if(($match = grep(/--with-lhapdf6-inc/i, @ARGV)) > 0) { $options=~m/--with-lhapdf6-inc=(\S*)/i; $gopt_with_lhapdf6_inc = $1; } if(! -d $gopt_with_lhapdf6_inc) { print "\n*** Warning *** LHAPDF6 has been enabled but you didn't specify the LHAPDF6 include path \n"; } # if it was not set, try to pick it up from the environment if($gopt_with_lhapdf6_inc eq "" && defined $ENV{'LHAPDF6_INC'}) { $gopt_with_lhapdf6_inc = $ENV{'LHAPDF6_INC'}; print "The \$LHAPDF6_INC env var is defined. I will pick that and use --with-lhapdf6-inc=$gopt_with_lhapdf6_inc\n"; } # if it still not set, try autodetecting it if(! -d $gopt_with_lhapdf6_inc && $auto_detect) { print "Auto-detecting the LHAPDF6 include path...\n"; $matched = auto_detect("LHAPDF.h","LHAPDF/LHAPDF.h"); print "$gopt_with_lhapdf6_inc \n"; if( $matched=~m/(\S*)\/LHAPDF\/LHAPDF.h/i ) { $gopt_with_lhapdf6_inc = $1; } print "Setting --with-lhapdf6-inc=$gopt_with_lhapdf6_inc\n"; } # check my $file = "$gopt_with_lhapdf6_inc/LHAPDF/LHAPDF.h"; if(! -e $file) { print "*** Error *** You need to specify the LHAPDF6 includes path using --with-lhapdf6-inc=/some/path/\n"; print "*** Error *** Otherwise, you should --disable-lhapdf6\n\n"; exit 1; } } # 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; } # # --with-apfel-inc= # my $gopt_with_apfel_inc = ""; if($gopt_enable_apfel eq "YES") { if($options=~m/--with-apfel-inc=(\S*)/i) { $gopt_with_apfel_inc = $1; } if(! -d $gopt_with_apfel_inc) { print "*** Error *** You need to specify the apfel include path using --with-apfel-inc=/some/path/\n\n"; exit 1; } } # # --with-apfel-lib= # my $gopt_with_apfel_lib = ""; if($gopt_enable_apfel eq "YES") { if($options=~m/--with-apfel-lib=(\S*)/i) { $gopt_with_apfel_lib = $1; } if(! -d $gopt_with_apfel_lib) { print "*** Error *** You need to specify the apfel library path using --with-apfel-lib=/some/path/\n\n"; exit 1; } } # Save config options # print MKCONF "GOPT_ENABLE_LHAPDF5=$gopt_enable_lhapdf5\n"; print MKCONF "GOPT_ENABLE_LHAPDF6=$gopt_enable_lhapdf6\n"; print MKCONF "GOPT_ENABLE_T2K=$gopt_enable_t2k\n"; print MKCONF "GOPT_ENABLE_FNAL=$gopt_enable_fnal\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_NNBAR_OSCILLATION=$gopt_enable_nnbar_oscillation\n"; print MKCONF "GOPT_ENABLE_BOOSTED_DARK_MATTER=$gopt_enable_boosted_dark_mat\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_MASTERCLASS=$gopt_enable_masterclass\n"; print MKCONF "GOPT_ENABLE_TEST=$gopt_enable_test\n"; 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_APFEL=$gopt_enable_apfel\n"; print MKCONF "GOPT_WITH_COMPILER=$gopt_with_compiler\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_LHAPDF5_LIB=$gopt_with_lhapdf5_lib\n"; print MKCONF "GOPT_WITH_LHAPDF5_INC=$gopt_with_lhapdf5_inc\n"; print MKCONF "GOPT_WITH_LHAPDF6_LIB=$gopt_with_lhapdf6_lib\n"; print MKCONF "GOPT_WITH_LHAPDF6_INC=$gopt_with_lhapdf6_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"; print MKCONF "GOPT_WITH_APFEL_INC=$gopt_with_apfel_inc\n"; print MKCONF "GOPT_WITH_APFEL_LIB=$gopt_with_apfel_lib\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=; 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: make "; # 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 { # First place to look when autodetecting is in the directories in LD_LIBRARY_PATH my @libdirs = ( ); push (@libdirs,split(":",$ENV{LD_LIBRARY_PATH})) if defined $ENV{LD_LIBRARY_PATH}; push (@libdirs,split(":",$ENV{DYLD_LIBRARY_PATH})) if defined $ENV{DYLD_LIBRARY_PATH}; #and the mac equivalent my @search_dir = (); foreach my $libdir (unique_entries(@libdirs)) { chomp($libdir); if (not $libdir) {next;} push (@search_dir, $libdir); # Append the LD library path directory @pathdirs = split("/",$libdir); $lastdir = pop(@pathdirs); $basedir = join("/",@pathdirs); if ($lastdir =~ m/lib/) {# If the LD_LIBRARY_PATH has "lib" in it, append "../include" push (@search_dir, $basedir."/include"); } } push (@search_dir,"/usr"); # Add usr push (@search_dir,"/lib"); # Add opt push (@search_dir,"/opt"); # Add opt 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_dir = unique_entries(@search_dir); # Search each dir only once $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 ""; } # Get unique entries in an array sub unique_entries { my %seen; return grep { !$seen{$_}++ } @_; }