From 666ec76f414cd10124107b16e44a5a3f4f63d69c Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Fri, 21 Jan 2005 11:53:23 +0000 Subject: [PATCH] * configure.ac (targ_archs): Use standard autoconf check for "struct stat.st_blocks" instead of rolling our own. * configure: Regenerated. * acconfig.h (HAVE_STRUCT_STAT_ST_BLOCKS): Remove undef. * config.in: Regenerated. --- gdb/ChangeLog | 8 +++ gdb/acconfig.h | 3 - gdb/config.in | 6 +- gdb/configure | 147 ++++++++++++++++++++++++++++++++--------------- gdb/configure.ac | 19 ++---- 5 files changed, 117 insertions(+), 66 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 050d502e0ac..c6de86e1324 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2005-01-21 Mark Kettenis + + * configure.ac (targ_archs): Use standard autoconf check for + "struct stat.st_blocks" instead of rolling our own. + * configure: Regenerated. + * acconfig.h (HAVE_STRUCT_STAT_ST_BLOCKS): Remove undef. + * config.in: Regenerated. + 2005-01-21 Mark Kettenis * configure.ac: Modernize checks for `long long' and `long double' diff --git a/gdb/acconfig.h b/gdb/acconfig.h index 19bf5392175..01e3b3fdcb0 100644 --- a/gdb/acconfig.h +++ b/gdb/acconfig.h @@ -6,9 +6,6 @@ /* Define if your struct reg has r_fs. */ #undef HAVE_STRUCT_REG_R_FS -/* Define if your struct stat has st_blocks. */ -#undef HAVE_STRUCT_STAT_ST_BLOCKS - /* Define if your struct reg has r_gs. */ #undef HAVE_STRUCT_REG_R_GS diff --git a/gdb/config.in b/gdb/config.in index 9c3aa5e1620..b9d87115fe4 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -7,9 +7,6 @@ /* Define if your struct reg has r_fs. */ #undef HAVE_STRUCT_REG_R_FS -/* Define if your struct stat has st_blocks. */ -#undef HAVE_STRUCT_STAT_ST_BLOCKS - /* Define if your struct reg has r_gs. */ #undef HAVE_STRUCT_REG_R_GS @@ -438,6 +435,9 @@ /* Define to 1 if your system has struct reg in . */ #undef HAVE_STRUCT_REG +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLOCKS + /* Define to 1 if your system has td_pcb in struct thread. */ #undef HAVE_STRUCT_THREAD_TD_PCB diff --git a/gdb/configure b/gdb/configure index 8759ad17cfa..028e495530a 100755 --- a/gdb/configure +++ b/gdb/configure @@ -13010,9 +13010,16 @@ fi done -echo "$as_me:$LINENO: checking for member st_blocks in struct stat" >&5 -echo $ECHO_N "checking for member st_blocks in struct stat... $ECHO_C" >&6 -if test "${gdb_cv_have_struct_stat_with_st_blocks_member+set}" = set; then +# ------------------------- # +# Checks for declarations. # +# ------------------------- # + +for ac_func in getopt +do + ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 +echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 +if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -13021,12 +13028,16 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +#undef $ac_tr_decl +#define $ac_tr_decl 1 + + int main () { -struct stat st; (void) st.st_blocks; +#ifndef $ac_func +char *(*pfn) = (char *(*)) $ac_func ; +#endif ; return 0; } @@ -13053,35 +13064,46 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gdb_cv_have_struct_stat_with_st_blocks_member=yes + eval "gcc_cv_have_decl_$ac_func=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gdb_cv_have_struct_stat_with_st_blocks_member=no +eval "gcc_cv_have_decl_$ac_func=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $gdb_cv_have_struct_stat_with_st_blocks_member" >&5 -echo "${ECHO_T}$gdb_cv_have_struct_stat_with_st_blocks_member" >&6 -if test $gdb_cv_have_struct_stat_with_st_blocks_member = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 +if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF +#define $ac_tr_decl 1 +_ACEOF + +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF +#define $ac_tr_decl 0 _ACEOF fi -# ------------------------- # -# Checks for declarations. # -# ------------------------- # +done +if test x = y ; then -for ac_func in getopt -do - ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` -echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 -echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 -if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_DECL_GETOPT 1 +_ACEOF +fi + + +# ----------------------- # +# Checks for structures. # +# ----------------------- # + +echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6 +if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -13090,16 +13112,57 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#undef $ac_tr_decl -#define $ac_tr_decl 1 - +$ac_includes_default +int +main () +{ +static struct stat ac_aggr; +if (ac_aggr.st_blocks) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_struct_stat_st_blocks=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default int main () { -#ifndef $ac_func -char *(*pfn) = (char *(*)) $ac_func ; -#endif +static struct stat ac_aggr; +if (sizeof ac_aggr.st_blocks) +return 0; ; return 0; } @@ -13126,36 +13189,26 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "gcc_cv_have_decl_$ac_func=yes" + ac_cv_member_struct_stat_st_blocks=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "gcc_cv_have_decl_$ac_func=no" +ac_cv_member_struct_stat_st_blocks=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6 +if test $ac_cv_member_struct_stat_st_blocks = yes; then -if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF -#define $ac_tr_decl 1 -_ACEOF - -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF -#define $ac_tr_decl 0 +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 _ACEOF -fi - -done -if test x = y ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_DECL_GETOPT 1 -_ACEOF fi diff --git a/gdb/configure.ac b/gdb/configure.ac index c079ac0efb4..82c8bbe8176 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -420,25 +420,18 @@ AC_CHECK_HEADERS(term.h, [], [], # unconditionally, so what's the point in checking these? AC_CHECK_HEADERS(ctype.h time.h) -dnl Check for struct stat with an st_blocks member -AC_MSG_CHECKING(for member st_blocks in struct stat) -AC_CACHE_VAL(gdb_cv_have_struct_stat_with_st_blocks_member, - [AC_TRY_COMPILE([#include -#include ], - [struct stat st; (void) st.st_blocks;], - gdb_cv_have_struct_stat_with_st_blocks_member=yes, - gdb_cv_have_struct_stat_with_st_blocks_member=no)]) -AC_MSG_RESULT($gdb_cv_have_struct_stat_with_st_blocks_member) -if test $gdb_cv_have_struct_stat_with_st_blocks_member = yes; then - AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS) -fi - # ------------------------- # # Checks for declarations. # # ------------------------- # gcc_AC_CHECK_DECLS(getopt) +# ----------------------- # +# Checks for structures. # +# ----------------------- # + +AC_CHECK_MEMBERS([struct stat.st_blocks]) + # ------------------ # # Checks for types. # # ------------------ # -- 2.30.2