[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: avoiding obsolete macros like AC_TRY_RUN
From: |
Ralf Wildenhues |
Subject: |
Re: avoiding obsolete macros like AC_TRY_RUN |
Date: |
Wed, 2 Sep 2009 06:56:22 +0200 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
* Jim Meyering wrote on Tue, Sep 01, 2009 at 08:19:55AM CEST:
>
> I'd welcome patches to modernize the m4/*.m4 files under my care.
> Since I tend to use gnulib's files as models, it's worthwhile to
> update them to use macros that aren't listed as "obsolete".
OK, here we go. This patch is for modules that you maintain or
co-maintain.
I removed uses of AC_TRY_{CPP,COMPILE,LINK,RUN}, replacing it with
the m4-semantic equivalent, double-m4-quoted, code. In a couple of
cases, I have improved the quoting of the surrounding code, too.
This means your code may not work with Autoconf older than 2.55
(sic! 7 years old), even if it did so before.
I have tested the patch by running
gnulib-tool --with-tests --test
and ensuring that the resulting configure script has differences only in
white space and within comments.
OK to apply?
Thanks,
Ralf
Remove obsolete macros in Jim's modules.
* m4/d-type.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Replace
obsolete Autoconf macros with modern counterparts.
* m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise.
* m4/dos.m4 (gl_AC_DOS): Likewise.
* m4/fpending.m4 (gl_FUNC_FPENDING): Likewise.
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Likewise.
* m4/getloadavg.m4 (gl_PREREQ_GETLOADAVG): Likewise.
* m4/jm-winsz1.m4 (gl_WINSIZE_IN_PTEM): Likewise.
* m4/link-follow.m4 (gl_AC_FUNC_LINK_FOLLOWS_SYMLINK): Likewise.
* m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Likewise.
* m4/mkdir-slash.m4 (gl_FUNC_MKDIR_TRAILING_SLASH): Likewise.
* m4/mode_t.m4 (gl_PROMOTED_TYPE_MODE_T): Likewise.
* m4/rename-dest-slash.m4 (gl_FUNC_RENAME_TRAILING_DEST_SLASH):
Likewise.
* m4/rename.m4 (gl_FUNC_RENAME): Likewise.
* m4/rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Likewise.
* m4/rpmatch.m4 (gl_PREREQ_RPMATCH): Likewise.
* m4/st_dm_mode.m4 (AC_STRUCT_ST_DM_MODE): Likewise.
* m4/stat-time.m4 (gl_STAT_TIME): Likewise.
* m4/utimes-null.m4 (gl_FUNC_UTIMES_NULL): Likewise.
Prompted by report from Bruce Korb.
---
m4/d-type.m4 | 14 ++++-----
m4/dirfd.m4 | 12 ++++----
m4/dos.m4 | 14 ++++----
m4/fpending.m4 | 10 ++----
m4/fsusage.m4 | 73 ++++++++++++++++++++++++----------------------
m4/getloadavg.m4 | 18 ++++++------
m4/jm-winsz1.m4 | 14 ++++----
m4/link-follow.m4 | 13 ++++----
m4/ls-mntd-fs.m4 | 60 +++++++++++++++++++-------------------
m4/mkdir-slash.m4 | 12 ++++----
m4/mode_t.m4 | 6 ++--
m4/rename-dest-slash.m4 | 12 ++++----
m4/rename.m4 | 12 ++++----
m4/rmdir-errno.m4 | 12 ++++----
m4/rpmatch.m4 | 6 ++--
m4/st_dm_mode.m4 | 11 ++++---
m4/stat-time.m4 | 10 +++---
m4/utimes-null.m4 | 12 ++++----
18 files changed, 160 insertions(+), 161 deletions(-)
diff --git a/m4/d-type.m4 b/m4/d-type.m4
index 7e99f9c..97e8852 100644
--- a/m4/d-type.m4
+++ b/m4/d-type.m4
@@ -1,4 +1,4 @@
-# serial 10
+# serial 11
dnl From Jim Meyering.
dnl
@@ -14,15 +14,13 @@ dnl
AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
[AC_CACHE_CHECK([for d_type member in directory struct],
gl_cv_struct_dirent_d_type,
- [AC_TRY_LINK(dnl
- [
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <dirent.h>
- ],
- [struct dirent dp; dp.d_type = 0;],
-
- gl_cv_struct_dirent_d_type=yes,
- gl_cv_struct_dirent_d_type=no)
+ ]],
+ [[struct dirent dp; dp.d_type = 0;]])],
+ [gl_cv_struct_dirent_d_type=yes],
+ [gl_cv_struct_dirent_d_type=no])
]
)
if test $gl_cv_struct_dirent_d_type = yes; then
diff --git a/m4/dirfd.m4 b/m4/dirfd.m4
index 5f845f5..02ddc9f 100644
--- a/m4/dirfd.m4
+++ b/m4/dirfd.m4
@@ -1,4 +1,4 @@
-# serial 16 -*- Autoconf -*-
+# serial 17 -*- Autoconf -*-
dnl Find out how to get the file descriptor associated with an open DIR*.
@@ -53,11 +53,11 @@ AC_DEFUN([gl_FUNC_DIRFD],
for ac_expr in d_fd dd_fd; do
CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
- AC_TRY_COMPILE(
- [#include <sys/types.h>
- #include <dirent.h>],
- [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
- dir_fd_found=yes
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ #include <dirent.h>]],
+ [[DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;]])],
+ [dir_fd_found=yes]
)
CFLAGS=$dirfd_save_CFLAGS
test "$dir_fd_found" = yes && break
diff --git a/m4/dos.m4 b/m4/dos.m4
index dd59571..231ddc0 100644
--- a/m4/dos.m4
+++ b/m4/dos.m4
@@ -1,4 +1,4 @@
-#serial 10 -*- autoconf -*-
+#serial 11 -*- autoconf -*-
# Define some macros required for proper operation of code in lib/*.c
# on MSDOS/Windows systems.
@@ -14,10 +14,10 @@ AC_DEFUN([gl_AC_DOS],
[
AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
[
- AC_TRY_COMPILE([],
- [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ &&
!defined __CYGWIN__
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined
__CYGWIN__
neither MSDOS nor Windows
-#endif],
+#endif]])],
[ac_cv_win_or_dos=yes],
[ac_cv_win_or_dos=no])
])
@@ -28,10 +28,10 @@ neither MSDOS nor Windows
AC_CACHE_CHECK([whether drive letter can start relative path],
[ac_cv_drive_letter_can_be_relative],
[
- AC_TRY_COMPILE([],
- [#if defined __CYGWIN__
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+#if defined __CYGWIN__
drive letters are always absolute
-#endif],
+#endif]])],
[ac_cv_drive_letter_can_be_relative=yes],
[ac_cv_drive_letter_can_be_relative=no])
])
diff --git a/m4/fpending.m4 b/m4/fpending.m4
index 7860d70..fecf3f3 100644
--- a/m4/fpending.m4
+++ b/m4/fpending.m4
@@ -1,4 +1,4 @@
-# serial 14
+# serial 15
# Copyright (C) 2000-2001, 2004-2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -65,11 +65,9 @@ AC_DEFUN([gl_FUNC_FPENDING],
# Skip each embedded comment.
case "$ac_expr" in '#'*) continue;; esac
- AC_TRY_COMPILE(
- [#include <stdio.h>
- ],
- [FILE *fp = stdin; (void) ($ac_expr);],
- fp_done=yes
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+ [[FILE *fp = stdin; (void) ($ac_expr);]])],
+ [fp_done=yes]
)
test "$fp_done" = yes && break
done
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index 8b8cbf7..d92470b 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -1,4 +1,4 @@
-# serial 24
+# serial 25
# Obtaining file system usage information.
# Copyright (C) 1997-1998, 2000-2001, 2003-2009 Free Software Foundation, Inc.
@@ -46,7 +46,7 @@ ac_fsusage_space=no
if test $ac_fsusage_space = no; then
# SVR4
AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs],
- [AC_TRY_LINK([#include <sys/types.h>
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#if defined __GLIBC__ && defined __linux__
Do not use statvfs on systems with GNU libc on Linux, because that function
stats all preceding entries in /proc/mounts, and that makes df hang if even
@@ -59,10 +59,10 @@ a system call.
"Do not use Tru64's statvfs implementation"
#endif
-#include <sys/statvfs.h>],
- [struct statvfs fsd; statvfs (0, &fsd);],
- fu_cv_sys_stat_statvfs=yes,
- fu_cv_sys_stat_statvfs=no)])
+#include <sys/statvfs.h>]],
+ [[struct statvfs fsd; statvfs (0, &fsd);]])],
+ [fu_cv_sys_stat_statvfs=yes],
+ [fu_cv_sys_stat_statvfs=no])])
if test $fu_cv_sys_stat_statvfs = yes; then
ac_fsusage_space=yes
AC_DEFINE([STAT_STATVFS], [1],
@@ -74,7 +74,7 @@ if test $ac_fsusage_space = no; then
# DEC Alpha running OSF/1
AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
AC_CACHE_VAL([fu_cv_sys_stat_statfs3_osf1],
- [AC_TRY_RUN([
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mount.h>
@@ -84,10 +84,10 @@ if test $ac_fsusage_space = no; then
struct statfs fsd;
fsd.f_fsize = 0;
return statfs (".", &fsd, sizeof (struct statfs)) != 0;
- }],
- fu_cv_sys_stat_statfs3_osf1=yes,
- fu_cv_sys_stat_statfs3_osf1=no,
- fu_cv_sys_stat_statfs3_osf1=no)])
+ }]])],
+ [fu_cv_sys_stat_statfs3_osf1=yes],
+ [fu_cv_sys_stat_statfs3_osf1=no],
+ [fu_cv_sys_stat_statfs3_osf1=no])])
AC_MSG_RESULT([$fu_cv_sys_stat_statfs3_osf1])
if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
ac_fsusage_space=yes
@@ -101,7 +101,7 @@ if test $ac_fsusage_space = no; then
AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
member (AIX, 4.3BSD)])
AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize],
- [AC_TRY_RUN([
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -117,10 +117,10 @@ member (AIX, 4.3BSD)])
struct statfs fsd;
fsd.f_bsize = 0;
return statfs (".", &fsd) != 0;
- }],
- fu_cv_sys_stat_statfs2_bsize=yes,
- fu_cv_sys_stat_statfs2_bsize=no,
- fu_cv_sys_stat_statfs2_bsize=no)])
+ }]])],
+ [fu_cv_sys_stat_statfs2_bsize=yes],
+ [fu_cv_sys_stat_statfs2_bsize=no],
+ [fu_cv_sys_stat_statfs2_bsize=no])])
AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
if test $fu_cv_sys_stat_statfs2_bsize = yes; then
ac_fsusage_space=yes
@@ -134,17 +134,18 @@ if test $ac_fsusage_space = no; then
# SVR3
AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
AC_CACHE_VAL([fu_cv_sys_stat_statfs4],
- [AC_TRY_RUN([#include <sys/types.h>
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
#include <sys/statfs.h>
int
main ()
{
struct statfs fsd;
return statfs (".", &fsd, sizeof fsd, 0) != 0;
- }],
- fu_cv_sys_stat_statfs4=yes,
- fu_cv_sys_stat_statfs4=no,
- fu_cv_sys_stat_statfs4=no)])
+ }]])],
+ [fu_cv_sys_stat_statfs4=yes],
+ [fu_cv_sys_stat_statfs4=no],
+ [fu_cv_sys_stat_statfs4=no])])
AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
if test $fu_cv_sys_stat_statfs4 = yes; then
ac_fsusage_space=yes
@@ -158,7 +159,8 @@ if test $ac_fsusage_space = no; then
AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
member (4.4BSD and NetBSD)])
AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize],
- [AC_TRY_RUN([#include <sys/types.h>
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -171,10 +173,10 @@ member (4.4BSD and NetBSD)])
struct statfs fsd;
fsd.f_fsize = 0;
return statfs (".", &fsd) != 0;
- }],
- fu_cv_sys_stat_statfs2_fsize=yes,
- fu_cv_sys_stat_statfs2_fsize=no,
- fu_cv_sys_stat_statfs2_fsize=no)])
+ }]])],
+ [fu_cv_sys_stat_statfs2_fsize=yes],
+ [fu_cv_sys_stat_statfs2_fsize=no],
+ [fu_cv_sys_stat_statfs2_fsize=no])])
AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
if test $fu_cv_sys_stat_statfs2_fsize = yes; then
ac_fsusage_space=yes
@@ -188,7 +190,8 @@ if test $ac_fsusage_space = no; then
# Ultrix
AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
AC_CACHE_VAL([fu_cv_sys_stat_fs_data],
- [AC_TRY_RUN([#include <sys/types.h>
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -205,10 +208,10 @@ if test $ac_fsusage_space = no; then
/* Ultrix's statfs returns 1 for success,
0 for not mounted, -1 for failure. */
return statfs (".", &fsd) != 1;
- }],
- fu_cv_sys_stat_fs_data=yes,
- fu_cv_sys_stat_fs_data=no,
- fu_cv_sys_stat_fs_data=no)])
+ }]])],
+ [fu_cv_sys_stat_fs_data=yes],
+ [fu_cv_sys_stat_fs_data=no],
+ [fu_cv_sys_stat_fs_data=no])])
AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
if test $fu_cv_sys_stat_fs_data = yes; then
ac_fsusage_space=yes
@@ -220,12 +223,12 @@ fi
if test $ac_fsusage_space = no; then
# SVR2
- AC_TRY_CPP([#include <sys/filsys.h>
- ],
- AC_DEFINE([STAT_READ_FILSYS], [1],
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h>
+ ]])],
+ [AC_DEFINE([STAT_READ_FILSYS], [1],
[Define if there is no specific function for reading file systems usage
information and you have the <sys/filsys.h> header file. (SVR2)])
- ac_fsusage_space=yes)
+ ac_fsusage_space=yes])
fi
AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 28237d7..e5ea9a4 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -174,14 +174,14 @@ AC_CHECK_HEADERS([nlist.h],
`n_un' member. Obsolete, depend on
`HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
address@hidden:@include <nlist.h>])
- AC_TRY_LINK([#include <nlist.h>],
- [struct nlist x;
- #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
- x.n_un.n_name = "";
- #else
- x.n_name = "";
- #endif],
- [AC_DEFINE([N_NAME_POINTER], [1],
- [Define to 1 if the nlist n_name member is a
pointer])])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <nlist.h>]],
+ [[struct nlist x;
+ #ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
+ x.n_un.n_name = "";
+ #else
+ x.n_name = "";
+ #endif]])],
+ [AC_DEFINE([N_NAME_POINTER], [1],
+ [Define to 1 if the nlist n_name member is a
pointer])])
])dnl
])# gl_PREREQ_GETLOADAVG
diff --git a/m4/jm-winsz1.m4 b/m4/jm-winsz1.m4
index 40aa8b5..7804c8a 100644
--- a/m4/jm-winsz1.m4
+++ b/m4/jm-winsz1.m4
@@ -1,4 +1,4 @@
-# serial 10
+# serial 11
# Copyright (C) 1996, 1999, 2001-2002, 2004, 2006, 2009
# Free Software Foundation, Inc.
@@ -31,15 +31,15 @@ AC_DEFUN([gl_WINSIZE_IN_PTEM],
gl_cv_sys_struct_winsize_needs_sys_ptem_h,
[gl_cv_sys_struct_winsize_needs_sys_ptem_h=yes
if test $ac_cv_sys_posix_termios = yes; then
- AC_TRY_COMPILE([#include <termios.h>],
- [struct winsize x;
- if (sizeof x > 0) return 0;],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]],
+ [[struct winsize x;
+ if (sizeof x > 0) return 0;]])],
[gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
fi
if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
- AC_TRY_COMPILE([#include <sys/ptem.h>],
- [struct winsize x;
- if (sizeof x > 0) return 0;],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/ptem.h>]],
+ [[struct winsize x;
+ if (sizeof x > 0) return 0;]])],
[], [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
fi])
if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
diff --git a/m4/link-follow.m4 b/m4/link-follow.m4
index d282442..0c1ea36 100644
--- a/m4/link-follow.m4
+++ b/m4/link-follow.m4
@@ -1,4 +1,4 @@
-# serial 11
+# serial 12
dnl Run a program to determine whether link(2) follows symlinks.
dnl Set LINK_FOLLOWS_SYMLINKS accordingly.
@@ -14,8 +14,7 @@ AC_DEFUN([gl_AC_FUNC_LINK_FOLLOWS_SYMLINK],
[
# Create a regular file.
echo > conftest.file
- AC_TRY_RUN(
- [
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h>
@@ -50,10 +49,10 @@ AC_DEFUN([gl_AC_FUNC_LINK_FOLLOWS_SYMLINK],
the link call followed the symlink. */
return SAME_INODE (sb_hard, sb_file) ? 0 : 1;
}
- ],
- gl_ac_cv_func_link_follows_symlink=yes,
- gl_ac_cv_func_link_follows_symlink=no,
- gl_ac_cv_func_link_follows_symlink=yes dnl We're cross compiling.
+ ]])],
+ [gl_ac_cv_func_link_follows_symlink=yes],
+ [gl_ac_cv_func_link_follows_symlink=no],
+ [gl_ac_cv_func_link_follows_symlink=yes] dnl We're cross compiling.
)
])
if test $gl_ac_cv_func_link_follows_symlink = yes; then
diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4
index 32ccb98..d042f99 100644
--- a/m4/ls-mntd-fs.m4
+++ b/m4/ls-mntd-fs.m4
@@ -1,4 +1,4 @@
-# serial 27
+# serial 28
# How to list mounted file systems.
# Copyright (C) 1998-2004, 2006, 2009 Free Software Foundation, Inc.
@@ -101,9 +101,9 @@ if test -z "$ac_list_mounted_fs"; then
# AIX.
AC_MSG_CHECKING([for mntctl function and struct vmount])
AC_CACHE_VAL([fu_cv_sys_mounted_vmount],
- [AC_TRY_CPP([#include <fshelp.h>],
- fu_cv_sys_mounted_vmount=yes,
- fu_cv_sys_mounted_vmount=no)])
+ [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <fshelp.h>]])],
+ [fu_cv_sys_mounted_vmount=yes],
+ [fu_cv_sys_mounted_vmount=no])])
AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
if test $fu_cv_sys_mounted_vmount = yes; then
ac_list_mounted_fs=found
@@ -123,7 +123,7 @@ if test $ac_cv_func_getmntent = yes; then
# 4.3BSD, SunOS, HP-UX, Dynix, Irix
AC_MSG_CHECKING([for one-argument getmntent function])
AC_CACHE_VAL([fu_cv_sys_mounted_getmntent1],
- [AC_TRY_COMPILE([
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
#include <stdio.h>
@@ -139,11 +139,11 @@ if test $ac_cv_func_getmntent = yes; then
# define MOUNTED MNTTABNAME
# endif
#endif
-],
- [ struct mntent *mnt = 0; char *table = MOUNTED;
- if (sizeof mnt && sizeof table) return 0;],
- fu_cv_sys_mounted_getmntent1=yes,
- fu_cv_sys_mounted_getmntent1=no)])
+]],
+ [[ struct mntent *mnt = 0; char *table = MOUNTED;
+ if (sizeof mnt && sizeof table) return 0;]])],
+ [fu_cv_sys_mounted_getmntent1=yes],
+ [fu_cv_sys_mounted_getmntent1=no])])
AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
if test $fu_cv_sys_mounted_getmntent1 = yes; then
ac_list_mounted_fs=found
@@ -179,20 +179,20 @@ if test -z "$ac_list_mounted_fs"; then
AC_MSG_CHECKING([for getfsstat function])
AC_CACHE_VAL([fu_cv_sys_mounted_getfsstat],
- [AC_TRY_LINK([
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
# define FS_TYPE(Ent) ((Ent).f_fstypename)
#else
# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
#endif
-]$getfsstat_includes
+$getfsstat_includes]]
,
- [struct statfs *stats;
- int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
- char *t = FS_TYPE (*stats); ],
- fu_cv_sys_mounted_getfsstat=yes,
- fu_cv_sys_mounted_getfsstat=no)])
+ [[struct statfs *stats;
+ int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
+ char *t = FS_TYPE (*stats); ]])],
+ [fu_cv_sys_mounted_getfsstat=yes],
+ [fu_cv_sys_mounted_getfsstat=no])])
AC_MSG_RESULT([$fu_cv_sys_mounted_getfsstat])
if test $fu_cv_sys_mounted_getfsstat = yes; then
ac_list_mounted_fs=found
@@ -206,12 +206,12 @@ if test -z "$ac_list_mounted_fs"; then
# SVR3
AC_MSG_CHECKING([for FIXME existence of three headers])
AC_CACHE_VAL([fu_cv_sys_mounted_fread_fstyp],
- [AC_TRY_CPP([
+ [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <sys/statfs.h>
#include <sys/fstyp.h>
-#include <mnttab.h>],
- fu_cv_sys_mounted_fread_fstyp=yes,
- fu_cv_sys_mounted_fread_fstyp=no)])
+#include <mnttab.h>]])],
+ [fu_cv_sys_mounted_fread_fstyp=yes],
+ [fu_cv_sys_mounted_fread_fstyp=no])])
AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
if test $fu_cv_sys_mounted_fread_fstyp = yes; then
ac_list_mounted_fs=found
@@ -236,7 +236,7 @@ if test -z "$ac_list_mounted_fs"; then
AC_MSG_CHECKING([whether getmntinfo returns statvfs structures])
AC_CACHE_VAL([fu_cv_sys_mounted_getmntinfo2],
[
- AC_TRY_COMPILE([
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
@@ -248,7 +248,7 @@ if test -z "$ac_list_mounted_fs"; then
# include <sys/statvfs.h>
#endif
extern int getmntinfo (struct statfs **, int);
- ], [],
+ ]], [])],
[fu_cv_sys_mounted_getmntinfo2=no],
[fu_cv_sys_mounted_getmntinfo2=yes])
])
@@ -273,11 +273,11 @@ if test -z "$ac_list_mounted_fs"; then
# Ultrix
AC_MSG_CHECKING([for getmnt function])
AC_CACHE_VAL([fu_cv_sys_mounted_getmnt],
- [AC_TRY_CPP([
+ [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <sys/fs_types.h>
-#include <sys/mount.h>],
- fu_cv_sys_mounted_getmnt=yes,
- fu_cv_sys_mounted_getmnt=no)])
+#include <sys/mount.h>]])],
+ [fu_cv_sys_mounted_getmnt=yes],
+ [fu_cv_sys_mounted_getmnt=no])])
AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
if test $fu_cv_sys_mounted_getmnt = yes; then
ac_list_mounted_fs=found
@@ -312,9 +312,9 @@ if test -z "$ac_list_mounted_fs"; then
# SVR2
AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
AC_CACHE_VAL([fu_cv_sys_mounted_fread],
- [AC_TRY_CPP([#include <mnttab.h>],
- fu_cv_sys_mounted_fread=yes,
- fu_cv_sys_mounted_fread=no)])
+ [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <mnttab.h>]])],
+ [fu_cv_sys_mounted_fread=yes],
+ [fu_cv_sys_mounted_fread=no])])
AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
if test $fu_cv_sys_mounted_fread = yes; then
ac_list_mounted_fs=found
diff --git a/m4/mkdir-slash.m4 b/m4/mkdir-slash.m4
index 4e56bda..a0bc12e 100644
--- a/m4/mkdir-slash.m4
+++ b/m4/mkdir-slash.m4
@@ -1,4 +1,4 @@
-# serial 7
+# serial 8
# Copyright (C) 2001, 2003-2004, 2006, 2008-2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_MKDIR_TRAILING_SLASH],
[
# Arrange for deletion of the temporary directory this test might create.
ac_clean_files="$ac_clean_files confdir-slash"
- AC_TRY_RUN([
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
# include <sys/types.h>
# include <sys/stat.h>
# include <stdlib.h>
@@ -29,10 +29,10 @@ AC_DEFUN([gl_FUNC_MKDIR_TRAILING_SLASH],
rmdir ("confdir-slash");
exit (mkdir ("confdir-slash/", 0700));
}
- ],
- gl_cv_func_mkdir_trailing_slash_bug=no,
- gl_cv_func_mkdir_trailing_slash_bug=yes,
- gl_cv_func_mkdir_trailing_slash_bug=yes
+ ]])],
+ [gl_cv_func_mkdir_trailing_slash_bug=no],
+ [gl_cv_func_mkdir_trailing_slash_bug=yes],
+ [gl_cv_func_mkdir_trailing_slash_bug=yes]
)
]
)
diff --git a/m4/mode_t.m4 b/m4/mode_t.m4
index a4dd694..9158237 100644
--- a/m4/mode_t.m4
+++ b/m4/mode_t.m4
@@ -1,4 +1,4 @@
-# mode_t.m4 serial 1
+# mode_t.m4 serial 2
dnl Copyright (C) 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -16,8 +16,8 @@ AC_DEFUN([gl_PROMOTED_TYPE_MODE_T],
dnl Assume mode_t promotes to 'int' if and only if it is smaller than
'int',
dnl and to itself otherwise. This assumption is not guaranteed by the ISO C
dnl standard, but we don't know of any real-world counterexamples.
- AC_TRY_COMPILE([#include <sys/types.h>],
- [typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
+ [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])],
[gl_cv_promoted_mode_t='int'],
[gl_cv_promoted_mode_t='mode_t'])
])
diff --git a/m4/rename-dest-slash.m4 b/m4/rename-dest-slash.m4
index b225d7b..2ddbbcb 100644
--- a/m4/rename-dest-slash.m4
+++ b/m4/rename-dest-slash.m4
@@ -1,4 +1,4 @@
-# serial 3
+# serial 4
# Copyright (C) 2006, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -18,18 +18,18 @@ AC_DEFUN([gl_FUNC_RENAME_TRAILING_DEST_SLASH],
rm -rf conftest.d1 conftest.d2
mkdir conftest.d1 ||
AC_MSG_ERROR([cannot create temporary directory])
- AC_TRY_RUN([
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
# include <stdio.h>
int
main ()
{
return (rename ("conftest.d1", "conftest.d2/") ? 1 : 0);
}
- ],
- gl_cv_func_rename_trailing_dest_slash_bug=no,
- gl_cv_func_rename_trailing_dest_slash_bug=yes,
+ ]])],
+ [gl_cv_func_rename_trailing_dest_slash_bug=no],
+ [gl_cv_func_rename_trailing_dest_slash_bug=yes],
dnl When crosscompiling, assume rename is broken.
- gl_cv_func_rename_trailing_dest_slash_bug=yes)
+ [gl_cv_func_rename_trailing_dest_slash_bug=yes])
rm -rf conftest.d1 conftest.d2
])
diff --git a/m4/rename.m4 b/m4/rename.m4
index dd70321..0592fcb 100644
--- a/m4/rename.m4
+++ b/m4/rename.m4
@@ -1,4 +1,4 @@
-# serial 13
+# serial 14
# Copyright (C) 2001, 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_RENAME],
rm -rf conftest.d1 conftest.d2
mkdir conftest.d1 ||
AC_MSG_ERROR([cannot create temporary directory])
- AC_TRY_RUN([
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
# include <stdio.h>
# include <stdlib.h>
int
@@ -30,11 +30,11 @@ AC_DEFUN([gl_FUNC_RENAME],
{
exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
}
- ],
- gl_cv_func_rename_trailing_slash_bug=no,
- gl_cv_func_rename_trailing_slash_bug=yes,
+ ]])],
+ [gl_cv_func_rename_trailing_slash_bug=no],
+ [gl_cv_func_rename_trailing_slash_bug=yes],
dnl When crosscompiling, assume rename is broken.
- gl_cv_func_rename_trailing_slash_bug=yes)
+ [gl_cv_func_rename_trailing_slash_bug=yes])
rm -rf conftest.d1 conftest.d2
])
diff --git a/m4/rmdir-errno.m4 b/m4/rmdir-errno.m4
index 4aca054..b7398bc 100644
--- a/m4/rmdir-errno.m4
+++ b/m4/rmdir-errno.m4
@@ -1,4 +1,4 @@
-# serial 9
+# serial 10
# Copyright (C) 2000, 2001, 2005, 2006, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -19,7 +19,7 @@ AC_DEFUN([gl_FUNC_RMDIR_NOTEMPTY],
# Arrange for deletion of the temporary directory this test creates.
ac_clean_files="$ac_clean_files confdir2"
mkdir confdir2; : > confdir2/file
- AC_TRY_RUN([
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
@@ -35,10 +35,10 @@ AC_DEFUN([gl_FUNC_RMDIR_NOTEMPTY],
fprintf (s, "%d\n", val);
return 0;
}
- ],
- gl_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`,
- gl_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4',
- gl_cv_func_rmdir_errno_not_empty=ENOTEMPTY
+ ]])],
+ [gl_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`],
+ [gl_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4'],
+ [gl_cv_func_rmdir_errno_not_empty=ENOTEMPTY]
)
]
)
diff --git a/m4/rpmatch.m4 b/m4/rpmatch.m4
index 387deff..9a8d29b 100644
--- a/m4/rpmatch.m4
+++ b/m4/rpmatch.m4
@@ -1,4 +1,4 @@
-# rpmatch.m4 serial 8
+# rpmatch.m4 serial 9
dnl Copyright (C) 2002-2003, 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -20,8 +20,8 @@ AC_DEFUN([gl_FUNC_RPMATCH],
# Prerequisites of lib/rpmatch.c.
AC_DEFUN([gl_PREREQ_RPMATCH], [
AC_CACHE_CHECK([for nl_langinfo and YESEXPR], [gl_cv_langinfo_yesexpr],
- [AC_TRY_LINK([#include <langinfo.h>],
- [char* cs = nl_langinfo(YESEXPR); return !cs;],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
+ [[char* cs = nl_langinfo(YESEXPR); return !cs;]])],
[gl_cv_langinfo_yesexpr=yes],
[gl_cv_langinfo_yesexpr=no])
])
diff --git a/m4/st_dm_mode.m4 b/m4/st_dm_mode.m4
index 6a6d5b7..641858c 100644
--- a/m4/st_dm_mode.m4
+++ b/m4/st_dm_mode.m4
@@ -1,4 +1,4 @@
-# serial 5
+# serial 6
# Copyright (C) 1998, 1999, 2001, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -9,10 +9,11 @@
AC_DEFUN([AC_STRUCT_ST_DM_MODE],
[AC_CACHE_CHECK([for st_dm_mode in struct stat], [ac_cv_struct_st_dm_mode],
- [AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/stat.h>], [struct stat s; s.st_dm_mode;],
- ac_cv_struct_st_dm_mode=yes,
- ac_cv_struct_st_dm_mode=no)])
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/stat.h>]], [[struct stat s; s.st_dm_mode;]])],
+ [ac_cv_struct_st_dm_mode=yes],
+ [ac_cv_struct_st_dm_mode=no])])
if test $ac_cv_struct_st_dm_mode = yes; then
AC_DEFINE([HAVE_ST_DM_MODE], [1],
diff --git a/m4/stat-time.m4 b/m4/stat-time.m4
index b860be8..cdef9d1 100644
--- a/m4/stat-time.m4
+++ b/m4/stat-time.m4
@@ -26,8 +26,8 @@ AC_DEFUN([gl_STAT_TIME],
AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
[AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
[ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
- [AC_TRY_COMPILE(
- [
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[
#include <sys/types.h>
#include <sys/stat.h>
#if HAVE_SYS_TIME_H
@@ -36,10 +36,10 @@ AC_DEFUN([gl_STAT_TIME],
#include <time.h>
struct timespec ts;
struct stat st;
- ],
- [
+ ]],
+ [[
st.st_atim = ts;
- ],
+ ]])],
[ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
[ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
diff --git a/m4/utimes-null.m4 b/m4/utimes-null.m4
index dffa798..91976f1 100644
--- a/m4/utimes-null.m4
+++ b/m4/utimes-null.m4
@@ -1,4 +1,4 @@
-# serial 8
+# serial 9
# Copyright (C) 1998-1999, 2001, 2003-2004, 2006, 2009 Free Software
# Foundation, Inc.
@@ -13,7 +13,7 @@ dnl then do case-insensitive s/utime/utimes/.
AC_DEFUN([gl_FUNC_UTIMES_NULL],
[AC_CACHE_CHECK([whether utimes accepts a null argument],
[ac_cv_func_utimes_null],
[rm -f conftest.data; > conftest.data
-AC_TRY_RUN([
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
/* In case stat has been defined to rpl_stat, undef it here. */
#undef stat
#include <sys/types.h>
@@ -27,10 +27,10 @@ return ! (stat ("conftest.data", &s) == 0
&& stat ("conftest.data", &t) == 0
&& t.st_mtime >= s.st_mtime
&& t.st_mtime - s.st_mtime < 120));
-}],
- ac_cv_func_utimes_null=yes,
- ac_cv_func_utimes_null=no,
- ac_cv_func_utimes_null=no)
+}]])],
+ [ac_cv_func_utimes_null=yes],
+ [ac_cv_func_utimes_null=no],
+ [ac_cv_func_utimes_null=no])
rm -f core core.* *.core])
if test $ac_cv_func_utimes_null = yes; then
--
1.6.4.2
- avoiding obsolete macros like AC_TRY_RUN [Re: gnulib-izing sharutils, Jim Meyering, 2009/09/01
- Re: avoiding obsolete macros like AC_TRY_RUN,
Ralf Wildenhues <=
- Re: avoiding obsolete macros like AC_TRY_RUN, Jim Meyering, 2009/09/02
- Re: avoiding obsolete macros like AC_TRY_RUN, Bruno Haible, 2009/09/02
- Re: avoiding obsolete macros like AC_TRY_RUN, Ralf Wildenhues, 2009/09/02
- Re: avoiding obsolete macros like AC_TRY_RUN, Ralf Wildenhues, 2009/09/04
- Re: avoiding obsolete macros like AC_TRY_RUN, Jim Meyering, 2009/09/04
- Re: avoiding obsolete macros like AC_TRY_RUN, Ben Pfaff, 2009/09/04