bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getloadavg and LIBOBJDIR


From: Bruno Haible
Subject: getloadavg and LIBOBJDIR
Date: Mon, 18 Sep 2006 15:08:47 +0200
User-agent: KMail/1.9.1

For some time now, getloadavg is a module that causes gnulib-tool to fail:

  $ ./gnulib-tool --create-testdir --dir=/dev/shm/testdir getloadavg
  ...
  checking for error_at_line... yes
  configure: error: ././getloadavg.c is missing
  make: Nothing to be done for `built_sources'.
  make: *** No rule to make target `distclean'.  Stop.

and similarly for "gnulib-tool --import".

The cause is the use of autoconf's LIBOBJDIR. gnulib-tool cannot set
LIBOBJDIR, because in some use cases, gnulib-tool is invoked twice within
the scope of the same configure.ac file. And autoconf or automake gives an
error if LIBOBJDIR is assigned directly and if AC_CONFIG_LIBOBJ_DIR is
invoked more than once.

Now that getloadavg.m4 has been moved from autoconf to gnulib, we can fix
the problem here. The appended patch fixes it, by specifying the location
of the getloadavg.c file as an argument to the autoconf macro (similar to
what we do in gt_JAVAEXEC).

Objections?


2006-09-17  Bruno Haible  <address@hidden>

        * gnulib-tool (func_import, func_create_testdir): Set gl_source_base
        at the beginning of the gl_INIT macro.
        * m4/getloadavg.m4 (gl_GETLOADAVG): Expect the directory of
        getloadavg.c as first argument.
        * modules/getloadavg (configure.ac): Pass $gl_source_base to
        gl_GETLOADAVG.

*** gnulib-20060908/gnulib-tool 2006-09-17 15:47:02.000000000 +0200
--- gnulib-20060908-modified/gnulib-tool        2006-09-17 23:21:59.000000000 
+0200
***************
*** 1858,1863 ****
--- 1858,1864 ----
        echo "  gl_libdeps="
        echo "  gl_ltlibdeps="
      fi
+     echo "  gl_source_base='$sourcebase'"
      if test "$auxdir" != "build-aux"; then
        sed_replace_build_aux='
          :a
***************
*** 2149,2154 ****
--- 2143,2149 ----
         echo "gl_libdeps="
         echo "gl_ltlibdeps="
       fi
+      echo "gl_source_base='$testsbase'"
       # Wrap the set of autoconf snippets into an autoconf macro that is then
       # invoked. This is needed because autoconf does not support AC_REQUIRE
       # at the top level:
***************
*** 2257,2262 ****
--- 2252,2258 ----
       echo "gl_libdeps="
       echo "gl_ltlibdeps="
     fi
+    echo "gl_source_base='$sourcebase'"
     # Wrap the set of autoconf snippets into an autoconf macro that is then
     # invoked. This is needed because autoconf does not support AC_REQUIRE
     # at the top level:
*** gnulib-20060908/m4/getloadavg.m4    2006-09-01 21:54:35.000000000 +0200
--- gnulib-20060908-modified/m4/getloadavg.m4   2006-09-17 23:22:29.000000000 
+0200
***************
*** 10,22 ****
  # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
  # New applications should use gl_GETLOADAVG instead.
  
! # gl_GETLOADAVG
! # -------------
  AC_DEFUN([gl_GETLOADAVG],
  [gl_have_func=no # yes means we've found a way to get the load average.
  
  # Make sure getloadavg.c is where it belongs, at configure-time.
! test -f "$srcdir/$ac_config_libobj_dir/getloadavg.c" ||
    AC_MSG_ERROR([$srcdir/$ac_config_libobj_dir/getloadavg.c is missing])
  
  gl_save_LIBS=$LIBS
--- 10,22 ----
  # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
  # New applications should use gl_GETLOADAVG instead.
  
! # gl_GETLOADAVG(LIBOBJDIR)
! # ------------------------
  AC_DEFUN([gl_GETLOADAVG],
  [gl_have_func=no # yes means we've found a way to get the load average.
  
  # Make sure getloadavg.c is where it belongs, at configure-time.
! test -f "$srcdir/$1/getloadavg.c" ||
    AC_MSG_ERROR([$srcdir/$ac_config_libobj_dir/getloadavg.c is missing])
  
  gl_save_LIBS=$LIBS
***************
*** 64,70 ****
               gl_cv_func_getloadavg_setgid,
  [AC_EGREP_CPP([Yowza Am I SETGID yet],
  [#define CONFIGURING_GETLOADAVG
! #include "$srcdir/$ac_config_libobj_dir/getloadavg.c"
  #ifdef LDAV_PRIVILEGED
  Yowza Am I SETGID yet
  #endif
--- 64,70 ----
               gl_cv_func_getloadavg_setgid,
  [AC_EGREP_CPP([Yowza Am I SETGID yet],
  [#define CONFIGURING_GETLOADAVG
! #include "$srcdir/$1/getloadavg.c"
  #ifdef LDAV_PRIVILEGED
  Yowza Am I SETGID yet
  #endif
*** gnulib-20060908/modules/getloadavg  2006-09-09 01:44:22.000000000 +0200
--- gnulib-20060908-modified/modules/getloadavg 2006-09-17 23:22:14.000000000 
+0200
***************
*** 14,20 ****
  fcntl-safer
  
  configure.ac:
! gl_GETLOADAVG
  
  Makefile.am:
  
--- 14,20 ----
  fcntl-safer
  
  configure.ac:
! gl_GETLOADAVG([$gl_source_base])
  
  Makefile.am:
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]