Skip to content
Snippets Groups Projects
mpi-config 3.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • Christian Engwer's avatar
    Christian Engwer committed
    #!/bin/bash
    
         echo Usage: canonicalname path >&2
    
      name="$1"
      while test -L "$name"; do
        if ! test -e "$name"; then
    
          echo $name: file not found >&2
    
          return 1
        fi
        if newname="`readlink $name`"; then
          name="$newname"
        else
          echo "$(dirname $name)/$(basename $name)"
        fi
      done
      echo $name
    
         echo Usage: canonicalpath path >&2
    
         return 1
      fi
      (cd $(dirname $(canonicalname $1)) && pwd)
    
    findm4dir() {
      BINDIR="$(canonicalpath $0)"
    
    Christian Engwer's avatar
    Christian Engwer committed
      # source-build
    
      M4DIR="$BINDIR/../m4"
      if test -f "$M4DIR/mpi-config.m4"; then
        echo "$M4DIR"
        return
      fi
    
    Christian Engwer's avatar
    Christian Engwer committed
      # installed
    
      M4DIR="$BINDIR/../share/dune/aclocal"
    
      if test -f "$M4DIR/mpi-config.m4"; then
        echo "$M4DIR"
        return
      fi
    
    Christian Engwer's avatar
    Christian Engwer committed
      # downloaded
      M4DIR="$BINDIR"
      if test -f "$M4DIR/mpi-config.m4"; then
        echo "$M4DIR"
        return
      fi
    
      echo "ERROR: could not find mpi-config.m4! Incomplete installation?" >&2
    
    mpi-config is a tool to help you determine the compiler and linker flags that
    you need in order to build your code with MPI.  It is very similar to pkg-config,
    but doesn't rely on help from your MPI installation.  If/when MPI implementations
    start supporting pkg-config then mpi-config will become obsolete.
      
    
    Usage: mpi-config [OPTIONS] [LIBRARIES]
    Options:
     [--mpicc[=COMPILER]]
     [--disable-cxx]
     [--verbose]
     [--version]
     [--mpiversion]
     [--libs]
     [--cflags]
    
    EOF
      exit $1
    }
    
    if test $# -eq 0 ; then
      usage 1 1>&2
    fi
    
    while test $# -gt 0 ; do
      case "$1" in
      -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
      *) optarg= ;;
      esac
    
      case $1 in
      --mpicc=*)
        MPICC=$optarg
        ;;
      --version)
        echo $version
        exit 0
        ;;
      --verbose)
        verbose=1
        ;;
      --disable-cxx)
        disablecxx=yes
        ;;
      --mpiversion)
        tasks="$tasks print_mpiversion"
        ;;
      --cflags)
        tasks="$tasks print_cflags"
        ;;
    
      --ldflags)
        tasks="$tasks print_ldflags"
        ;;
    
    Christian Engwer's avatar
    Christian Engwer committed
    if test x$MPICC = x ; then
    
    # find m4 file
    M4DIR=`findm4dir`
    
    
    m4 -I$M4DIR <<EOF
    
    changequote([, ])
    define([AC_DEFUN],[define([\$1],[\$2])])
    define([AC_MSG_CHECKING],[
    
    ])
    define([AC_MSG_NOTICE],[
      if test $verbose -gt 0; then
        echo "\$@"
    
    ])
    define([AC_MSG_ERROR],[
      if test $verbose -gt 0; then
        echo "Error: \$@"
        exit 1
    
    
    print_mpiversion() {
      get_mpiparameters
      echo $MPI_VERSION
    }
    
    print_cflags() {
      get_mpiparameters
    
    Christian Engwer's avatar
    Christian Engwer committed
      if test x$disablecxx = xyes; then
    
        DUNEMPICPPFLAGS="$DUNEMPICPPFLAGS $MPI_NOCXXFLAGS"
    
      echo $DUNEMPICPPFLAGS
    }
    
    print_ldflags() {
      get_mpiparameters
      echo $DUNEMPILDFLAGS
    
      echo $DUNEMPILIBS