Skip to content

Commit 5c5026e

Browse files
committed
Allow specifying page size at configure time
1 parent 2b3c960 commit 5c5026e

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

configure.ac

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,23 @@ AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 foreign color-tests parallel-tests])
66
AM_PROG_CC_C_O
77
AC_PROG_CXX
88

9+
PAGESIZE=auto
10+
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+
])
22+
)
23+
24+
AC_DEFINE_UNQUOTED(PAGESIZE, ${PAGESIZE})
25+
AC_MSG_RESULT([Setting page size to ${PAGESIZE}])
26+
927
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile patchelf.spec])
1028
AC_OUTPUT

src/patchelf.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@ unsigned char * contents = 0;
4040

4141

4242
static unsigned int getPageSize(){
43-
#ifdef MIPSEL
44-
/* The lemote fuloong 2f kernel defconfig sets a page size of
45-
16KB. */
46-
return 4096 * 4;
47-
#else
48-
return 4096;
49-
#endif
43+
return PAGESIZE;
5044
}
5145

5246

0 commit comments

Comments
 (0)