From 66821508f4064904995189f4b46652eb6257b1ea Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sat, 17 Feb 2018 10:37:18 -0800 Subject: Fix install --strip-program check after merge Also, fix the use of AC_CACHE_CHECK in stat format checker. Signed-off-by: Alexey Neyman diff --git a/.gitignore b/.gitignore index d8a8f32..292a4f5 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/configure.ac b/configure.ac index e7feec5..02f91e0 100644 --- a/configure.ac +++ b/configure.ac @@ -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 @@ -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]) @@ -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 diff --git a/m4/ctng_cpu_count.m4 b/m4/ctng_cpu_count.m4 index 4ea50d8..c10ae8b 100644 --- a/m4/ctng_cpu_count.m4 +++ b/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") ]) diff --git a/m4/ctng_prog_install.m4 b/m4/ctng_prog_install.m4 new file mode 100644 index 0000000..61cd358 --- /dev/null +++ b/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])]) + ]) diff --git a/m4/ctng_prog_stat.m4 b/m4/ctng_prog_stat.m4 index 5db3469..6bee076 100644 --- a/m4/ctng_prog_stat.m4 +++ b/m4/ctng_prog_stat.m4 @@ -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])]) ]) -- cgit v0.10.2-6-g49f6