aclocal.m4: minor coding style change

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

aclocal.m4: minor coding style change

Ivan Shmakov
        Currently, the most of the macro definitions in `aclocal.m4'
        have the macro name unquoted.  This coding style is error-prone;
        consider, e. g.:

$ cat foo.m4
define(foo, `bar')dnl
define(foo, `baz')dnl
`foo' => foo
`bar' => bar
$ m4 foo.m4
foo => baz
bar => baz
$

        I. e., the second `define' is actually the definition for `bar',
        not `foo'!

        Hence, I'm suggesting the change below.

        The change is purely stylistic and doesn't affect generated
        `configure' at all.

        The change is thanks to the following (assuming GNU Sed):

$ sed -i '/\b\(AC_DEFUN(\)\([[:alnum:]_]\+\)\b/s//\1[\2]/' aclocal.m4

diff --git a/aclocal.m4 b/aclocal.m4
index a5740a5..f3fe2e2 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,5 +1,5 @@
 
-AC_DEFUN(LOC_CHECK_USE,[
+AC_DEFUN([LOC_CHECK_USE],[
 AC_MSG_CHECKING(whether to use $2)
 AC_MSG_RESULT("$with_$1")
 case "$with_$1" in
@@ -10,7 +10,7 @@ esac
 
 ])
 
-AC_DEFUN(LOC_CHECK_INC_PATH,[
+AC_DEFUN([LOC_CHECK_INC_PATH],[
 AC_MSG_CHECKING(for location of $2 includes)
 case "$with_$1_includes" in
 y | ye | yes | n | no)
@@ -30,7 +30,7 @@ if test -n "$with_$1_includes" ; then
 fi
 ])
 
-AC_DEFUN(LOC_CHECK_LIB_PATH,[
+AC_DEFUN([LOC_CHECK_LIB_PATH],[
 AC_MSG_CHECKING(for location of $2 library)
 case "$with_$1_libs" in
 y | ye | yes | n | no)
@@ -50,7 +50,7 @@ if test -n "$with_$1_libs"; then
 fi
 ])
 
-AC_DEFUN(LOC_CHECK_SHARE_PATH,[
+AC_DEFUN([LOC_CHECK_SHARE_PATH],[
 AC_MSG_CHECKING(for location of $2 data files)
 case "$with_$1_share" in
 y | ye | yes | n | no)
@@ -68,7 +68,7 @@ if test -n "$with_$1_share" ; then
 fi
 ])
 
-AC_DEFUN(LOC_CHECK_INCLUDES,[
+AC_DEFUN([LOC_CHECK_INCLUDES],[
 ac_save_cppflags="$CPPFLAGS"
 CPPFLAGS="$3 $CPPFLAGS"
 AC_CHECK_HEADERS($1, [], ifelse($4,[],[
@@ -123,7 +123,7 @@ ifelse($8,[],[
 LDFLAGS=${ac_save_ldflags}
 ])
 
-AC_DEFUN(LOC_CHECK_VERSION_STRING,[
+AC_DEFUN([LOC_CHECK_VERSION_STRING],[
 AC_MSG_CHECKING($3 version)
 ac_save_cppflags="$CPPFLAGS"
 CPPFLAGS="$5 $CPPFLAGS"
@@ -144,13 +144,13 @@ int main(void) {
 CPPFLAGS=$ac_save_cppflags
 ])
 
-AC_DEFUN(LOC_CHECK_SHARE,[
+AC_DEFUN([LOC_CHECK_SHARE],[
 AC_CHECK_FILE($3/$1, [], ifelse($4,[],[
     AC_MSG_ERROR([*** Unable to locate $2 data files.])
 ], $4))
 ])
 
-AC_DEFUN(LOC_CHECK_VERSION_INT,[
+AC_DEFUN([LOC_CHECK_VERSION_INT],[
 AC_MSG_CHECKING($3 version)
 ac_save_cppflags="$CPPFLAGS"
 CPPFLAGS="$5 $CPPFLAGS"
@@ -173,31 +173,31 @@ CPPFLAGS=$ac_save_cppflags
 
 dnl autoconf undefines "eval", so use "builtin([eval], ...)"
 
-AC_DEFUN(LOC_PAD,[$1[]ifelse(builtin([eval],len($1) > 23),1,[
+AC_DEFUN([LOC_PAD],[$1[]ifelse(builtin([eval],len($1) > 23),1,[
                           ],substr([                        ],len($1)))])
 
-AC_DEFUN(LOC_ARG_WITH,[
+AC_DEFUN([LOC_ARG_WITH],[
 AC_ARG_WITH($1,
 LOC_PAD([  --with-$1])[support $2 functionality (default: ]ifelse([$3],,yes,[$3])[)],,
 [with_]patsubst([$1], -, _)[=]ifelse([$3],,yes,[$3]))
 ])
 
-AC_DEFUN(LOC_ARG_WITH_INC,[
+AC_DEFUN([LOC_ARG_WITH_INC],[
 AC_ARG_WITH($1-includes,
 LOC_PAD([  --with-$1-includes=DIRS])[$2 include files are in DIRS])
 ])
 
-AC_DEFUN(LOC_ARG_WITH_LIB,[
+AC_DEFUN([LOC_ARG_WITH_LIB],[
 AC_ARG_WITH($1-libs,
 LOC_PAD([  --with-$1-libs=DIRS])[$2 library files are in DIRS])
 ])
 
-AC_DEFUN(LOC_ARG_WITH_SHARE,[
+AC_DEFUN([LOC_ARG_WITH_SHARE],[
 AC_ARG_WITH($1-share,
 LOC_PAD([  --with-$1-share=DIR])[$2 data files are in DIR])
 ])
 
-AC_DEFUN(LOC_OPTIONAL,[
+AC_DEFUN([LOC_OPTIONAL],[
 AC_MSG_CHECKING(whether to build $1)
 if test -n "$USE_$2" ; then
  AC_MSG_RESULT(yes)
@@ -223,7 +223,7 @@ int main(void) {
 }
 ])
 
-AC_DEFUN(LOC_CHECK_FP_INF_NAN,[
+AC_DEFUN([LOC_CHECK_FP_INF_NAN],[
 AC_MSG_CHECKING([for full floating-point support]$1)
 AC_TRY_RUN(LOC_FP_TEST,
 [   AC_MSG_RESULT(yes)
@@ -237,7 +237,7 @@ AC_TRY_RUN(LOC_FP_TEST,
 
 dnl check whether the compiler supports the -mieee switch
 
-AC_DEFUN(LOC_CHECK_CC_MIEEE,[
+AC_DEFUN([LOC_CHECK_CC_MIEEE],[
 AC_MSG_CHECKING(whether "cc -mieee" works)
 ac_save_cflags=${CFLAGS}
 CFLAGS="$CFLAGS -mieee"
@@ -248,15 +248,15 @@ AC_TRY_COMPILE(,,
 CFLAGS=${ac_save_cflags}
 ])
 
-AC_DEFUN(LOC_MSG,[
+AC_DEFUN([LOC_MSG],[
 echo "$1"
 ])
 
-AC_DEFUN(LOC_PAD_26,[substr([                           ],len($1))])
+AC_DEFUN([LOC_PAD_26],[substr([                           ],len($1))])
 
-AC_DEFUN(LOC_YES_NO,[if test -n "${$1}" ; then echo yes ; else echo no ; fi])
+AC_DEFUN([LOC_YES_NO],[if test -n "${$1}" ; then echo yes ; else echo no ; fi])
 
-AC_DEFUN(LOC_MSG_USE,[
+AC_DEFUN([LOC_MSG_USE],[
 [echo "  $1:]LOC_PAD_26($1)`LOC_YES_NO($2)`"])
 
 #------------------------------------------------------------------------
@@ -280,7 +280,7 @@ AC_DEFUN(LOC_MSG_USE,[
 # SHARED_BUILD Value of 1 or 0
 #------------------------------------------------------------------------
 
-AC_DEFUN(SC_ENABLE_SHARED, [
+AC_DEFUN([SC_ENABLE_SHARED], [
     AC_MSG_CHECKING([how to build libraries])
     AC_ARG_ENABLE(shared,
  [  --enable-shared         build and link with shared libraries [--enable-shared]],
@@ -407,7 +407,7 @@ AC_DEFUN(SC_ENABLE_SHARED, [
 #
 #--------------------------------------------------------------------
 
-AC_DEFUN(SC_CONFIG_CFLAGS, [
+AC_DEFUN([SC_CONFIG_CFLAGS], [
 
     # Step 0.a: Enable 64 bit support?
 

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: aclocal.m4: minor coding style change

Ivan Shmakov
>>>>> Ivan Shmakov <[hidden email]> writes:

 > Currently, the most of the macro definitions in `aclocal.m4' have the
 > macro name unquoted.  This coding style is error-prone; consider,
 > e. g.:

[...]

        Since there were no objections, I've now committed the change:

http://trac.osgeo.org/grass/changeset/30155

 > The change is purely stylistic and doesn't affect generated
 > `configure' at all.

        There was a minor difference:

--- configure.~1~ 2008-02-15 01:09:55.000000000 +0600
+++ configure 2008-02-15 01:18:20.000000000 +0600
@@ -1014,7 +1014,7 @@
   if { (eval echo configure:1015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj) ;;
+      *.$ac_ext | *.c | *.o | *.obj) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done

        Is it due to slightly different Autoconf versions?

[...]

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: aclocal.m4: minor coding style change

hamish-2
Ivan Shmakov <[hidden email]> wrote:

> There was a minor difference:
>
> --- configure.~1~ 2008-02-15 01:09:55.000000000 +0600
> +++ configure 2008-02-15 01:18:20.000000000 +0600
> @@ -1014,7 +1014,7 @@
>    if { (eval echo configure:1015: \"$ac_link\") 1>&5; (eval
> $ac_link) 2>&5; }; then
>      for file in conftest.*; do
>        case $file in
> -      *.c | *.o | *.obj) ;;
> +      *.$ac_ext | *.c | *.o | *.obj) ;;
>        *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
>        esac
>      done
>
> Is it due to slightly different Autoconf versions?
>
> [...]


I came across the same thing the other day (autoconf2.13 from
Debian/Etch)   http://trac.osgeo.org/grass/ticket/44#comment:6

?,
Hamish



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev