Re: Using and detecting environment variables as flags
John Ling wrote: Hello, I want to be able to read/check the value of an environment variable in my Makefile.am. This would be a variable that I set as part of the an [action-if-found] in the AC_SEARCH_LIBS method, that I set in configure.ac. How do I reference such a variable? In addition, depending on the value of this variable, I then want to pass a signal from my Makefile.am to yet another Makefile which is called from Makefile.am. This signal is to tell the second Makefile to add an -lz in its LIBS definition. How do I do this? In what way can I send such a flag/signal? What is the real problem you are trying to solve? Normally, autoconf results get stored into substitution strings that wind up as Makefile macros and set appropriately in the derived Makefile.
Re: Using and detecting environment variables as flags
Hi Bruce. So I have the following in my configure.ac: AC_SEARCH_LIBS([compress], [z], ,) So if this Z library exists then I want the build process to include this library during linking. Otherwise I run into errors about not being able to find the 'compress' function in the Z library. I have a Makefile.am that does some of the build process, but it also calls a Makefile.loader with a target that states 'make -f Makefile.loader', which is a Makefile that also must link with the Z library if it exists. I want to detect the availability of this Z library during configure time, and then pass this information all the way to Makefile.loader where I can decide whether I can add a '-lz' in my LIBS variable, in this Makefile.loader, in order for it to link to this Z library. What is this substitution string in this case for the Z library and how can I use it? Thanks, John Bruce Korb wrote: What is the real problem you are trying to solve? Normally, autoconf results get stored into substitution strings that wind up as Makefile macros and set appropriately in the derived Makefile.
Re: Using and detecting environment variables as flags
I think I've figured out the way to do it: In my Makefile.am I put in a line like 'export CONFIGURE-TIME_LIBS=$(LIBS)' Then in my Makefile.loader I put in my LIBS definition: LIBS = $(CONFIGURE-TIME_LIBS) ... Regards, John Bruce Korb wrote: John Ling wrote: Hello, I want to be able to read/check the value of an environment variable in my Makefile.am. This would be a variable that I set as part of the an [action-if-found] in the AC_SEARCH_LIBS method, that I set in configure.ac. How do I reference such a variable? In addition, depending on the value of this variable, I then want to pass a signal from my Makefile.am to yet another Makefile which is called from Makefile.am. This signal is to tell the second Makefile to add an -lz in its LIBS definition. How do I do this? In what way can I send such a flag/signal? What is the real problem you are trying to solve? Normally, autoconf results get stored into substitution strings that wind up as Makefile macros and set appropriately in the derived Makefile.
Re: Using and detecting environment variables as flags
John Ling wrote: I think I've figured out the way to do it: In my Makefile.am I put in a line like 'export CONFIGURE-TIME_LIBS=$(LIBS)' Then in my Makefile.loader I put in my LIBS definition: LIBS = $(CONFIGURE-TIME_LIBS) ... You might have better luck with CONFIGURE_TIME_LIBS ;-) How do I reference such a variable? In addition, depending on the value of this variable, I then want to pass a signal from my Makefile.am to yet another Makefile which is called from Makefile.am. This signal is to tell the second Makefile to add an -lz in its LIBS definition. How do I do this? In what way can I send such a flag/signal? Methinks what you want is along the lines of: AC_CHECKLIB(z, gzopen) and that will add -lz to LIBS if gzopen() is found in it. %LIBS% will be inserted by automake in all your Makefile.in files. Good luck. - Bruce