1 dnl GNOME_SUPPORT_CHECKS
2 dnl Check for various support functions needed by the standard
3 dnl Gnome libraries. Sets LIBOBJS, might define some macros.
4 dnl This should only be used when building the Gnome libs;
5 dnl Gnome clients should not need this macro.
6 AC_DEFUN([GNOME_SUPPORT_CHECKS],[
7 # we need an `awk' to build `gnomesupport.h'
8 AC_REQUIRE([AC_PROG_AWK])
10 # this should go away soon
11 need_gnome_support=yes
13 save_LIBOBJS="$LIBOBJS"
16 AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
21 # copied from `configure.in' of `libiberty'
22 vars="program_invocation_short_name program_invocation_name sys_errlist"
24 AC_MSG_CHECKING([for $v])
25 AC_CACHE_VAL(gnome_cv_var_$v,
26 [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
27 [eval "gnome_cv_var_$v=yes"],
28 [eval "gnome_cv_var_$v=no"])])
29 if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then
31 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
32 AC_DEFINE_UNQUOTED($n)
38 AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen)
39 AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf)
41 AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o")
43 # to include `error.c' error.c has some HAVE_* checks
44 AC_CHECK_FUNCS(vprintf doprnt strerror_r)
47 # This is required if we declare setreuid () and setregid ().
50 # see if we need to declare some functions. Solaris is notorious for
51 # putting functions into the `libc' but not listing them in the headers
52 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h)
53 GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize)
54 GCC_NEED_DECLARATION(scandir,[
60 # Turn our LIBOBJS into libtool objects. This is gross, but it
61 # requires changes to autoconf before it goes away.
62 LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
63 AC_SUBST(need_gnome_support)
66 LIBOBJS="$save_LIBOBJS"
67 AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes)