On Tue, May 5, 2015 at 12:32 PM, <[email protected]> wrote:

> ]Directory: /trunk/src/
> ======================
>
> File [modified]: detect.sh
> Delta lines: +11 -2
> ===================================================================
> --- trunk/src/detect.sh 2015-02-23 17:24:40 UTC (rev 102)
> +++ trunk/src/detect.sh 2015-05-05 16:32:59 UTC (rev 103)
> @@ -158,10 +158,19 @@
>  # Check for additional libraries
>
>  
> ################################################################################
>
> +# Set library directory name for machine architecture:
> +gcc -dumpversion > /dev/null 2>&1
> +
> +if [ $? -eq 0 ]; then
> +  MACHINE=${MACHINE:=`gcc -dumpmachine`}
> +else
> +  MACHINE=${MACHINE:=""}
> +fi
> +
>  # Set options
>  # Fortran modules may be located in the lib directory
> -HDF5_INC_DIRS="${HDF5_DIR}/include ${HDF5_DIR}/lib"
> -HDF5_LIB_DIRS="${HDF5_DIR}/lib"
> +HDF5_INC_DIRS="${HDF5_DIR}/include ${HDF5_DIR}/lib/${MACHINE}
> ${HDF5_DIR}/lib"
> +HDF5_LIB_DIRS="${HDF5_DIR}/lib/${MACHINE} ${HDF5_DIR}/lib"
>  HDF5_LIBS="${HDF5_CXX_LIBS} ${HDF5_FORTRAN_LIBS} ${HDF5_C_LIBS}"
>

This patch won't work.

1. The shell script detect.sh is set up such that any failing command will
immediately abort the script. Thus the check $? won't work. Instead, you
can run "gcc -dumpversion" directly in the if command.
2. "gcc -dumpversion" is called twice; it suffices to call it once.
3. There is a convention to have externally visible variable upper case,
and internal variables lower case.
4. The way in which MACHINE is set is overly complicated. Saying
"MACHINE=..." is sufficient, unless MACHINE can have a previous value.
5. If MACHINE is empty, then HDF5_LIB_DIRS still contains the string
"${HDF5_DIR}/lib/". This should be avoided.
6. A minor issue: They syntax $(...) is preferred over `...`.

Here is an updated version:

# Set library directory name for machine architecture
if machine=$(gcc -dumpversion 2>/dev/null); then
    machinedir="${HDF5_DIR}/lib/${machine}"
else
    machinedir=''
fi

# Set options
# Fortran modules may be located in the lib directory
HDF5_INC_DIRS="${HDF5_DIR}/include ${machinedir} ${HDF5_DIR}/lib"
HDF5_LIB_DIRS="${machinedir} ${HDF5_DIR}/lib"
HDF5_LIBS="${HDF5_CXX_LIBS} ${HDF5_FORTRAN_LIBS} ${HDF5_C_LIBS}"

I've updated thorn HDF5; can you update thorn Boost?

-erik

-- 
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/
_______________________________________________
Users mailing list
[email protected]
http://cactuscode.org/mailman/listinfo/users

Reply via email to