From 08cc62478bc1d27551920917cfebf54877f222df Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 17 Jan 2018 14:54:16 +0000 Subject: [PATCH] switched to use AX_CHECK_NUMVALOF() to detect PATH_MAX --- moo/configure | 66 +++++++++++++++++++++++--------------------- moo/configure.ac | 24 ++++------------ moo/lib/moo-cfg.h.in | 9 ++++-- 3 files changed, 46 insertions(+), 53 deletions(-) diff --git a/moo/configure b/moo/configure index 6683419..83c7de6 100755 --- a/moo/configure +++ b/moo/configure @@ -19962,37 +19962,6 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PATH_MAX" >&5 -$as_echo_n "checking for PATH_MAX... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include -int -main () -{ -;;;;;;;;;; -PATH_MAX - ; - return 0; -} - -_ACEOF -moo_cv_path_max="`$ac_cv_prog_CPP conftest.c | awk '/;;;;;;;;;;/ { start=1 } /^(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)*/ { if (start == 1) { print $0; start++; } }'`" -if test "x${moo_cv_path_max}" = "x" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not defined" >&5 -$as_echo "not defined" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${moo_cv_path_max}" >&5 -$as_echo "${moo_cv_path_max}" >&6; } - -cat >>confdefs.h <<_ACEOF -#define MOO_PATH_MAX ${moo_cv_path_max} -_ACEOF - -fi - # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -20870,6 +20839,33 @@ _ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of PATH_MAX" >&5 +$as_echo_n "checking numeric value of PATH_MAX... " >&6; } +if ${ax_cv_numvalof_PATH_MAX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(PATH_MAX)" "ax_cv_numvalof_PATH_MAX" "#include +"; then : + +else + ax_cv_numvalof_PATH_MAX=0 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_PATH_MAX" >&5 +$as_echo "$ax_cv_numvalof_PATH_MAX" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define NUMVALOF_PATH_MAX $ax_cv_numvalof_PATH_MAX +_ACEOF + + + + if test "x${platform_win32}" = "xyes" then # The cast to long int works around a bug in the HP C Compiler @@ -21856,6 +21852,14 @@ cat >>confdefs.h <<_ACEOF #define MOO_MBLEN_MAX ${ax_cv_numvalof_MB_LEN_MAX} _ACEOF +if test ${ax_cv_numvalof_PATH_MAX} -gt 0 +then + +cat >>confdefs.h <<_ACEOF +#define QSE_PATH_MAX ${ax_cv_numvalof_PATH_MAX} +_ACEOF + +fi cat >>confdefs.h <<_ACEOF diff --git a/moo/configure.ac b/moo/configure.ac index b965ced..405e186 100644 --- a/moo/configure.ac +++ b/moo/configure.ac @@ -253,25 +253,6 @@ AC_TRY_RUN( ] ) -dnl check the defined value of PATH_MAX in limits.h -dnl look for a numeric value of 2 or more digits after preprocessing. -AC_MSG_CHECKING([for PATH_MAX]) -AC_LANG_CONFTEST([ - AC_LANG_PROGRAM( - [#include ], - [;;;;;;;;;; -PATH_MAX]) -]) -moo_cv_path_max="`$ac_cv_prog_CPP conftest.c | awk '/;;;;;;;;;;/ { start=1 } /^(0|1|2|3|4|5|6|7|8|9)(0|1|2|3|4|5|6|7|8|9)*/ { if (start == 1) { print $0; start++; } }'`" -if test "x${moo_cv_path_max}" = "x" -then - dnl either not defined or defined to a non-numeric value - AC_MSG_RESULT(not defined) -else - AC_MSG_RESULT(${moo_cv_path_max}) - AC_DEFINE_UNQUOTED(MOO_PATH_MAX, ${moo_cv_path_max}, [PATH_MAX]) -fi - dnl check the size of primitive data types AC_CHECK_SIZEOF(char,,[[]]) AC_CHECK_SIZEOF(short,,[[]]) @@ -302,6 +283,7 @@ AC_CHECK_SIZEOF(off64_t) AC_CHECK_SIZEOF(mbstate_t,,[#include ]) AX_CHECK_NUMVALOF(MB_LEN_MAX,[32],[#include ]) +AX_CHECK_NUMVALOF(PATH_MAX,[0],[#include ]) if test "x${platform_win32}" = "xyes" then @@ -510,6 +492,10 @@ AC_DEFINE_UNQUOTED(MOO_SIZEOF_OFF64_T, ${ac_cv_sizeof_off64_t}, [sizeof(off64_t) AC_DEFINE_UNQUOTED(MOO_SIZEOF_MBSTATE_T, ${ac_cv_sizeof_mbstate_t}, [sizeof(mbstate_t)]) AC_DEFINE_UNQUOTED(MOO_MBLEN_MAX, ${ax_cv_numvalof_MB_LEN_MAX}, [MB_LEN_MAX]) +if test ${ax_cv_numvalof_PATH_MAX} -gt 0 +then + AC_DEFINE_UNQUOTED(QSE_PATH_MAX, ${ax_cv_numvalof_PATH_MAX}, [PATH_MAX]) +fi AC_DEFINE_UNQUOTED(MOO_SIZEOF_STRUCT_SOCKADDR_IN, ${ac_cv_sizeof_struct_sockaddr_in}, [sizeof(struct sockaddr_in)]) AC_DEFINE_UNQUOTED(MOO_SIZEOF_STRUCT_SOCKADDR_IN6, ${ac_cv_sizeof_struct_sockaddr_in6}, [sizeof(struct sockaddr_in6)]) diff --git a/moo/lib/moo-cfg.h.in b/moo/lib/moo-cfg.h.in index 24a3b59..440742c 100644 --- a/moo/lib/moo-cfg.h.in +++ b/moo/lib/moo-cfg.h.in @@ -416,9 +416,6 @@ /* Patch level */ #undef MOO_PACKAGE_VERSION_PATCH -/* PATH_MAX */ -#undef MOO_PATH_MAX - /* Define if sa_family_t is signed */ #undef MOO_SA_FAMILY_T_IS_SIGNED @@ -515,6 +512,9 @@ /* The size of `MB_LEN_MAX', as computed by valueof. */ #undef NUMVALOF_MB_LEN_MAX +/* The size of `PATH_MAX', as computed by valueof. */ +#undef NUMVALOF_PATH_MAX + /* Name of package */ #undef PACKAGE @@ -540,6 +540,9 @@ your system. */ #undef PTHREAD_CREATE_JOINABLE +/* PATH_MAX */ +#undef QSE_PATH_MAX + /* The size of `char', as computed by sizeof. */ #undef SIZEOF_CHAR