[PATCH 2/5] Move to autoconf standard function name checks & defines

Gaetan Nadon memsize at videotron.ca
Fri Dec 2 18:30:21 PST 2011


On Fri, 2011-12-02 at 20:42 -0500, Gaetan Nadon wrote:

> On Fri, 2011-12-02 at 10:48 -0800, Alan Coopersmith wrote:
> 
> > Replace multiple methods of checking for funcs calls with
> > AC_CHECK_FUNCS
> > Replace multiple methods of selecting fallback funcs with
> > AC_REPLACE_FUNCS
> 
> A feature of autoconf I had not encountered yet. AC_REPLACE_FUNCS uses
> AC_LIBOBJ which in turns sets up the LIBOBJS and LTLIBOBJS variables
> in the Makefile.
> 
> > Replace HAS_* and NEED_* #defines with autogenerated HAVE_*
> > 
> > Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> > ---
> >  configure.ac              |   38 +++++---------------------
> >  hw/dmx/config/Makefile.am |    3 --
> >  hw/vfb/InitOutput.c       |   26 +++++++++---------
> >  hw/xwin/win.h             |    4 +-
> >  include/dix-config.h.in   |   65
> > +++++++++++++++++++++++---------------------
> >  include/os.h              |    8 +++---
> >  include/xkb-config.h.in   |    3 --
> >  mi/mibitblt.c             |    2 +-
> >  os/Makefile.am            |   16 +---------
> >  os/access.c               |   28 +++++++++---------
> >  os/connection.c           |    6 ++--
> >  os/osdep.h                |    6 ----
> >  os/strcasecmp.c           |    4 +-
> >  os/strcasestr.c           |    2 +-
> >  os/strlcpy.c              |    2 +
> >  15 files changed, 85 insertions(+), 128 deletions(-)
> > 
> > 
> > 
> 
> 
> I got a compiler error (full build). Note that my system does not have
> strlcpy or strlcat. These two objects are available to all Makefiles
> $LIBOBJS appended near the end of the gcc command. 
> 
> make[2]: Entering directory `/home/nadon/xorg/src/xserver/hw/xfree86'
> libtool: link: gcc -std=gnu99 -DHAVE_DIX_CONFIG_H -Wall
> -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wnested-externs -fno-strict-aliasing
> -Wbad-function-cast -Wformat=2 -Wold-style-definition
> -Wdeclaration-after-statement -fno-strict-aliasing -D_BSD_SOURCE
> -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/home/nadon/xorg/src/inst/include
> -I/home/nadon/xorg/src/inst/include/pixman-1 -I/usr/include/freetype2
> -I../../include -I../../include -I../../Xext -I../../composite
> -I../../damageext -I../../xfixes -I../../Xi -I../../mi
> -I../../miext/sync -I../../miext/shadow -I../../miext/damage
> -I../../render -I../../randr -I../../fb -DHAVE_XORG_CONFIG_H
> -I/home/nadon/xorg/src/inst/include -DXF86PM
> -I/home/nadon/xorg/src/inst/include -g -O2 -o Xorg
> sdksyms.o ../../dix/dix.O ../../os/os.O
> -Wl,--export-dynamic  ../../dix/.libs/libmain.a
> loader/.libs/libloader.a common/.libs/libcommon.a
> os-support/.libs/libxorgos.a parser/.libs/libxf86config_internal.a
> dixmods/.libs/libdixmods.a modes/.libs/libxf86modes.a
> ramdac/.libs/libramdac.a ddc/.libs/libddc.a i2c/.libs/libi2c.a
> dixmods/.libs/libxorgxkb.a ../../composite/.libs/libcomposite.a ../../xfixes/.libs/libxfixes.a ../../Xext/.libs/libXextbuiltin.a ../../glx/.libs/libglx.a ../../randr/.libs/librandr.a ../../render/.libs/librender.a ../../damageext/.libs/libdamageext.a ../../miext/sync/.libs/libsync.a ../../miext/damage/.libs/libdamage.a ../../miext/shadow/.libs/libshadow.a ../../Xi/.libs/libXi.a ../../xkb/.libs/libxkb.a ../../mi/.libs/libmi.a ../../os/.libs/libos.a -lcrypto -ldl -L/home/nadon/xorg/src/inst/lib /home/nadon/xorg/src/inst/lib/libpciaccess.so -lpthread /home/nadon/xorg/src/inst/lib/libpixman-1.so /home/nadon/xorg/src/inst/lib/libXfont.so /home/nadon/xorg/src/inst/lib/libXau.so /home/nadon/xorg/src/inst/lib/libXdmcp.so -lm -lrt -Wl,-rpath -Wl,/home/nadon/xorg/src/inst/lib -Wl,-rpath -Wl,/home/nadon/xorg/src/inst/lib
> 
> sdksyms.o:(.data+0x388): undefined reference to `strlcpy'
> sdksyms.o:(.data+0x390): undefined reference to `strlcat'
> 
> ../../os/os.O: In function `siHostnameAddrMatch':
> /home/nadon/xorg/src/xserver/os/access.c:1759: undefined reference to
> `strlcpy'
> ../../os/os.O: In function `AuthAudit':
> /home/nadon/xorg/src/xserver/os/connection.c:518: undefined reference
> to `strlcpy'
> /home/nadon/xorg/src/xserver/os/connection.c:536: undefined reference
> to `strlcpy'
> ../../os/os.O: In function `VAuditF':
> /home/nadon/xorg/src/xserver/os/log.c:576: undefined reference to
> `strlcpy'
> common/.libs/libcommon.a(xf86Config.o): In function
> `xf86ValidateFontPath':
> /home/nadon/xorg/src/xserver/hw/xfree86/common/xf86Config.c:198:
> undefined reference to `strlcpy'
> common/.libs/libcommon.a(xf86Xinput.o):/home/nadon/xorg/src/xserver/hw/xfree86/common/xf86Xinput.c:463: more undefined references to `strlcpy' follow
> collect2: ld returned 1 exit status
> make[2]: *** [Xorg] Error 1
> make[2]: Leaving directory `/home/nadon/xorg/src/xserver/hw/xfree86'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/nadon/xorg/src/xserver/hw/xfree86'
> make: *** [all] Error 2
> 
> =======================================================================================================
> 
> nadon at ubuntu:~/xorg/src/xserver/os$ make
> /bin/bash ../libtool  --tag=CC   --mode=compile gcc -std=gnu99
> -DHAVE_CONFIG_H -I. -I../include    -DHAVE_DIX_CONFIG_H -Wall
> -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes
> -Wmissing-declarations -Wnested-externs -fno-strict-aliasing
> -Wbad-function-cast -Wformat=2 -Wold-style-definition
> -Wdeclaration-after-statement -fno-strict-aliasing -D_BSD_SOURCE
> -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/home/nadon/xorg/src/inst/include
> -I/home/nadon/xorg/src/inst/include/pixman-1 -I/usr/include/freetype2
> -I../include -I../include -I../Xext -I../composite -I../damageext
> -I../xfixes -I../Xi -I../mi -I../miext/sync -I../miext/shadow
> -I../miext/damage -I../render -I../randr -I../fb  -g -O2 -MT access.lo
> -MD -MP -MF .deps/access.Tpo -c -o access.lo access.c
> libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../include
> -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wstrict-prototypes
> -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
> -fno-strict-aliasing -Wbad-function-cast -Wformat=2
> -Wold-style-definition -Wdeclaration-after-statement
> -fno-strict-aliasing -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT
> -I/home/nadon/xorg/src/inst/include
> -I/home/nadon/xorg/src/inst/include/pixman-1 -I/usr/include/freetype2
> -I../include -I../include -I../Xext -I../composite -I../damageext
> -I../xfixes -I../Xi -I../mi -I../miext/sync -I../miext/shadow
> -I../miext/damage -I../render -I../randr -I../fb -g -O2 -MT access.lo
> -MD -MP -MF .deps/access.Tpo -c access.c  -fPIC -DPIC
> -o .libs/access.o
> mv -f .deps/access.Tpo .deps/access.Plo
> /bin/bash ../libtool  --tag=CC   --mode=link gcc -std=gnu99
> -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wstrict-prototypes
> -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
> -fno-strict-aliasing -Wbad-function-cast -Wformat=2
> -Wold-style-definition -Wdeclaration-after-statement
> -fno-strict-aliasing -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT
> -I/home/nadon/xorg/src/inst/include
> -I/home/nadon/xorg/src/inst/include/pixman-1 -I/usr/include/freetype2
> -I../include -I../include -I../Xext -I../composite -I../damageext
> -I../xfixes -I../Xi -I../mi -I../miext/sync -I../miext/shadow
> -I../miext/damage -I../render -I../randr -I../fb  -g -O2   -o libos.la
> WaitFor.lo access.lo auth.lo backtrace.lo client.lo connection.lo
> io.lo mitauth.lo oscolor.lo osinit.lo utils.lo xdmauth.lo xsha1.lo
> xstrans.lo xprintf.lo log.lo rpcauth.lo xdmcp.lo -lcrypto -ldl
> strlcat.o strlcpy.o -lm  -lrt
> 
> *** Warning: Linking the shared library libos.la against the
> non-libtool
> *** objects  strlcat.o strlcpy.o is not portable!
> 


