Skip to content

Commit

Permalink
Replaced cwd and chdir with filesystem library
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniBussi committed Apr 27, 2023
1 parent 586569a commit 03032e2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 370 deletions.
318 changes: 0 additions & 318 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,7 @@ enable_external_molfile_plugins
enable_zlib
enable_dlopen
enable_rtld_default
enable_chdir
enable_subprocess
enable_getcwd
enable_popen
enable_execinfo
enable_gsl
Expand Down Expand Up @@ -1433,10 +1431,8 @@ Optional Features:
--enable-zlib enable search for zlib, default: yes
--enable-dlopen enable search for dlopen, default: yes
--enable-rtld_default enable search for RTLD_DEFAULT macro, default: yes
--enable-chdir enable search for chdir function, default: yes
--enable-subprocess enable search for functions needed to manage a
subprocess, default: yes
--enable-getcwd enable search for getcwd function, default: yes
--enable-popen enable search for popen, default: yes
--enable-execinfo enable search for execinfo, default: yes
--enable-gsl enable search for gsl, default: yes
Expand Down Expand Up @@ -2983,24 +2979,6 @@ fi



chdir=
# Check whether --enable-chdir was given.
if test "${enable_chdir+set}" = set; then :
enableval=$enable_chdir; case "${enableval}" in
(yes) chdir=true ;;
(no) chdir=false ;;
(*) as_fn_error $? "wrong argument to --enable-chdir" "$LINENO" 5 ;;
esac
else
case "yes" in
(yes) chdir=true ;;
(no) chdir=false ;;
esac

fi



subprocess=
# Check whether --enable-subprocess was given.
if test "${enable_subprocess+set}" = set; then :
Expand All @@ -3019,24 +2997,6 @@ fi



getcwd=
# Check whether --enable-getcwd was given.
if test "${enable_getcwd+set}" = set; then :
enableval=$enable_getcwd; case "${enableval}" in
(yes) getcwd=true ;;
(no) getcwd=false ;;
(*) as_fn_error $? "wrong argument to --enable-getcwd" "$LINENO" 5 ;;
esac
else
case "yes" in
(yes) getcwd=true ;;
(no) getcwd=false ;;
esac

fi



popen=
# Check whether --enable-popen was given.
if test "${enable_popen+set}" = set; then :
Expand Down Expand Up @@ -7437,145 +7397,6 @@ $as_echo "$as_me: WARNING: cannot enable __PLUMED_HAS_RTLD_DEFAULT" >&2;}

fi

if test $chdir = true ; then

found=ko
__PLUMED_HAS_CHDIR=no
ac_fn_cxx_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
if test "x$ac_cv_header_unistd_h" = xyes; then :


if test "${libsearch}" = true ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing chdir" >&5
$as_echo_n "checking for library containing chdir... " >&6; }
if ${ac_cv_search_chdir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char chdir ();
int
main ()
{
return chdir ();
;
return 0;
}
_ACEOF
for ac_lib in '' ; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_search_chdir=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_chdir+:} false; then :
break
fi
done
if ${ac_cv_search_chdir+:} false; then :

else
ac_cv_search_chdir=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_chdir" >&5
$as_echo "$ac_cv_search_chdir" >&6; }
ac_res=$ac_cv_search_chdir
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
found=ok
fi

else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing chdir" >&5
$as_echo_n "checking for library containing chdir... " >&6; }
if ${ac_cv_search_chdir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char chdir ();
int
main ()
{
return chdir ();
;
return 0;
}
_ACEOF
for ac_lib in '' ; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_search_chdir=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_chdir+:} false; then :
break
fi
done
if ${ac_cv_search_chdir+:} false; then :

else
ac_cv_search_chdir=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_chdir" >&5
$as_echo "$ac_cv_search_chdir" >&6; }
ac_res=$ac_cv_search_chdir
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
found=ok
fi

fi


fi


if test $found = ok ; then
$as_echo "#define __PLUMED_HAS_CHDIR 1" >>confdefs.h

__PLUMED_HAS_CHDIR=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable __PLUMED_HAS_CHDIR" >&5
$as_echo "$as_me: WARNING: cannot enable __PLUMED_HAS_CHDIR" >&2;}
fi

fi

if test $subprocess = true ; then

found=ko
Expand Down Expand Up @@ -7772,145 +7593,6 @@ $as_echo "$as_me: WARNING: cannot enable __PLUMED_HAS_SUBPROCESS" >&2;}

