summaryrefslogtreecommitdiff
path: root/pkgtools/compat_headers
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2008-05-25 18:32:28 +0000
committertnn <tnn@pkgsrc.org>2008-05-25 18:32:28 +0000
commitf36cb919d88cae5c2cf6f8c4a8c988904b22ffb0 (patch)
treed296f032c239de1f651cd445fc4729acc16bb115 /pkgtools/compat_headers
parentdd38987dacef58dfefad7fe3cfce1a3839c4d941 (diff)
downloadpkgsrc-f36cb919d88cae5c2cf6f8c4a8c988904b22ffb0.tar.gz
If there is no va_copy(), provide one and just assume the compiler knows
how to copy va_lists by value.
Diffstat (limited to 'pkgtools/compat_headers')
-rw-r--r--pkgtools/compat_headers/files/Makefile.in10
-rw-r--r--pkgtools/compat_headers/files/config.h.in3
-rwxr-xr-xpkgtools/compat_headers/files/configure77
-rw-r--r--pkgtools/compat_headers/files/configure.in20
-rw-r--r--pkgtools/compat_headers/files/stdarg.h.in8
5 files changed, 116 insertions, 2 deletions
diff --git a/pkgtools/compat_headers/files/Makefile.in b/pkgtools/compat_headers/files/Makefile.in
index ca98c42352d..43129f67b4b 100644
--- a/pkgtools/compat_headers/files/Makefile.in
+++ b/pkgtools/compat_headers/files/Makefile.in
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.in,v 1.2 2008/05/24 22:11:20 tnn Exp $
+# $NetBSD: Makefile.in,v 1.3 2008/05/25 18:32:28 tnn Exp $
REPLACE_stdint= @REPLACE_stdint@
REPLACE_inttypes= @REPLACE_inttypes@
@@ -6,6 +6,7 @@ REPLACE_resolv= @REPLACE_resolv@
REPLACE_sys_select= @REPLACE_sys_select@
REPLACE_math= @REPLACE_math@
REPLACE_stdlib= @REPLACE_stdlib@
+REPLACE_stdarg= @REPLACE_stdarg@
PREFIX= @prefix@
DESTDIR?=
@@ -30,6 +31,9 @@ all: .PHONY
.if ${REPLACE_stdlib} == "yes"
./mkhdr.sh stdlib.h < stdlib.h.in > stdlib.h
.endif
+.if ${REPLACE_stdarg} == "yes"
+ ./mkhdr.sh stdarg.h < stdarg.h.in > stdarg.h
+.endif
install: .PHONY
printf "" > PLIST
@@ -59,3 +63,7 @@ install: .PHONY
${INSTALL} -m 644 stdlib.h ${DESTDIR}${PREFIX}/include
echo include/stdlib.h >> PLIST
.endif
+.if ${REPLACE_stdarg} == "yes"
+ ${INSTALL} -m 644 stdarg.h ${DESTDIR}${PREFIX}/include
+ echo include/stdarg.h >> PLIST
+.endif
diff --git a/pkgtools/compat_headers/files/config.h.in b/pkgtools/compat_headers/files/config.h.in
index 95392282bce..be706a66593 100644
--- a/pkgtools/compat_headers/files/config.h.in
+++ b/pkgtools/compat_headers/files/config.h.in
@@ -22,6 +22,9 @@
#undef CH_FLOORF
/* descr */
+#undef CH_HAVE_VA_COPY
+
+/* descr */
#undef CH_HPUX
/* descr */
diff --git a/pkgtools/compat_headers/files/configure b/pkgtools/compat_headers/files/configure
index 4ef7795dff3..1b3e97b73ed 100755
--- a/pkgtools/compat_headers/files/configure
+++ b/pkgtools/compat_headers/files/configure
@@ -688,6 +688,7 @@ REPLACE_inttypes
REPLACE_resolv
REPLACE_sys_select
REPLACE_stdlib
+REPLACE_stdarg
REPLACE_math
CPP
GREP
@@ -2861,6 +2862,8 @@ REPLACE_resolv=no
REPLACE_sys_select=no
REPLACE_stdlib=no
REPLACE_math=no
+REPLACE_stdarg=no
+
@@ -2892,6 +2895,12 @@ _ACEOF
cat >>confdefs.h <<\_ACEOF
+#define CH_HAVE_VA_COPY 0
+_ACEOF
+
+
+
+cat >>confdefs.h <<\_ACEOF
#define CH_FLOORF 0
_ACEOF
@@ -4381,6 +4390,74 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+#
+# Check for va_copy
+#
+
+# XXX needs to be TRY_RUN
+{ $as_echo "$as_me:$LINENO: checking if we have va_copy" >&5
+$as_echo_n "checking if we have va_copy... " >&6; }
+if test "$cross_compiling" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+void foo(va_list x, va_list y) {va_copy(x, y);}
+int main(void) {return 0;}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cat >>confdefs.h <<\_ACEOF
+#define CH_HAVE_VA_COPY 1
+_ACEOF
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+REPLACE_stdarg=yes
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
#
# Make sure we have float math functions, provide macros otherwise.
#
diff --git a/pkgtools/compat_headers/files/configure.in b/pkgtools/compat_headers/files/configure.in
index bf96581fcaf..ab7737ec652 100644
--- a/pkgtools/compat_headers/files/configure.in
+++ b/pkgtools/compat_headers/files/configure.in
@@ -1,4 +1,4 @@
-dnl $NetBSD: configure.in,v 1.1.1.1 2008/05/24 03:35:41 tnn Exp $
+dnl $NetBSD: configure.in,v 1.2 2008/05/25 18:32:28 tnn Exp $
AC_PREREQ(2.62)
AC_INIT([compat_headers],[20080523],[tnn@NetBSD.org])
@@ -15,12 +15,14 @@ REPLACE_resolv=no
REPLACE_sys_select=no
REPLACE_stdlib=no
REPLACE_math=no
+REPLACE_stdarg=no
AC_SUBST(REPLACE_stdint)
AC_SUBST(REPLACE_inttypes)
AC_SUBST(REPLACE_resolv)
AC_SUBST(REPLACE_sys_select)
AC_SUBST(REPLACE_stdlib)
+AC_SUBST(REPLACE_stdarg)
AC_SUBST(REPLACE_math)
AC_DEFINE([CH_LP64], [0], [descr])
@@ -28,6 +30,8 @@ AC_DEFINE([CH_HPUX], [0], [descr])
AC_DEFINE([CH_HPUX_MISSING_RES_PROTO], [0], [descr])
AC_DEFINE([CH_HPUX___STRTOLL], [0], [descr])
+AC_DEFINE([CH_HAVE_VA_COPY], [0], [descr])
+
AC_DEFINE([CH_FLOORF], [0], [descr])
AC_DEFINE([CH_CEILF], [0], [descr])
AC_DEFINE([CH_SINF], [0], [descr])
@@ -153,6 +157,20 @@ REPLACE_stdlib=yes
, [AC_MSG_RESULT(no)])
, [AC_MSG_RESULT(no)])
+
+#
+# Check for va_copy
+#
+
+# XXX needs to be TRY_RUN
+AC_MSG_CHECKING([if we have va_copy])
+AC_TRY_RUN([#include <stdarg.h>
+void foo(va_list x, va_list y) {va_copy(x, y);}
+int main(void) {return 0;}],
+[AC_DEFINE(CH_HAVE_VA_COPY) AC_MSG_RESULT(yes)],
+[AC_MSG_RESULT(no)
+REPLACE_stdarg=yes])
+
#
# Make sure we have float math functions, provide macros otherwise.
#
diff --git a/pkgtools/compat_headers/files/stdarg.h.in b/pkgtools/compat_headers/files/stdarg.h.in
new file mode 100644
index 00000000000..a883267c87b
--- /dev/null
+++ b/pkgtools/compat_headers/files/stdarg.h.in
@@ -0,0 +1,8 @@
+#include "config.h"
+@include "@real_header@"
+@ifndef _COMPAT_STDARG_H_
+@define _COMPAT_STDARG_H_
+#if CH_HAVE_VA_COPY < 1
+@define va_copy(dst,src) (dst=(src))
+#endif
+@endif /* _COMPAT_STDARG_H_ */