Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unreliable tests in configure.ac #2111

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ AC_MSG_CHECKING([__pmResult padding])
ans=`sed <conftest.out -n -e '/__pmResult pad/s/.* //p'`
if test -n "$ans"
then
AC_DEFINE_UNQUOTED(PM_PAD_RESULT, $ans, [])
AC_DEFINE_UNQUOTED(PM_PAD_RESULT, $ans, [__pmResult padding])
AC_MSG_RESULT($ans)
else
AC_MSG_RESULT([no])
Expand All @@ -572,7 +572,7 @@ AC_MSG_CHECKING([timespec padding])
ans=`sed <conftest.out -n -e '/timespec pad/s/.* //p'`
if test -n "$ans"
then
AC_DEFINE_UNQUOTED(PM_PAD_TIMESPEC, $ans, [])
AC_DEFINE_UNQUOTED(PM_PAD_TIMESPEC, $ans, [timespec padding])
AC_MSG_RESULT($ans)
else
AC_MSG_RESULT([no])
Expand Down Expand Up @@ -2509,6 +2509,11 @@ AC_SUBST([rdynamic_flag])

dnl check if argument to user's select() method in scandir call is const
AC_MSG_CHECKING([whether const arg for scandir() select method])
save_CFLAGS="$CFLAGS"
dnl Using -Werror to make the compiler fail on purpose if scandir()
dnl on this system does not support `const struct dirent *' for
dnl callbacks.
CFLAGS="-Werror"
cat <<End-of-File >conftest.c
#include <stdlib.h>
#include <unistd.h>
Expand All @@ -2518,14 +2523,16 @@ my_select(const struct dirent *foo) { return 0; }
int main() { struct dirent **list; return scandir(".", &list, my_select, NULL); }
End-of-File
(eval $ac_compile) 2>conftest.out
_ret=$?
cat conftest.out >&5
if test -s conftest.out
if test $_ret != 0
then
AC_MSG_RESULT(no)
else
AC_DEFINE(HAVE_CONST_DIRENT, [1], [const arg for scandir() select method])
AC_MSG_RESULT(yes)
fi
CFLAGS="$save_CFLAGS"
rm -f conftest.*

dnl check if struct dirent has a d_off (directory offset) field
Expand All @@ -2537,8 +2544,9 @@ cat <<End-of-File >conftest.c
int main() { struct dirent d; d.d_off = 0; }
End-of-File
(eval $ac_compile) 2>conftest.out
_ret=$?
cat conftest.out >&5
if test -s conftest.out
if test $_ret != 0
then
AC_MSG_RESULT(no)
else
Expand Down