Skip to content

Commit

Permalink
revert c changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Apr 9, 2024
1 parent 51b1027 commit 9b4962f
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 83 deletions.
34 changes: 21 additions & 13 deletions bin/h5cc.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ host_os="@host_os@"

prog_name="`basename $0`"

qargs=""
misc_args=""
compile_args=""
libraries=""
link_args=""
Expand All @@ -71,7 +71,8 @@ clibpath=""

do_link="yes"
do_compile="no"
dash_c=""
dash_o="no"
dash_c="no"
get_output_file="no"

SHOW="eval"
Expand Down Expand Up @@ -208,10 +209,12 @@ for arg in $@ ; do
fi

do_link="no"
dash_c="-c"
dash_c="yes"
;;
-o)
if test "x$dash_c" = "x-c"; then
dash_o="yes"

if test "x$dash_c" = "xyes"; then
compile_args="$compile_args $arg"
else
link_args="$link_args $arg"
Expand All @@ -221,7 +224,7 @@ for arg in $@ ; do
;;
-E|-M|-MT)
compile_args="$compile_args $arg"
dash_c="-c"
dash_c="yes"
do_link="no"
;;
-l*)
Expand Down Expand Up @@ -256,14 +259,16 @@ for arg in $@ ; do
usage
;;
*\"*)
tmp="'"$arg"'"
qargs="$qargs $tmp"
qarg="'"$arg"'"
misc_args="$misc_args $qarg"
;;
*\'*)
tmp='"'"$arg"'"'
qargs="$qargs $tmp"
qarg='"'"$arg"'"'
misc_args="$misc_args $qarg"
;;
*)
misc_args="$misc_args $qarg"

if test -s "$arg"; then
ext=`expr "$arg" : '.*\(\..*\)'`

Expand All @@ -273,7 +278,7 @@ for arg in $@ ; do
fname=`basename $arg .c`
link_objs="$link_objs $fname.o"
elif test "x$ext" = "x.o"; then
if test "x$dash_c" = "x-c"; then
if test "x$dash_c" = "xyes"; then
compile_args="$compile_args $arg"
else
do_link="yes"
Expand All @@ -293,15 +298,18 @@ for arg in $@ ; do
;;
esac
done
link_args="$link_args $qargs"
if test "$dash_c" = "-c" -a "$do_compile" = no -a "$do_link" = no ; then

if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then
# -c was specified. Force do_compile on.
do_compile=yes
fi

if test "x$do_compile" = "xyes"; then
if test "x$dash_c" != "xyes"; then
compile_args="-c $compile_args"
fi

$SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $dash_c $qargs $compile_args
$SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $misc_args $compile_args
status=$?

if test "$status" != "0"; then
Expand Down
74 changes: 42 additions & 32 deletions c++/src/h5c++.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ host_os="@host_os@"

prog_name="`basename $0`"

qargs=""
misc_args=""
compile_args=""
libraries=""
link_args=""
Expand All @@ -69,7 +69,8 @@ clibpath=""

do_link="yes"
do_compile="no"
dash_c=""
dash_o="no"
dash_c="no"
get_output_file="no"

SHOW="eval"
Expand Down Expand Up @@ -204,10 +205,12 @@ for arg in $@ ; do
fi

do_link="no"
dash_c="-c"
dash_c="yes"
;;
-o)
if test "x$dash_c" = "x-c"; then
dash_o="yes"

if test "x$dash_c" = "xyes"; then
compile_args="$compile_args $arg"
else
link_args="$link_args $arg"
Expand All @@ -217,7 +220,7 @@ for arg in $@ ; do
;;
-E|-M|-MT)
compile_args="$compile_args $arg"
dash_c="-c"
dash_c="yes"
do_link="no"
;;
-l*)
Expand Down Expand Up @@ -246,47 +249,54 @@ for arg in $@ ; do
usage
;;
*\"*)
tmp="'"$arg"'"
qargs="$qargs $tmp"
qarg="'"$arg"'"
misc_args="$misc_args $qarg"
;;
*\'*)
tmp='"'"$arg"'"'
qargs="$qargs $tmp"
qarg='"'"$arg"'"'
misc_args="$misc_args $qarg"
;;

*)
if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
if [ "$ext" = ".C" -o "$ext" = ".cxx" -o "$ext" = ".cpp" -o \
"$ext" = ".cc" -o "$ext" = ".c" -o "$ext" = ".CC" ] ; then
misc_args="$misc_args $qarg"

if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
if [ "$ext" = ".C" -o "$ext" = ".cxx" -o "$ext" = ".cpp" -o \
"$ext" = ".cc" -o "$ext" = ".c" -o "$ext" = ".CC" ] ; then

