Skip to contentSkip to conversation

Drop -I$includedir/alsa from alsa.pc

RFC PATCH In review Takashi Iwai 2 participants 4 messages Mar 26, 2019 – Mar 28, 2019

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Drop -I$includedir/alsa from alsa.pc

We used to put the additional include path $includedir/alsa in pkgconfig just because some applications have included asoundlib.h like
#include <asoundlib.h>
although the canonical form should be
#include <alsa/asoundlib.h>

However, adding this include path is significantly dangerous due to possible conflicts of file names like version.h. It's already the reason to discourage people using alsa.pc for the packages.

In this patch, the additional include path from alsa.pc is dropped finally. At the same time, as a rescue plan for the programs including via <asoundlib.h>, a stub header file is provided in include/sound/asoundlib.h. It just includes alsa/asoundlib.h with a warning to suggest for replacing with alsa/asoundlib.h. Actually this is the same file as we install into sys/asoundlib.h, so the whole changes are very minimal here.

---
 include/Makefile.am | 1 +
 utils/alsa.pc.in    | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/Makefile.am +1 -0
index 67f32e36c911..fffc8a62e88b 100644
@@ -96,3 +96,4 @@ AM_CPPFLAGS=-I$(top_srcdir)/include
 install-data-hook:
 	test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
 	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
+	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)/asoundlib.h
utils/alsa.pc.in +1 -3
index 8de9859f42db..444f66d85a34 100644
@@ -9,6 +9,4 @@ Version: @VERSION@
 Requires: 
 Libs: -L${libdir} -lasound
 Libs.private: @ALSA_DEPLIBS@
-# -I${includedir}/alsa below is just for backward compatibility
-# (it was set so mistakely in the older version)
-Cflags: -I${includedir} -I${includedir}/alsa
+Cflags: -I${includedir}
Signature · 1 line
2.16.4
Acked-by on v1 1/1
#1 lore raw

Dne 26. 03. 19 v 15:15 Takashi Iwai napsal(a):

Quoted 39 lines

We used to put the additional include path $includedir/alsa in pkgconfig just because some applications have included asoundlib.h like
#include <asoundlib.h>
although the canonical form should be
#include <alsa/asoundlib.h>

However, adding this include path is significantly dangerous due to possible conflicts of file names like version.h. It's already the reason to discourage people using alsa.pc for the packages.

In this patch, the additional include path from alsa.pc is dropped finally. At the same time, as a rescue plan for the programs including via <asoundlib.h>, a stub header file is provided in include/sound/asoundlib.h. It just includes alsa/asoundlib.h with a warning to suggest for replacing with alsa/asoundlib.h. Actually this is the same file as we install into sys/asoundlib.h, so the whole changes are very minimal here.

---
 include/Makefile.am | 1 +
 utils/alsa.pc.in    | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/Makefile.am +1 -0
index 67f32e36c911..fffc8a62e88b 100644
@@ -96,3 +96,4 @@ AM_CPPFLAGS=-I$(top_srcdir)/include
 install-data-hook:
 	test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
 	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
+	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)/asoundlib.h
utils/alsa.pc.in +0 -0
index 8de9859f42db..444f66d85a34 100644

utils/alsa.pc.in Version: @VERSION@ · line 12

Quoted 7 lines
utils/alsa.pc.in +1 -3
@@ -9,6 +9,4 @@ Version: @VERSION@
 Requires: 
 Libs: -L${libdir} -lasound
 Libs.private: @ALSA_DEPLIBS@
-# -I${includedir}/alsa below is just for backward compatibility
-# (it was set so mistakely in the older version)
-Cflags: -I${includedir} -I${includedir}/alsa
+Cflags: -I${includedir}
Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#2 lore raw
Quoted 42 lines · Jaroslav Kysela

Dne 26. 03. 19 v 15:15 Takashi Iwai napsal(a):

Quoted 40 lines

We used to put the additional include path $includedir/alsa in pkgconfig just because some applications have included asoundlib.h like
#include <asoundlib.h>
although the canonical form should be
#include <alsa/asoundlib.h>

However, adding this include path is significantly dangerous due to possible conflicts of file names like version.h. It's already the reason to discourage people using alsa.pc for the packages.

