aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@src.gnome.org>1998-07-16 07:47:31 +0800
committerRaja R Harinath <harinath@src.gnome.org>1998-07-16 07:47:31 +0800
commit04472528403b0c43456e46b3fda3669c02949ee2 (patch)
tree4546519e9a36dba1c9dc54f88b3e92d9c76994b5
parent1f4e3ff9bc7aea7966cf7df0503582ef1f7657b0 (diff)
downloadgsoc2013-evolution-04472528403b0c43456e46b3fda3669c02949ee2.tar.gz
gsoc2013-evolution-04472528403b0c43456e46b3fda3669c02949ee2.tar.zst
gsoc2013-evolution-04472528403b0c43456e46b3fda3669c02949ee2.zip
Add `need-declaration.m4'.
* Makefile.am (MACROS): Add `need-declaration.m4'. * gnome-support.m4 (AC_REPLACE_FUNCS): Add memmove, strtod, strtol, strtoul. (GCC_NEED_DECLARATIONS): New check. Check whether `gethostname' needs to be declared. * need-declaration.m4: New file. Stolen from EGCS. svn path=/trunk/; revision=281
-rw-r--r--macros/ChangeLog11
-rw-r--r--macros/Makefile.am19
-rw-r--r--macros/gnome-support.m411
-rw-r--r--macros/need-declaration.m442
4 files changed, 71 insertions, 12 deletions
diff --git a/macros/ChangeLog b/macros/ChangeLog
index 73dce0126f..bd76fc01fd 100644
--- a/macros/ChangeLog
+++ b/macros/ChangeLog
@@ -1,3 +1,14 @@
+1998-07-15 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (MACROS): Add `need-declaration.m4'.
+
+ * gnome-support.m4 (AC_REPLACE_FUNCS): Add memmove, strtod,
+ strtol, strtoul.
+ (GCC_NEED_DECLARATIONS): New check. Check whether `gethostname'
+ needs to be declared.
+
+ * need-declaration.m4: New file. Stolen from EGCS.
+
1998-07-13 Raja R Harinath <harinath@cs.umn.edu>
* gnome-support.m4 (AC_REPLACE_FUNCS): Add check for `mkstemp'.
diff --git a/macros/Makefile.am b/macros/Makefile.am
index 5d1b1e378b..28dc457462 100644
--- a/macros/Makefile.am
+++ b/macros/Makefile.am
@@ -1,16 +1,17 @@
## Please update this variable if any new macros are created
-MACROS= \
+MACROS= \
aclocal-include.m4 \
- curses.m4 \
- gnome-fileutils.m4 \
+ curses.m4 \
+ gnome-fileutils.m4 \
gnome-guile-checks.m4 \
- gnome-libgtop-check.m4 \
- gnome-libgtop-sysdeps.m4 \
+ gnome-libgtop-check.m4 \
+ gnome-libgtop-sysdeps.m4 \
gnome-objc-checks.m4 \
- gnome-pthread-check.m4 \
- gnome-support.m4 \
- gnome-x-checks.m4 \
- gnome.m4
+ gnome-pthread-check.m4 \
+ gnome-support.m4 \
+ gnome-x-checks.m4 \
+ gnome.m4 \
+ need-declaration.m4
EXTRA_DIST=$(MACROS) autogen.sh macros.dep
MAINTAINERCLEANFILES=macros.dep
diff --git a/macros/gnome-support.m4 b/macros/gnome-support.m4
index 738c175a41..7d5fdbe1b1 100644
--- a/macros/gnome-support.m4
+++ b/macros/gnome-support.m4
@@ -78,10 +78,15 @@ AC_DEFUN([GNOME_SUPPORT_CHECKS],[
LIBOBJS="$LIBOBJS easy-vsnprintf.o",
LIBOBJS="$LIBOBJS vsnprintf.o")])
- AC_REPLACE_FUNCS(mkstemp scandir strcasecmp strerror strndup strnlen)
- AC_REPLACE_FUNCS(strtok_r vasprintf)
+ AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen)
+ AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf)
- if test "$LIBOBJS" != ""; then
+ # see if we need to declare some functions. Solaris is notorious for
+ # putting functions into the `libc' but not listing them in the headers
+ AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h)
+ GCC_NEED_DECLARATIONS(gethostname)
+
+ if test "$LIBOBJS$gcc_need_declarations" != ""; then
need_gnome_support=yes
fi
# Turn our LIBOBJS into libtool objects. This is gross, but it
diff --git a/macros/need-declaration.m4 b/macros/need-declaration.m4
new file mode 100644
index 0000000000..d5b7bc66d5
--- /dev/null
+++ b/macros/need-declaration.m4
@@ -0,0 +1,42 @@
+dnl See whether we need a declaration for a function.
+dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
+AC_DEFUN(GCC_NEED_DECLARATION,
+[AC_MSG_CHECKING([whether $1 must be declared])
+AC_CACHE_VAL(gcc_cv_decl_needed_$1,
+[AC_TRY_COMPILE([
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+$2],
+[char *(*pfn) = (char *(*)) $1],
+eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
+if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ gcc_need_declarations="$gcc_need_declarations $1"
+ gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ AC_DEFINE_UNQUOTED($gcc_tr_decl)
+else
+ AC_MSG_RESULT(no)
+fi
+])dnl
+
+dnl Check multiple functions to see whether each needs a declaration.
+dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
+AC_DEFUN(GCC_NEED_DECLARATIONS,
+[for ac_func in $1
+do
+GCC_NEED_DECLARATION($ac_func, $2)
+done
+]
+)