Skip to content
Snippets Groups Projects
Commit 17028220 authored by Christian Engwer's avatar Christian Engwer
Browse files

fixed canonicalpath, first try readlink, if it's a file use the real name

[[Imported from SVN: r4715]]
parent 879ed810
No related branches found
No related tags found
No related merge requests found
...@@ -2,23 +2,20 @@ ...@@ -2,23 +2,20 @@
set -e set -e
# Get the canonical path (without using readlink) canonicalname(){
# Does not work for weired file names
canonicalizepath(){
if test $# -ne 1; then if test $# -ne 1; then
echo Usage: canonicalizepath path echo Usage: canonicalname path > /dev/stderr
return 1 return 1
fi fi
local searchpath="$PATH:.:$(dirname $0)" readlink $1 || echo "$(dirname $1)/$(basename $1)"
local prog=$(echo $0 | sed 's/.*\/\([-_a-zA-Z0-9]*\)$/\1/') }
for i in `echo $searchpath | sed -e 's/:/ /g'`; do
if test -e "$i/$prog" ; then canonicalpath(){
canonicalpath="$i" if test $# -ne 1; then
return 0 echo Usage: canonicalpath path > /dev/stderr
fi return 1
done fi
echo "Error: no canonical path found" (cd $(dirname $(canonicalname $1)) && pwd)
exit 1
} }
if test "x$1" = "x--debug"; then if test "x$1" = "x--debug"; then
...@@ -32,8 +29,7 @@ fi ...@@ -32,8 +29,7 @@ fi
# Read the modules find part # Read the modules find part
canonicalizepath $0 . $(canonicalpath $0)/dunemodules.inc
. $canonicalpath/dunemodules.inc
### ###
...@@ -251,7 +247,7 @@ while test $# -gt 0; do ...@@ -251,7 +247,7 @@ while test $# -gt 0; do
echo echo
exit 1; exit 1;
fi fi
OPTS_FILE=$(cd $(dirname $(readlink -f $arg)); pwd)/$(basename $arg) OPTS_FILE=$(canonicalpath $arg)/$(basename $arg)
if ! test -r "$OPTS_FILE"; then if ! test -r "$OPTS_FILE"; then
usage usage
echo "ERROR: could not read opts file \"$OPTS_FILE\"" echo "ERROR: could not read opts file \"$OPTS_FILE\""
......
...@@ -9,22 +9,20 @@ ...@@ -9,22 +9,20 @@
set -e set -e
# Get the canonical path (without using readlink) canonicalname(){
canonicalizepath(){
if test $# -ne 1; then if test $# -ne 1; then
echo Usage: canonicalizepath path echo Usage: canonicalname path > /dev/stderr
return 1 return 1
fi fi
local searchpath="$PATH:.:$(dirname $0)" readlink $1 || echo "$(dirname $1)/$(basename $1)"
local prog=$(echo $0 | sed 's/.*\/\([-_a-zA-Z0-9]*\)$/\1/') }
for i in `echo $searchpath | sed -e 's/:/ /g'`; do
if test -e "$i/$prog" ; then canonicalpath(){
canonicalpath="$i" if test $# -ne 1; then
return echo Usage: canonicalpath path > /dev/stderr
fi return 1
done fi
echo "Error: no canonical path found" (cd $(dirname $(canonicalname $1)) && pwd)
exit 1
} }
echo Dune project/module generator echo Dune project/module generator
...@@ -42,8 +40,7 @@ while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do ...@@ -42,8 +40,7 @@ while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do
MODULE="$PROJECT" MODULE="$PROJECT"
# Read the modules find part # Read the modules find part
canonicalizepath $0 . $(canonicalpath $0)/dunemodules.inc
. $(cd $canonicalpath; pwd)/dunemodules.inc
if [ "$MODULES" = "" ]; then if [ "$MODULES" = "" ]; then
find_modules . find_modules .
......
...@@ -2,22 +2,20 @@ ...@@ -2,22 +2,20 @@
set -e set -e
# Get the canonical path (without using readlink) canonicalname(){
canonicalizepath(){
if test $# -ne 1; then if test $# -ne 1; then
echo Usage: canonicalizepath path echo Usage: canonicalname path > /dev/stderr
return 1 return 1
fi fi
local searchpath="$PATH:.:$(dirname $0)" readlink $1 || echo "$(dirname $1)/$(basename $1)"
local prog=$(echo $0 | sed 's/.*\/\([-_a-zA-Z0-9]*\)$/\1/') }
for i in `echo $searchpath | sed -e 's/:/ /g'`; do
if test -e "$i/$prog" ; then canonicalpath(){
canonicalpath="$i" if test $# -ne 1; then
return 0 echo Usage: canonicalpath path > /dev/stderr
fi return 1
done fi
echo "Error: no canonical path found" (cd $(dirname $(canonicalname $1)) && pwd)
exit 1
} }
version=0.1 version=0.1
...@@ -90,11 +88,8 @@ fi ...@@ -90,11 +88,8 @@ fi
# load mpi-config.m4 # load mpi-config.m4
# #
# Read the modules find part
canonicalizepath $0
eval "$( eval "$(
m4 -I$canonicalpath/../m4/ <<EOF m4 -I$(canonicalpath $0/../m4/) <<EOF
changequote([, ]) changequote([, ])
define([AC_DEFUN],[define([\$1],[\$2])]) define([AC_DEFUN],[define([\$1],[\$2])])
define([AC_MSG_CHECKING],[ define([AC_MSG_CHECKING],[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment