Re: Autoconf can't find X11 libraries

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

 



On Thu, Jan 21, 2016 at 10:11:47AM +0300, anatoly techtonik wrote:
> On Wed, Jan 13, 2016 at 1:19 PM, Thomas Dickey <dickey@xxxxxxx> wrote:
> > On Mon, Jan 11, 2016 at 02:05:49PM +0300, anatoly techtonik wrote:
> >> Hi,
> >>
> >> In this build on Ubuntu x86_64 autoconf is unable to find X11
> >> libraries:
> >>     https://travis-ci.org/techtonik/PDCurses/builds/101477536
> >> However, it works with explicit configure option
> >>     --x-libraries=/usr/lib/x86_64-linux-gnu
> >>     https://travis-ci.org/techtonik/PDCurses/builds/101506738
> >>
> >> It looks like the problem is PDCurses specific
> >> http://askubuntu.com/questions/539574/how-to-install-xaw-package-with-header-files/578003
> >> probably because people rarely use Xaw. Anyway, how to fix
> >> it? Is it an autoconf bug?
> >
> > no - it is a bug in PDCurses' configure script, which assumes that the
> > libraries are in a directory "../lib" relative to the location of the
> > X headers.
> 
> Thank for clarification. The ./configure script is autogenerated  - at
> least this is said in headers
> "Generated by GNU Autoconf 2.61 for PDCurses 3.4."
> So, is it a bug in Autoconf?
> 
> > You might find this to be useful:
> >
> >         http://anonscm.debian.org/cgit/users/agmartin/pdcurses.git/
> 
> I see only two patches, one of which is said to be fixed upstream
> https://anonscm.debian.org/cgit/users/agmartin/pdcurses.git/tree/debian/patches
> I can't extract the solution for complication problem from them.

hmm.  I started a while back by tweaking the configure script, and noticed
Martin's tree, made a copy of _that_, and eliminated most of the unnecessary
stuff.  Since I'm not going to publish _that_ tree (I maintain ncurses), it
would be of limited use.

So (referring to PDCurses 3.4)
this line in the configure script is the problem:

	mh_lib_dirs="$x_libraries `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`"

The problem is that 64-bit machines nowadays generally use lib64 - not lib,
as the script assumes.  When I tweaked it by hand, I just edited that line.

	mh_lib_dirs="$x_libraries `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib64/g`"

But I prefer packages...

Refreshing my memory, I see that Martin may not have _fixed_ that.
But I did, using a script in the debian/rules file.  I'm attaching
that, for discussion.

> > Before noticing this, I would simply build PDCurses with a quick fix
> > for its configure script bug.  (Actually now I build it using Martin's
> > version plus some further fixes -- I use that for test-builds, e.g.,
> > of lynx, dialog).
> 
> Can you clarify how to fix this configure script? Looks like the file that
> should be fixed is
> https://anonscm.debian.org/cgit/users/agmartin/pdcurses.git/tree/configure.ac
> but I don't understand its semantics well enough to find the
> problem myself.
> 
> Thanks.

-- 
Thomas E. Dickey <dickey@xxxxxxxxxxxxxxxxxxxx>
http://invisible-island.net
ftp://invisible-island.net
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/quilt/quilt.make

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

# Use default buildflags for hardening
CFLAGS             := $(shell dpkg-buildflags --get CFLAGS) -Wall
CPPFLAGS           := $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS            := $(shell dpkg-buildflags --get LDFLAGS)

# Make sure we do not link against unneeded libs.
LDFLAGS            += -Wl,--as-needed

export CFLAGS CPPFLAGS LDFLAGS

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

# Shared library versions
include version.mif
version = $(VERDOT)
major   = $(word 1,$(subst ., ,$(VERDOT)))

# The installation dir for shared library package
my_pdcursesdir = $(CURDIR)/debian/pdcurses$(major)

DEBIAN_FULL_DESTDIR = $(CURDIR)/debian/tmp
PUBLIC_FULL_DESTDIR = $(CURDIR)/debian/pdcurses3
PUBLIC_FULL_LIBDIR  = $(CURDIR)/debian/pdcurses3/usr/lib

config.status: configure
	dh_testdir

ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	ln -s curses.h xcurses.h

	# The configure script assumes that all X libraries are in the "lib"
	# directory matching the "include" directory.  Change that to be the
	# set of directories that ldconfig knows about.
	ldconfig -p |fgrep '=>' |sed -e 's%^.* => %%' -e 's%/[^/]*$$%%' |sort -u |tr '\n' ' ' >all_dirs
	cat all_dirs
	echo 's,^mh_lib_dirs=.*,mh_lib_dirs="'`cat all_dirs`'",' >fixup.sed
	cat fixup.sed
	sed -i -f fixup.sed configure

	# Add here commands to configure the package.
	./configure CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
		--host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr \
		--libdir=\$${prefix}/lib \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		-x-libraries=/usr/lib \
		--enable-xim


build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp:  config.status
	dh_testdir

	# Add here commands to compile the package.
	$(MAKE) RXPACKEXPORTS="-Wl,-soname,libXCurses.so.$(major) ${LDFLAGS}"

	touch build-stamp

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp
	-[ -L "xcurses.h" ] && rm xcurses.h

	# Add here commands to clean up after the build process.
	[ ! -f Makefile ] || $(MAKE) distclean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Add here commands to install the package into debian/tmp
	# Need to set {bin,lib}dir to work around buggy Makefile.in unconditionally setting it
	$(MAKE) install DESTDIR=$(DEBIAN_FULL_DESTDIR) \
		libdir=$(PUBLIC_FULL_LIBDIR) \
		bindir=$(PUBLIC_FULL_LIBDIR)/pdcurses
	mkdir -p $(my_pdcursesdir)/etc/X11/Xresources/XCurses
	mkdir -p $(my_pdcursesdir)/usr/share/pixmaps
	install -m 644 debian/XCurses.xresources \
		$(my_pdcursesdir)/etc/X11/Xresources/XCurses
	install -m 644 x11/little_icon.xbm \
		$(my_pdcursesdir)/usr/share/pixmaps/xcurses32.xbm
	install -m 644 x11/big_icon.xbm \
		$(my_pdcursesdir)/usr/share/pixmaps/xcurses64.xbm
	( cd $(PUBLIC_FULL_LIBDIR) && \
		mv libXCurses.so libXCurses.so.$(version) && \
                ln -s libXCurses.so.$(version) libXCurses.so.$(major) && \
		ln -s libXCurses.so.$(major) libXCurses.so && \
		ln -sf libXCurses.so libXpanel.so && \
		ln -sf libXCurses.a libXpanel.a && \
		ln -sf libXpanel.a libxpanel.a )

	# Install Debian xcurses-config wrapper
	mkdir -p $(PUBLIC_FULL_DESTDIR)/usr/bin
	install debian/xcurses-config.wrapper $(PUBLIC_FULL_DESTDIR)/usr/bin/xcurses-config


# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs -A doc/x11.txt README
	dh_installexamples
#	dh_installinfo
	dh_movefiles
	dh_installman
	dh_link
	# dh_strip
	dh_strip -ppdcurses3 --dbg-package=pdcurses3-dbg
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux