Skip to content

Commit

Permalink
Fix install --strip-program check after merge
Browse files Browse the repository at this point in the history
Also, fix the use of AC_CACHE_CHECK in stat format checker.

Signed-off-by: Alexey Neyman <stilor@att.net>
  • Loading branch information
stilor committed Apr 7, 2018
1 parent 7655fc2 commit 6682150
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -5,8 +5,8 @@ aclocal.m4
config.h*
config.log
config.status
/Makefile
/Makefile.in
Makefile
Makefile.in
*ct-ng*
!ct-ng.comp
!ct-ng.in
Expand Down
28 changes: 2 additions & 26 deletions configure.ac
Expand Up @@ -38,21 +38,6 @@ AC_ARG_ENABLE(
[--enable-static],
[build static libraries (deprecated, ignored)])])

# Check if install(1) supports --strip-program=...
AC_DEFUN(
[ACX_INSTALL_STRIP_PROGRAM],
[touch conftest
mkdir conftest.dir
AC_MSG_CHECKING([if install takes --strip-program option])
AS_IF([$INSTALL --strip-program=true -s conftest conftest.dir/conftest 2>/dev/null],
[install_with_strip_program=y
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
ACX_SET_KCONFIG_OPTION([install_with_strip_program])
rm -rf conftest.dir
rm -f conftest
])

# Check for --build and --host...
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
Expand All @@ -66,10 +51,7 @@ AC_ARG_PROGRAM
AC_PROG_MKDIR_P
AC_PROG_LN_S

CTNG_WITH_DEPRECATED([install], [INSTALL])
AC_ARG_VAR([INSTALL], [Specify the full path to a BSD-compatible install])
AC_PROG_INSTALL
ACX_INSTALL_STRIP_PROGRAM
CTNG_PROG_INSTALL

CTNG_WITH_DEPRECATED([grep], [GREP])
AC_ARG_VAR([GREP], [Specify the full path to GNU grep])
Expand Down Expand Up @@ -140,13 +122,7 @@ AC_CHECK_PROGS([curl], [curl])
CTNG_SET_KCONFIG_OPTION([curl])
AC_SUBST([curl])

CTNG_PROG_STAT(
[CTNG_SET_KCONFIG_OPTION([stat_flavor_GNU], [y])
CTNG_SET_KCONFIG_OPTION([stat_flavor_BSD])
],
[CTNG_SET_KCONFIG_OPTION([stat_flavor_BSD], [y])
CTNG_SET_KCONFIG_OPTION([stat_flavor_GNU])
])
CTNG_PROG_STAT

CTNG_CPU_COUNT

Expand Down
8 changes: 4 additions & 4 deletions m4/ctng_cpu_count.m4
@@ -1,10 +1,10 @@
# Find out how to count CPUs
AC_DEFUN([CTNG_CPU_COUNT],
[AC_CACHE_CHECK([whether to use getconf or sysctl to count CPUs],
[acx_cv_cpu_count],
[ctng_cv_cpu_count],
[getconf _NPROCESSORS_ONLN >/dev/null 2>&1 && \
acx_cv_cpu_count="getconf _NPROCESSORS_ONLN"
ctng_cv_cpu_count="getconf _NPROCESSORS_ONLN"
sysctl -n hw.ncpu >/dev/null 2>&1 && \
acx_cv_cpu_count="sysctl -n hw.ncpu"])
AC_SUBST(CPU_COUNT, "$acx_cv_cpu_count")
ctng_cv_cpu_count="sysctl -n hw.ncpu"])
AC_SUBST(CPU_COUNT, "$ctng_cv_cpu_count")
])
26 changes: 26 additions & 0 deletions m4/ctng_prog_install.m4
@@ -0,0 +1,26 @@
# Additional checks for install(1)

# Check if install(1) supports --strip-program=...
AC_DEFUN(
[CTNG_INSTALL_STRIP_PROGRAM],
[AC_CACHE_CHECK([whether install takes --strip-program option],
[ctng_cv_install_with_strip_program],
[touch conftest
mkdir conftest.dir
AS_IF([$INSTALL --strip-program=true -s conftest conftest.dir/conftest 2>/dev/null],
[ctng_cv_install_with_strip_program=yes],
[ctng_cv_install_with_strip_program=no])
rm -rf conftest.dir
rm -f conftest
])
AS_IF([test "$ctng_cv_install_with_strip_program" = yes], [$1], [$2])
])

AC_DEFUN([CTNG_PROG_INSTALL],
[CTNG_WITH_DEPRECATED([install], [INSTALL])
AC_ARG_VAR([INSTALL], [Specify the full path to a BSD-compatible install])
AC_PROG_INSTALL
CTNG_INSTALL_STRIP_PROGRAM(
[CTNG_SET_KCONFIG_OPTION([install_with_strip_program], [y])],
[CTNG_SET_KCONFIG_OPTION([install_with_strip_program])])
])
31 changes: 19 additions & 12 deletions m4/ctng_prog_stat.m4
Expand Up @@ -2,23 +2,30 @@
# string (BSD or GNU). Defines ac_cv_stat_flavor to either GNU or BSD;
# and evaluates either IF-GNU or IF-BSD expression.
# CTNG_PROG_STAT([IF-GNU], [IF-BSD])
AC_DEFUN([CTNG_PROG_STAT],
[AX_REQUIRE_DEFINED([CTNG_CHECK_PROGS_REQ])
CTNG_CHECK_PROGS_REQ([stat], [stat])
AC_CACHE_CHECK([whether stat takes GNU or BSD format],
[acx_cv_stat_flavor],
AC_DEFUN([CTNG_PROG_STAT_FORMAT],
[AC_CACHE_CHECK([whether stat takes GNU or BSD format],
[ctng_cv_stat_flavor],
[touch conftest
chmod 642 conftest
attr_bsd=$(stat -f '%Lp' conftest 2>/dev/null)
attr_gnu=$(stat -c '%a' conftest 2>/dev/null)
rm -f conftest
AS_IF([test "$attr_bsd" = "642"],
[acx_cv_stat_flavor=BSD
$2
],
[ctng_cv_stat_flavor=BSD],
[test "$attr_gnu" = "642"],
[acx_cv_stat_flavor=GNU
$1
],
[AC_MSG_ERROR([cannot determine stat(1) format option])])])
[ctng_cv_stat_flavor=GNU],
[ctng_cv_stat_flavor=unknown])])
AS_IF([test "$ctng_cv_stat_flavor" = "GNU" ], [$1],
[test "$ctng_cv_stat_flavor" = "BSD" ], [$2],
[AC_MSG_ERROR([cannot determine stat(1) format option])])
])

AC_DEFUN([CTNG_PROG_STAT],
[AX_REQUIRE_DEFINED([CTNG_CHECK_PROGS_REQ])
CTNG_CHECK_PROGS_REQ([stat], [stat])
CTNG_PROG_STAT_FORMAT(
[CTNG_SET_KCONFIG_OPTION([stat_flavor_GNU], [y])
CTNG_SET_KCONFIG_OPTION([stat_flavor_BSD])],
[CTNG_SET_KCONFIG_OPTION([stat_flavor_BSD], [y])
CTNG_SET_KCONFIG_OPTION([stat_flavor_GNU])])
])

0 comments on commit 6682150

Please sign in to comment.