fi

if test $getcwd = true ; then

found=ko
__PLUMED_HAS_GETCWD=no
ac_fn_cxx_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
if test "x$ac_cv_header_unistd_h" = xyes; then :


if test "${libsearch}" = true ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getcwd" >&5
$as_echo_n "checking for library containing getcwd... " >&6; }
if ${ac_cv_search_getcwd+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char getcwd ();
int
main ()
{
return getcwd ();
;
return 0;
}
_ACEOF
for ac_lib in '' ; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_search_getcwd=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_getcwd+:} false; then :
break
fi
done
if ${ac_cv_search_getcwd+:} false; then :

else
ac_cv_search_getcwd=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getcwd" >&5
$as_echo "$ac_cv_search_getcwd" >&6; }
ac_res=$ac_cv_search_getcwd
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
found=ok
fi

else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getcwd" >&5
$as_echo_n "checking for library containing getcwd... " >&6; }
if ${ac_cv_search_getcwd+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char getcwd ();
int
main ()
{
return getcwd ();
;
return 0;
}
_ACEOF
for ac_lib in '' ; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_search_getcwd=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_getcwd+:} false; then :
break
fi
done
if ${ac_cv_search_getcwd+:} false; then :

else
ac_cv_search_getcwd=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getcwd" >&5
$as_echo "$ac_cv_search_getcwd" >&6; }
ac_res=$ac_cv_search_getcwd
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
found=ok
fi

fi


fi


if test $found = ok ; then
$as_echo "#define __PLUMED_HAS_GETCWD 1" >>confdefs.h

__PLUMED_HAS_GETCWD=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot enable __PLUMED_HAS_GETCWD" >&5
$as_echo "$as_me: WARNING: cannot enable __PLUMED_HAS_GETCWD" >&2;}
fi

fi

if test $popen = true ; then

found=ko
Expand Down
10 changes: 0 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,7 @@ PLUMED_CONFIG_ENABLE([external-molfile-plugins],[search for external molfile_plu
PLUMED_CONFIG_ENABLE([zlib],[search for zlib],[yes])
PLUMED_CONFIG_ENABLE([dlopen],[search for dlopen],[yes])
PLUMED_CONFIG_ENABLE([rtld_default],[search for RTLD_DEFAULT macro],[yes])
PLUMED_CONFIG_ENABLE([chdir],[search for chdir function],[yes])
PLUMED_CONFIG_ENABLE([subprocess],[search for functions needed to manage a subprocess],[yes])
PLUMED_CONFIG_ENABLE([getcwd],[search for getcwd function],[yes])
PLUMED_CONFIG_ENABLE([popen],[search for popen],[yes])
PLUMED_CONFIG_ENABLE([execinfo],[search for execinfo],[yes])
PLUMED_CONFIG_ENABLE([gsl],[search for gsl],[yes])
Expand Down Expand Up @@ -745,10 +743,6 @@ main ()
], [__PLUMED_HAS_RTLD_DEFAULT])
fi

if test $chdir = true ; then
PLUMED_CHECK_PACKAGE([unistd.h],[chdir],[__PLUMED_HAS_CHDIR])
fi

if test $subprocess = true ; then
PLUMED_CHECK_CXX_PACKAGE([subprocess],[
/* random program calling all the functions needed to manage a subprocess */
Expand Down Expand Up @@ -784,10 +778,6 @@ main ()
], [__PLUMED_HAS_SUBPROCESS])
fi

if test $getcwd = true ; then
PLUMED_CHECK_PACKAGE([unistd.h],[getcwd],[__PLUMED_HAS_GETCWD])
fi

if test $popen = true ; then
PLUMED_CHECK_PACKAGE([cstdio],[popen],[__PLUMED_HAS_POPEN])
fi
Expand Down
Loading

1 comment on commit 03032e2

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/a-masterclass-22-09.txt
Found broken examples in automatic/a-masterclass-22-11.txt
Found broken examples in automatic/a-masterclass-22-12.txt
Found broken examples in automatic/performance-optimization.txt
Found broken examples in automatic/a-trieste-6.txt
Found broken examples in automatic/munster.txt
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/ENVIRONMENTSIMILARITY.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/GHBFIX.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/MAZE_MEMETIC_SAMPLING.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_RANDOM_WALK.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in MiscelaneousPP.md

Please sign in to comment.