#! /bin/bash # # $HEADER$ # # This script is run on developer copies of Open MPI -- *not* # distribution tarballs. ############################################################################## # # User-definable parameters (search path and minimum supported versions) # ############################################################################## ompi_aclocal_search="aclocal" ompi_autoheader_search="autoheader" ompi_autoconf_search="autoconf" ompi_libtoolize_search="libtoolize glibtoolize" ompi_automake_search="automake" ompi_automake_version="1.7" ompi_autoconf_version="2.58" ompi_libtool_version="1.5" ############################################################################## # # Global variables - should not need to modify defaults # ############################################################################## ompi_aclocal_version="$ompi_automake_version" ompi_autoheader_version="$ompi_autoconf_version" ompi_libtoolize_version="$ompi_libtool_version" # program names to execute ompi_aclocal="" ompi_autoheader="" ompi_autoconf="" ompi_libtoolize="" ompi_automake="" mca_no_configure_components_file="config/mca_no_configure_components.m4" mca_no_config_list_file="mca_no_config_list" mca_no_config_amc_file="mca_no_config_amc" autogen_subdir_file="autogen.subdirs" ############################################################################ # # Version check - does major,minor,release check (hopefully ignoring # beta et al) # # INPUT: # - minimum version allowable # - version we found # # OUTPUT: # - 0 version is ok # - 1 version is not ok # # SIDE EFFECTS: # none # ############################################################################## check_version() { local min_version="$1" local version="$2" local min_major_version="`echo $min_version | cut -f1 -d.`" local min_minor_version="`echo $min_version | cut -f2 -d.`" local min_release_version="`echo $min_version | cut -f3 -d.`" if test "$min_release_version" = "" ; then min_release_version=0 fi local major_version="`echo $version | cut -f1 -d.`" local minor_version="`echo $version | cut -f2 -d.`" local release_version="`echo $version | cut -f3 -d.`" if test "$release_version" = "" ; then release_version=0 fi if test $min_major_version -lt $major_version ; then return 0 elif test $min_major_version -gt $major_version ; then return 1 fi if test $min_minor_version -lt $minor_version ; then return 0 elif test $min_minor_version -gt $minor_version ; then return 1 fi if test $min_release_version -gt $release_version ; then return 1 fi return 0 } ############################################################################## # # find app - find a version of the given application that is new # enough for use # # INPUT: # - name of application (eg aclocal) # # OUTPUT: # none # # SIDE EFFECTS: # - sets application_name variable to working executable name # - aborts on error finding application # ############################################################################## find_app() { local app_name="$1" local version="0.0.0" local min_version="99.99.99" local found=0 eval "min_version=\"\$ompi_${app_name}_version\"" eval "search_path=\"\$ompi_${app_name}_search\"" for i in $search_path ; do version="`${i} --version 2>&1`" if test "$?" != 0 ; then continue fi version="`echo $version | cut -f2 -d')'`" version="`echo $version | cut -f1 -d' '`" if check_version $min_version $version ; then eval "ompi_${app_name}=\"${i}\"" found=1 break fi done if test "$found" = "0" ; then cat < Errr... there's no configure.in or configure.ac file!" fi if test -n "$fad_cfile"; then auxdir="`grep AC_CONFIG_AUX_DIR $fad_cfile | cut -d\( -f 2 | cut -d\) -f 1`" fi if test -f "$auxdir/$fad_file"; then rm -f "$auxdir/$fad_file" fi fi } ############################################################################## # # run_gnu_tools - run the GNU tools in a given directory # # INPUT: # - OMPI top directory # # OUTPUT: # none # # SIDE EFFECTS: # - assumes that the directory is ready to have the GNU tools run # in it (i.e., there's some form of configure.*) # - may preprocess the directory before running the GNU tools # (e.g., generale Makefile.am's from configure.params, etc.) # ############################################################################## run_gnu_tools() { rgt_ompi_topdir="$1" # Sanity check to ensure that there's a configure.in or # configure.ac file here, or if there's a configure.params # file and we need to run make_configure.pl. if test -f configure.params -a -f configure.stub -a \ -x "$rgt_ompi_topdir/config/mca_make_configure.pl"; then cat < Err... there's no configure.in or configure.ac file in this directory" --> Confused; aborting in despair EOF exit 1 fi unset happy # Find and delete the GNU helper script files find_and_delete config.guess find_and_delete config.sub find_and_delete depcomp find_and_delete install-sh find_and_delete ltconfig find_and_delete ltmain.sh find_and_delete missing find_and_delete mkinstalldirs find_and_delete libtool # Run the GNU tools echo "*** Running GNU tools" run_and_check $ompi_aclocal if test "`grep AC_CONFIG_HEADER $file`" != "" -o \ "`grep AM_CONFIG_HEADER $file`" != ""; then run_and_check $ompi_autoheader fi run_and_check $ompi_autoconf # We only need the libltdl stuff for the top-level # configure, not any of the MCA components. if test -f include/mpi.h; then rm -rf libltdl src/libltdl src/ltdl.h run_and_check $ompi_libtoolize --automake --copy --ltdl mv libltdl src echo "Adjusting libltdl for OMPI :-(" echo " -- patching for argz bugfix in libtool 1.5" cd src/libltdl if test "`grep 'while ((before >= *pargz) && (before[-1] != LT_EOS_CHAR))' ltdl.c`" != ""; then patch -N -p0 <= *pargz) && (before[-1] != LT_EOS_CHAR)) + while ((before > *pargz) && (before[-1] != LT_EOS_CHAR)) --before; { EOF else echo " ==> your libtool doesn't need this! yay!" fi cd ../.. echo " -- patching configure for broken -c/-o compiler test" sed -e 's/chmod -w \./#OMPI\/MPI FIX: chmod -w ./' \ configure > configure.new mv configure.new configure chmod a+x configure else run_and_check $ompi_libtoolize --automake --copy fi run_and_check $ompi_automake --foreign -a --copy --include-deps } ############################################################################## # # process_dir - look at the files present in a given directory, and do # one of the following: # - skip/ignore it # - run custom autogen.sh in it # - run the GNU tools in it # - get a list of Makefile.am's to add to the top-level configure # # INPUT: # - directory to run in # - OMPI top directory # # OUTPUT: # none # # SIDE EFFECTS: # - skips directories with .ompi_no_gnu .ompi_ignore # - uses provided autogen.sh if available # ############################################################################## process_dir() { pd_dir="$1" pd_ompi_topdir="$2" pd_cur_dir="`pwd`" # Convert to absolutes if test -d "$pd_dir"; then cd "$pd_dir" pd_abs_dir="`pwd`" cd "$pd_cur_dir" fi if test -d "$pd_ompi_topdir"; then cd "$pd_ompi_topdir" pd_ompi_topdir="`pwd`" cd "$pd_cur_dir" fi if test -d "$pd_dir"; then cd "$pd_dir" # See if the package doesn't want us to set it up if test -f .ompi_no_gnu; then cat <> $pd_list_file <> $pd_amc_file <> $pd_list_file done # Add this component directory to the list of # subdirectories to traverse when building. cat >> $pd_list_file <--version.h.template.in. In there, # have #define's with values that are @foo@ (i.e., # the result of AC_SUBST) make_version_header_template "$pd_ver_header_base" "$pd_component_type" "$pd_component_name" # 2. Add the template header file to the list of # AC_CONFIG_FILES so that AC_SUBST'ed things will # be substituted in. cat >> $pd_list_file <--version.h file unchanged (and # therefore its timestamp unaltered) if nothing # changed. cat >> $pd_list_file < /dev/null 2>&1 if test "\$?" != "0"; then cp "$pd_ver_header.template" "$pd_ver_header" echo "config.status: regenerating $pd_ver_header" else echo "config.state: $pd_ver_header unchanged" fi else cp "$pd_ver_header.template" "$pd_ver_header" echo "config.status: creating $pd_ver_header" fi rm $pd_ver_header.template]) EOF fi # Setup the AM_CONDITIONAL to build this component cat >> $pd_amc_file < Adding to top-level configure no-configure subdirs: --> $pd_dir --> Adding to top-level configure AC_CONFIG_FILES list: --> $PARAM_CONFIG_FILES EOF fi else cat < Found $autogen_subdir_file -- sub-traversing..." echo "" for dir in `cat $autogen_subdir_file`; do if test -d "$dir"; then echo "*** Running autogen.sh in $dir" echo "*** (started in $pd_subdir_start_dir)" cd "$dir" $pd_ompi_topdir/autogen.sh -l cd "$pd_subdir_start_dir" echo "" fi done echo "<== Back in $pd_subdir_start_dir" echo "<== autogen.sh continuing..." fi # Go back to the topdir cd "$pd_cur_dir" fi unset PARAM_CONFIG_FILES PARAM_VERSION_FILE unset pd_dir pd_ompi_topdir pd_cur_dir pd_component_type } ############################################################################## # # make_template_version_header -- make a templated version header # file, but only if we have a PARAM_VERSION_FILE that exists # # INPUT: # - filename base # - component type name # - component name # # OUTPUT: # none # # SIDE EFFECTS: # ############################################################################## make_version_header_template() { mvht_filename="$1" mvht_component_type="$2" mvht_component_name="$3" # See if we have a VERSION file . ./configure.params if test -z "$PARAM_VERSION_FILE"; then if test -f "VERSION"; then PARAM_VERSION_FILE="VERSION" fi else if test ! -f "$PARAM_VERSION_FILE"; then PARAM_VERSION_FILE= fi fi if test -n "$PARAM_VERSION_FILE" -a -f "$PARAM_VERSION_FILE" -a \ "$pd_component_type" != "common"; then rm -f "$mvht_filename.template.in" cat > "$mvht_filename.template.in" < "$mca_no_configure_components_file" <