/* Define to 1 if you have the <complex.h> header file. */
#undef HAVE_COMPLEX_H
+/* Define to 1 if you have the declaration of `program_invocation_short_name',
+ and to 0 if you don't. */
+#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
/* Define to 1 if you have the <fenv.h> header file. */
#undef HAVE_FENV_H
/* Define to 1 if you have the <fptrap.h> header file. */
#undef HAVE_FPTRAP_H
+/* Define to 1 if you have the `getprogname' function. */
+#undef HAVE_GETPROGNAME
+
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
} # ac_fn_cxx_check_header_compile
+# ac_fn_cxx_check_decl LINENO SYMBOL VAR INCLUDES
+# -----------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_cxx_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_cxx_check_decl
+
# ac_fn_cxx_check_func LINENO FUNC VAR
# ------------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
as_fn_append ac_header_list " fptrap.h"
as_fn_append ac_header_list " complex.h"
as_fn_append ac_header_list " stdlib.h"
+as_fn_append ac_header_list " errno.h"
+as_fn_append ac_func_list " getprogname"
as_fn_append ac_func_list " random_r"
as_fn_append ac_func_list " srandom_r"
as_fn_append ac_func_list " initstate_r"
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11753 "configure"
+#line 11801 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11859 "configure"
+#line 11907 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-# These are GLIBC
+
+
+# Look for a way to represent the program name
+# First, check the GLIBC case
+ac_fn_cxx_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "
+#if HAVE_ERRNO_H
+# define _GNU_SOURCE
+# include <errno.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl
+_ACEOF
+
+
+# Check an alternate
+# These are GLIBC
+
+
+
+
AC_SUBST(extra_ldflags_libgcobol)
AC_CHECK_HEADERS_ONCE(floatingpoint.h ieeefp.h fenv.h fptrap.h \
-complex.h stdlib.h)
+complex.h stdlib.h errno.h)
+
+# Look for a way to represent the program name
+# First, check the GLIBC case
+AC_CHECK_DECLS([program_invocation_short_name], , ,[
+#if HAVE_ERRNO_H
+# define _GNU_SOURCE
+# include <errno.h>
+#endif
+])
+
+# Check an alternate
+AC_CHECK_FUNCS_ONCE(getprogname)
# These are GLIBC
AC_CHECK_FUNCS_ONCE(random_r srandom_r initstate_r setstate_r)
#include <signal.h>
#include <syslog.h>
#include <unistd.h>
+#if __has_include(<errno.h>)
+# include <errno.h> // for program_invocation_short_name
+#endif
#include "config.h"
#include "libgcobol-fp.h"
static void
default_exception_handler( ec_type_t ec )
{
- extern char *program_invocation_short_name;
+#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+ /* Declared in errno.h, when available. */
+ const char *ident = program_invocation_short_name;
+#elif defined (HAVE_GETPROGNAME)
+ /* Declared in stdlib.h. */
+ const char *ident = getprogname();
+#else
+ /* Avoid a NULL entry. */
+ const char *ident = "unnamed_COBOL_program";
+#endif
static bool first_time = true;
static int priority = LOG_INFO, option = LOG_PERROR, facility = LOG_USER;
- const char *ident = program_invocation_short_name;
ec_disposition_t disposition = ec_category_fatal_e;
if( first_time ) {