summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin E Martin <kem@kem.org>2005-12-03 01:13:36 +0000
committerKevin E Martin <kem@kem.org>2005-12-03 01:13:36 +0000
commit45811c86eb34e9f09e7d807ba4633107513f0d52 (patch)
tree3c501799c9817d22b28522c7737aff9d1e431f32
parentc03cc7739b37ca504a2b56a73945755c41c68b2a (diff)
Automatically generate FUNCPROTO and NARROWPROTO defines in Xfuncproto.h.
-rw-r--r--ChangeLog7
-rw-r--r--Xfuncproto.h.in108
-rw-r--r--configure.ac135
3 files changed, 250 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3dc2b2c..5b888cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-12-02 Kevin E. Martin <kem-at-freedesktop-dot-org>
+
+ * Xfuncproto.h.in:
+ * configure.ac:
+ Automatically generate FUNCPROTO and NARROWPROTO defines in
+ Xfuncproto.h.
+
2005-11-09 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
new file mode 100644
index 0000000..b08a1e8
--- /dev/null
+++ b/Xfuncproto.h.in
@@ -0,0 +1,108 @@
+/* $Xorg: Xfuncproto.h,v 1.4 2001/02/09 02:03:22 xorgcvs Exp $ */
+/*
+ *
+Copyright 1989, 1991, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+/* $XFree86: xc/include/Xfuncproto.h,v 3.4 2001/12/14 19:53:25 dawes Exp $ */
+
+/* Definitions to make function prototypes manageable */
+
+#ifndef _XFUNCPROTO_H_
+#define _XFUNCPROTO_H_
+
+#ifndef NeedFunctionPrototypes
+#define NeedFunctionPrototypes 1
+#endif /* NeedFunctionPrototypes */
+
+#ifndef NeedVarargsPrototypes
+#define NeedVarargsPrototypes 1
+#endif /* NeedVarargsPrototypes */
+
+#if NeedFunctionPrototypes
+
+#ifndef NeedNestedPrototypes
+#define NeedNestedPrototypes 1
+#endif /* NeedNestedPrototypes */
+
+#ifndef _Xconst
+#define _Xconst const
+#endif /* _Xconst */
+
+/* Function prototype configuration (see configure for more info) */
+#ifndef NARROWPROTO
+#undef NARROWPROTO
+#endif
+#ifndef FUNCPROTO
+#undef FUNCPROTO
+#endif
+
+#ifndef NeedWidePrototypes
+#ifdef NARROWPROTO
+#define NeedWidePrototypes 0
+#else
+#define NeedWidePrototypes 1 /* default to make interropt. easier */
+#endif
+#endif /* NeedWidePrototypes */
+
+#endif /* NeedFunctionPrototypes */
+
+#ifndef _XFUNCPROTOBEGIN
+#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
+#define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
+#define _XFUNCPROTOEND }
+#else
+#define _XFUNCPROTOBEGIN
+#define _XFUNCPROTOEND
+#endif
+#endif /* _XFUNCPROTOBEGIN */
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
+# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
+#else
+# define _X_SENTINEL(x)
+# define _X_ATTRIBUTE_PRINTF(x,y)
+#endif /* GNUC >= 4 */
+
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
+# define _X_EXPORT __attribute__((visibility("default")))
+# define _X_HIDDEN __attribute__((visibility("hidden")))
+# define _X_INTERNAL __attribute__((visibility("internal")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define _X_EXPORT __global
+# define _X_HIDDEN __hidden
+# define _X_INTERNAL __hidden
+#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
+# define _X_EXPORT
+# define _X_HIDDEN
+# define _X_INTERNAL
+#endif
+
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)
+# define _X_DEPRECATED __attribute__((deprecated))
+#else /* not gcc >= 3.1 */
+# define _X_DEPRECATED
+#endif
+
+#endif /* _XFUNCPROTO_H_ */
diff --git a/configure.ac b/configure.ac
index 1ffc87f..e89e4c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,6 +2,37 @@ AC_PREREQ([2.57])
AC_INIT([Xproto], [7.0.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AC_CONFIG_HEADER([do-not-use-config.h])
+AC_CONFIG_HEADER([Xfuncproto.h])
+
+AC_CANONICAL_HOST
+
+m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
+
+# Check for enable/disable options
+AC_ARG_ENABLE(function-prototypes,
+ AS_HELP_STRING([--enable-function-prototypes],
+ [force function prototypes (default: auto)]),
+ [FUNCPROTO=$enableval], [FUNCPROTO=auto])
+AC_ARG_ENABLE(varargs-prototypes,
+ AS_HELP_STRING([--enable-varargs-prototypes],
+ [varargs prototypes are supported (default: auto)]),
+ [VAPROTO=$enableval], [VAPROTO=auto])
+AC_ARG_ENABLE(const-prototypes,
+ AS_HELP_STRING([--enable-const-prototypes],
+ [const is supported (default: auto)]),
+ [CONSTPROTO=$enableval], [CONSTPROTO=auto])
+AC_ARG_ENABLE(nested-prototypes,
+ AS_HELP_STRING([--enable-nested-prototypes],
+ [nested prototypes are supported (default: auto)]),
+ [NESTEDPROTO=$enableval], [NESTEDPROTO=auto])
+AC_ARG_ENABLE(wide-prototypes,
+ AS_HELP_STRING([--enable-wide-prototypes],
+ [widen function prototypes (default: auto)]),
+ [WIDEPROTO=$enableval], [WIDEPROTO=auto])
+
+
+# Handle Xpoll.h.in
fds_bits_found=false;
if test "x$fds_bits_found" = xfalse ; then
@@ -35,6 +66,110 @@ fi
AC_SUBST([USE_FDS_BITS])
+
+# Handle Xfuncproto.h
+AC_MSG_CHECKING([whether const prototypes are supported])
+if test "x$CONSTPROTO" = xauto; then
+ case $host_os in
+ linux*) CONSTPROTO=yes ;;
+ freebsd*) CONSTPROTO=yes ;;
+ netbsd*) CONSTPROTO=yes ;;
+ openbsd*) CONSTPROTO=yes ;;
+ solaris*) CONSTPROTO=yes ;;
+ *) CONSTPROTO=no ;;
+ esac
+fi
+AC_MSG_RESULT([$CONSTPROTO])
+
+AC_MSG_CHECKING([whether varargs prototypes are supported])
+if test "x$VAPROTO" = xauto; then
+ case $host_os in
+ linux*) VAPROTO=yes ;;
+ freebsd*) VAPROTO=yes ;;
+ netbsd*) VAPROTO=yes ;;
+ openbsd*) VAPROTO=yes ;;
+ solaris*) VAPROTO=yes ;;
+ *) VAPROTO=no ;;
+ esac
+fi
+AC_MSG_RESULT([$VAPROTO])
+
+AC_MSG_CHECKING([whether nested prototypes are supported])
+if test "x$NESTEDPROTO" = xauto; then
+ case $host_os in
+ linux*) NESTEDPROTO=yes ;;
+ freebsd*) NESTEDPROTO=yes ;;
+ netbsd*) NESTEDPROTO=yes ;;
+ openbsd*) NESTEDPROTO=yes ;;
+ solaris*) NESTEDPROTO=yes ;;
+ *) NESTEDPROTO=no ;;
+ esac
+fi
+AC_MSG_RESULT([$NESTEDPROTO])
+
+AC_MSG_CHECKING([whether to force function prototypes])
+if test "x$FUNCPROTO" = xauto; then
+ case $host_os in
+ linux*) FUNCPROTO=yes ;;
+ freebsd*) FUNCPROTO=yes ;;
+ netbsd*) FUNCPROTO=yes ;;
+ openbsd*) FUNCPROTO=yes ;;
+ *)
+ if test "x$VAPROTO" = xyes && test "x$NESTEDPROTO" = xyes; then
+ FUNCPROTO=yes
+ else
+ FUNCPROTO=no
+ fi
+ ;;
+ esac
+fi
+AC_MSG_RESULT([$FUNCPROTO])
+
+# Logic for this was taken from Imake.tmpl
+if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes && test "x$NESTEDPROTO" = xyes && test "x$CONSTPROTO" = xyes; then
+ AC_DEFINE(FUNCPROTO, [15], [FUNCPROTO])
+else
+ if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes && test "x$NESTEDPROTO" = xyes; then
+ AC_DEFINE(FUNCPROTO, [11], [FUNCPROTO])
+ else
+ if test "x$FUNCPROTO" = xyes && test "x$NESTEDPROTO" = xyes; then
+ AC_DEFINE(FUNCPROTO, [9], [FUNCPROTO])
+ else
+ if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes && test "x$CONSTPROTO" = xyes; then
+ AC_DEFINE(FUNCPROTO, [7], [FUNCPROTO])
+ else
+ if test "x$FUNCPROTO" = xyes && test "x$CONSTPROTO" = xyes; then
+ AC_DEFINE(FUNCPROTO, [5], [FUNCPROTO])
+ else
+ if test "x$FUNCPROTO" = xyes && test "x$VAPROTO" = xyes; then
+ AC_DEFINE(FUNCPROTO, [3], [FUNCPROTO])
+ else
+ if test "x$FUNCPROTO" = xyes; then
+ AC_DEFINE(FUNCPROTO, [], [FUNCPROTO])
+ fi
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+AC_MSG_CHECKING([whether to widen function prototypes])
+if test "x$WIDEPROTO" = xauto; then
+ case $host_os in
+ linux*) WIDEPROTO=no ;;
+ freebsd*) WIDEPROTO=no ;;
+ netbsd*) WIDEPROTO=no ;;
+ openbsd*) WIDEPROTO=no ;;
+ *) WIDEPROTO=yes ;;
+ esac
+fi
+AC_MSG_RESULT([$WIDEPROTO])
+
+if test "x$WIDEPROTO" = xno; then
+ AC_DEFINE(NARROWPROTO, [], [Narrow prototypes])
+fi
+
XORG_RELEASE_VERSION
AC_OUTPUT([Makefile