do_compile="yes"
compile_args="$compile_args $arg"
fname=`basename $arg $ext`
link_objs="$link_objs $fname.o"
elif [ "$ext" = ".o" ] ; then
if test "x$dash_c" = "x-c" ; then
compile_args="$compile_args $arg"
else
do_link="yes"
link_objs="$link_objs $arg"
fi
elif test "x$ext" = "x.a"; then
# This is an archive that we're linking in
libraries=" $libraries $arg "
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
fi
elif [ "$ext" = ".o" ] ; then
if test "x$dash_c" = "xyes" ; then
compile_args="$compile_args $arg"
else
do_link="yes"
link_objs="$link_objs $arg"
fi
elif test "x$ext" = "x.a"; then
# This is an archive that we're linking in
libraries=" $libraries $arg "
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
fi
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
compile_args="$compile_args $arg"
link_args="$link_args $arg"
fi
;;
;;
esac
done
link_args="$link_args $qargs"

if test "x$do_compile" = "xyes"; then
if test "x$dash_c" != "xyes"; then
compile_args="-c $compile_args"
fi

$SHOW $CXX -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $dash_c $qargs $compile_args
$SHOW $CXX -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $misc_args $compile_args
status=$?

if test "$status" != "0"; then
Expand Down
84 changes: 46 additions & 38 deletions fortran/src/h5fc.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ host_os="@host_os@"

prog_name="`basename $0`"

qargs=""
misc_args=""
compile_args=""
link_args=""
link_objs=""

do_link="yes"
do_compile="no"
dash_c=""
dash_o="no"
dash_c="no"
get_output_file="no"

SHOW="eval"
Expand Down Expand Up @@ -182,10 +183,12 @@ for arg in $@ ; do
fi

do_link="no"
dash_c="-c"
dash_c="yes"
;;
-o)
if test "x$dash_c" = "x-c"; then
dash_o="yes"

if test "x$dash_c" = "xyes"; then
compile_args="$compile_args $arg"
else
link_args="$link_args $arg"
Expand All @@ -195,7 +198,7 @@ for arg in $@ ; do
;;
-E|-M|-MT)
compile_args="$compile_args $arg"
dash_c="-c"
dash_c="yes"
do_link="no"
;;
-l*)
Expand Down Expand Up @@ -230,58 +233,63 @@ for arg in $@ ; do
usage
;;
*\"*)
tmp="'"$arg"'"
qargs="$qargs $tmp"
qarg="'"$arg"'"
misc_args="$misc_args $qarg"
;;
*\'*)
tmp='"'"$arg"'"'
qargs="$qargs $tmp"
qarg='"'"$arg"'"'
misc_args="$misc_args $qarg"
;;
*)
if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
if [ "$ext" = ".f" -o "$ext" = ".F" -o \
"$ext" = ".for" -o "$ext" = ".FOR" -o \
"$ext" = ".ftn" -o "$ext" = ".FTN" -o \
"$ext" = ".f90" -o "$ext" = ".F90" -o \
"$ext" = ".f95" -o "$ext" = ".F95" -o \
"$ext" = ".f03" -o "$ext" = ".F03" -o \
"$ext" = ".f08" -o "$ext" = ".F08" ] ; then

*) misc_args="$misc_args $arg"
if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
if [ "$ext" = ".f" -o "$ext" = ".F" -o \
"$ext" = ".for" -o "$ext" = ".FOR" -o \
"$ext" = ".ftn" -o "$ext" = ".FTN" -o \
"$ext" = ".f90" -o "$ext" = ".F90" -o \
"$ext" = ".f95" -o "$ext" = ".F95" -o \
"$ext" = ".f03" -o "$ext" = ".F03" -o \
"$ext" = ".f08" -o "$ext" = ".F08" ] ; then
do_compile="yes"
compile_args="$compile_args $arg"
fname=`basename $arg $ext`
link_objs="$link_objs $fname.o"
elif [ "$ext" = ".o" ] ; then
if test "x$dash_c" = "x-c" ; then
compile_args="$compile_args $arg"
else
do_link="yes"
link_objs="$link_objs $arg"
fi
elif test "x$ext" = "x.a"; then
# This is an archive that we're linking in
libraries=" $libraries $arg "
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
fi
elif [ "$ext" = ".o" ] ; then
if test "x$dash_c" = "xyes" ; then
compile_args="$compile_args $arg"
else
do_link="yes"
link_objs="$link_objs $arg"
fi
elif test "x$ext" = "x.a"; then
# This is an archive that we're linking in
libraries=" $libraries $arg "
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
fi
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
compile_args="$compile_args $arg"
link_args="$link_args $arg"
fi
;;
;;
esac
done
link_args="$link_args $qargs"

# It's possible that there isn't a modules flag...
fmodules=""
if test -n "$F9XMODFLAG"; then
fmodules="${F9XMODFLAG}${fmoddir}"
fi

if test "x$do_compile" = "xyes"; then
if test "x$dash_c" != "xyes"; then
compile_args="-c $compile_args"
fi


$SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $dash_c $qargs $compile_args
$SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $misc_args $compile_args
status=$?

if test "$status" != "0"; then
Expand Down

0 comments on commit 9b4962f

Please sign in to comment.