summaryrefslogtreecommitdiff
path: root/configure.ac
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 /configure.ac
parentc03cc7739b37ca504a2b56a73945755c41c68b2a (diff)
Automatically generate FUNCPROTO and NARROWPROTO defines in Xfuncproto.h.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac135
1 files changed, 135 insertions, 0 deletions
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