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]) |
---|
9 | |
---|
10 | # this should go away soon |
---|
11 | need_gnome_support=yes |
---|
12 | |
---|
13 | save_LIBOBJS="$LIBOBJS" |
---|
14 | LIBOBJS= |
---|
15 | |
---|
16 | AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o") |
---|
17 | |
---|
18 | # for `scandir' |
---|
19 | AC_HEADER_DIRENT |
---|
20 | |
---|
21 | # copied from `configure.in' of `libiberty' |
---|
22 | vars="program_invocation_short_name program_invocation_name sys_errlist" |
---|
23 | for v in $vars; do |
---|
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 |
---|
30 | AC_MSG_RESULT(yes) |
---|
31 | n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` |
---|
32 | AC_DEFINE_UNQUOTED($n) |
---|
33 | else |
---|
34 | AC_MSG_RESULT(no) |
---|
35 | fi |
---|
36 | done |
---|
37 | |
---|
38 | AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen) |
---|
39 | AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf) |
---|
40 | |
---|
41 | AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o") |
---|
42 | |
---|
43 | # to include `error.c' error.c has some HAVE_* checks |
---|
44 | AC_CHECK_FUNCS(vprintf doprnt strerror_r) |
---|
45 | AM_FUNC_ERROR_AT_LINE |
---|
46 | |
---|
47 | # This is required if we declare setreuid () and setregid (). |
---|
48 | AC_TYPE_UID_T |
---|
49 | |
---|
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,[ |
---|
55 | #ifdef HAVE_DIRENT_H |
---|
56 | #include <dirent.h> |
---|
57 | #endif |
---|
58 | ]) |
---|
59 | |
---|
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) |
---|
64 | AC_SUBST(LTLIBOBJS) |
---|
65 | |
---|
66 | LIBOBJS="$save_LIBOBJS" |
---|
67 | AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes) |
---|
68 | ]) |
---|