From: Akim Demaille Date: Fri, 19 May 2000 12:15:14 +0000 (+0000) Subject: * acspecific.m4 (_AC_LIBOBJ_GETLOADAVG): New macro, extracted from X-Git-Tag: autoconf-2.50~910 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf9061701f996cb973f63ad1721ca49d287bce0b;p=thirdparty%2Fautoconf.git * acspecific.m4 (_AC_LIBOBJ_GETLOADAVG): New macro, extracted from (AC_FUNC_GETLOADAVG): here. Use it. --- diff --git a/ChangeLog b/ChangeLog index 8e1816141..fdbc40f3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-05-19 Akim Demaille + + * acspecific.m4 (_AC_LIBOBJ_GETLOADAVG): New macro, extracted from + (AC_FUNC_GETLOADAVG): here. + Use it. + 2000-05-19 Akim Demaille * acgeneral.m4 (AC_SPECIALIZE): Avoid a useless `indir'. diff --git a/acspecific.m4 b/acspecific.m4 index 56ee54ebc..7fb241450 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -857,6 +857,59 @@ fi ])# AC_FUNC_FNMATCH +# _AC_LIBOBJ_GETLOADAVG +# --------------------- +# Set up the AC_LIBOBJ replacement of `getloadavg'. +define([_AC_LIBOBJ_GETLOADAVG], +[AC_LIBOBJ(getloadavg) +AC_DEFINE(C_GETLOADAVG, 1, [Define if using `getloadavg.c'.]) +# Figure out what our getloadavg.c needs. +ac_have_func=no +AC_CHECK_HEADER(sys/dg_sys_info.h, +[ac_have_func=yes + AC_DEFINE(DGUX, 1, [Define for DGUX with .]) + AC_CHECK_LIB(dgc, dg_sys_info)]) + +AC_CHECK_HEADER(locale.h) +AC_CHECK_FUNCS(setlocale) + +# We cannot check for , because Solaris 2 does not use dwarf (it +# uses stabs), but it is still SVR4. We cannot check for because +# Irix 4.0.5F has the header but not the library. +if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then + ac_have_func=yes + AC_DEFINE(SVR4, 1, [Define on System V Release 4.]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(inq_stats/cpustats.h, + [ac_have_func=yes + AC_DEFINE(UMAX, 1, [Define for Encore UMAX.]) + AC_DEFINE(UMAX4_3, 1, + [Define for Encore UMAX 4.3 that has + instead of .])]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(sys/cpustats.h, + [ac_have_func=yes; AC_DEFINE(UMAX)]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADERS(mach/mach.h) +fi + +AC_CHECK_HEADERS(nlist.h, +[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], + [AC_DEFINE(NLIST_NAME_UNION, 1, + [Define if your `struct nlist' has an + `n_un' member. Obsolete, depend on + `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], + [@%:@include ]) +])dnl +])# _AC_LIBOBJ_GETLOADAVG + + # AC_FUNC_GETLOADAVG # ------------------ AC_DEFUN([AC_FUNC_GETLOADAVG], @@ -892,71 +945,22 @@ if test $ac_have_func = no; then [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS]) fi -# Make sure it is really in the library, if we think we found it. -AC_REPLACE_FUNCS(getloadavg) - -if test $ac_cv_func_getloadavg = yes; then - AC_DEFINE(HAVE_GETLOADAVG, 1, - [Define if your system has its own `getloadavg' function.]) - ac_have_func=yes -else - AC_DEFINE(C_GETLOADAVG, 1, [Define if using `getloadavg.c'.]) - # Figure out what our getloadavg.c needs. - ac_have_func=no - AC_CHECK_HEADER(sys/dg_sys_info.h, - [ac_have_func=yes - AC_DEFINE(DGUX, 1, [Define for DGUX with .]) - AC_CHECK_LIB(dgc, dg_sys_info)]) - - AC_CHECK_HEADER(locale.h) - AC_CHECK_FUNCS(setlocale) - - # We cannot check for , because Solaris 2 does not use dwarf (it - # uses stabs), but it is still SVR4. We cannot check for because - # Irix 4.0.5F has the header but not the library. - if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then - ac_have_func=yes - AC_DEFINE(SVR4, 1, [Define on System V Release 4.]) - fi - - if test $ac_have_func = no; then - AC_CHECK_HEADER(inq_stats/cpustats.h, - [ac_have_func=yes - AC_DEFINE(UMAX, 1, [Define for Encore UMAX.]) - AC_DEFINE(UMAX4_3, 1, - [Define for Encore UMAX 4.3 that has - instead of .])]) - fi - - if test $ac_have_func = no; then - AC_CHECK_HEADER(sys/cpustats.h, - [ac_have_func=yes; AC_DEFINE(UMAX)]) - fi - - if test $ac_have_func = no; then - AC_CHECK_HEADERS(mach/mach.h) - fi - - AC_CHECK_HEADERS(nlist.h, - [AC_CHECK_MEMBERS([struct nlist.n_un.n_name], - [AC_DEFINE(NLIST_NAME_UNION, 1, - [Define if your `struct nlist' has an - `n_un' member. Obsolete, depend on - `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], - [@%:@include ]) - ])dnl -fi # Do not have getloadavg in system libraries. +# Make sure it is really in the library, if we think we found it, +# otherwise set up the replacement function. +AC_CHECK_FUNCS(getloadavg, [], + [_AC_LIBOBJ_GETLOADAVG]) # Some definitions of getloadavg require that the program be installed setgid. dnl FIXME: Don't hardwire the path of getloadavg.c in the top-level directory. AC_CACHE_CHECK(whether getloadavg requires setgid, - ac_cv_func_getloadavg_setgid, + ac_cv_func_getloadavg_setgid, [AC_EGREP_CPP([Yowza Am I SETGID yet], [#include "$srcdir/getloadavg.c" #ifdef LDAV_PRIVILEGED Yowza Am I SETGID yet @%:@endif], - ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)]) + ac_cv_func_getloadavg_setgid=yes, + ac_cv_func_getloadavg_setgid=no)]) if test $ac_cv_func_getloadavg_setgid = yes; then NEED_SETGID=true AC_DEFINE(GETLOADAVG_PRIVILEGED, 1, @@ -978,9 +982,8 @@ if test $ac_cv_func_getloadavg_setgid = yes; then s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; / /s/.* //;p;']` ]) - KMEM_GROUP=$ac_cv_group_kmem + AC_SUBST(KMEM_GROUP, $ac_cv_group_kmem)dnl fi -AC_SUBST(KMEM_GROUP)dnl if test "x$ac_save_LIBS" = x; then GETLOADAVG_LIBS=$LIBS else diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 56ee54ebc..7fb241450 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -857,6 +857,59 @@ fi ])# AC_FUNC_FNMATCH +# _AC_LIBOBJ_GETLOADAVG +# --------------------- +# Set up the AC_LIBOBJ replacement of `getloadavg'. +define([_AC_LIBOBJ_GETLOADAVG], +[AC_LIBOBJ(getloadavg) +AC_DEFINE(C_GETLOADAVG, 1, [Define if using `getloadavg.c'.]) +# Figure out what our getloadavg.c needs. +ac_have_func=no +AC_CHECK_HEADER(sys/dg_sys_info.h, +[ac_have_func=yes + AC_DEFINE(DGUX, 1, [Define for DGUX with .]) + AC_CHECK_LIB(dgc, dg_sys_info)]) + +AC_CHECK_HEADER(locale.h) +AC_CHECK_FUNCS(setlocale) + +# We cannot check for , because Solaris 2 does not use dwarf (it +# uses stabs), but it is still SVR4. We cannot check for because +# Irix 4.0.5F has the header but not the library. +if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then + ac_have_func=yes + AC_DEFINE(SVR4, 1, [Define on System V Release 4.]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(inq_stats/cpustats.h, + [ac_have_func=yes + AC_DEFINE(UMAX, 1, [Define for Encore UMAX.]) + AC_DEFINE(UMAX4_3, 1, + [Define for Encore UMAX 4.3 that has + instead of .])]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(sys/cpustats.h, + [ac_have_func=yes; AC_DEFINE(UMAX)]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADERS(mach/mach.h) +fi + +AC_CHECK_HEADERS(nlist.h, +[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], + [AC_DEFINE(NLIST_NAME_UNION, 1, + [Define if your `struct nlist' has an + `n_un' member. Obsolete, depend on + `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], + [@%:@include ]) +])dnl +])# _AC_LIBOBJ_GETLOADAVG + + # AC_FUNC_GETLOADAVG # ------------------ AC_DEFUN([AC_FUNC_GETLOADAVG], @@ -892,71 +945,22 @@ if test $ac_have_func = no; then [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS]) fi -# Make sure it is really in the library, if we think we found it. -AC_REPLACE_FUNCS(getloadavg) - -if test $ac_cv_func_getloadavg = yes; then - AC_DEFINE(HAVE_GETLOADAVG, 1, - [Define if your system has its own `getloadavg' function.]) - ac_have_func=yes -else - AC_DEFINE(C_GETLOADAVG, 1, [Define if using `getloadavg.c'.]) - # Figure out what our getloadavg.c needs. - ac_have_func=no - AC_CHECK_HEADER(sys/dg_sys_info.h, - [ac_have_func=yes - AC_DEFINE(DGUX, 1, [Define for DGUX with .]) - AC_CHECK_LIB(dgc, dg_sys_info)]) - - AC_CHECK_HEADER(locale.h) - AC_CHECK_FUNCS(setlocale) - - # We cannot check for , because Solaris 2 does not use dwarf (it - # uses stabs), but it is still SVR4. We cannot check for because - # Irix 4.0.5F has the header but not the library. - if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then - ac_have_func=yes - AC_DEFINE(SVR4, 1, [Define on System V Release 4.]) - fi - - if test $ac_have_func = no; then - AC_CHECK_HEADER(inq_stats/cpustats.h, - [ac_have_func=yes - AC_DEFINE(UMAX, 1, [Define for Encore UMAX.]) - AC_DEFINE(UMAX4_3, 1, - [Define for Encore UMAX 4.3 that has - instead of .])]) - fi - - if test $ac_have_func = no; then - AC_CHECK_HEADER(sys/cpustats.h, - [ac_have_func=yes; AC_DEFINE(UMAX)]) - fi - - if test $ac_have_func = no; then - AC_CHECK_HEADERS(mach/mach.h) - fi - - AC_CHECK_HEADERS(nlist.h, - [AC_CHECK_MEMBERS([struct nlist.n_un.n_name], - [AC_DEFINE(NLIST_NAME_UNION, 1, - [Define if your `struct nlist' has an - `n_un' member. Obsolete, depend on - `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], - [@%:@include ]) - ])dnl -fi # Do not have getloadavg in system libraries. +# Make sure it is really in the library, if we think we found it, +# otherwise set up the replacement function. +AC_CHECK_FUNCS(getloadavg, [], + [_AC_LIBOBJ_GETLOADAVG]) # Some definitions of getloadavg require that the program be installed setgid. dnl FIXME: Don't hardwire the path of getloadavg.c in the top-level directory. AC_CACHE_CHECK(whether getloadavg requires setgid, - ac_cv_func_getloadavg_setgid, + ac_cv_func_getloadavg_setgid, [AC_EGREP_CPP([Yowza Am I SETGID yet], [#include "$srcdir/getloadavg.c" #ifdef LDAV_PRIVILEGED Yowza Am I SETGID yet @%:@endif], - ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)]) + ac_cv_func_getloadavg_setgid=yes, + ac_cv_func_getloadavg_setgid=no)]) if test $ac_cv_func_getloadavg_setgid = yes; then NEED_SETGID=true AC_DEFINE(GETLOADAVG_PRIVILEGED, 1, @@ -978,9 +982,8 @@ if test $ac_cv_func_getloadavg_setgid = yes; then s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; / /s/.* //;p;']` ]) - KMEM_GROUP=$ac_cv_group_kmem + AC_SUBST(KMEM_GROUP, $ac_cv_group_kmem)dnl fi -AC_SUBST(KMEM_GROUP)dnl if test "x$ac_save_LIBS" = x; then GETLOADAVG_LIBS=$LIBS else