[ lame-Bugs-3606629 ] [patch] Check for tgetent instead of initscr, check -ltinfo

SourceForge.net <[email protected]>
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <[email protected]>
Bugs item #3606629, was opened at 2013-03-02 10:02
Message generated for change (Comment added) made by ssuominen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100290&aid=3606629&group_id=290

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Samuli Suominen (ssuominen)
Assigned to: Nobody/Anonymous (nobody)
Summary: [patch] Check for tgetent instead of initscr, check -ltinfo

Initial Comment:
if libncurses is configured to use the separate libtinfo library, half of the symbols go into libtinfo and then libncurses is linked against it
so AC_CHECK_LIB is unadequate for checking if libncurses is present or not
pkg-config file ncurses.pc should be used instead to get correct Libs: and Libs.private: contents

not doing so results in compile errors like:

libtool: link: x86_64-pc-linux-gnu-gcc -Wall -pipe -march=btver1 -mtune=btver1 -Wl,-O1 -o .libs/lame lame_main.o main.o brhist.o console.o get_audio.o lametime.o parse.o timestatus.o  -Wl,--as-needed ../libmp3lame/.libs/libmp3lame.so -lncurses /usr/lib64/libsndfile.so -lFLAC -lvorbisenc -lvorbis -logg -lm
libtool: link: x86_64-pc-linux-gnu-gcc -Wall -pipe -march=btver1 -mtune=btver1 -Wl,-O1 -o .libs/mp3rtp mp3rtp.o rtp.o main.o brhist.o console.o get_audio.o lametime.o parse.o timestatus.o  -Wl,--as-needed ../libmp3lame/.libs/libmp3lame.so -lncurses /usr/lib64/libsndfile.so -lFLAC -lvorbisenc -lvorbis -logg -lm
console.o: In function `get_termcap_string':
console.c:(.text+0xe3): undefined reference to `tgetstr'
console.o: In function `get_termcap_number':
console.c:(.text+0x14a): undefined reference to `tgetnum'
console.o: In function `apply_termcap_settings':
console.c:(.text+0x1a9): undefined reference to `tgetent'
collect2: ld returned 1 exit status
console.o: In function `get_termcap_string':
console.c:(.text+0xe3): undefined reference to `tgetstr'
console.o: In function `get_termcap_number':
console.c:(.text+0x14a): undefined reference to `tgetnum'
console.o: In function `apply_termcap_settings':
console.c:(.text+0x1a9): undefined reference to `tgetent'
collect2: ld returned 1 exit status

as reported downstream here:

https://bugs.gentoo.org/show_bug.cgi?id=454322

the attached patch fixes things

----------------------------------------------------------------------

>Comment By: Samuli Suominen (ssuominen)
Date: 2013-03-03 07:11

Message:
configure.in was checking initscr() function from the termcap libraries,
whereas iniscr() is not used anywhere in the lame code, so changing it to
the used function tgetent() seemed appropiate

then since as explained earlier, libtinfo can be built out from libncurses
source tree, which moves the tgetent() function from -lncurses to -ltinfo
so I've simply added new AC_CHECK_LIB there, and it works nicely

----------------------------------------------------------------------

Comment By: Samuli Suominen (ssuominen)
Date: 2013-03-02 10:10

Message:
In fact, if libtinfo is built, then it doesn't link against libncurses at
all, so adding AC_CHECK_LIB, as last one, for tinfo, might just work too
but I still prefer pkg-config

$ objdump -p /usr/bin/lame |grep NEEDED
  NEEDED               libmp3lame.so.0
  NEEDED               libtinfo.so.5
  NEEDED               libsndfile.so.1
  NEEDED               libm.so.6
  NEEDED               libc.so.6



----------------------------------------------------------------------

Comment By: Samuli Suominen (ssuominen)
Date: 2013-03-02 10:03

Message:
just for the record:

- building separate libtinfo is optional in Gentoo Linux
- Debian has it always built as separate

don't know about others

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100290&aid=3606629&group_id=290

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.