@@ -44,12 +44,14 @@ report_results()
44
44
echo " " | tee -a setup.csh setup.sh
45
45
if [[ -x " ${cmake_install_path} /cmake" ]]; then
46
46
echo " # Prepend the CMake path to the PATH environment variable:" | tee -a setup.sh setup.csh
47
- echo " if [[ -z \"\$ {PATH}\" ]]; then " >> setup.sh
48
- echo " export PATH=\" ${cmake_install_path%/ } / \" " >> setup.sh
47
+ echo " if [[ -z \"\$ {PATH}\" ]]; then " >> setup.sh
48
+ echo " export PATH=\" ${cmake_install_path%/ } \" " >> setup.sh
49
49
echo " else " >> setup.sh
50
- echo " export PATH=\" ${cmake_install_path%/ } /\" :\$ {PATH} " >> setup.sh
50
+ echo " if ! [[ \"\$ {PATH}\" =~ \" ${cmake_install_path} \" ]] ; then " >> setup.sh
51
+ echo " export PATH=\" ${cmake_install_path%/ } \" :\$ {PATH} " >> setup.sh
52
+ echo " fi " >> setup.sh
51
53
echo " fi " >> setup.sh
52
- echo " set path = (\" ${cmake_install_path%/ } \" / \"\$ path\" ) " >> setup.csh
54
+ echo " set path = (\" ${cmake_install_path%/ } \" \"\$ path\" ) " >> setup.csh
53
55
fi
54
56
if [[ -x " ${fully_qualified_FC} " ]]; then
55
57
echo " # Prepend the compiler path to the PATH environment variable:" | tee -a setup.sh setup.csh
@@ -60,15 +62,19 @@ report_results()
60
62
echo " fi " >> setup.sh
61
63
echo " set path = (\" ${compiler_install_root%/ } \" /bin \"\$ path\" ) " >> setup.csh
62
64
fi
65
+ LD_LIB_P_VAR=LD_LIBRARY_PATH
66
+ if [[ " ${OSTYPE:- } " =~ [Dd]arwin ]]; then
67
+ LD_LIB_P_VAR=DYLD_LIBRARY_PATH
68
+ fi
63
69
if [[ -d " ${compiler_install_root%/ } /lib" || -d " ${compiler_install_root%/ } /lib64" ]]; then
64
- echo " # Prepend the compiler library paths to the LD_LIBRARY_PATH environment variable:" | tee -a setup.sh setup.csh
70
+ echo " # Prepend the compiler library paths to the ${LD_LIB_P_VAR} environment variable:" | tee -a setup.sh setup.csh
65
71
compiler_lib_paths=" ${compiler_install_root%/ } /lib64/:${compiler_install_root%/ } /lib"
66
- echo " if [[ -z \"\$ {LD_LIBRARY_PATH }\" ]]; then " >> setup.sh
67
- echo " export LD_LIBRARY_PATH =\" ${compiler_lib_paths%/ } \" " >> setup.sh
72
+ echo " if [[ -z \"\$ {!LD_LIB_P_VAR }\" ]]; then " >> setup.sh
73
+ echo " export ${LD_LIB_P_VAR} =\" ${compiler_lib_paths%/ } \" " >> setup.sh
68
74
echo " else " >> setup.sh
69
- echo " export LD_LIBRARY_PATH =\" ${compiler_lib_paths%/ } :\$ {LD_LIBRARY_PATH }\" " >> setup.sh
75
+ echo " export ${LD_LIB_P_VAR} =\" ${compiler_lib_paths%/ } :\$ {!LD_LIB_P_VAR }\" " >> setup.sh
70
76
echo " fi " >> setup.sh
71
- echo " set LD_LIBRARY_PATH = (\" ${compiler_lib_paths%/ } \" /bin \"\$ LD_LIBRARY_PATH\" ) " >> setup.csh
77
+ echo " set LD_LIBRARY_PATH = (\" ${compiler_lib_paths%/ } \" \"\$ { LD_LIBRARY_PATH} \" ) " >> setup.csh
72
78
fi
73
79
echo " " >> setup.sh
74
80
if [[ -x " ${mpi_install_root} /bin/mpifort" ]]; then
0 commit comments