Skip to content

Commit a28fd74

Browse files
committed
Fix PAGESIZE auto-determination
Don't use "which" (which might not exist), and don't redirect getconf auto to /dev/null.
1 parent 5010097 commit a28fd74

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

configure.ac

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ AC_PROG_CXX
88

99
PAGESIZE=auto
1010
AC_ARG_WITH([page-size],
11-
AS_HELP_STRING([--with-page-size=SIZE], [Specify default pagesize (default auto)]),
12-
PAGESIZE=$withval
13-
)
14-
15-
AS_IF([test "x$PAGESIZE" = xauto],
16-
AS_IF([which getconf &>/dev/null], [
17-
PAGESIZE=`getconf PAGESIZE &>/dev/null || getconf PAGE_SIZE &>/dev/null`
18-
])
19-
AS_IF([test "x$PAGESIZE" = x], [
20-
PAGESIZE=4096
21-
])
11+
AS_HELP_STRING([--with-page-size=SIZE], [Specify default pagesize (default auto)]),
12+
PAGESIZE=$withval
2213
)
2314

15+
if test "$PAGESIZE" = auto; then
16+
if type -p getconf &>/dev/null; then
17+
PAGESIZE=$(getconf PAGESIZE || getconf PAGE_SIZE)
18+
fi
19+
if test "$PAGESIZE" = auto -o -z "$PAGESIZE"; then
20+
PAGESIZE=4096
21+
fi
22+
fi
23+
2424
AC_DEFINE_UNQUOTED(PAGESIZE, ${PAGESIZE})
2525
AC_MSG_RESULT([Setting page size to ${PAGESIZE}])
2626

0 commit comments

Comments
 (0)