From 04a4b535093895bb825fcf98390737b000331541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Fri, 25 Mar 2016 21:12:51 +0000 Subject: Use AC_CHECK_MEMBERS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I18779ad869c97a6ddd12e39fe2f7a1f7b0c8cf56 Reviewed-on: https://code.wireshark.org/review/14754 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde --- ConfigureChecks.cmake | 4 ++-- acinclude.m4 | 45 --------------------------------------- caputils/capture-pcap-util-unix.c | 2 +- cmakeconfig.h.in | 4 ++-- config.h.win32 | 2 -- configure.ac | 4 ++-- ui/gtk/file_dlg.c | 8 +++---- 7 files changed, 11 insertions(+), 58 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 600a04c36f..be9511e85b 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -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 diff --git a/acinclude.m4 b/acinclude.m4 index f62610e3bb..05b6f0e6c4 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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 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 ], [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 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 -#include ], [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 # diff --git a/caputils/capture-pcap-util-unix.c b/caputils/capture-pcap-util-unix.c index 244682772a..416349f87e 100644 --- a/caputils/capture-pcap-util-unix.c +++ b/caputils/capture-pcap-util-unix.c @@ -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)) + diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 7e28e0bb69..b979bfca89 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -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 diff --git a/config.h.win32 b/config.h.win32 index c308625402..326e5061a3 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -41,8 +41,6 @@ #define HAVE_PLUGINS 1 #define HAVE_EXTCAP 1 -/* #undef HAVE_SA_LEN */ - /* #undef HAVE_MKSTEMP */ /* #undef HAVE_MKDTEMP */ diff --git a/configure.ac b/configure.ac index 2a37fad148..bc0e283c3f 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/ui/gtk/file_dlg.c b/ui/gtk/file_dlg.c index aff41f0098..47e443dcff 100644 --- a/ui/gtk/file_dlg.c +++ b/ui/gtk/file_dlg.c @@ -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. */ -- cgit v1.2.3