mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Move symbol visibility checks to m4/visibility.m4
This commit is contained in:
parent
5bf5a4e26c
commit
ea5668086c
1
MANIFEST
1
MANIFEST
@ -434,6 +434,7 @@ m4/lt~obsolete.m4
|
|||||||
m4/python.m4
|
m4/python.m4
|
||||||
m4/runlog.m4
|
m4/runlog.m4
|
||||||
m4/sudo.m4
|
m4/sudo.m4
|
||||||
|
m4/visibility.m4
|
||||||
pathnames.h.in
|
pathnames.h.in
|
||||||
plugins/audit_json/Makefile.in
|
plugins/audit_json/Makefile.in
|
||||||
plugins/audit_json/audit_json.c
|
plugins/audit_json/audit_json.c
|
||||||
|
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@ -27,3 +27,4 @@ m4_include([m4/lt~obsolete.m4])
|
|||||||
m4_include([m4/python.m4])
|
m4_include([m4/python.m4])
|
||||||
m4_include([m4/runlog.m4])
|
m4_include([m4/runlog.m4])
|
||||||
m4_include([m4/sudo.m4])
|
m4_include([m4/sudo.m4])
|
||||||
|
m4_include([m4/visibility.m4])
|
||||||
|
168
configure
vendored
168
configure
vendored
@ -31602,83 +31602,8 @@ fi
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--allow-multiple-definition" >&5
|
|
||||||
printf %s "checking whether the linker accepts -Wl,--allow-multiple-definition... " >&6; }
|
|
||||||
if test ${ax_cv_check_ldflags___Wl___allow_multiple_definition+y}
|
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else case e in #(
|
|
||||||
e)
|
|
||||||
ax_check_save_flags=$LDFLAGS
|
|
||||||
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
int
|
if test -n "$GCC"; then
|
||||||
main (void)
|
|
||||||
{
|
|
||||||
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"
|
|
||||||
then :
|
|
||||||
ax_cv_check_ldflags___Wl___allow_multiple_definition=yes
|
|
||||||
else case e in #(
|
|
||||||
e) ax_cv_check_ldflags___Wl___allow_multiple_definition=no ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
LDFLAGS=$ax_check_save_flags ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___Wl___allow_multiple_definition" >&5
|
|
||||||
printf "%s\n" "$ax_cv_check_ldflags___Wl___allow_multiple_definition" >&6; }
|
|
||||||
if test x"$ax_cv_check_ldflags___Wl___allow_multiple_definition" = xyes
|
|
||||||
then :
|
|
||||||
|
|
||||||
if test ${LDFLAGS+y}
|
|
||||||
then :
|
|
||||||
|
|
||||||
case " $LDFLAGS " in #(
|
|
||||||
*" -Wl,--allow-multiple-definition "*) :
|
|
||||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains -Wl,--allow-multiple-definition"; } >&5
|
|
||||||
(: LDFLAGS already contains -Wl,--allow-multiple-definition) 2>&5
|
|
||||||
ac_status=$?
|
|
||||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; } ;; #(
|
|
||||||
*) :
|
|
||||||
|
|
||||||
as_fn_append LDFLAGS " -Wl,--allow-multiple-definition"
|
|
||||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5
|
|
||||||
(: LDFLAGS="$LDFLAGS") 2>&5
|
|
||||||
ac_status=$?
|
|
||||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; }
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
else case e in #(
|
|
||||||
e)
|
|
||||||
LDFLAGS=-Wl,--allow-multiple-definition
|
|
||||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5
|
|
||||||
(: LDFLAGS="$LDFLAGS") 2>&5
|
|
||||||
ac_status=$?
|
|
||||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; }
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
else case e in #(
|
|
||||||
e) : ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test -n "$GCC"; then
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5
|
||||||
printf %s "checking whether C compiler accepts -fvisibility=hidden... " >&6; }
|
printf %s "checking whether C compiler accepts -fvisibility=hidden... " >&6; }
|
||||||
if test ${ax_cv_check_cflags___fvisibility_hidden+y}
|
if test ${ax_cv_check_cflags___fvisibility_hidden+y}
|
||||||
@ -31759,7 +31684,7 @@ else case e in #(
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
hpux*)
|
hpux*)
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Bhidden_def" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Bhidden_def" >&5
|
||||||
@ -31964,9 +31889,9 @@ fi
|
|||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$lt_cv_prog_gnu_ld" = "yes"; then
|
if test "$lt_cv_prog_gnu_ld" = "yes"; then
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld supports anonymous map files" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld supports anonymous map files" >&5
|
||||||
printf %s "checking whether ld supports anonymous map files... " >&6; }
|
printf %s "checking whether ld supports anonymous map files... " >&6; }
|
||||||
if test ${sudo_cv_var_gnu_ld_anon_map+y}
|
if test ${sudo_cv_var_gnu_ld_anon_map+y}
|
||||||
@ -31980,7 +31905,7 @@ else case e in #(
|
|||||||
global: foo;
|
global: foo;
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
EOF
|
EOF
|
||||||
_CFLAGS="$CFLAGS"
|
_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
_LDFLAGS="$LDFLAGS"
|
_LDFLAGS="$LDFLAGS"
|
||||||
@ -32004,6 +31929,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
|||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
CFLAGS="$_CFLAGS"
|
CFLAGS="$_CFLAGS"
|
||||||
LDFLAGS="$_LDFLAGS"
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
rm -f conftest.map
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -32013,7 +31939,7 @@ printf "%s\n" "$sudo_cv_var_gnu_ld_anon_map" >&6; }
|
|||||||
if test "$sudo_cv_var_gnu_ld_anon_map" = "yes"; then
|
if test "$sudo_cv_var_gnu_ld_anon_map" = "yes"; then
|
||||||
LT_LDDEP="\$(shlib_map)"; LT_LDEXPORTS="-Wl,--version-script,\$(shlib_map)"
|
LT_LDDEP="\$(shlib_map)"; LT_LDEXPORTS="-Wl,--version-script,\$(shlib_map)"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
solaris2*)
|
solaris2*)
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld supports anonymous map files" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld supports anonymous map files" >&5
|
||||||
@ -32029,7 +31955,7 @@ else case e in #(
|
|||||||
global: foo;
|
global: foo;
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
EOF
|
EOF
|
||||||
_CFLAGS="$CFLAGS"
|
_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
_LDFLAGS="$LDFLAGS"
|
_LDFLAGS="$LDFLAGS"
|
||||||
@ -32053,6 +31979,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
|||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
CFLAGS="$_CFLAGS"
|
CFLAGS="$_CFLAGS"
|
||||||
LDFLAGS="$_LDFLAGS"
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
rm -f conftest.map
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -32112,7 +32039,84 @@ printf "%s\n" "$sudo_cv_var_hpux_ld_symbol_export" >&6; }
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--allow-multiple-definition" >&5
|
||||||
|
printf %s "checking whether the linker accepts -Wl,--allow-multiple-definition... " >&6; }
|
||||||
|
if test ${ax_cv_check_ldflags___Wl___allow_multiple_definition+y}
|
||||||
|
then :
|
||||||
|
printf %s "(cached) " >&6
|
||||||
|
else case e in #(
|
||||||
|
e)
|
||||||
|
ax_check_save_flags=$LDFLAGS
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"
|
||||||
|
then :
|
||||||
|
ax_cv_check_ldflags___Wl___allow_multiple_definition=yes
|
||||||
|
else case e in #(
|
||||||
|
e) ax_cv_check_ldflags___Wl___allow_multiple_definition=no ;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LDFLAGS=$ax_check_save_flags ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___Wl___allow_multiple_definition" >&5
|
||||||
|
printf "%s\n" "$ax_cv_check_ldflags___Wl___allow_multiple_definition" >&6; }
|
||||||
|
if test x"$ax_cv_check_ldflags___Wl___allow_multiple_definition" = xyes
|
||||||
|
then :
|
||||||
|
|
||||||
|
if test ${LDFLAGS+y}
|
||||||
|
then :
|
||||||
|
|
||||||
|
case " $LDFLAGS " in #(
|
||||||
|
*" -Wl,--allow-multiple-definition "*) :
|
||||||
|
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS already contains -Wl,--allow-multiple-definition"; } >&5
|
||||||
|
(: LDFLAGS already contains -Wl,--allow-multiple-definition) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; } ;; #(
|
||||||
|
*) :
|
||||||
|
|
||||||
|
as_fn_append LDFLAGS " -Wl,--allow-multiple-definition"
|
||||||
|
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5
|
||||||
|
(: LDFLAGS="$LDFLAGS") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
else case e in #(
|
||||||
|
e)
|
||||||
|
LDFLAGS=-Wl,--allow-multiple-definition
|
||||||
|
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LDFLAGS=\"\$LDFLAGS\""; } >&5
|
||||||
|
(: LDFLAGS="$LDFLAGS") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
else case e in #(
|
||||||
|
e) : ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "$enable_sanitizer" != "no"; then
|
if test "$enable_sanitizer" != "no"; then
|
||||||
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$enable_sanitizer" | sed "$as_sed_sh"`
|
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$enable_sanitizer" | sed "$as_sed_sh"`
|
||||||
|
139
configure.ac
139
configure.ac
@ -4568,149 +4568,14 @@ case "$OS" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
SUDO_SYMBOL_VISIBILITY
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl For fuzz_policy we redefine getaddrinfo() and freeaddrinfo(), but
|
dnl For fuzz_policy we redefine getaddrinfo() and freeaddrinfo(), but
|
||||||
dnl this can cause problems with ld.lld when sanitizers are enabled.
|
dnl this can cause problems with ld.lld when sanitizers are enabled.
|
||||||
dnl
|
dnl
|
||||||
AX_CHECK_LINK_FLAG([-Wl,--allow-multiple-definition], [AX_APPEND_FLAG([-Wl,--allow-multiple-definition], [LDFLAGS])])
|
AX_CHECK_LINK_FLAG([-Wl,--allow-multiple-definition], [AX_APPEND_FLAG([-Wl,--allow-multiple-definition], [LDFLAGS])])
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl Check for symbol visibility support.
|
|
||||||
dnl This test relies on AC_LANG_WERROR
|
|
||||||
dnl
|
|
||||||
if test -n "$GCC"; then
|
|
||||||
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
|
|
||||||
AC_DEFINE(HAVE_DSO_VISIBILITY)
|
|
||||||
AX_APPEND_FLAG([-fvisibility=hidden], [CFLAGS])
|
|
||||||
LT_LDEXPORTS=
|
|
||||||
LT_LDDEP=
|
|
||||||
])
|
|
||||||
else
|
|
||||||
case "$host_os" in
|
|
||||||
hpux*)
|
|
||||||
AX_CHECK_COMPILE_FLAG([-Bhidden_def], [
|
|
||||||
# HP-UX cc may not allow __declspec(dllexport) to be
|
|
||||||
# used in conjunction with #pragma HP_DEFINED_EXTERNAL
|
|
||||||
# when redefining standard libc functions.
|
|
||||||
AC_CACHE_CHECK([whether __declspec(dllexport) can be used when overriding libc functions],
|
|
||||||
[sudo_cv_var_hpux_declspec_libc_function],
|
|
||||||
[
|
|
||||||
_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="${CFLAGS} -Bhidden_def"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
|
|
||||||
__declspec(dllexport) char * getenv(const char *n) { return NULL; }]])], [
|
|
||||||
sudo_cv_var_hpux_declspec_libc_function=yes
|
|
||||||
], [
|
|
||||||
sudo_cv_var_hpux_declspec_libc_function=no
|
|
||||||
])
|
|
||||||
CFLAGS="$_CFLAGS"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
if test "$sudo_cv_var_hpux_declspec_libc_function" = "yes"; then
|
|
||||||
AC_DEFINE(HAVE_DSO_VISIBILITY)
|
|
||||||
AX_APPEND_FLAG([-Bhidden_def], [CFLAGS])
|
|
||||||
LT_LDEXPORTS=
|
|
||||||
LT_LDDEP=
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
;;
|
|
||||||
solaris2*)
|
|
||||||
AX_CHECK_COMPILE_FLAG([-xldscope=hidden], [
|
|
||||||
AC_DEFINE(HAVE_DSO_VISIBILITY)
|
|
||||||
AX_APPEND_FLAG([-xldscope=hidden], [CFLAGS])
|
|
||||||
LT_LDEXPORTS=
|
|
||||||
LT_LDDEP=
|
|
||||||
])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl Check whether ld supports version scripts (only GNU and Solaris ld).
|
|
||||||
dnl If possible, we use this even if the compiler has symbol visibility
|
|
||||||
dnl support so we will notice mismatches between the exports file and
|
|
||||||
dnl sudo_dso_public annotations in the source code.
|
|
||||||
dnl This test relies on AC_LANG_WERROR
|
|
||||||
dnl
|
|
||||||
if test "$lt_cv_prog_gnu_ld" = "yes"; then
|
|
||||||
AC_CACHE_CHECK([whether ld supports anonymous map files],
|
|
||||||
[sudo_cv_var_gnu_ld_anon_map],
|
|
||||||
[
|
|
||||||
sudo_cv_var_gnu_ld_anon_map=no
|
|
||||||
cat > conftest.map <<-EOF
|
|
||||||
{
|
|
||||||
global: foo;
|
|
||||||
local: *;
|
|
||||||
};
|
|
||||||
EOF
|
|
||||||
_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
|
||||||
_LDFLAGS="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS -fpic -shared -Wl,--version-script,./conftest.map"
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
|
|
||||||
[sudo_cv_var_gnu_ld_anon_map=yes])
|
|
||||||
CFLAGS="$_CFLAGS"
|
|
||||||
LDFLAGS="$_LDFLAGS"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
if test "$sudo_cv_var_gnu_ld_anon_map" = "yes"; then
|
|
||||||
LT_LDDEP="\$(shlib_map)"; LT_LDEXPORTS="-Wl,--version-script,\$(shlib_map)"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
case "$host_os" in
|
|
||||||
solaris2*)
|
|
||||||
AC_CACHE_CHECK([whether ld supports anonymous map files],
|
|
||||||
[sudo_cv_var_solaris_ld_anon_map],
|
|
||||||
[
|
|
||||||
sudo_cv_var_solaris_ld_anon_map=no
|
|
||||||
cat > conftest.map <<-EOF
|
|
||||||
{
|
|
||||||
global: foo;
|
|
||||||
local: *;
|
|
||||||
};
|
|
||||||
EOF
|
|
||||||
_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
|
||||||
_LDFLAGS="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS -shared -Wl,-M,./conftest.map"
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
|
|
||||||
[sudo_cv_var_solaris_ld_anon_map=yes])
|
|
||||||
CFLAGS="$_CFLAGS"
|
|
||||||
LDFLAGS="$_LDFLAGS"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
if test "$sudo_cv_var_solaris_ld_anon_map" = "yes"; then
|
|
||||||
LT_LDDEP="\$(shlib_map)"; LT_LDEXPORTS="-Wl,-M,\$(shlib_map)"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
hpux*)
|
|
||||||
AC_CACHE_CHECK([whether ld supports controlling exported symbols],
|
|
||||||
[sudo_cv_var_hpux_ld_symbol_export],
|
|
||||||
[
|
|
||||||
sudo_cv_var_hpux_ld_symbol_export=no
|
|
||||||
echo "+e foo" > conftest.opt
|
|
||||||
_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
|
||||||
_LDFLAGS="$LDFLAGS"
|
|
||||||
if test -n "$GCC"; then
|
|
||||||
LDFLAGS="$LDFLAGS -shared -Wl,-c,./conftest.opt"
|
|
||||||
else
|
|
||||||
LDFLAGS="$LDFLAGS -b -Wl,-c,./conftest.opt"
|
|
||||||
fi
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
|
|
||||||
[sudo_cv_var_hpux_ld_symbol_export=yes])
|
|
||||||
CFLAGS="$_CFLAGS"
|
|
||||||
LDFLAGS="$_LDFLAGS"
|
|
||||||
rm -f conftest.opt
|
|
||||||
]
|
|
||||||
)
|
|
||||||
if test "$sudo_cv_var_hpux_ld_symbol_export" = "yes"; then
|
|
||||||
LT_LDDEP="\$(shlib_opt)"; LT_LDEXPORTS="-Wl,-c,\$(shlib_opt)"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Check for -fsanitize support
|
dnl Check for -fsanitize support
|
||||||
dnl This test relies on AC_LANG_WERROR
|
dnl This test relies on AC_LANG_WERROR
|
||||||
|
140
m4/visibility.m4
Normal file
140
m4/visibility.m4
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
AC_DEFUN([SUDO_SYMBOL_VISIBILITY], [
|
||||||
|
dnl
|
||||||
|
dnl Check for symbol visibility support.
|
||||||
|
dnl This test relies on AC_LANG_WERROR
|
||||||
|
dnl
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [
|
||||||
|
AC_DEFINE(HAVE_DSO_VISIBILITY)
|
||||||
|
AX_APPEND_FLAG([-fvisibility=hidden], [CFLAGS])
|
||||||
|
LT_LDEXPORTS=
|
||||||
|
LT_LDDEP=
|
||||||
|
])
|
||||||
|
else
|
||||||
|
case "$host_os" in
|
||||||
|
hpux*)
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Bhidden_def], [
|
||||||
|
# HP-UX cc may not allow __declspec(dllexport) to be
|
||||||
|
# used in conjunction with #pragma HP_DEFINED_EXTERNAL
|
||||||
|
# when redefining standard libc functions.
|
||||||
|
AC_CACHE_CHECK([whether __declspec(dllexport) can be used when overriding libc functions],
|
||||||
|
[sudo_cv_var_hpux_declspec_libc_function],
|
||||||
|
[
|
||||||
|
_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="${CFLAGS} -Bhidden_def"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
|
||||||
|
__declspec(dllexport) char * getenv(const char *n) { return NULL; }]])], [
|
||||||
|
sudo_cv_var_hpux_declspec_libc_function=yes
|
||||||
|
], [
|
||||||
|
sudo_cv_var_hpux_declspec_libc_function=no
|
||||||
|
])
|
||||||
|
CFLAGS="$_CFLAGS"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if test "$sudo_cv_var_hpux_declspec_libc_function" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_DSO_VISIBILITY)
|
||||||
|
AX_APPEND_FLAG([-Bhidden_def], [CFLAGS])
|
||||||
|
LT_LDEXPORTS=
|
||||||
|
LT_LDDEP=
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
;;
|
||||||
|
solaris2*)
|
||||||
|
AX_CHECK_COMPILE_FLAG([-xldscope=hidden], [
|
||||||
|
AC_DEFINE(HAVE_DSO_VISIBILITY)
|
||||||
|
AX_APPEND_FLAG([-xldscope=hidden], [CFLAGS])
|
||||||
|
LT_LDEXPORTS=
|
||||||
|
LT_LDDEP=
|
||||||
|
])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl Check whether ld supports version scripts (most ELF linkers).
|
||||||
|
dnl If possible, we use this even if the compiler has symbol visibility
|
||||||
|
dnl support so we will notice mismatches between the exports file and
|
||||||
|
dnl sudo_dso_public annotations in the source code.
|
||||||
|
dnl This test relies on AC_LANG_WERROR
|
||||||
|
dnl
|
||||||
|
if test "$lt_cv_prog_gnu_ld" = "yes"; then
|
||||||
|
AC_CACHE_CHECK([whether ld supports anonymous map files],
|
||||||
|
[sudo_cv_var_gnu_ld_anon_map],
|
||||||
|
[
|
||||||
|
sudo_cv_var_gnu_ld_anon_map=no
|
||||||
|
cat > conftest.map <<-EOF
|
||||||
|
{
|
||||||
|
global: foo;
|
||||||
|
local: *;
|
||||||
|
};
|
||||||
|
EOF
|
||||||
|
_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
|
_LDFLAGS="$LDFLAGS"
|
||||||
|
LDFLAGS="$LDFLAGS -fpic -shared -Wl,--version-script,./conftest.map"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
|
||||||
|
[sudo_cv_var_gnu_ld_anon_map=yes])
|
||||||
|
CFLAGS="$_CFLAGS"
|
||||||
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
rm -f conftest.map
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if test "$sudo_cv_var_gnu_ld_anon_map" = "yes"; then
|
||||||
|
LT_LDDEP="\$(shlib_map)"; LT_LDEXPORTS="-Wl,--version-script,\$(shlib_map)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
case "$host_os" in
|
||||||
|
solaris2*)
|
||||||
|
AC_CACHE_CHECK([whether ld supports anonymous map files],
|
||||||
|
[sudo_cv_var_solaris_ld_anon_map],
|
||||||
|
[
|
||||||
|
sudo_cv_var_solaris_ld_anon_map=no
|
||||||
|
cat > conftest.map <<-EOF
|
||||||
|
{
|
||||||
|
global: foo;
|
||||||
|
local: *;
|
||||||
|
};
|
||||||
|
EOF
|
||||||
|
_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
|
_LDFLAGS="$LDFLAGS"
|
||||||
|
LDFLAGS="$LDFLAGS -shared -Wl,-M,./conftest.map"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
|
||||||
|
[sudo_cv_var_solaris_ld_anon_map=yes])
|
||||||
|
CFLAGS="$_CFLAGS"
|
||||||
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
rm -f conftest.map
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if test "$sudo_cv_var_solaris_ld_anon_map" = "yes"; then
|
||||||
|
LT_LDDEP="\$(shlib_map)"; LT_LDEXPORTS="-Wl,-M,\$(shlib_map)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
hpux*)
|
||||||
|
AC_CACHE_CHECK([whether ld supports controlling exported symbols],
|
||||||
|
[sudo_cv_var_hpux_ld_symbol_export],
|
||||||
|
[
|
||||||
|
sudo_cv_var_hpux_ld_symbol_export=no
|
||||||
|
echo "+e foo" > conftest.opt
|
||||||
|
_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
|
_LDFLAGS="$LDFLAGS"
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
LDFLAGS="$LDFLAGS -shared -Wl,-c,./conftest.opt"
|
||||||
|
else
|
||||||
|
LDFLAGS="$LDFLAGS -b -Wl,-c,./conftest.opt"
|
||||||
|
fi
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]], [[]])],
|
||||||
|
[sudo_cv_var_hpux_ld_symbol_export=yes])
|
||||||
|
CFLAGS="$_CFLAGS"
|
||||||
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
rm -f conftest.opt
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if test "$sudo_cv_var_hpux_ld_symbol_export" = "yes"; then
|
||||||
|
LT_LDDEP="\$(shlib_opt)"; LT_LDEXPORTS="-Wl,-c,\$(shlib_opt)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
])
|
Loading…
x
Reference in New Issue
Block a user