summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2016-01-15 01:47:00 (GMT)
committerFelipe Sateler <fsateler@debian.org>2016-01-15 01:47:00 (GMT)
commit5c5026e572e36358b170d15a9451e6a471d710b6 (patch)
treed63b1fee97feddbb4e33cf47257a931557c262d6
parent2b3c9602e710a92f5ab2c6f0a6143fc382aca724 (diff)
downloadpatchelf-5c5026e572e36358b170d15a9451e6a471d710b6.zip
patchelf-5c5026e572e36358b170d15a9451e6a471d710b6.tar.gz
patchelf-5c5026e572e36358b170d15a9451e6a471d710b6.tar.bz2
Allow specifying page size at configure time
-rw-r--r--configure.ac18
-rw-r--r--src/patchelf.cc8
2 files changed, 19 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 44783c4..29445b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,5 +6,23 @@ AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 foreign color-tests parallel-tests])
AM_PROG_CC_C_O
AC_PROG_CXX
+PAGESIZE=auto
+AC_ARG_WITH([page-size],
+ AS_HELP_STRING([--with-page-size=SIZE], [Specify default pagesize (default auto)]),
+ PAGESIZE=$withval
+ )
+
+AS_IF([test "x$PAGESIZE" = xauto],
+ AS_IF([which getconf &>/dev/null], [
+ PAGESIZE=`getconf PAGESIZE &>/dev/null || getconf PAGE_SIZE &>/dev/null`
+ ])
+ AS_IF([test "x$PAGESIZE" = x], [
+ PAGESIZE=4096
+ ])
+)
+
+AC_DEFINE_UNQUOTED(PAGESIZE, ${PAGESIZE})
+AC_MSG_RESULT([Setting page size to ${PAGESIZE}])
+
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile patchelf.spec])
AC_OUTPUT
diff --git a/src/patchelf.cc b/src/patchelf.cc
index ddde0c1..e4bb084 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -40,13 +40,7 @@ unsigned char * contents = 0;
static unsigned int getPageSize(){
-#ifdef MIPSEL
- /* The lemote fuloong 2f kernel defconfig sets a page size of
- 16KB. */
- return 4096 * 4;
-#else
- return 4096;
-#endif
+ return PAGESIZE;
}