diff --git a/.gitignore b/.gitignore index d8a8f32c..292a4f51 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 e7feec5e..02f91e09 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 4ea50d81..c10ae8bb 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 00000000..61cd3580 --- /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 5db34693..6bee0760 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])]) ])