mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-22 20:35:44 +01:00
configure tries cp -r -n
This commit is contained in:
parent
52a00468c0
commit
69aa17862c
28
configure.ac
28
configure.ac
@ -98,6 +98,31 @@ case $CC in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check if `cp -r -n` works, otherwise use `cp -r`
|
||||
AC_CHECK_PROGS(CP_PROG, [cp])
|
||||
|
||||
AC_MSG_CHECKING([for cp -r -n option])
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <unistd.h>
|
||||
],[
|
||||
execl("/bin/sh", "sh", "-c", "mkdir tmpdir1 && \
|
||||
touch tmpdir1/test_file && \
|
||||
$CP_PROG -r -n tmpdir1 tmpdir2 && \
|
||||
exec ls tmpdir2/test_file", NULL);
|
||||
])],
|
||||
[ rm -rf tmpdir1 tmpdir2
|
||||
CP_COMMAND="\"$CP_PROG\", \"-r\", \"-n\""
|
||||
AC_MSG_RESULT([yes])],
|
||||
[ rm -rf tmpdir1 tmpdir2
|
||||
CP_COMMAND="\"$CP_PROG\", \"-r\""
|
||||
AC_MSG_RESULT([no])],
|
||||
[ rm -rf tmpdir1 tmpdir2
|
||||
CP_COMMAND="\"$CP_PROG\", \"-r\""
|
||||
AC_MSG_RESULT([no])]
|
||||
)
|
||||
AC_DEFINE_UNQUOTED([CP_COMMAND], [$CP_COMMAND], [Command used for trexio_cp])
|
||||
|
||||
|
||||
## ---------
|
||||
## Libraries
|
||||
@ -175,6 +200,9 @@ AC_TYPE_INT64_T
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT64_T
|
||||
AC_TYPE_PID_T
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
|
||||
# Checks for library functions.
|
||||
# AC_FUNC_MALLOC
|
||||
|
@ -1590,7 +1590,7 @@ def _inquire(file_name: str) -> bool:
|
||||
|
||||
** File copy
|
||||
|
||||
~trexio_cp~ copies a TREXIO file using =/bin/cp=.
|
||||
~trexio_cp~ copies a TREXIO file using =cp=.
|
||||
|
||||
**Input parameters:**
|
||||
1) ~source_file_name~ - string containing the name of the source file
|
||||
@ -1654,16 +1654,16 @@ trexio_cp(const char* source, const char* dest)
|
||||
if (pid == 0) {
|
||||
switch (back_end_local) {
|
||||
case TREXIO_TEXT:
|
||||
execl("/bin/cp", "/bin/cp", "-r", "-n", source, dest, (char *)0);
|
||||
execlp("cp", CP_COMMAND, source, dest, (char *)0);
|
||||
case TREXIO_HDF5:
|
||||
#ifdef HAVE_HDF5
|
||||
execl("/bin/cp", "/bin/cp", "-n", source, dest, (char *)0);
|
||||
execlp("cp", CP_COMMAND, source, dest, (char *)0);
|
||||
#else
|
||||
return TREXIO_FILE_ERROR;
|
||||
#endif
|
||||
/*
|
||||
case TREXIO_JSON:
|
||||
execl("/bin/cp", "/bin/cp", source, dest, (char *)0);
|
||||
execlp("cp", CP_COMMAND, source, dest, (char *)0);
|
||||
,*/
|
||||
default:
|
||||
return TREXIO_FILE_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user