In this patch, the additional include path from alsa.pc is dropped finally. At the same time, as a rescue plan for the programs including via <asoundlib.h>, a stub header file is provided in include/sound/asoundlib.h. It just includes alsa/asoundlib.h with a warning to suggest for replacing with alsa/asoundlib.h. Actually this is the same file as we install into sys/asoundlib.h, so the whole changes are very minimal here.

---
 include/Makefile.am | 1 +
 utils/alsa.pc.in    | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/Makefile.am +1 -0
index 67f32e36c911..fffc8a62e88b 100644
@@ -96,3 +96,4 @@ AM_CPPFLAGS=-I$(top_srcdir)/include
 install-data-hook:
 	test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
 	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
+	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)/asoundlib.h
utils/alsa.pc.in +0 -0
index 8de9859f42db..444f66d85a34 100644
@@ -9,6 +9,4 @@ Version: @VERSION@
 Requires: 
Quoted 8 lines

utils/alsa.pc.in Version: @VERSION@ · line 12

Quoted 6 lines
utils/alsa.pc.in +1 -3
 Libs: -L${libdir} -lasound
 Libs.private: @ALSA_DEPLIBS@
-# -I${includedir}/alsa below is just for backward compatibility
-# (it was set so mistakely in the older version)
-Cflags: -I${includedir} -I${includedir}/alsa
+Cflags: -I${includedir}

Thanks, I'm going to wait until tomorrow, then merge the change.

Takashi

author Acked-by Jaroslav Kysela on v1 1/1
#3 lore raw
In reply to Takashi Iwai
Quoted 20 lines · Takashi Iwai

We used to put the additional include path $includedir/alsa in pkgconfig just because some applications have included asoundlib.h like
#include <asoundlib.h>
although the canonical form should be
#include <alsa/asoundlib.h>

However, adding this include path is significantly dangerous due to possible conflicts of file names like version.h. It's already the reason to discourage people using alsa.pc for the packages.

In this patch, the additional include path from alsa.pc is dropped finally. At the same time, as a rescue plan for the programs including via <asoundlib.h>, a stub header file is provided in include/sound/asoundlib.h. It just includes alsa/asoundlib.h with a warning to suggest for replacing with alsa/asoundlib.h. Actually this is the same file as we install into sys/asoundlib.h, so the whole changes are very minimal here.

Quoted 1 line

Sorry, there was a typo in the patch. The correct one is below. In anyway, I'm going to merge the patch soon later.

Takashi

-- 8< --
From: Takashi Iwai <[email protected]>
Subject: [PATCH] Drop -I$includedir/alsa from alsa.pc

We used to put the additional include path $includedir/alsa in pkgconfig just because some applications have included asoundlib.h like
#include <asoundlib.h>
although the canonical form should be
#include <alsa/asoundlib.h>

However, adding this include path is significantly dangerous due to possible conflicts of file names like version.h. It's already the reason to discourage people using alsa.pc for the packages.

In this patch, the additional include path from alsa.pc is dropped finally. At the same time, as a rescue plan for the programs including via <asoundlib.h>, a stub header file is provided in include/sound/asoundlib.h. It just includes alsa/asoundlib.h with a warning to suggest for replacing with alsa/asoundlib.h. Actually this is the same file as we install into sys/asoundlib.h, so the whole changes are very minimal here.

---
 include/Makefile.am | 1 +
 utils/alsa.pc.in    | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/Makefile.am +1 -0
index 67f32e36c911..665704a32129 100644
@@ -96,3 +96,4 @@ AM_CPPFLAGS=-I$(top_srcdir)/include
 install-data-hook:
 	test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
 	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
+	$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(includedir)/asoundlib.h
utils/alsa.pc.in +1 -3
index 8de9859f42db..444f66d85a34 100644
@@ -9,6 +9,4 @@ Version: @VERSION@
 Requires: 
 Libs: -L${libdir} -lasound
 Libs.private: @ALSA_DEPLIBS@
-# -I${includedir}/alsa below is just for backward compatibility
-# (it was set so mistakely in the older version)
-Cflags: -I${includedir} -I${includedir}/alsa
+Cflags: -I${includedir}
Signature · 1 line
2.16.4