configure: Replace AC_TRY_RUN and AC_TRY_LINK.
authorAndre Noll <maan@systemlinux.org>
Sat, 28 Jul 2012 06:44:00 +0000 (08:44 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 27 Aug 2012 11:01:06 +0000 (13:01 +0200)
Both macros are considered obsolete. AC_TRY_RUN has been obsoleted
by AC_RUN_IFELSE while AC_TRY_LINK has been replaced by AC_LINK_IFELSE.

This patch replaces all occurrences of these two obsolete macros and
bumps the required autoconf version to 2.61 (which was released in
2006 and is shipped with Ubuntu Hardy).

configure.ac

index e07f9e0..46985f0 100644 (file)
@@ -1,10 +1,10 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.60)
+AC_PREREQ([2.61])
 
 
-AC_INIT(paraslash, [git], maan@systemlinux.org)
+AC_INIT([paraslash],[git],[maan@systemlinux.org])
 AC_CONFIG_HEADER([config.h])
 
 AC_PATH_PROG(UNAMEPATH, uname, no)
@@ -180,8 +180,8 @@ AC_DEFUN([AX_FUNC_SNPRINTF],
 [AC_CHECK_FUNCS(snprintf vsnprintf)
 AC_MSG_CHECKING(for working snprintf)
 AC_CACHE_VAL(ac_cv_have_working_snprintf,
-[AC_TRY_RUN(
-[#include <stdio.h>
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stdio.h>
 
 int main(void)
 {
@@ -195,12 +195,12 @@ int main(void)
     if (strcmp (bufd, "1")) exit (1);
     if (i != 3) exit (1);
     exit(0);
-}], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
+}]])],[ac_cv_have_working_snprintf=yes],
+[ac_cv_have_working_snprintf=no],[ac_cv_have_working_snprintf=cross])])
 AC_MSG_RESULT([$ac_cv_have_working_snprintf])
 AC_MSG_CHECKING(for working vsnprintf)
 AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
-[AC_TRY_RUN(
-[#include <stdio.h>
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
 #include <stdarg.h>
 
 int my_vsnprintf (char *buf, const char *tmpl, ...)
@@ -225,7 +225,8 @@ int main(void)
     if (strcmp (bufd, "1")) exit (1);
     if (i != 3) exit (1);
     exit(0);
-}], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
+}]])],[ac_cv_have_working_vsnprintf=yes],
+[ac_cv_have_working_vsnprintf=no],[ac_cv_have_working_vsnprintf=cross])])
 AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
 if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
 AC_MSG_ERROR([fatal: buggy snprintf() detected])
@@ -423,13 +424,13 @@ AC_SEARCH_LIBS([inet_ntoa],[nsl],[],[
 ],[])
 ########################################################################### ucred
 AC_MSG_CHECKING(for struct ucred)
-AC_TRY_LINK([
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #define _GNU_SOURCE
        #include <sys/types.h>
        #include <sys/socket.h>
-],[
+]], [[
        struct ucred sucred; sucred.pid=0;
-],[have_ucred=yes],[have_ucred=no])
+]])],[have_ucred=yes],[have_ucred=no])
 AC_MSG_RESULT($have_ucred)
 if test ${have_ucred} = yes; then
        AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
@@ -472,13 +473,13 @@ LIBS="$OLD_LIBS"
 
 ########################################################################### ip_mreqn
 AC_MSG_CHECKING(for struct ip_mreqn (UDPv4 multicast))
-AC_TRY_LINK([
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <netdb.h>
        #include <net/if.h>
-],[
+]], [[
        struct ip_mreqn mn;
        mn.imr_ifindex = 0;
-],[have_ip_mreqn=yes],[have_ip_mreqn=no])
+]])],[have_ip_mreqn=yes],[have_ip_mreqn=no])
 AC_MSG_RESULT($have_ip_mreqn)
 if test ${have_ip_mreqn} = yes; then
        AC_DEFINE(HAVE_IP_MREQN, 1, define to 1 you have struct ip_mreqn)
@@ -486,11 +487,11 @@ fi
 ########################################################################### osx
 
 AC_MSG_CHECKING(for CoreAudio (MacOs))
-AC_TRY_LINK([
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <CoreAudio/CoreAudio.h>
-],[
+]], [[
        AudioDeviceID id;
-],[have_core_audio=yes],[have_core_audio=no])
+]])],[have_core_audio=yes],[have_core_audio=no])
 AC_MSG_RESULT($have_core_audio)
 if test ${have_core_audio} = yes; then
        f1="-framework CoreAudio"
@@ -738,11 +739,11 @@ if test -n "$with_id3tag_libs"; then
 fi
 
 AC_MSG_CHECKING(for libid3tag)
-AC_TRY_LINK([
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <id3tag.h>
-],[
+]], [[
        struct id3_tag t = {.flags = 0};
-],[], [have_libid3tag=no])
+]])],[],[have_libid3tag=no])
 AC_MSG_RESULT($have_libid3tag)
 
 if test ${have_libid3tag} = yes; then