Commit b7bd0036 authored by Niels Möller's avatar Niels Möller

* acinclude.m4 (LSH_GCC_FUNCTION_NAME, LSH_FUNC_ALLOCA)

(LSH_FUNC_STRERROR, LSH_FUNC_STRSIGNAL): New macros.
* configure.ac: Use them.

Rev: acinclude.m4:1.15
Rev: configure.ac:1.39
parent c69648dd
......@@ -313,3 +313,78 @@ AH_BOTTOM(
# define UNUSED
#endif
])])
AC_DEFUN([LSH_GCC_FUNCTION_NAME],
[# Check for gcc's __FUNCTION__ variable
AH_TEMPLATE([HAVE_GCC_FUNCTION],
[Define if the compiler understands __FUNCTION__])
AH_BOTTOM(
[#if HAVE_GCC_FUNCTION
# define FUNCTION_NAME __FUNCTION__
#else
# define FUNCTION_NAME "Unknown"
#endif
])
AC_CACHE_CHECK(for __FUNCTION__,
lsh_cv_c_FUNCTION,
[ AC_TRY_COMPILE(,
[ #if __GNUC__ == 3
# error __FUNCTION__ is broken in gcc-3
#endif
void foo(void) { char c = __FUNCTION__[0]; } ],
lsh_cv_c_FUNCTION=yes,
lsh_cv_c_FUNCTION=no)])
if test "x$lsh_cv_c_FUNCTION" = "xyes"; then
AC_DEFINE(HAVE_GCC_FUNCTION)
fi
])
# Check for alloca, and include the standard blurb in config.h
AC_DEFUN([LSH_FUNC_ALLOCA],
[AC_FUNC_ALLOCA
AH_BOTTOM(
[/* AIX requires this to be the first thing in the file. */
#ifndef __GNUC__
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#endif
])])
AC_DEFUN([LSH_FUNC_STRERROR],
[AC_CHECK_FUNCS(strerror)
AH_BOTTOM(
[#if HAVE_STRERROR
#define STRERROR strerror
#else
#define STRERROR(x) (sys_errlist[x])
#endif
])])
AC_DEFUN([LSH_FUNC_STRSIGNAL],
[AC_CHECK_FUNCS(strsignal)
AC_CHECK_DECLS([sys_siglist, _sys_siglist])
AH_BOTTOM(
[#if HAVE_STRSIGNAL
# define STRSIGNAL strsignal
#else /* !HAVE_STRSIGNAL */
# if HAVE_DECL_SYS_SIGLIST
# define STRSIGNAL(x) (sys_siglist[x])
# else
# if HAVE_DECL__SYS_SIGLIST
# define STRSIGNAL(x) (_sys_siglist[x])
# endif
# endif
#endif /* !HAVE_STRSIGNAL */
])])
......@@ -520,10 +520,12 @@ AC_CHECK_SIZEOF(long, 4)
# Checks for library functions.
AC_FUNC_ALLOCA
LSH_FUNC_ALLOCA
LSH_FUNC_STRERROR
LSH_FUNC_STRSIGNAL
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(select socket strerror strsignal strtol alarm)
AC_CHECK_FUNCS(select socket strtol alarm)
AC_CHECK_FUNCS(getrusage gettimeofday)
AC_CHECK_FUNCS(getspnam)
AC_CHECK_FUNCS(vsnprintf inet_aton)
......@@ -723,23 +725,7 @@ if test x$lsh_cv_sys_unix98_ptys = xyes; then
fi
LSH_GCC_ATTRIBUTES
# Check for gcc's __FUNCTION__ variable
AC_CACHE_CHECK(for __FUNCTION__,
lsh_cv_c_FUNCTION,
[ AC_TRY_COMPILE(,
[ #if __GNUC__ == 3
# error __FUNCTION__ is broken in gcc-3
#endif
void foo(void) { char c = __FUNCTION__[0]; } ],
lsh_cv_c_FUNCTION=yes,
lsh_cv_c_FUNCTION=no)])
AH_TEMPLATE([HAVE_GCC_FUNCTION],
[Define if the compiler understands __FUNCTION__])
if test "x$lsh_cv_c_FUNCTION" = "xyes"; then
AC_DEFINE(HAVE_GCC_FUNCTION)
fi
LSH_GCC_FUNCTION_NAME
AC_MSG_CHECKING(for BSD pty names)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment