emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#37499: closed (Wrong location of deps directory when using AC_SUBST)


From: GNU bug Tracking System
Subject: bug#37499: closed (Wrong location of deps directory when using AC_SUBST)
Date: Wed, 09 Dec 2020 02:21:02 +0000

Your message dated Tue, 8 Dec 2020 19:20:03 -0700
with message-id <202012090220.0B92K3V3017432@freefriends.org>
and subject line Re: bug#37499: Wrong location of deps directory when using 
AC_SUBST
has caused the debbugs.gnu.org bug report #37499,
regarding Wrong location of deps directory when using AC_SUBST
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
37499: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37499
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Wrong location of deps directory when using AC_SUBST Date: Tue, 24 Sep 2019 08:55:50 -0400
Package: automake
Version: 1.15.1

I have noticed a strange/wrong behavior when using AC_SUBST to pass a path to Makefile.am to be used to include additional source files.
In my configure.ac I allow definition of a MYLIB_PATH variable through --with-mylib=...
The path identify a directory where I have additional common sources that I want to include in my final build (I know I should build that as a separate lib, but this is not the point).

This is the configure.ac:
-----------------------------------------
AC_INIT(testApp, 1.0, fabriziobertocci@gmail.com)
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_CC
AC_CONFIG_MACRO_DIRS([m4])

AC_ARG_WITH(mylib,
[  --with-mylib=PATH     Sets PATH where my lib is checked out (../mylib) ],
[
        MYLIB_PATH="${withval}"
        AC_MSG_RESULT(Using MYLib library from ${withval})
],[
        MYLIB_PATH="../mylib"
])

dnl Verify the common lib dir is found
AC_CHECK_FILE("$MYLIB_PATH/mylib.h",
      [     AC_MSG_RESULT(Successfully found mylib.h under "${MYLIB_PATH}")
      ],[   AC_MSG_ERROR(Cannot find MyLibrary. Use --with-mylib parameter to specify where lib is checked out)
] )

dnl Use relative path:
dnl MYLIB_PATH=`realpath --relative-to src "${MYLIB_PATH}"`

dnl Use absolute path of lib
MYLIB_PATH=`readlink -f ${MYLIB_PATH}`

AC_MSG_RESULT(Using MyLibrary relative to src: ${MYLIB_PATH})
AC_SUBST(MYLIB_PATH)
AC_OUTPUT(Makefile src/Makefile)
-----------------------------------
Then in my src/Makefile.am, I add to my sources, the files from @MYLI_PATH@:
-----------------------------------
bin_PROGRAMS = testApp
testApp_SOURCES = main.c @MYLIB_PATH@/mylib_log.c
testApp_CFLAGS = -I@MYLIB_PATH@/lib
------------------------------------

Problem:
If I define MYLIB_PATH as RELATIVE path to the 'src' directory (inside my project), everything works fine (in the configure.ac, use the realpath utility to convert any MYLIB_PATH to relative to the 'src' dir).
Unfortunately if MYLIB_PATH is an ABSOLUTE PATH (as in the example above), it doesn't work.
After running configure, the .deps directory is created under src like if the MYLIB_PATH is stripped out of the first '/':
So for example if I have my project under:
/home/fabrizio/test/autotool-issue/lib
/home/fabrizio/test/autotool-issue/proj   <- this is where is configure.ac
/home/fabrizio/test/autotool-issue/proj/src   <- This is where are the sources 
After running configure, I get the .deps directory created here:
/home/fabrizio/test/autotool-issue/proj/src/home/fabrizio/test/autotool-issue/lib/.deps/testApp-mylib_log.Po

The workaround is to use always relative path.
I have a full reproducible project I could attach. Just let me know.
I have used this pattern for more than 10 years, but I don't remember ever seeing this issue (although I attempted to use absolute paths only now). Tested with newer systems like Linux Mint 19.2 as well as a bit older systems like CentOS 7. Same problem on both.

Regards,
Fabrizio Bertocci



--- End Message ---
--- Begin Message --- Subject: Re: bug#37499: Wrong location of deps directory when using AC_SUBST Date: Tue, 8 Dec 2020 19:20:03 -0700
Hi Fabrizio,

    $ tar xfz autotool-bug-abs.tar.gz
    $ cd autotool-bug/proj
    $ ./bootstrap.sh
    $ ./configure --with-mylib=../lib
    $ make

Thanks for the careful recipe. Unfortunately, it still works for me.
readlink -f does return the full path, and I see the full path embedded
in the Makefiles in various places, but not the crucial line:

Makefile:353:/home/fabrizio/temp/autotool-bug/lib/.deps/testApp-mylib_log.Po: 
No such

Line 353 of my src/Makefile is simply
DEPDIR = .deps

which, I guess, explains why it is not failing for me. But I find myself
unable to guess why you are getting a full path there. Looking at the
way $(DEPDIR) is used, it seems expected that it is simply .deps (minus
the leading . on Windows I guess).

I wonder ... are you using an original automake 1.16.x from ftp.gnu.org?
Or are you maybe using a distro version of automake? That could explain
the different behavior (i.e., the distro people introduced some subtle
problem). Otherwise, I'm at a loss.

    Just try to run those commands and unless is something simple to
    address, please close the ticket and let's move on.

It doesn't look simple, so closing as instructed :).

All the best,
Karl


--- End Message ---

reply via email to

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