build: fix "pragma weak" mixups

Not only was there a minor typo in the "pragma weak" preprocessor
checks, but also were the tests not behaving as needed - they only
indicated support for the /first/ method of implementing weak aliases,
which on Linux is __attribute__ and not #pragma.

* m4/ax_sys_weak_alias.m4: set defines for _all_ weak alias methods
* zebra/kernel_null.c: fix typo

Cc: Doug VanLeuven <roamdad@sonic.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2013-01-27 04:46:02 +01:00
parent b0baf0740e
commit b2baffe8d2
2 changed files with 10 additions and 14 deletions

View file

@ -167,9 +167,8 @@ void weakf(int c) __attribute__((weak, alias("__weakf")));],
]) ])
# What was the result of the test? # What was the result of the test?
AS_IF([test $ax_sys_weak_alias = no && AS_IF([test $ax_cv_sys_weak_alias_attribute = yes], [
test $ax_cv_sys_weak_alias_attribute = yes], [ test $ax_sys_weak_alias = no && ax_sys_weak_alias=attribute
ax_sys_weak_alias=attribute
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_ATTRIBUTE], 1, AC_DEFINE([HAVE_SYS_WEAK_ALIAS_ATTRIBUTE], 1,
[Define this if weak aliases may be created with __attribute__]) [Define this if weak aliases may be created with __attribute__])
]) ])
@ -192,9 +191,8 @@ void __weakf(int c) {}],
]) ])
# What was the result of the test? # What was the result of the test?
AS_IF([test $ax_sys_weak_alias = no && AS_IF([test $ax_cv_sys_weak_alias_pragma = yes], [
test $ax_cv_sys_weak_alias_pragma = yes], [ test $ax_sys_weak_alias = no && ax_sys_weak_alias=pragma
ax_sys_weak_alias=pragma
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_PRAGMA], 1, AC_DEFINE([HAVE_SYS_WEAK_ALIAS_PRAGMA], 1,
[Define this if weak aliases may be created with @%:@pragma weak]) [Define this if weak aliases may be created with @%:@pragma weak])
]) ])
@ -217,9 +215,8 @@ void __weakf(int c) {}],
]) ])
# What was the result of the test? # What was the result of the test?
AS_IF([test $ax_sys_weak_alias = no && AS_IF([test $ax_cv_sys_weak_alias_hpsecondary = yes], [
test $ax_cv_sys_weak_alias_hpsecondary = yes], [ test $ax_sys_weak_alias = no && ax_sys_weak_alias=hpsecondary
ax_sys_weak_alias=hpsecondary
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_HPSECONDARY], 1, AC_DEFINE([HAVE_SYS_WEAK_ALIAS_HPSECONDARY], 1,
[Define this if weak aliases may be created with @%:@pragma _HP_SECONDARY_DEF]) [Define this if weak aliases may be created with @%:@pragma _HP_SECONDARY_DEF])
]) ])
@ -242,9 +239,8 @@ void __weakf(int c) {}],
]) ])
# What was the result of the test? # What was the result of the test?
AS_IF([test $ax_sys_weak_alias = no && AS_IF([test $ax_cv_sys_weak_alias_criduplicate = yes], [
test $ax_cv_sys_weak_alias_criduplicate = yes], [ test $ax_sys_weak_alias = no && ax_sys_weak_alias=criduplicate
ax_sys_weak_alias=criduplicate
AC_DEFINE([HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE], 1, AC_DEFINE([HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE], 1,
[Define this if weak aliases may be created with @%:@pragma _CRI duplicate]) [Define this if weak aliases may be created with @%:@pragma _CRI duplicate])
]) ])
@ -271,7 +267,6 @@ _ACEOF
@%:@ifndef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE @%:@ifndef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
extern void weakf(int c); extern void weakf(int c);
@%:@endif
@%:@if defined(HAVE_SYS_WEAK_ALIAS_PRAGMA) @%:@if defined(HAVE_SYS_WEAK_ALIAS_PRAGMA)
@%:@pragma weak weakf = __weakf @%:@pragma weak weakf = __weakf
@%:@elif defined(HAVE_SYS_WEAK_ALIAS_HPSECONDARY) @%:@elif defined(HAVE_SYS_WEAK_ALIAS_HPSECONDARY)
@ -279,6 +274,7 @@ extern void weakf(int c);
@%:@elif defined(HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE) @%:@elif defined(HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE)
@%:@pragma _CRI duplicate weakf as __weakf @%:@pragma _CRI duplicate weakf as __weakf
@%:@endif @%:@endif
@%:@endif
void __weakf(int c) {} void __weakf(int c) {}
@%:@ifdef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE @%:@ifdef HAVE_SYS_WEAK_ALIAS_ATTRIBUTE
void weakf(int c) __attribute((weak, alias("__weakf"))); void weakf(int c) __attribute((weak, alias("__weakf")));

View file

@ -16,7 +16,7 @@ int kernel_delete_ipv4 (struct prefix *a, struct rib *b) { return 0; }
#endif #endif
int kernel_add_ipv6 (struct prefix *a, struct rib *b) { return 0; } int kernel_add_ipv6 (struct prefix *a, struct rib *b) { return 0; }
#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA_PRAGMA #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
#pragma weak kernel_delete_ipv6 = kernel_add_ipv6 #pragma weak kernel_delete_ipv6 = kernel_add_ipv6
#else #else
int kernel_delete_ipv6 (struct prefix *a, struct rib *b) { return 0; } int kernel_delete_ipv6 (struct prefix *a, struct rib *b) { return 0; }