@matheusbsbs / matheus-bagliano / commits / 1e58dba142
Fork 0

configure: use AC_LANG_PROGRAM consistently

Avoid warnings from Autoconf 2.68 about missing use of AC_LANG_PROGRAM and friends. Quoting autoconf-2.68/NEWS: ** The macros AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and AC_RUN_IFELSE now warn if the first argument failed to use AC_LANG_SOURCE or AC_LANG_PROGRAM to generate the conftest file contents. A new macro AC_LANG_DEFINES_PROVIDED exists if you have a compelling reason why you cannot use AC_LANG_SOURCE but must avoid the warning. The underlying reason for that change is that AC_LANG_{SOURCE,PROGRAM} take care to supply the previously computed set of #defines (and include standard headers if so desired) for preprocessed languages like C and C++. In some cases, AC_LANG_PROGRAM is already used but not sufficiently m4-quoted, so we just need to add another set of [quotes] to prevent the autoconf warning from being triggered bogusly. Quoting all arguments (except when calling special macros that need to be expanded before recursion) is better style, anyway. These and more rules are described in detail in 'info Autoconf "Programming in M4"'. No change in the resulting config.mak.autogen after running ./configure intended. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ralf Wildenhues committed Jan 2, 2011 at 11:24 UTC 1e58dba142c673c59fbb9d10aeecf62217d4fc9c
2 files changed +21 -39
aclocal.m4
+2 -2
@@ -13,7 +13,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],
13 git_cv_socklen_t_equiv=
14 for arg2 in "struct sockaddr" void; do
15 for t in int size_t unsigned long "unsigned long"; do
16 - AC_TRY_COMPILE([
16 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
17 #include <sys/types.h>
18 #include <sys/socket.h>
19
@@ -21,7 +21,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],
21 ],[
22 $t len;
23 getpeername(0,0,&len);
24 - ],[
24 + ])],[
25 git_cv_socklen_t_equiv="$t"
26 break 2
27 ])
configure.ac
+19 -37
@@ -345,7 +345,7 @@ esac
345 AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
346 SAVE_LDFLAGS="${LDFLAGS}"
347 LDFLAGS="${SAVE_LDFLAGS} -R /"
348 - AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])
348 + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])
349 LDFLAGS="${SAVE_LDFLAGS}"
350 ])
351 if test "$git_cv_ld_dashr" = "yes"; then
@@ -354,7 +354,7 @@ else
354 AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [
355 SAVE_LDFLAGS="${LDFLAGS}"
356 LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
357 - AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])
357 + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])
358 LDFLAGS="${SAVE_LDFLAGS}"
359 ])
360 if test "$git_cv_ld_wl_rpath" = "yes"; then
@@ -363,7 +363,7 @@ else
363 AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [
364 SAVE_LDFLAGS="${LDFLAGS}"
365 LDFLAGS="${SAVE_LDFLAGS} -rpath /"
366 - AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])
366 + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])
367 LDFLAGS="${SAVE_LDFLAGS}"
368 ])
369 if test "$git_cv_ld_rpath" = "yes"; then
@@ -472,15 +472,9 @@ if test -z "$NO_ICONV"; then
472
473 GIT_STASH_FLAGS($ICONVDIR)
474
475 -AC_DEFUN([ICONVTEST_SRC], [
476 -#include <iconv.h>
477 -
478 -int main(void)
479 -{
480 - iconv_open("", "");
481 - return 0;
482 -}
483 -])
475 +AC_DEFUN([ICONVTEST_SRC],
476 +[AC_LANG_PROGRAM([#include <iconv.h>],
477 + [iconv_open("", "");])])
478
479 if test -n "$ICONVDIR"; then
480 lib_order="-liconv -lc"
@@ -500,7 +494,7 @@ for l in $lib_order; do
494 old_LIBS="$LIBS"
495 LIBS="$LIBS $l"
496 AC_MSG_CHECKING([for iconv in $l])
503 - AC_LINK_IFELSE(ICONVTEST_SRC,
497 + AC_LINK_IFELSE([ICONVTEST_SRC],
498 [AC_MSG_RESULT([yes])
499 NO_ICONV=
500 break],
@@ -528,18 +522,12 @@ fi
522 GIT_STASH_FLAGS($ZLIB_PATH)
523
524 AC_DEFUN([ZLIBTEST_SRC], [
531 -#include <zlib.h>
532 -
533 -int main(void)
534 -{
535 - deflateBound(0, 0);
536 - return 0;
537 -}
538 -])
525 +AC_LANG_PROGRAM([#include <zlib.h>],
526 + [deflateBound(0, 0);])])
527 AC_MSG_CHECKING([for deflateBound in -lz])
528 old_LIBS="$LIBS"
529 LIBS="$LIBS -lz"
542 -AC_LINK_IFELSE(ZLIBTEST_SRC,
530 +AC_LINK_IFELSE([ZLIBTEST_SRC],
531 [AC_MSG_RESULT([yes])],
532 [AC_MSG_RESULT([no])
533 NO_DEFLATE_BOUND=yes])
@@ -631,23 +619,19 @@ AC_SUBST(NO_INTTYPES_H)
619 #
620 # Define OLD_ICONV if your library has an old iconv(), where the second
621 # (input buffer pointer) parameter is declared with type (const char **).
634 -AC_DEFUN([OLDICONVTEST_SRC], [[
622 +AC_DEFUN([OLDICONVTEST_SRC], [
623 +AC_LANG_PROGRAM([[
624 #include <iconv.h>
625
626 extern size_t iconv(iconv_t cd,
627 char **inbuf, size_t *inbytesleft,
628 char **outbuf, size_t *outbytesleft);
640 -
641 -int main(void)
642 -{
643 - return 0;
644 -}
645 -]])
629 +]], [])])
630
631 GIT_STASH_FLAGS($ICONVDIR)
632
633 AC_MSG_CHECKING([for old iconv()])
650 -AC_COMPILE_IFELSE(OLDICONVTEST_SRC,
634 +AC_COMPILE_IFELSE([OLDICONVTEST_SRC],
635 [AC_MSG_RESULT([no])],
636 [AC_MSG_RESULT([yes])
637 OLD_ICONV=UnfortunatelyYes])
@@ -931,18 +915,16 @@ AC_SUBST(NO_INITGROUPS)
915 #
916 # Define PTHREAD_LIBS to the linker flag used for Pthread support.
917 AC_DEFUN([PTHREADTEST_SRC], [
918 +AC_LANG_PROGRAM([[
919 #include <pthread.h>
935 -
936 -int main(void)
937 -{
920 +]], [[
921 pthread_mutex_t test_mutex;
922 int retcode = 0;
923 retcode |= pthread_mutex_init(&test_mutex,(void *)0);
924 retcode |= pthread_mutex_lock(&test_mutex);
925 retcode |= pthread_mutex_unlock(&test_mutex);
926 return retcode;
944 -}
945 -])
927 +]])])
928
929 dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM(
930 dnl [[#include <pthread.h>]],
@@ -962,7 +944,7 @@ elif test -z "$PTHREAD_CFLAGS"; then
944 old_CFLAGS="$CFLAGS"
945 CFLAGS="$opt $CFLAGS"
946 AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])
965 - AC_LINK_IFELSE(PTHREADTEST_SRC,
947 + AC_LINK_IFELSE([PTHREADTEST_SRC],
948 [AC_MSG_RESULT([yes])
949 NO_PTHREADS=
950 PTHREAD_LIBS="$opt"
@@ -982,7 +964,7 @@ else
964 old_CFLAGS="$CFLAGS"
965 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
966 AC_MSG_CHECKING([Checking for POSIX Threads with '$PTHREAD_CFLAGS'])
985 - AC_LINK_IFELSE(PTHREADTEST_SRC,
967 + AC_LINK_IFELSE([PTHREADTEST_SRC],
968 [AC_MSG_RESULT([yes])
969 NO_PTHREADS=
970 PTHREAD_LIBS="$PTHREAD_CFLAGS"