apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject cvs commit: apr/build apr_common.m4
Date Tue, 27 Feb 2001 11:09:46 GMT
gstein      01/02/27 03:09:45

  Modified:    build    apr_common.m4
  Log:
  Use some deep M4 magic to remove two "echo | sed" subshell operations per
  header file tested (plus a couple shell "eval" statements). We now use M4's
  translit() to create cache and APR variable names (rather than invoking
  sed). For the loop over the headers, we use a magical tail-recursive M4
  macro.
  
  Revision  Changes    Path
  1.8       +33 -15    apr/build/apr_common.m4
  
  Index: apr_common.m4
  ===================================================================
  RCS file: /home/cvs/apr/build/apr_common.m4,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- apr_common.m4	2001/02/27 03:51:02	1.7
  +++ apr_common.m4	2001/02/27 11:09:43	1.8
  @@ -332,6 +332,30 @@
   AC_MSG_RESULT([$msg])
   ])dnl
   
  +
  +dnl the following is a newline, a space, and a tab. don't reindent!
  +define([newline_space_tab],[
  + 	])
  +
  +dnl
  +dnl APR_COMMA_ARGS(ARG1 ...)
  +dnl  convert the whitespace-separated arguments into comman-separated
  +dnl  arguments.
  +dnl
  +dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...)
  +dnl  subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i]
  +dnl  within each iteration.
  +dnl
  +changequote({,})
  +define({APR_COMMA_ARGS},{patsubst([$}{1],[[}newline_space_tab{]+],[,])})
  +define({APR_FOREACH},
  +  {ifelse($}{2,,,
  +          [define([eachval],
  +                  $}{2)$}{1[]APR_FOREACH([$}{1],
  +                                         builtin([shift],
  +                                                 builtin([shift], $}{@)))])})
  +changequote([,])
  +
   dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ])
   dnl  we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0
   dnl  if FLAG-TO-SET is null, we automagically determine it's name
  @@ -341,21 +365,15 @@
   dnl  
   AC_DEFUN(APR_FLAG_HEADERS,[
   AC_CHECK_HEADERS($1)
  -for aprt_i in $1
  -do
  -    if test "x$2" = "x"; then
  -        aprt_fts="`echo $aprt_i | sed -e 's%/%_%g' -e 's/\.//g'`"
  -    else
  -        aprt_fts="$2"
  -    fi
  -    safe_name=`echo "$aprt_i" | sed 'y%./+-%__p_%'`
  -    eval "cache_value=\$ac_cv_header_$safe_name"
  -    if test "$cache_value" = "yes"; then
  -      eval $aprt_fts=ifelse($3,yes,yes,1)
  -    else
  -      eval $aprt_fts=ifelse($3,yes,no,0)
  -    fi
  -done
  +APR_FOREACH([
  +[if test "$ac_cv_header_]translit(eachval,[./+-],[__p_])" = "yes"; then
  +dnl note: this translit() maps "/" to "_" and omits ".". the third arg
  +dnl really *is* intended to be one shorter than the second arg.
  +  ifelse($2,,translit(eachval,[/.],[_]),$2)=ifelse($3,yes,yes,1)
  +else
  +  ifelse($2,,translit(eachval,[/.],[_]),$2)=ifelse($3,yes,no,0)
  +fi
  +], APR_COMMA_ARGS($1))
   ])
   
   dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ])
  
  
  

Mime
View raw message