Use AC_CHECK_MEMBERS

Change-Id: I18779ad869c97a6ddd12e39fe2f7a1f7b0c8cf56
Reviewed-on: https://code.wireshark.org/review/14754
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
João Valverde 2016-03-25 21:12:51 +00:00 committed by João Valverde
parent ae9e311480
commit 04a4b53509
7 changed files with 11 additions and 58 deletions

View File

@ -137,8 +137,8 @@ endif()
#Struct members
include(CheckStructHasMember)
check_struct_has_member("struct sockaddr" sa_len sys/socket.h HAVE_SA_LEN)
check_struct_has_member("struct stat" st_flags sys/stat.h HAVE_ST_FLAGS)
check_struct_has_member("struct sockaddr" sa_len sys/socket.h HAVE_SOCKADDR_SA_LEN)
check_struct_has_member("struct stat" st_flags sys/stat.h HAVE_STAT_ST_FLAGS)
check_struct_has_member("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZONE)
#Symbols but NOT enums or types

View File

@ -98,51 +98,6 @@ AC_DEFUN([AC_WIRESHARK_POP_FLAGS],
])
#
# AC_WIRESHARK_STRUCT_ST_FLAGS
#
dnl AC_STRUCT_ST_BLKSIZE extracted from the file in question,
dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into
dnl AC_WIRESHARK_STRUCT_ST_FLAGS, which checks if "struct stat"
dnl has the 4.4BSD "st_flags" member, and defines HAVE_ST_FLAGS; that's
dnl what's in this file.
dnl Done by Guy Harris <guy@alum.mit.edu> on 2012-06-02.
dnl ### Checks for structure members
AC_DEFUN([AC_WIRESHARK_STRUCT_ST_FLAGS],
[AC_CACHE_CHECK([for st_flags in struct stat], ac_cv_wireshark_struct_st_flags,
[AC_TRY_COMPILE([#include <sys/stat.h>], [struct stat s; s.st_flags;],
ac_cv_wireshark_struct_st_flags=yes, ac_cv_wireshark_struct_st_flags=no)])
if test $ac_cv_wireshark_struct_st_flags = yes; then
AC_DEFINE(HAVE_ST_FLAGS, 1, [Define if st_flags field exists in struct stat])
fi
])
#
# AC_WIRESHARK_STRUCT_SA_LEN
#
dnl AC_STRUCT_ST_BLKSIZE extracted from the file in question,
dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into
dnl AC_WIRESHARK_STRUCT_SA_LEN, which checks if "struct sockaddr"
dnl has the 4.4BSD "sa_len" member, and defines HAVE_SA_LEN; that's
dnl what's in this file.
dnl Done by Guy Harris <guy@alum.mit.edu> on 1998-11-14.
dnl ### Checks for structure members
AC_DEFUN([AC_WIRESHARK_STRUCT_SA_LEN],
[AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_wireshark_struct_sa_len,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
ac_cv_wireshark_struct_sa_len=yes, ac_cv_wireshark_struct_sa_len=no)])
if test $ac_cv_wireshark_struct_sa_len = yes; then
AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
fi
])
#
# AC_WIRESHARK_BREAKLOOP_TRY_LINK
#

View File

@ -272,7 +272,7 @@ get_interface_list(int *err, char **err_str)
}
next:
#ifdef HAVE_SA_LEN
#ifdef HAVE_SOCKADDR_SA_LEN
ifr = (struct ifreq *) ((char *) ifr +
(ifr->ifr_addr.sa_len > sizeof(ifr->ifr_addr) ?
ifr->ifr_addr.sa_len : sizeof(ifr->ifr_addr)) +

View File

@ -295,7 +295,7 @@
#cmakedefine HAVE_REMOTE 1
/* Define if sa_len field exists in struct sockaddr */
#cmakedefine HAVE_SA_LEN 1
#cmakedefine HAVE_SOCKADDR_SA_LEN 1
/* Define to 1 if you want to playing SBC by standalone BlueZ SBC library */
#cmakedefine HAVE_SBC 1
@ -319,7 +319,7 @@
#cmakedefine HAVE_STRPTIME 1
/* Define if st_flags field exists in struct stat */
#cmakedefine HAVE_ST_FLAGS 1
#cmakedefine HAVE_STAT_ST_FLAGS 1
/* Define to 1 if you have the `sysconf' function. */
#cmakedefine HAVE_SYSCONF 1

View File

@ -41,8 +41,6 @@
#define HAVE_PLUGINS 1
#define HAVE_EXTCAP 1
/* #undef HAVE_SA_LEN */
/* #undef HAVE_MKSTEMP */
/* #undef HAVE_MKDTEMP */

View File

@ -2734,12 +2734,12 @@ AC_STRUCT_TIMEZONE
# We need to know whether "struct stat" has an "st_flags" member
# for file_user_immutable().
AC_WIRESHARK_STRUCT_ST_FLAGS
AC_CHECK_MEMBERS([struct stat.st_flags])
# We need to know whether "struct sockaddr" has an "sa_len" member
# for get_interface_list().
AC_WIRESHARK_STRUCT_SA_LEN
AC_CHECK_MEMBERS([struct sockaddr.sa_len])
# We must know our byte order
AC_C_BIGENDIAN

View File

@ -304,9 +304,9 @@ file_target_unwritable_ui(GtkWidget *chooser_w, char *cf_name)
return TRUE;
}
/* OK, we have the permission bits and, if HAVE_ST_FLAGS is defined,
/* OK, we have the permission bits and, if HAVE_STAT_ST_FLAGS is defined,
the flags. (If we don't, we don't worry about it.) */
#ifdef HAVE_ST_FLAGS
#ifdef HAVE_STAT_ST_FLAGS
if (statbuf.st_flags & UF_IMMUTABLE) {
display_basename = g_filename_display_basename(cf_name);
msg_dialog = gtk_message_dialog_new(GTK_WINDOW(chooser_w),
@ -325,7 +325,7 @@ file_target_unwritable_ui(GtkWidget *chooser_w, char *cf_name)
display_basename);
g_free(display_basename);
} else
#endif /* HAVE_ST_FLAGS */
#endif /* HAVE_STAT_ST_FLAGS */
if ((statbuf.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) == 0) {
display_basename = g_filename_display_basename(cf_name);
msg_dialog = gtk_message_dialog_new(GTK_WINDOW(chooser_w),
@ -358,7 +358,7 @@ file_target_unwritable_ui(GtkWidget *chooser_w, char *cf_name)
return FALSE;
}
#ifdef HAVE_ST_FLAGS
#ifdef HAVE_STAT_ST_FLAGS
/* OK, they want to overwrite the file. If it has the "user
immutable" flag, we have to turn that off first, so we
can move on top of, or overwrite, the file. */