{"thread":{"id":"26173","subject":"[PATCH] Consistent use of AC_LANG_PROGRAM in configure.ac and aclocal.m4.","startedAt":"2011-01-02T06:00:44Z","lastAt":"2011-02-12T23:35:58Z","messageCount":7,"participants":["Ralf Wildenhues","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"158807","messageId":"20110102060044.GJ19818@gmx.de","threadId":"26173","inReplyTo":null,"subject":"[PATCH] Consistent use of AC_LANG_PROGRAM in configure.ac and aclocal.m4.","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2011-01-02T06:00:44Z","receivedAt":"2011-01-02T06:00:44Z","isPatch":true,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"This avoids warnings from Autoconf 2.68 about missing use of\nAC_LANG_PROGRAM and friends.\n\nSigned-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>\n---\n\nThe patch should not cause any semantic changes in the generated\nconfigure script.\n\nThanks,\nRalf\n\n aclocal.m4   |    4 ++--\n configure.ac |   56 +++++++++++++++++++-------------------------------------\n 2 files changed, 21 insertions(+), 39 deletions(-)\n\ndiff --git a/aclocal.m4 b/aclocal.m4\nindex d399de2..f11bc7e 100644\n--- a/aclocal.m4\n+++ b/aclocal.m4\n@@ -13,7 +13,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],\n          git_cv_socklen_t_equiv=\n          for arg2 in \"struct sockaddr\" void; do\n             for t in int size_t unsigned long \"unsigned long\"; do\n-               AC_TRY_COMPILE([\n+               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([\n                   #include <sys/types.h>\n                   #include <sys/socket.h>\n \n@@ -21,7 +21,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],\n                ],[\n                   $t len;\n                   getpeername(0,0,&len);\n-               ],[\n+               ])],[\n                   git_cv_socklen_t_equiv=\"$t\"\n                   break 2\n                ])\ndiff --git a/configure.ac b/configure.ac\nindex 5792425..20039c5 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -345,7 +345,7 @@ esac\n AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [\n    SAVE_LDFLAGS=\"${LDFLAGS}\"\n    LDFLAGS=\"${SAVE_LDFLAGS} -R /\"\n-   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n+   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n    LDFLAGS=\"${SAVE_LDFLAGS}\"\n ])\n if test \"$git_cv_ld_dashr\" = \"yes\"; then\n@@ -354,7 +354,7 @@ else\n    AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [\n       SAVE_LDFLAGS=\"${LDFLAGS}\"\n       LDFLAGS=\"${SAVE_LDFLAGS} -Wl,-rpath,/\"\n-      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])\n+      AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])\n       LDFLAGS=\"${SAVE_LDFLAGS}\"\n    ])\n    if test \"$git_cv_ld_wl_rpath\" = \"yes\"; then\n@@ -363,7 +363,7 @@ else\n       AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [\n          SAVE_LDFLAGS=\"${LDFLAGS}\"\n          LDFLAGS=\"${SAVE_LDFLAGS} -rpath /\"\n-         AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])\n+         AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])\n          LDFLAGS=\"${SAVE_LDFLAGS}\"\n       ])\n       if test \"$git_cv_ld_rpath\" = \"yes\"; then\n@@ -472,15 +472,9 @@ if test -z \"$NO_ICONV\"; then\n \n GIT_STASH_FLAGS($ICONVDIR)\n \n-AC_DEFUN([ICONVTEST_SRC], [\n-#include <iconv.h>\n-\n-int main(void)\n-{\n-\ticonv_open(\"\", \"\");\n-\treturn 0;\n-}\n-])\n+AC_DEFUN([ICONVTEST_SRC],\n+[AC_LANG_PROGRAM([#include <iconv.h>],\n+ [iconv_open(\"\", \"\");])])\n \n if test -n \"$ICONVDIR\"; then\n    lib_order=\"-liconv -lc\"\n@@ -500,7 +494,7 @@ for l in $lib_order; do\n     old_LIBS=\"$LIBS\"\n     LIBS=\"$LIBS $l\"\n     AC_MSG_CHECKING([for iconv in $l])\n-    AC_LINK_IFELSE(ICONVTEST_SRC,\n+    AC_LINK_IFELSE([ICONVTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \tNO_ICONV=\n \tbreak],\n@@ -528,18 +522,12 @@ fi\n GIT_STASH_FLAGS($ZLIB_PATH)\n \n AC_DEFUN([ZLIBTEST_SRC], [\n-#include <zlib.h>\n-\n-int main(void)\n-{\n-\tdeflateBound(0, 0);\n-\treturn 0;\n-}\n-])\n+AC_LANG_PROGRAM([#include <zlib.h>],\n+ [deflateBound(0, 0);])])\n AC_MSG_CHECKING([for deflateBound in -lz])\n old_LIBS=\"$LIBS\"\n LIBS=\"$LIBS -lz\"\n-AC_LINK_IFELSE(ZLIBTEST_SRC,\n+AC_LINK_IFELSE([ZLIBTEST_SRC],\n \t[AC_MSG_RESULT([yes])],\n \t[AC_MSG_RESULT([no])\n \tNO_DEFLATE_BOUND=yes])\n@@ -631,23 +619,19 @@ AC_SUBST(NO_INTTYPES_H)\n #\n # Define OLD_ICONV if your library has an old iconv(), where the second\n # (input buffer pointer) parameter is declared with type (const char **).\n-AC_DEFUN([OLDICONVTEST_SRC], [[\n+AC_DEFUN([OLDICONVTEST_SRC], [\n+AC_LANG_PROGRAM([[\n #include <iconv.h>\n \n extern size_t iconv(iconv_t cd,\n \t\t    char **inbuf, size_t *inbytesleft,\n \t\t    char **outbuf, size_t *outbytesleft);\n-\n-int main(void)\n-{\n-\treturn 0;\n-}\n-]])\n+]], [])])\n \n GIT_STASH_FLAGS($ICONVDIR)\n \n AC_MSG_CHECKING([for old iconv()])\n-AC_COMPILE_IFELSE(OLDICONVTEST_SRC,\n+AC_COMPILE_IFELSE([OLDICONVTEST_SRC],\n \t[AC_MSG_RESULT([no])],\n \t[AC_MSG_RESULT([yes])\n \tOLD_ICONV=UnfortunatelyYes])\n@@ -931,18 +915,16 @@ AC_SUBST(NO_INITGROUPS)\n #\n # Define PTHREAD_LIBS to the linker flag used for Pthread support.\n AC_DEFUN([PTHREADTEST_SRC], [\n+AC_LANG_PROGRAM([[\n #include <pthread.h>\n-\n-int main(void)\n-{\n+]], [[\n \tpthread_mutex_t test_mutex;\n \tint retcode = 0;\n \tretcode |= pthread_mutex_init(&test_mutex,(void *)0);\n \tretcode |= pthread_mutex_lock(&test_mutex);\n \tretcode |= pthread_mutex_unlock(&test_mutex);\n \treturn retcode;\n-}\n-])\n+]])])\n \n dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM(\n dnl   [[#include <pthread.h>]],\n@@ -962,7 +944,7 @@ elif test -z \"$PTHREAD_CFLAGS\"; then\n      old_CFLAGS=\"$CFLAGS\"\n      CFLAGS=\"$opt $CFLAGS\"\n      AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])\n-     AC_LINK_IFELSE(PTHREADTEST_SRC,\n+     AC_LINK_IFELSE([PTHREADTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \t\tNO_PTHREADS=\n \t\tPTHREAD_LIBS=\"$opt\"\n@@ -982,7 +964,7 @@ else\n   old_CFLAGS=\"$CFLAGS\"\n   CFLAGS=\"$PTHREAD_CFLAGS $CFLAGS\"\n   AC_MSG_CHECKING([Checking for POSIX Threads with '$PTHREAD_CFLAGS'])\n-  AC_LINK_IFELSE(PTHREADTEST_SRC,\n+  AC_LINK_IFELSE([PTHREADTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \t\tNO_PTHREADS=\n \t\tPTHREAD_LIBS=\"$PTHREAD_CFLAGS\"\n-- \n1.7.4.rc0\n"},{"id":"158810","messageId":"20110102075953.GB8937@burratino","threadId":"26173","inReplyTo":"20110102060044.GJ19818@gmx.de","subject":"Re: [PATCH] Consistent use of AC_LANG_PROGRAM in configure.ac and aclocal.m4.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-02T07:59:53Z","receivedAt":"2011-01-02T07:59:53Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ralf Wildenhues wrote:\n\n> This avoids warnings from Autoconf 2.68 about missing use of\n> AC_LANG_PROGRAM and friends.\n> \n> Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>\n> ---\n> \n> The patch should not cause any semantic changes in the generated\n> configure script.\n\nThis part belongs in the commit message too, imho (though no need to\nresend just for that, of course).\n\n> --- a/configure.ac\n> +++ b/configure.ac\n> @@ -345,7 +345,7 @@ esac\n>  AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [\n>     SAVE_LDFLAGS=\"${LDFLAGS}\"\n>     LDFLAGS=\"${SAVE_LDFLAGS} -R /\"\n> -   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n> +   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n\nCould you say a few words about the effect of this?  Mostly because\nit would be useful to people down the line tempted to make the same\nmistake again.\n\n> @@ -500,7 +494,7 @@ for l in $lib_order; do\n>      old_LIBS=\"$LIBS\"\n>      LIBS=\"$LIBS $l\"\n>      AC_MSG_CHECKING([for iconv in $l])\n> -    AC_LINK_IFELSE(ICONVTEST_SRC,\n> +    AC_LINK_IFELSE([ICONVTEST_SRC],\n\nI'm curious about this one, too.\n\n> @@ -931,18 +915,16 @@ AC_SUBST(NO_INITGROUPS)\n>  #\n>  # Define PTHREAD_LIBS to the linker flag used for Pthread support.\n>  AC_DEFUN([PTHREADTEST_SRC], [\n> +AC_LANG_PROGRAM([[\n>  #include <pthread.h>\n> -\n> -int main(void)\n> -{\n> +]], [[\n>  \tpthread_mutex_t test_mutex;\n\nBy the way, what problem is the warning about AC_LANG_PROGRAM meant to\nprevent?  (Just curious.  A five-minute google search didn't reveal\nanything obvious.)\n\nThanks,\nJonathan\n"},{"id":"158811","messageId":"20110102094730.GA10365@gmx.de","threadId":"26173","inReplyTo":"20110102075953.GB8937@burratino","subject":"Re: [PATCH] Consistent use of AC_LANG_PROGRAM in configure.ac and aclocal.m4.","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2011-01-02T09:47:30Z","receivedAt":"2011-01-02T09:47:30Z","isPatch":true,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"* Jonathan Nieder wrote on Sun, Jan 02, 2011 at 08:59:53AM CET:\n> Ralf Wildenhues wrote:\n> \n> > The patch should not cause any semantic changes in the generated\n> > configure script.\n> \n> This part belongs in the commit message too, imho (though no need to\n> resend just for that, of course).\n\nYeah, you're right.\n\n> > -   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n> > +   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n> \n> Could you say a few words about the effect of this?  Mostly because\n> it would be useful to people down the line tempted to make the same\n> mistake again.\n\nAllow me to quote autoconf-2.68/NEWS:\n\n  ** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and\n     AC_RUN_IFELSE now warn if the first argument failed to use\n     AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file\n     contents.  A new macro AC_LANG_DEFINES_PROVIDED exists if you have\n     a compelling reason why you cannot use AC_LANG_SOURCE but must\n     avoid the warning.\n\nThe underlying reason for this change is that AC_LANG_{SOURCE,PROGRAM}\ntake care to actually supply the previously computed set of #defines\n(and include the standard headers if so desired), for preprocessed\nlanguages like C and C++.  In the above case, AC_LANG_PROGRAM is already\nused, but not sufficiently m4-quoted, so that the autoconf warning will\nbe triggered bogusly.\n\nThe general rule for m4 quotation is: one set of quotes for each macro\nargument, e.g.:\n  MACRO1([arg with MACRO2([arg], [arg])], [arg], ...)\n\nand for innermost arguments which need to undergo no m4 expansion at all\na double set of quotes should be used, e.g.:\n  AC_LANG_SOURCE([[int s[42]; /* Program sources containing brackets.  */]])\n\nOnly for some special macros that need to be expanded before recursion\nno quoting should be used.\n\nThese and more rules are described in detail in 'info Autoconf\n\"Programming in M4\"'.  The rules can often be relaxed when the macro\narguments contain no active characters like comma, brackets or other\nmacro invocations themselves, but IMVHO it is easier getting used to\njust quote things normally.\n\n> > @@ -500,7 +494,7 @@ for l in $lib_order; do\n> >      old_LIBS=\"$LIBS\"\n> >      LIBS=\"$LIBS $l\"\n> >      AC_MSG_CHECKING([for iconv in $l])\n> > -    AC_LINK_IFELSE(ICONVTEST_SRC,\n> > +    AC_LINK_IFELSE([ICONVTEST_SRC],\n> \n> I'm curious about this one, too.\n\nLikewise this is just underquotation leading to false positive.\n\n> > @@ -931,18 +915,16 @@ AC_SUBST(NO_INITGROUPS)\n> >  #\n> >  # Define PTHREAD_LIBS to the linker flag used for Pthread support.\n> >  AC_DEFUN([PTHREADTEST_SRC], [\n> > +AC_LANG_PROGRAM([[\n> >  #include <pthread.h>\n> > -\n> > -int main(void)\n> > -{\n> > +]], [[\n> >  \tpthread_mutex_t test_mutex;\n> \n> By the way, what problem is the warning about AC_LANG_PROGRAM meant to\n> prevent?  (Just curious.  A five-minute google search didn't reveal\n> anything obvious.)\n\nSee above.\n\nI would be happy to update the patch in a way that makes it more\nhelpful, but most of the above is fairly general Autoconf rules,\nso I'm not sure what you need (being blinded by looking at this\nstuff too often).\n\nCheers,\nRalf\n"},{"id":"158813","messageId":"20110102100012.GA12284@burratino","threadId":"26173","inReplyTo":"20110102094730.GA10365@gmx.de","subject":"Re: [PATCH] Consistent use of AC_LANG_PROGRAM in configure.ac and aclocal.m4.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-02T10:00:12Z","receivedAt":"2011-01-02T10:00:12Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ralf Wildenhues wrote:\n\n> See above.\n>\n> I would be happy to update the patch in a way that makes it more\n> helpful, but most of the above is fairly general Autoconf rules,\n> so I'm not sure what you need (being blinded by looking at this\n> stuff too often).\n\nA little essay in the commit message should be sufficient.  Something\nvaguely like this, maybe.  (cut and pasted from the above)\n\n This avoids warnings from Autoconf 2.68 about missing use of\n AC_LANG_PROGRAM and friends.\n\n Allow me to quote autoconf-2.68/NEWS:\n\n   ** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and\n      AC_RUN_IFELSE now warn if the first argument failed to use\n      AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file\n      contents.  A new macro AC_LANG_DEFINES_PROVIDED exists if you have\n      a compelling reason why you cannot use AC_LANG_SOURCE but must\n      avoid the warning.\n\n The underlying reason for this change is that AC_LANG_{SOURCE,PROGRAM}\n take care to actually supply the previously computed set of #defines\n (and include the standard headers if so desired), for preprocessed\n languages like C and C++.\n\n In some cases, AC_LANG_PROGRAM is already used but not sufficiently\n m4-quoted, so we just need to add another set of [quotes] to prevent\n the autoconf warning from being triggered bogusly.  Quoting all\n arguments (except when calling special macros that _need_ to be\n expanded before recursion) is better style, anyway.  These and more\n rules are described in detail in 'info Autoconf \"Programming in M4\"'.\n\n The patch should not cause any semantic changes in the generated\n configure script.\n\n Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>\n"},{"id":"158814","messageId":"20110102102455.GD10365@gmx.de","threadId":"26173","inReplyTo":"20110102100012.GA12284@burratino","subject":"[PATCH] Consistent use of AC_LANG_PROGRAM in configure.ac and aclocal.m4.","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2011-01-02T10:24:55Z","receivedAt":"2011-01-02T10:24:55Z","isPatch":true,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"This avoids warnings from Autoconf 2.68 about missing use of\nAC_LANG_PROGRAM and friends.\n\nQuoting autoconf-2.68/NEWS:\n\n  ** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and\n     AC_RUN_IFELSE now warn if the first argument failed to use\n     AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file\n     contents.  A new macro AC_LANG_DEFINES_PROVIDED exists if you have\n     a compelling reason why you cannot use AC_LANG_SOURCE but must\n     avoid the warning.\n\nThe underlying reason for this change is that AC_LANG_{SOURCE,PROGRAM}\ntake care to actually supply the previously computed set of #defines\n(and include the standard headers if so desired), for preprocessed\nlanguages like C and C++.\n\nIn some cases, AC_LANG_PROGRAM is already used but not sufficiently\nm4-quoted, so we just need to add another set of [quotes] to prevent\nthe autoconf warning from being triggered bogusly.  Quoting all\narguments (except when calling special macros that _need_ to be\nexpanded before recursion) is better style, anyway.  These and more\nrules are described in detail in 'info Autoconf \"Programming in M4\"'.\n\nThe patch should not cause any semantic changes in the generated\nconfigure script.\n\nSigned-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>\n---\n\n* Jonathan Nieder wrote on Sun, Jan 02, 2011 at 11:00:12AM CET:\n> Ralf Wildenhues wrote:\n> \n> > I would be happy to update the patch in a way that makes it more\n> > helpful, but most of the above is fairly general Autoconf rules,\n> > so I'm not sure what you need (being blinded by looking at this\n> > stuff too often).\n> \n> A little essay in the commit message should be sufficient.  Something\n> vaguely like this, maybe.  (cut and pasted from the above)\n\nThank you for your help!  Resending like this.\n\nCheers,\nRalf\n\n aclocal.m4   |    4 ++--\n configure.ac |   56 +++++++++++++++++++-------------------------------------\n 2 files changed, 21 insertions(+), 39 deletions(-)\n\ndiff --git a/aclocal.m4 b/aclocal.m4\nindex d399de2..f11bc7e 100644\n--- a/aclocal.m4\n+++ b/aclocal.m4\n@@ -13,7 +13,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],\n          git_cv_socklen_t_equiv=\n          for arg2 in \"struct sockaddr\" void; do\n             for t in int size_t unsigned long \"unsigned long\"; do\n-               AC_TRY_COMPILE([\n+               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([\n                   #include <sys/types.h>\n                   #include <sys/socket.h>\n \n@@ -21,7 +21,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],\n                ],[\n                   $t len;\n                   getpeername(0,0,&len);\n-               ],[\n+               ])],[\n                   git_cv_socklen_t_equiv=\"$t\"\n                   break 2\n                ])\ndiff --git a/configure.ac b/configure.ac\nindex 5792425..20039c5 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -345,7 +345,7 @@ esac\n AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [\n    SAVE_LDFLAGS=\"${LDFLAGS}\"\n    LDFLAGS=\"${SAVE_LDFLAGS} -R /\"\n-   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n+   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n    LDFLAGS=\"${SAVE_LDFLAGS}\"\n ])\n if test \"$git_cv_ld_dashr\" = \"yes\"; then\n@@ -354,7 +354,7 @@ else\n    AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [\n       SAVE_LDFLAGS=\"${LDFLAGS}\"\n       LDFLAGS=\"${SAVE_LDFLAGS} -Wl,-rpath,/\"\n-      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])\n+      AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])\n       LDFLAGS=\"${SAVE_LDFLAGS}\"\n    ])\n    if test \"$git_cv_ld_wl_rpath\" = \"yes\"; then\n@@ -363,7 +363,7 @@ else\n       AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [\n          SAVE_LDFLAGS=\"${LDFLAGS}\"\n          LDFLAGS=\"${SAVE_LDFLAGS} -rpath /\"\n-         AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])\n+         AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])\n          LDFLAGS=\"${SAVE_LDFLAGS}\"\n       ])\n       if test \"$git_cv_ld_rpath\" = \"yes\"; then\n@@ -472,15 +472,9 @@ if test -z \"$NO_ICONV\"; then\n \n GIT_STASH_FLAGS($ICONVDIR)\n \n-AC_DEFUN([ICONVTEST_SRC], [\n-#include <iconv.h>\n-\n-int main(void)\n-{\n-\ticonv_open(\"\", \"\");\n-\treturn 0;\n-}\n-])\n+AC_DEFUN([ICONVTEST_SRC],\n+[AC_LANG_PROGRAM([#include <iconv.h>],\n+ [iconv_open(\"\", \"\");])])\n \n if test -n \"$ICONVDIR\"; then\n    lib_order=\"-liconv -lc\"\n@@ -500,7 +494,7 @@ for l in $lib_order; do\n     old_LIBS=\"$LIBS\"\n     LIBS=\"$LIBS $l\"\n     AC_MSG_CHECKING([for iconv in $l])\n-    AC_LINK_IFELSE(ICONVTEST_SRC,\n+    AC_LINK_IFELSE([ICONVTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \tNO_ICONV=\n \tbreak],\n@@ -528,18 +522,12 @@ fi\n GIT_STASH_FLAGS($ZLIB_PATH)\n \n AC_DEFUN([ZLIBTEST_SRC], [\n-#include <zlib.h>\n-\n-int main(void)\n-{\n-\tdeflateBound(0, 0);\n-\treturn 0;\n-}\n-])\n+AC_LANG_PROGRAM([#include <zlib.h>],\n+ [deflateBound(0, 0);])])\n AC_MSG_CHECKING([for deflateBound in -lz])\n old_LIBS=\"$LIBS\"\n LIBS=\"$LIBS -lz\"\n-AC_LINK_IFELSE(ZLIBTEST_SRC,\n+AC_LINK_IFELSE([ZLIBTEST_SRC],\n \t[AC_MSG_RESULT([yes])],\n \t[AC_MSG_RESULT([no])\n \tNO_DEFLATE_BOUND=yes])\n@@ -631,23 +619,19 @@ AC_SUBST(NO_INTTYPES_H)\n #\n # Define OLD_ICONV if your library has an old iconv(), where the second\n # (input buffer pointer) parameter is declared with type (const char **).\n-AC_DEFUN([OLDICONVTEST_SRC], [[\n+AC_DEFUN([OLDICONVTEST_SRC], [\n+AC_LANG_PROGRAM([[\n #include <iconv.h>\n \n extern size_t iconv(iconv_t cd,\n \t\t    char **inbuf, size_t *inbytesleft,\n \t\t    char **outbuf, size_t *outbytesleft);\n-\n-int main(void)\n-{\n-\treturn 0;\n-}\n-]])\n+]], [])])\n \n GIT_STASH_FLAGS($ICONVDIR)\n \n AC_MSG_CHECKING([for old iconv()])\n-AC_COMPILE_IFELSE(OLDICONVTEST_SRC,\n+AC_COMPILE_IFELSE([OLDICONVTEST_SRC],\n \t[AC_MSG_RESULT([no])],\n \t[AC_MSG_RESULT([yes])\n \tOLD_ICONV=UnfortunatelyYes])\n@@ -931,18 +915,16 @@ AC_SUBST(NO_INITGROUPS)\n #\n # Define PTHREAD_LIBS to the linker flag used for Pthread support.\n AC_DEFUN([PTHREADTEST_SRC], [\n+AC_LANG_PROGRAM([[\n #include <pthread.h>\n-\n-int main(void)\n-{\n+]], [[\n \tpthread_mutex_t test_mutex;\n \tint retcode = 0;\n \tretcode |= pthread_mutex_init(&test_mutex,(void *)0);\n \tretcode |= pthread_mutex_lock(&test_mutex);\n \tretcode |= pthread_mutex_unlock(&test_mutex);\n \treturn retcode;\n-}\n-])\n+]])])\n \n dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM(\n dnl   [[#include <pthread.h>]],\n@@ -962,7 +944,7 @@ elif test -z \"$PTHREAD_CFLAGS\"; then\n      old_CFLAGS=\"$CFLAGS\"\n      CFLAGS=\"$opt $CFLAGS\"\n      AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])\n-     AC_LINK_IFELSE(PTHREADTEST_SRC,\n+     AC_LINK_IFELSE([PTHREADTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \t\tNO_PTHREADS=\n \t\tPTHREAD_LIBS=\"$opt\"\n@@ -982,7 +964,7 @@ else\n   old_CFLAGS=\"$CFLAGS\"\n   CFLAGS=\"$PTHREAD_CFLAGS $CFLAGS\"\n   AC_MSG_CHECKING([Checking for POSIX Threads with '$PTHREAD_CFLAGS'])\n-  AC_LINK_IFELSE(PTHREADTEST_SRC,\n+  AC_LINK_IFELSE([PTHREADTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \t\tNO_PTHREADS=\n \t\tPTHREAD_LIBS=\"$PTHREAD_CFLAGS\"\n-- \n1.7.4.rc0\n"},{"id":"160210","messageId":"20110201193927.GA1634@gmx.de","threadId":"26173","inReplyTo":"20110102102455.GD10365@gmx.de","subject":"Re: [PATCH] Consistent use of AC_LANG_PROGRAM in configure.ac and aclocal.m4.","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2011-02-01T19:39:27Z","receivedAt":"2011-02-01T19:39:27Z","isPatch":true,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"* Ralf Wildenhues wrote on Sun, Jan 02, 2011 at 11:24:55AM CET:\n> This avoids warnings from Autoconf 2.68 about missing use of\n> AC_LANG_PROGRAM and friends.\n\nI'd like to ping this patch:\nhttp://thread.gmane.org/gmane.comp.version-control.git/164409/focus=164416\n\nwhich IIUC addresses all previous comments in the thread and was\notherwise noncontroversial.  If there is anything else left to do,\nI'd be happy to hear about it.\n\nThanks,\nRalf\n"},{"id":"160968","messageId":"20110212233558.GA13660@elie","threadId":"26173","inReplyTo":"20110201193927.GA1634@gmx.de","subject":"[PATCH resend] configure: use AC_LANG_PROGRAM consistently","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-02-12T23:35:58Z","receivedAt":"2011-02-12T23:35:58Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>\nDate: Sun, 2 Jan 2011 11:24:55 +0100\n\nAvoid warnings from Autoconf 2.68 about missing use of AC_LANG_PROGRAM\nand friends.\n\nQuoting autoconf-2.68/NEWS:\n\n  ** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and\n     AC_RUN_IFELSE now warn if the first argument failed to use\n     AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file\n     contents.  A new macro AC_LANG_DEFINES_PROVIDED exists if you have\n     a compelling reason why you cannot use AC_LANG_SOURCE but must\n     avoid the warning.\n\nThe underlying reason for that change is that AC_LANG_{SOURCE,PROGRAM}\ntake care to supply the previously computed set of #defines (and\ninclude standard headers if so desired) for preprocessed languages\nlike C and C++.\n\nIn some cases, AC_LANG_PROGRAM is already used but not sufficiently\nm4-quoted, so we just need to add another set of [quotes] to prevent\nthe autoconf warning from being triggered bogusly.  Quoting all\narguments (except when calling special macros that need to be expanded\nbefore recursion) is better style, anyway.  These and more rules are\ndescribed in detail in 'info Autoconf \"Programming in M4\"'.\n\nNo change in the resulting config.mak.autogen after running\n./configure intended.\n\nSigned-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nHi,\n\nRalf Wildenhues wrote:\n> * Ralf Wildenhues wrote on Sun, Jan 02, 2011 at 11:24:55AM CET:\n\n>> This avoids warnings from Autoconf 2.68 about missing use of\n>> AC_LANG_PROGRAM and friends.\n>\n> I'd like to ping this patch:\n> http://thread.gmane.org/gmane.comp.version-control.git/164409/focus=164416\n>\n> which IIUC addresses all previous comments in the thread and was\n> otherwise noncontroversial.  If there is anything else left to do,\n> I'd be happy to hear about it.\n\nThe point of using AC_LANG_PROGRAM is that some magic (like #define\n_GNU_SOURCE) could be added before the code used to perform a feature\ntest.  And that is good --- we have similar magic in\ngit-compat-util.h, for similar reasons.\n\nThe worrisome aspect is that autoconf's magic and git's magic are\nunlikely to work the same way, making the detection inaccurate.\n\nThat said, at least this patch doesn't make it worse.  Consistency\nis nice.  And sometimes squashing a warning is worthwhile just for\nthe sake of squashing a warning, so other warnings don't get lost\nin the noise.\n\n aclocal.m4   |    4 ++--\n configure.ac |   56 +++++++++++++++++++-------------------------------------\n 2 files changed, 21 insertions(+), 39 deletions(-)\n\ndiff --git a/aclocal.m4 b/aclocal.m4\nindex d399de2..f11bc7e 100644\n--- a/aclocal.m4\n+++ b/aclocal.m4\n@@ -13,7 +13,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],\n          git_cv_socklen_t_equiv=\n          for arg2 in \"struct sockaddr\" void; do\n             for t in int size_t unsigned long \"unsigned long\"; do\n-               AC_TRY_COMPILE([\n+               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([\n                   #include <sys/types.h>\n                   #include <sys/socket.h>\n \n@@ -21,7 +21,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],\n                ],[\n                   $t len;\n                   getpeername(0,0,&len);\n-               ],[\n+               ])],[\n                   git_cv_socklen_t_equiv=\"$t\"\n                   break 2\n                ])\ndiff --git a/configure.ac b/configure.ac\nindex 5792425..20039c5 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -345,7 +345,7 @@ esac\n AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [\n    SAVE_LDFLAGS=\"${LDFLAGS}\"\n    LDFLAGS=\"${SAVE_LDFLAGS} -R /\"\n-   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n+   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])\n    LDFLAGS=\"${SAVE_LDFLAGS}\"\n ])\n if test \"$git_cv_ld_dashr\" = \"yes\"; then\n@@ -354,7 +354,7 @@ else\n    AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [\n       SAVE_LDFLAGS=\"${LDFLAGS}\"\n       LDFLAGS=\"${SAVE_LDFLAGS} -Wl,-rpath,/\"\n-      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])\n+      AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])\n       LDFLAGS=\"${SAVE_LDFLAGS}\"\n    ])\n    if test \"$git_cv_ld_wl_rpath\" = \"yes\"; then\n@@ -363,7 +363,7 @@ else\n       AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [\n          SAVE_LDFLAGS=\"${LDFLAGS}\"\n          LDFLAGS=\"${SAVE_LDFLAGS} -rpath /\"\n-         AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])\n+         AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])\n          LDFLAGS=\"${SAVE_LDFLAGS}\"\n       ])\n       if test \"$git_cv_ld_rpath\" = \"yes\"; then\n@@ -472,15 +472,9 @@ if test -z \"$NO_ICONV\"; then\n \n GIT_STASH_FLAGS($ICONVDIR)\n \n-AC_DEFUN([ICONVTEST_SRC], [\n-#include <iconv.h>\n-\n-int main(void)\n-{\n-\ticonv_open(\"\", \"\");\n-\treturn 0;\n-}\n-])\n+AC_DEFUN([ICONVTEST_SRC],\n+[AC_LANG_PROGRAM([#include <iconv.h>],\n+ [iconv_open(\"\", \"\");])])\n \n if test -n \"$ICONVDIR\"; then\n    lib_order=\"-liconv -lc\"\n@@ -500,7 +494,7 @@ for l in $lib_order; do\n     old_LIBS=\"$LIBS\"\n     LIBS=\"$LIBS $l\"\n     AC_MSG_CHECKING([for iconv in $l])\n-    AC_LINK_IFELSE(ICONVTEST_SRC,\n+    AC_LINK_IFELSE([ICONVTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \tNO_ICONV=\n \tbreak],\n@@ -528,18 +522,12 @@ fi\n GIT_STASH_FLAGS($ZLIB_PATH)\n \n AC_DEFUN([ZLIBTEST_SRC], [\n-#include <zlib.h>\n-\n-int main(void)\n-{\n-\tdeflateBound(0, 0);\n-\treturn 0;\n-}\n-])\n+AC_LANG_PROGRAM([#include <zlib.h>],\n+ [deflateBound(0, 0);])])\n AC_MSG_CHECKING([for deflateBound in -lz])\n old_LIBS=\"$LIBS\"\n LIBS=\"$LIBS -lz\"\n-AC_LINK_IFELSE(ZLIBTEST_SRC,\n+AC_LINK_IFELSE([ZLIBTEST_SRC],\n \t[AC_MSG_RESULT([yes])],\n \t[AC_MSG_RESULT([no])\n \tNO_DEFLATE_BOUND=yes])\n@@ -631,23 +619,19 @@ AC_SUBST(NO_INTTYPES_H)\n #\n # Define OLD_ICONV if your library has an old iconv(), where the second\n # (input buffer pointer) parameter is declared with type (const char **).\n-AC_DEFUN([OLDICONVTEST_SRC], [[\n+AC_DEFUN([OLDICONVTEST_SRC], [\n+AC_LANG_PROGRAM([[\n #include <iconv.h>\n \n extern size_t iconv(iconv_t cd,\n \t\t    char **inbuf, size_t *inbytesleft,\n \t\t    char **outbuf, size_t *outbytesleft);\n-\n-int main(void)\n-{\n-\treturn 0;\n-}\n-]])\n+]], [])])\n \n GIT_STASH_FLAGS($ICONVDIR)\n \n AC_MSG_CHECKING([for old iconv()])\n-AC_COMPILE_IFELSE(OLDICONVTEST_SRC,\n+AC_COMPILE_IFELSE([OLDICONVTEST_SRC],\n \t[AC_MSG_RESULT([no])],\n \t[AC_MSG_RESULT([yes])\n \tOLD_ICONV=UnfortunatelyYes])\n@@ -931,18 +915,16 @@ AC_SUBST(NO_INITGROUPS)\n #\n # Define PTHREAD_LIBS to the linker flag used for Pthread support.\n AC_DEFUN([PTHREADTEST_SRC], [\n+AC_LANG_PROGRAM([[\n #include <pthread.h>\n-\n-int main(void)\n-{\n+]], [[\n \tpthread_mutex_t test_mutex;\n \tint retcode = 0;\n \tretcode |= pthread_mutex_init(&test_mutex,(void *)0);\n \tretcode |= pthread_mutex_lock(&test_mutex);\n \tretcode |= pthread_mutex_unlock(&test_mutex);\n \treturn retcode;\n-}\n-])\n+]])])\n \n dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM(\n dnl   [[#include <pthread.h>]],\n@@ -962,7 +944,7 @@ elif test -z \"$PTHREAD_CFLAGS\"; then\n      old_CFLAGS=\"$CFLAGS\"\n      CFLAGS=\"$opt $CFLAGS\"\n      AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])\n-     AC_LINK_IFELSE(PTHREADTEST_SRC,\n+     AC_LINK_IFELSE([PTHREADTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \t\tNO_PTHREADS=\n \t\tPTHREAD_LIBS=\"$opt\"\n@@ -982,7 +964,7 @@ else\n   old_CFLAGS=\"$CFLAGS\"\n   CFLAGS=\"$PTHREAD_CFLAGS $CFLAGS\"\n   AC_MSG_CHECKING([Checking for POSIX Threads with '$PTHREAD_CFLAGS'])\n-  AC_LINK_IFELSE(PTHREADTEST_SRC,\n+  AC_LINK_IFELSE([PTHREADTEST_SRC],\n \t[AC_MSG_RESULT([yes])\n \t\tNO_PTHREADS=\n \t\tPTHREAD_LIBS=\"$PTHREAD_CFLAGS\"\n-- \n1.7.4.1\n"}]}