Use a configure substitution in `lib_LTLIBRARIES`How do I access a user defined variable as defined at the top of a Makefile.am file?In very simple gtk2 c app, problem setting up gnu build toolsAm I using libtool correctly?Suppress automake's canonicalization warning of a variable nameHow do I access a user defined variable as defined at the top of a Makefile.am file?Configure an autotools project with Clang sanitizers in a static lib configuration?Disabling cxx support for libtool after calling AC_PROG_CXXautomake: use local headers instead of installedAutotools build fails due to subdir-objects option in AM_INIT_AUTOMAKEHow do I get GNU __attribute__((constructor)) to work in a library?(automake, libtool) build fails in automake when using same source file name in different directory
How does the "reverse syntax" in Middle English work?
Greek theta instead of lower case þ (Icelandic) in TexStudio
Is presenting a play showing Military charactes in a bad light a crime in the US?
Gambler's Fallacy Dice
Should I twist DC power and ground wires from a power supply?
Character had a different name in the past. Which name should I use in a flashback?
Warped chessboard
What should I wear to go and sign an employment contract?
Why aren't satellites disintegrated even though they orbit earth within earth's Roche Limits?
Windows reverting changes made by Linux to FAT32 partition
Bookshelves: the intruder
Find the values of U, V, C based on the given relationship...useful for upcoming puzzles
Why favour the standard WP loop over iterating over (new WP_Query())->get_posts()?
Was Tyrion always a poor strategist?
Can 2 light bulbs of 120V in series be used on 230V AC?
How to plot a surface from a system of equations?
Working hours and productivity expectations for game artists and programmers
Good examples of "two is easy, three is hard" in computational sciences
Was murdering a slave illegal in American slavery, and if so, what punishments were given for it?
Does science define life as "beginning at conception"?
Germany rejected my entry to Schengen countries
Pedaling at different gear ratios on flat terrain: what's the point?
How come Arya Stark wasn't hurt by this in Game of Thrones Season 8 Episode 5?
How to convince boss to spend notice period on documentation instead of new projects
Use a configure substitution in `lib_LTLIBRARIES`
How do I access a user defined variable as defined at the top of a Makefile.am file?In very simple gtk2 c app, problem setting up gnu build toolsAm I using libtool correctly?Suppress automake's canonicalization warning of a variable nameHow do I access a user defined variable as defined at the top of a Makefile.am file?Configure an autotools project with Clang sanitizers in a static lib configuration?Disabling cxx support for libtool after calling AC_PROG_CXXautomake: use local headers instead of installedAutotools build fails due to subdir-objects option in AM_INIT_AUTOMAKEHow do I get GNU __attribute__((constructor)) to work in a library?(automake, libtool) build fails in automake when using same source file name in different directory
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to implement with Autotools a “multiversion option” for my shared library: in case the user enables it, the library must be able to cohabitate with other versions of itself. That means that the name of the binary must contain the version string, or at least any string that distinguishes it from other versions.
libtool has an option, -release
, which does exactly that. However, as explained here, this will not work for my purpose, because at least one file will not have any suffix appended and this will create conflicts with other versions of the package:
4.3. Multiple libraries versions
While libtool was designed to handle the presence of multiple
libraries implementing the same API (and even ABI) on the system,
distributions made that necessity moot. On the other hand, it is not
uncommon for multiple versions of a library to be installed, with
multiple API implemented, allowing consumers to pick their supported
version. This is the case, for instance, of Gtk+ and Glib.
The first reaction would be to combine the two options,
-release
and
-version-info
; this would, though, be wrong. When using-release
the
static archive, the one with.a
extension, the libtool archive (see
Section 6, “Libtool Archives”) and the.so
file used by the
link editor would not have a revision appended, which means that two
different version of the library can't be installed at the same time.
In this situation, the best option is to append part of the library's
version information to the library's name, which is exemplified by
Glib'slibglib-2.0.so.0
soname. To do so, the declaration in the
Makefile.am
has to be like this:lib_LTLIBRARIES = libtest-1.0.la
libtest_1_0_la_LDFLAGS = -version-info 0:0:0
The paragraph I just quoted contains also a general solution for this problem, which is to manually append a suffix to the name of the binary file. However this can be a tiring task to do if the library changes version often, and for sure does not suit my case, where a suffix must be appended only if the user enables an option.
I have been able to prepare the environment in configure.ac
so that the following two variable substitutions are set to an empty string if the “multiversion option” is disabled, and when it is enabled they are set as:
AC_SUBST([LIBRARY_SUFFIX_1], [-1.2])
AC_SUBST([LIBRARY_SUFFIX_2], [_1_2])
But when I try to export these substitutions to src/Makefile.am
, as in the following example,
lib_LTLIBRARIES = libfoo@LIBRARY_SUFFIX_1@.la
libfoo@LIBRARY_SUFFIX_2@_la_SOURCES =
foo.c
libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS =
-version-info "2:0:0"
libfoo@LIBRARY_SUFFIX_2@_la_LIBADD =
I get the following error messages from configure
:
src/Makefile.am:17: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_SOURCES' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:23: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LIBADD' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:20: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
After doing a bit of research I have found several packages that do exactly what I have tried to do (#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11). I have found also this similar question on stackoverflow, but the answers do not help much. I have even found an article in the official guide of Automake that proposes an example very similar to what I want to do, but if I try to copy and paste it verbatim I still get the same error messages.
On the other hand this other article from the same guide states that
You can’t put a configure substitution (e.g., ‘
@FOO@
’ or ‘$(FOO)
’
whereFOO
is defined viaAC_SUBST
) into a_SOURCES
variable. The
reason for this is a bit hard to explain, but suffice to say that it
simply won’t work. Automake will give an error if you try to do this.
However I am not putting a configure substitution into a _SOURCES
variable, what I am trying to do is to get the name itself of a _SOURCES
variable from a configure substitution. And I have found at least eleven packages that do exactly that.
So the question is: what am I doing wrong? Is anyone able to produce a minimal working example where the content of lib_LTLIBRARIES
is taken from a configure substitution?
autotools configure automake libtool multiple-versions
add a comment |
I am trying to implement with Autotools a “multiversion option” for my shared library: in case the user enables it, the library must be able to cohabitate with other versions of itself. That means that the name of the binary must contain the version string, or at least any string that distinguishes it from other versions.
libtool has an option, -release
, which does exactly that. However, as explained here, this will not work for my purpose, because at least one file will not have any suffix appended and this will create conflicts with other versions of the package:
4.3. Multiple libraries versions
While libtool was designed to handle the presence of multiple
libraries implementing the same API (and even ABI) on the system,
distributions made that necessity moot. On the other hand, it is not
uncommon for multiple versions of a library to be installed, with
multiple API implemented, allowing consumers to pick their supported
version. This is the case, for instance, of Gtk+ and Glib.
The first reaction would be to combine the two options,
-release
and
-version-info
; this would, though, be wrong. When using-release
the
static archive, the one with.a
extension, the libtool archive (see
Section 6, “Libtool Archives”) and the.so
file used by the
link editor would not have a revision appended, which means that two
different version of the library can't be installed at the same time.
In this situation, the best option is to append part of the library's
version information to the library's name, which is exemplified by
Glib'slibglib-2.0.so.0
soname. To do so, the declaration in the
Makefile.am
has to be like this:lib_LTLIBRARIES = libtest-1.0.la
libtest_1_0_la_LDFLAGS = -version-info 0:0:0
The paragraph I just quoted contains also a general solution for this problem, which is to manually append a suffix to the name of the binary file. However this can be a tiring task to do if the library changes version often, and for sure does not suit my case, where a suffix must be appended only if the user enables an option.
I have been able to prepare the environment in configure.ac
so that the following two variable substitutions are set to an empty string if the “multiversion option” is disabled, and when it is enabled they are set as:
AC_SUBST([LIBRARY_SUFFIX_1], [-1.2])
AC_SUBST([LIBRARY_SUFFIX_2], [_1_2])
But when I try to export these substitutions to src/Makefile.am
, as in the following example,
lib_LTLIBRARIES = libfoo@LIBRARY_SUFFIX_1@.la
libfoo@LIBRARY_SUFFIX_2@_la_SOURCES =
foo.c
libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS =
-version-info "2:0:0"
libfoo@LIBRARY_SUFFIX_2@_la_LIBADD =
I get the following error messages from configure
:
src/Makefile.am:17: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_SOURCES' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:23: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LIBADD' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:20: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
After doing a bit of research I have found several packages that do exactly what I have tried to do (#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11). I have found also this similar question on stackoverflow, but the answers do not help much. I have even found an article in the official guide of Automake that proposes an example very similar to what I want to do, but if I try to copy and paste it verbatim I still get the same error messages.
On the other hand this other article from the same guide states that
You can’t put a configure substitution (e.g., ‘
@FOO@
’ or ‘$(FOO)
’
whereFOO
is defined viaAC_SUBST
) into a_SOURCES
variable. The
reason for this is a bit hard to explain, but suffice to say that it
simply won’t work. Automake will give an error if you try to do this.
However I am not putting a configure substitution into a _SOURCES
variable, what I am trying to do is to get the name itself of a _SOURCES
variable from a configure substitution. And I have found at least eleven packages that do exactly that.
So the question is: what am I doing wrong? Is anyone able to produce a minimal working example where the content of lib_LTLIBRARIES
is taken from a configure substitution?
autotools configure automake libtool multiple-versions
In the first place, I think this is a bad idea. In the second place, however, the diagnostic messages you present are warnings, not errors, and they appear to have come from Automake (perhaps viaautoreconf
), not fromconfigure
. So have you tried ignoring the warnings (which are correct) and configuring and building your project anyway? It just might work.
– John Bollinger
Mar 24 at 3:41
@JohnBollinger Yes, I have tried to ignore the warnings of course: the substitutions are simply ignored and the strings inside the ‘at signs’ left verbatim. I don't know why you think it is a bad idea, configure substitutions are born exactly for doing these kind of things.
– madmurphy
Mar 24 at 5:03
Configure substitutions are for related things, but they are not for this thing. The names of build targets ought to be available to Automake, not determined at build time. But it is a bad idea moreso because library names should be consistent. if you put version numbers into a project's library base names then you should always do it for that project's libraries. This is not something that should be selectable at build time.
– John Bollinger
Mar 24 at 17:18
@JohnBollinger I have found the answer to my question. However, concerning your question if it is a bad idea or not, I find it solves easily the dilemma of how to name the.so
files of a library, and plenty of packages use the substitution above. If you want to see how I have implemented my “multiversion option” you can have a look at my library (see INSTALL for more info).
– madmurphy
Mar 26 at 4:00
add a comment |
I am trying to implement with Autotools a “multiversion option” for my shared library: in case the user enables it, the library must be able to cohabitate with other versions of itself. That means that the name of the binary must contain the version string, or at least any string that distinguishes it from other versions.
libtool has an option, -release
, which does exactly that. However, as explained here, this will not work for my purpose, because at least one file will not have any suffix appended and this will create conflicts with other versions of the package:
4.3. Multiple libraries versions
While libtool was designed to handle the presence of multiple
libraries implementing the same API (and even ABI) on the system,
distributions made that necessity moot. On the other hand, it is not
uncommon for multiple versions of a library to be installed, with
multiple API implemented, allowing consumers to pick their supported
version. This is the case, for instance, of Gtk+ and Glib.
The first reaction would be to combine the two options,
-release
and
-version-info
; this would, though, be wrong. When using-release
the
static archive, the one with.a
extension, the libtool archive (see
Section 6, “Libtool Archives”) and the.so
file used by the
link editor would not have a revision appended, which means that two
different version of the library can't be installed at the same time.
In this situation, the best option is to append part of the library's
version information to the library's name, which is exemplified by
Glib'slibglib-2.0.so.0
soname. To do so, the declaration in the
Makefile.am
has to be like this:lib_LTLIBRARIES = libtest-1.0.la
libtest_1_0_la_LDFLAGS = -version-info 0:0:0
The paragraph I just quoted contains also a general solution for this problem, which is to manually append a suffix to the name of the binary file. However this can be a tiring task to do if the library changes version often, and for sure does not suit my case, where a suffix must be appended only if the user enables an option.
I have been able to prepare the environment in configure.ac
so that the following two variable substitutions are set to an empty string if the “multiversion option” is disabled, and when it is enabled they are set as:
AC_SUBST([LIBRARY_SUFFIX_1], [-1.2])
AC_SUBST([LIBRARY_SUFFIX_2], [_1_2])
But when I try to export these substitutions to src/Makefile.am
, as in the following example,
lib_LTLIBRARIES = libfoo@LIBRARY_SUFFIX_1@.la
libfoo@LIBRARY_SUFFIX_2@_la_SOURCES =
foo.c
libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS =
-version-info "2:0:0"
libfoo@LIBRARY_SUFFIX_2@_la_LIBADD =
I get the following error messages from configure
:
src/Makefile.am:17: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_SOURCES' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:23: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LIBADD' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:20: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
After doing a bit of research I have found several packages that do exactly what I have tried to do (#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11). I have found also this similar question on stackoverflow, but the answers do not help much. I have even found an article in the official guide of Automake that proposes an example very similar to what I want to do, but if I try to copy and paste it verbatim I still get the same error messages.
On the other hand this other article from the same guide states that
You can’t put a configure substitution (e.g., ‘
@FOO@
’ or ‘$(FOO)
’
whereFOO
is defined viaAC_SUBST
) into a_SOURCES
variable. The
reason for this is a bit hard to explain, but suffice to say that it
simply won’t work. Automake will give an error if you try to do this.
However I am not putting a configure substitution into a _SOURCES
variable, what I am trying to do is to get the name itself of a _SOURCES
variable from a configure substitution. And I have found at least eleven packages that do exactly that.
So the question is: what am I doing wrong? Is anyone able to produce a minimal working example where the content of lib_LTLIBRARIES
is taken from a configure substitution?
autotools configure automake libtool multiple-versions
I am trying to implement with Autotools a “multiversion option” for my shared library: in case the user enables it, the library must be able to cohabitate with other versions of itself. That means that the name of the binary must contain the version string, or at least any string that distinguishes it from other versions.
libtool has an option, -release
, which does exactly that. However, as explained here, this will not work for my purpose, because at least one file will not have any suffix appended and this will create conflicts with other versions of the package:
4.3. Multiple libraries versions
While libtool was designed to handle the presence of multiple
libraries implementing the same API (and even ABI) on the system,
distributions made that necessity moot. On the other hand, it is not
uncommon for multiple versions of a library to be installed, with
multiple API implemented, allowing consumers to pick their supported
version. This is the case, for instance, of Gtk+ and Glib.
The first reaction would be to combine the two options,
-release
and
-version-info
; this would, though, be wrong. When using-release
the
static archive, the one with.a
extension, the libtool archive (see
Section 6, “Libtool Archives”) and the.so
file used by the
link editor would not have a revision appended, which means that two
different version of the library can't be installed at the same time.
In this situation, the best option is to append part of the library's
version information to the library's name, which is exemplified by
Glib'slibglib-2.0.so.0
soname. To do so, the declaration in the
Makefile.am
has to be like this:lib_LTLIBRARIES = libtest-1.0.la
libtest_1_0_la_LDFLAGS = -version-info 0:0:0
The paragraph I just quoted contains also a general solution for this problem, which is to manually append a suffix to the name of the binary file. However this can be a tiring task to do if the library changes version often, and for sure does not suit my case, where a suffix must be appended only if the user enables an option.
I have been able to prepare the environment in configure.ac
so that the following two variable substitutions are set to an empty string if the “multiversion option” is disabled, and when it is enabled they are set as:
AC_SUBST([LIBRARY_SUFFIX_1], [-1.2])
AC_SUBST([LIBRARY_SUFFIX_2], [_1_2])
But when I try to export these substitutions to src/Makefile.am
, as in the following example,
lib_LTLIBRARIES = libfoo@LIBRARY_SUFFIX_1@.la
libfoo@LIBRARY_SUFFIX_2@_la_SOURCES =
foo.c
libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS =
-version-info "2:0:0"
libfoo@LIBRARY_SUFFIX_2@_la_LIBADD =
I get the following error messages from configure
:
src/Makefile.am:17: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_SOURCES' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:23: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LIBADD' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
src/Makefile.am:20: warning: variable 'libfoo@LIBRARY_SUFFIX_2@_la_LDFLAGS' is defined but no program or library has 'libfoo@LIBRARY_SUFFIX_2@_la' as canonical name (possible typo)
After doing a bit of research I have found several packages that do exactly what I have tried to do (#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11). I have found also this similar question on stackoverflow, but the answers do not help much. I have even found an article in the official guide of Automake that proposes an example very similar to what I want to do, but if I try to copy and paste it verbatim I still get the same error messages.
On the other hand this other article from the same guide states that
You can’t put a configure substitution (e.g., ‘
@FOO@
’ or ‘$(FOO)
’
whereFOO
is defined viaAC_SUBST
) into a_SOURCES
variable. The
reason for this is a bit hard to explain, but suffice to say that it
simply won’t work. Automake will give an error if you try to do this.
However I am not putting a configure substitution into a _SOURCES
variable, what I am trying to do is to get the name itself of a _SOURCES
variable from a configure substitution. And I have found at least eleven packages that do exactly that.
So the question is: what am I doing wrong? Is anyone able to produce a minimal working example where the content of lib_LTLIBRARIES
is taken from a configure substitution?
autotools configure automake libtool multiple-versions
autotools configure automake libtool multiple-versions
edited Mar 24 at 2:21
madmurphy
asked Mar 23 at 18:18
madmurphymadmurphy
17617
17617
In the first place, I think this is a bad idea. In the second place, however, the diagnostic messages you present are warnings, not errors, and they appear to have come from Automake (perhaps viaautoreconf
), not fromconfigure
. So have you tried ignoring the warnings (which are correct) and configuring and building your project anyway? It just might work.
– John Bollinger
Mar 24 at 3:41
@JohnBollinger Yes, I have tried to ignore the warnings of course: the substitutions are simply ignored and the strings inside the ‘at signs’ left verbatim. I don't know why you think it is a bad idea, configure substitutions are born exactly for doing these kind of things.
– madmurphy
Mar 24 at 5:03
Configure substitutions are for related things, but they are not for this thing. The names of build targets ought to be available to Automake, not determined at build time. But it is a bad idea moreso because library names should be consistent. if you put version numbers into a project's library base names then you should always do it for that project's libraries. This is not something that should be selectable at build time.
– John Bollinger
Mar 24 at 17:18
@JohnBollinger I have found the answer to my question. However, concerning your question if it is a bad idea or not, I find it solves easily the dilemma of how to name the.so
files of a library, and plenty of packages use the substitution above. If you want to see how I have implemented my “multiversion option” you can have a look at my library (see INSTALL for more info).
– madmurphy
Mar 26 at 4:00
add a comment |
In the first place, I think this is a bad idea. In the second place, however, the diagnostic messages you present are warnings, not errors, and they appear to have come from Automake (perhaps viaautoreconf
), not fromconfigure
. So have you tried ignoring the warnings (which are correct) and configuring and building your project anyway? It just might work.
– John Bollinger
Mar 24 at 3:41
@JohnBollinger Yes, I have tried to ignore the warnings of course: the substitutions are simply ignored and the strings inside the ‘at signs’ left verbatim. I don't know why you think it is a bad idea, configure substitutions are born exactly for doing these kind of things.
– madmurphy
Mar 24 at 5:03
Configure substitutions are for related things, but they are not for this thing. The names of build targets ought to be available to Automake, not determined at build time. But it is a bad idea moreso because library names should be consistent. if you put version numbers into a project's library base names then you should always do it for that project's libraries. This is not something that should be selectable at build time.
– John Bollinger
Mar 24 at 17:18
@JohnBollinger I have found the answer to my question. However, concerning your question if it is a bad idea or not, I find it solves easily the dilemma of how to name the.so
files of a library, and plenty of packages use the substitution above. If you want to see how I have implemented my “multiversion option” you can have a look at my library (see INSTALL for more info).
– madmurphy
Mar 26 at 4:00
In the first place, I think this is a bad idea. In the second place, however, the diagnostic messages you present are warnings, not errors, and they appear to have come from Automake (perhaps via
autoreconf
), not from configure
. So have you tried ignoring the warnings (which are correct) and configuring and building your project anyway? It just might work.– John Bollinger
Mar 24 at 3:41
In the first place, I think this is a bad idea. In the second place, however, the diagnostic messages you present are warnings, not errors, and they appear to have come from Automake (perhaps via
autoreconf
), not from configure
. So have you tried ignoring the warnings (which are correct) and configuring and building your project anyway? It just might work.– John Bollinger
Mar 24 at 3:41
@JohnBollinger Yes, I have tried to ignore the warnings of course: the substitutions are simply ignored and the strings inside the ‘at signs’ left verbatim. I don't know why you think it is a bad idea, configure substitutions are born exactly for doing these kind of things.
– madmurphy
Mar 24 at 5:03
@JohnBollinger Yes, I have tried to ignore the warnings of course: the substitutions are simply ignored and the strings inside the ‘at signs’ left verbatim. I don't know why you think it is a bad idea, configure substitutions are born exactly for doing these kind of things.
– madmurphy
Mar 24 at 5:03
Configure substitutions are for related things, but they are not for this thing. The names of build targets ought to be available to Automake, not determined at build time. But it is a bad idea moreso because library names should be consistent. if you put version numbers into a project's library base names then you should always do it for that project's libraries. This is not something that should be selectable at build time.
– John Bollinger
Mar 24 at 17:18
Configure substitutions are for related things, but they are not for this thing. The names of build targets ought to be available to Automake, not determined at build time. But it is a bad idea moreso because library names should be consistent. if you put version numbers into a project's library base names then you should always do it for that project's libraries. This is not something that should be selectable at build time.
– John Bollinger
Mar 24 at 17:18
@JohnBollinger I have found the answer to my question. However, concerning your question if it is a bad idea or not, I find it solves easily the dilemma of how to name the
.so
files of a library, and plenty of packages use the substitution above. If you want to see how I have implemented my “multiversion option” you can have a look at my library (see INSTALL for more info).– madmurphy
Mar 26 at 4:00
@JohnBollinger I have found the answer to my question. However, concerning your question if it is a bad idea or not, I find it solves easily the dilemma of how to name the
.so
files of a library, and plenty of packages use the substitution above. If you want to see how I have implemented my “multiversion option” you can have a look at my library (see INSTALL for more info).– madmurphy
Mar 26 at 4:00
add a comment |
2 Answers
2
active
oldest
votes
I don't understand why -release
won't work for you, so I'll just leave that solution out of this answer. The procedure is similar, but will create different .so
file names (e.g. libfoo-1.2.so
and libfoo.so
) but the same .a
name.
configure.ac
AC_INIT([myproject],[0.1],[project@example.com])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/foo.c])
AC_PROG_CC
AC_ARG_ENABLE([multi], AS_HELP_STRING([--enable-multi], [Enable multi]))
AM_INIT_AUTOMAKE([1.15 foreign])
AM_PROG_LIBTOOL
AM_CONDITIONAL([MULTI_NAME], [test "x$enable_multi" = "xyes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Makefile.am
SRCS=src/foo.c
lib_LTLIBRARIES=
if MULTI_NAME
lib_LTLIBRARIES+=libfoo-1.2.la
libfoo_1_2_la_SOURCES=$(SRCS)
else
lib_LTLIBRARIES+=libfoo.la
libfoo_la_SOURCES=$(SRCS)
endif
./configure ; make
creates libfoo.so.0.0.0
(on Linux where versioning is on by default). ./configure --enable-multi ; make
creates libfoo-1.2.so.0.0.0
This doesn't give me the warnings you were seeing. When I try using AC_SUBST
I see the same warnings; it builds the libraries OK.
Thank you, ldav1s. I have found the reason behind the warnings (you can find the explanation in my answer). Your solution will work. However in the end I have opted for using an environment variable to be passed toautoconf
rather than to./configure
. In this way I can obtain a literal for the package name to use inAC_INIT()
(see my project's INSTALL file for more info).
– madmurphy
Apr 19 at 5:38
add a comment |
I have found the answer to my question. If I use the same configure substitution for both the content of lib_LTLIBRARIES
and the names of libXXX_la_SOURCES
libXXX_la_LDFLAGS
libXXX_la_LIBADD
, everything seems to work fine, as in the following scenario:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@CUSTOM_NAME@_la_SOURCES =
foo.c
lib@CUSTOM_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@CUSTOM_NAME@_la_LIBADD =
...
But, for some reason, as soon as I use two different configure substitutions, even when they contain the same text, I get the errors above. So, the following scenario is not accepted:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
AC_SUBST([ANOTHER_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@ANOTHER_NAME@_la_SOURCES =
foo.c
lib@ANOTHER_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@ANOTHER_NAME@_la_LIBADD =
...
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316957%2fuse-a-configure-substitution-in-lib-ltlibraries%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't understand why -release
won't work for you, so I'll just leave that solution out of this answer. The procedure is similar, but will create different .so
file names (e.g. libfoo-1.2.so
and libfoo.so
) but the same .a
name.
configure.ac
AC_INIT([myproject],[0.1],[project@example.com])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/foo.c])
AC_PROG_CC
AC_ARG_ENABLE([multi], AS_HELP_STRING([--enable-multi], [Enable multi]))
AM_INIT_AUTOMAKE([1.15 foreign])
AM_PROG_LIBTOOL
AM_CONDITIONAL([MULTI_NAME], [test "x$enable_multi" = "xyes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Makefile.am
SRCS=src/foo.c
lib_LTLIBRARIES=
if MULTI_NAME
lib_LTLIBRARIES+=libfoo-1.2.la
libfoo_1_2_la_SOURCES=$(SRCS)
else
lib_LTLIBRARIES+=libfoo.la
libfoo_la_SOURCES=$(SRCS)
endif
./configure ; make
creates libfoo.so.0.0.0
(on Linux where versioning is on by default). ./configure --enable-multi ; make
creates libfoo-1.2.so.0.0.0
This doesn't give me the warnings you were seeing. When I try using AC_SUBST
I see the same warnings; it builds the libraries OK.
Thank you, ldav1s. I have found the reason behind the warnings (you can find the explanation in my answer). Your solution will work. However in the end I have opted for using an environment variable to be passed toautoconf
rather than to./configure
. In this way I can obtain a literal for the package name to use inAC_INIT()
(see my project's INSTALL file for more info).
– madmurphy
Apr 19 at 5:38
add a comment |
I don't understand why -release
won't work for you, so I'll just leave that solution out of this answer. The procedure is similar, but will create different .so
file names (e.g. libfoo-1.2.so
and libfoo.so
) but the same .a
name.
configure.ac
AC_INIT([myproject],[0.1],[project@example.com])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/foo.c])
AC_PROG_CC
AC_ARG_ENABLE([multi], AS_HELP_STRING([--enable-multi], [Enable multi]))
AM_INIT_AUTOMAKE([1.15 foreign])
AM_PROG_LIBTOOL
AM_CONDITIONAL([MULTI_NAME], [test "x$enable_multi" = "xyes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Makefile.am
SRCS=src/foo.c
lib_LTLIBRARIES=
if MULTI_NAME
lib_LTLIBRARIES+=libfoo-1.2.la
libfoo_1_2_la_SOURCES=$(SRCS)
else
lib_LTLIBRARIES+=libfoo.la
libfoo_la_SOURCES=$(SRCS)
endif
./configure ; make
creates libfoo.so.0.0.0
(on Linux where versioning is on by default). ./configure --enable-multi ; make
creates libfoo-1.2.so.0.0.0
This doesn't give me the warnings you were seeing. When I try using AC_SUBST
I see the same warnings; it builds the libraries OK.
Thank you, ldav1s. I have found the reason behind the warnings (you can find the explanation in my answer). Your solution will work. However in the end I have opted for using an environment variable to be passed toautoconf
rather than to./configure
. In this way I can obtain a literal for the package name to use inAC_INIT()
(see my project's INSTALL file for more info).
– madmurphy
Apr 19 at 5:38
add a comment |
I don't understand why -release
won't work for you, so I'll just leave that solution out of this answer. The procedure is similar, but will create different .so
file names (e.g. libfoo-1.2.so
and libfoo.so
) but the same .a
name.
configure.ac
AC_INIT([myproject],[0.1],[project@example.com])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/foo.c])
AC_PROG_CC
AC_ARG_ENABLE([multi], AS_HELP_STRING([--enable-multi], [Enable multi]))
AM_INIT_AUTOMAKE([1.15 foreign])
AM_PROG_LIBTOOL
AM_CONDITIONAL([MULTI_NAME], [test "x$enable_multi" = "xyes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Makefile.am
SRCS=src/foo.c
lib_LTLIBRARIES=
if MULTI_NAME
lib_LTLIBRARIES+=libfoo-1.2.la
libfoo_1_2_la_SOURCES=$(SRCS)
else
lib_LTLIBRARIES+=libfoo.la
libfoo_la_SOURCES=$(SRCS)
endif
./configure ; make
creates libfoo.so.0.0.0
(on Linux where versioning is on by default). ./configure --enable-multi ; make
creates libfoo-1.2.so.0.0.0
This doesn't give me the warnings you were seeing. When I try using AC_SUBST
I see the same warnings; it builds the libraries OK.
I don't understand why -release
won't work for you, so I'll just leave that solution out of this answer. The procedure is similar, but will create different .so
file names (e.g. libfoo-1.2.so
and libfoo.so
) but the same .a
name.
configure.ac
AC_INIT([myproject],[0.1],[project@example.com])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/foo.c])
AC_PROG_CC
AC_ARG_ENABLE([multi], AS_HELP_STRING([--enable-multi], [Enable multi]))
AM_INIT_AUTOMAKE([1.15 foreign])
AM_PROG_LIBTOOL
AM_CONDITIONAL([MULTI_NAME], [test "x$enable_multi" = "xyes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Makefile.am
SRCS=src/foo.c
lib_LTLIBRARIES=
if MULTI_NAME
lib_LTLIBRARIES+=libfoo-1.2.la
libfoo_1_2_la_SOURCES=$(SRCS)
else
lib_LTLIBRARIES+=libfoo.la
libfoo_la_SOURCES=$(SRCS)
endif
./configure ; make
creates libfoo.so.0.0.0
(on Linux where versioning is on by default). ./configure --enable-multi ; make
creates libfoo-1.2.so.0.0.0
This doesn't give me the warnings you were seeing. When I try using AC_SUBST
I see the same warnings; it builds the libraries OK.
edited Apr 19 at 20:23
answered Apr 18 at 1:23
ldav1sldav1s
13.4k23949
13.4k23949
Thank you, ldav1s. I have found the reason behind the warnings (you can find the explanation in my answer). Your solution will work. However in the end I have opted for using an environment variable to be passed toautoconf
rather than to./configure
. In this way I can obtain a literal for the package name to use inAC_INIT()
(see my project's INSTALL file for more info).
– madmurphy
Apr 19 at 5:38
add a comment |
Thank you, ldav1s. I have found the reason behind the warnings (you can find the explanation in my answer). Your solution will work. However in the end I have opted for using an environment variable to be passed toautoconf
rather than to./configure
. In this way I can obtain a literal for the package name to use inAC_INIT()
(see my project's INSTALL file for more info).
– madmurphy
Apr 19 at 5:38
Thank you, ldav1s. I have found the reason behind the warnings (you can find the explanation in my answer). Your solution will work. However in the end I have opted for using an environment variable to be passed to
autoconf
rather than to ./configure
. In this way I can obtain a literal for the package name to use in AC_INIT()
(see my project's INSTALL file for more info).– madmurphy
Apr 19 at 5:38
Thank you, ldav1s. I have found the reason behind the warnings (you can find the explanation in my answer). Your solution will work. However in the end I have opted for using an environment variable to be passed to
autoconf
rather than to ./configure
. In this way I can obtain a literal for the package name to use in AC_INIT()
(see my project's INSTALL file for more info).– madmurphy
Apr 19 at 5:38
add a comment |
I have found the answer to my question. If I use the same configure substitution for both the content of lib_LTLIBRARIES
and the names of libXXX_la_SOURCES
libXXX_la_LDFLAGS
libXXX_la_LIBADD
, everything seems to work fine, as in the following scenario:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@CUSTOM_NAME@_la_SOURCES =
foo.c
lib@CUSTOM_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@CUSTOM_NAME@_la_LIBADD =
...
But, for some reason, as soon as I use two different configure substitutions, even when they contain the same text, I get the errors above. So, the following scenario is not accepted:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
AC_SUBST([ANOTHER_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@ANOTHER_NAME@_la_SOURCES =
foo.c
lib@ANOTHER_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@ANOTHER_NAME@_la_LIBADD =
...
add a comment |
I have found the answer to my question. If I use the same configure substitution for both the content of lib_LTLIBRARIES
and the names of libXXX_la_SOURCES
libXXX_la_LDFLAGS
libXXX_la_LIBADD
, everything seems to work fine, as in the following scenario:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@CUSTOM_NAME@_la_SOURCES =
foo.c
lib@CUSTOM_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@CUSTOM_NAME@_la_LIBADD =
...
But, for some reason, as soon as I use two different configure substitutions, even when they contain the same text, I get the errors above. So, the following scenario is not accepted:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
AC_SUBST([ANOTHER_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@ANOTHER_NAME@_la_SOURCES =
foo.c
lib@ANOTHER_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@ANOTHER_NAME@_la_LIBADD =
...
add a comment |
I have found the answer to my question. If I use the same configure substitution for both the content of lib_LTLIBRARIES
and the names of libXXX_la_SOURCES
libXXX_la_LDFLAGS
libXXX_la_LIBADD
, everything seems to work fine, as in the following scenario:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@CUSTOM_NAME@_la_SOURCES =
foo.c
lib@CUSTOM_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@CUSTOM_NAME@_la_LIBADD =
...
But, for some reason, as soon as I use two different configure substitutions, even when they contain the same text, I get the errors above. So, the following scenario is not accepted:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
AC_SUBST([ANOTHER_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@ANOTHER_NAME@_la_SOURCES =
foo.c
lib@ANOTHER_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@ANOTHER_NAME@_la_LIBADD =
...
I have found the answer to my question. If I use the same configure substitution for both the content of lib_LTLIBRARIES
and the names of libXXX_la_SOURCES
libXXX_la_LDFLAGS
libXXX_la_LIBADD
, everything seems to work fine, as in the following scenario:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@CUSTOM_NAME@_la_SOURCES =
foo.c
lib@CUSTOM_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@CUSTOM_NAME@_la_LIBADD =
...
But, for some reason, as soon as I use two different configure substitutions, even when they contain the same text, I get the errors above. So, the following scenario is not accepted:
Content of configure.ac
:
...
AC_SUBST([CUSTOM_NAME], [foo])
AC_SUBST([ANOTHER_NAME], [foo])
...
Content of src/Makefile.am
:
...
lib_LTLIBRARIES = lib@CUSTOM_NAME@.la
lib@ANOTHER_NAME@_la_SOURCES =
foo.c
lib@ANOTHER_NAME@_la_LDFLAGS =
-version-info "2:0:0"
lib@ANOTHER_NAME@_la_LIBADD =
...
edited Mar 26 at 19:35
answered Mar 26 at 3:52
madmurphymadmurphy
17617
17617
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55316957%2fuse-a-configure-substitution-in-lib-ltlibraries%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In the first place, I think this is a bad idea. In the second place, however, the diagnostic messages you present are warnings, not errors, and they appear to have come from Automake (perhaps via
autoreconf
), not fromconfigure
. So have you tried ignoring the warnings (which are correct) and configuring and building your project anyway? It just might work.– John Bollinger
Mar 24 at 3:41
@JohnBollinger Yes, I have tried to ignore the warnings of course: the substitutions are simply ignored and the strings inside the ‘at signs’ left verbatim. I don't know why you think it is a bad idea, configure substitutions are born exactly for doing these kind of things.
– madmurphy
Mar 24 at 5:03
Configure substitutions are for related things, but they are not for this thing. The names of build targets ought to be available to Automake, not determined at build time. But it is a bad idea moreso because library names should be consistent. if you put version numbers into a project's library base names then you should always do it for that project's libraries. This is not something that should be selectable at build time.
– John Bollinger
Mar 24 at 17:18
@JohnBollinger I have found the answer to my question. However, concerning your question if it is a bad idea or not, I find it solves easily the dilemma of how to name the
.so
files of a library, and plenty of packages use the substitution above. If you want to see how I have implemented my “multiversion option” you can have a look at my library (see INSTALL for more info).– madmurphy
Mar 26 at 4:00