aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cobol/util.cc19
-rw-r--r--gcc/config.in6
-rwxr-xr-xgcc/configure2
-rw-r--r--gcc/configure.ac2
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index 62ecd98..101a0a0 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -72,6 +72,25 @@ extern int yyparse(void);
extern int demonstration_administrator(int N);
+#if !defined (HAVE_GET_CURRENT_DIR_NAME)
+/* Posix platforms might not have get_current_dir_name but should have
+ getcwd() and PATH_MAX. */
+#if __has_include (<limits.h>)
+# include <limits.h>
+#endif
+/* The Hurd doesn't define PATH_MAX. */
+#if !defined (PATH_MAX) && defined(__GNU__)
+# define PATH_MAX 4096
+#endif
+static inline char *
+get_current_dir_name ()
+{
+ /* Use libiberty's allocator here. */
+ char *buf = (char *) xmalloc (PATH_MAX);
+ return getcwd (buf, PATH_MAX);
+}
+#endif
+
const char *
symbol_type_str( enum symbol_type_t type )
{
diff --git a/gcc/config.in b/gcc/config.in
index 0b46faa..bc60d36 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1624,6 +1624,12 @@
#endif
+/* Define to 1 if you have the `get_current_dir_name' function. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GET_CURRENT_DIR_NAME
+#endif
+
+
/* Define to 1 if using GNU as. */
#ifndef USED_FOR_TARGET
#undef HAVE_GNU_AS
diff --git a/gcc/configure b/gcc/configure
index 0ef47a9..ae1d349 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -10640,7 +10640,7 @@ for ac_func in times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo mallinfo2 fstatat getauxval \
- clock_gettime munmap msync
+ clock_gettime munmap msync get_current_dir_name
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 4ac419a..8ef11e3 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1574,7 +1574,7 @@ AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat getauxval \
- clock_gettime munmap msync)
+ clock_gettime munmap msync get_current_dir_name)
# At least for glibc, clock_gettime is in librt. But don't pull that
# in if it still doesn't give us the function we want.