This os Makefile.am should read:

libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) $(LTLIBOBJS)  --> Use
LTLIBOBJS rather than LIBOBJS

I get a successful build now.

It links with .lo files now:

        [...] -lcrypto -ldl strlcat.lo strlcpy.lo -lm  -lrt



> libtool: link: rm -fr  .libs/libos.a .libs/libos.la
> libtool: link: ar
> cru .libs/libos.a .libs/WaitFor.o .libs/access.o .libs/auth.o .libs/backtrace.o .libs/client.o .libs/connection.o .libs/io.o .libs/mitauth.o .libs/oscolor.o .libs/osinit.o .libs/utils.o .libs/xdmauth.o .libs/xsha1.o .libs/xstrans.o .libs/xprintf.o .libs/log.o .libs/rpcauth.o .libs/xdmcp.o 
> libtool: link: ranlib .libs/libos.a
> libtool: link: ( cd ".libs" && rm -f "libos.la" && ln -s "../libos.la"
> "libos.la" )
> /usr/bin/dtrace -G -C -o dtrace.o
> -s ../dix/Xserver.d .libs/*.o ../dix/.libs/*.o
> ld -r -o os.O dtrace.o .libs/*.o
> 
> I hope it is not just a glitch on my system, I'll try digging more. 
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111202/f4d91f3a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111202/f4d91f3a/attachment.pgp>


More information about the xorg-devel mailing list