#!/usr/bin/perl -w # $Id:$ use strict; use warnings; use Cwd qw(abs_path); use Getopt::Long; my @user = $ENV{'USER'}; my @hostName = $ENV{'HOST'}; my @outfile = abs_path"makefile.init"; print "Make include file is @outfile\n"; # Make sure there's a Makefile file. die "Makefile is missing in the current directory!\n" unless -e 'makefile'; if ( -e abs_path"build/Makefile.init" ) {print "here;\n"}; if ( -e abs_path"build/Makefile.init" ) { print "File for this machine is already there. Do you really want to re-config (n/y):\n"; my $input = ; chomp $input; if ( $input eq "n" ) { die "Stop configuration \n" } } # Default values for command-line options. my %opt = ( HDF4_PATH => '${SSEC_HDF4_DIR}', HDF5_PATH => '${SSEC_HDF5_DIR}', NETCDF_PATH => '${SSEC_NETCDF_DIR}', ); my @sargv = @ARGV; GetOptions( \%opt, 'HDF4_PATH=s', 'HDF5_PATH=s', 'NETCDF_PATH=s', 'help' ) or die "Error parsing command-line options!\n"; # Help. usage() if $opt{help}; open (CONFIG, '> ',@outfile) or die "Could not open file '@outfile' $!)\n"; print CONFIG '# This file was generated on ' . localtime() . " by $ENV{USER}", " with the following command-line arguments: @sargv.\n# System info: ", `uname -a`; print CONFIG "# Include all required macros on the following lines:\n\n"; print CONFIG "export HDF4_PATH =$opt{HDF4_PATH}\n"; print CONFIG "export HDF5_PATH =$opt{HDF5_PATH}\n"; print CONFIG "export NETCDF_PATH = $opt{NETCDF_PATH}\n"; # print CONFIG "hdf5libs = -I$opt{hdf5_ifort}include/ -L$opt{hdf5_ifort}lib/\n"; close CONFIG; print "The CX_SDS_IO IFORT source code is configured for build on this system.\n"; exit; sub usage { print < Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --hdf5_ifort= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --netcdf_ifort= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --dncomp_ifort= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --cx_sds_io_ifort= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --hdf4_gcc= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --hdf5_gcc= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --netcdf_gcc= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --dncomp_gcc= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. --cx_sds_io_gcc= Path to the directory where HDF library and include files are stored. Default is the root path SSEC global variable of hdf4 library SSEC_HDF4_LIB / ../. HELP exit; }