Patch for compiling under Sun

Hi All,

Trying to compile Tidy with SunPro

cc: Sun C 5.8 2005/10/13
CC: Sun C++ 5.8 Patch 121018-20 2009/04/20

I've tried hacking the configure script, but that wasn't fruitful.

$ /usr/bin/sh build/gnuauto/setup.sh
build/gnuauto/setup.sh: !: not found

Generating the build system in
/export/nas02/users/mbana/Libs/test-recompile/tidy

copying files into place: cd build/gnuauto && cp -R -f *
/export/nas02/users/mbana/Libs/test-recompile/tidy
running: libtoolize --force --copy
You should update your `aclocal.m4' by running aclocal.
running: aclocal
running: automake -a -c --foreign
src/Makefile.am:60: Libtool library used but `LIBTOOL' is undefined
src/Makefile.am:60:
src/Makefile.am:60: The usual way to define `LIBTOOL' is to add
`AC_PROG_LIBTOOL'
src/Makefile.am:60: to `configure.in' and run `aclocal' and `autoconf'
again.
running: autoconf
configure.in:84: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

If the above commands were successful you should now be able
to build in the usual way:

        $ ./configure --prefix=/usr
        $ make
        $ make install

to get a list of configure options type: ./configure --help

Alternatively, you should be able to build outside of the source
tree. e.g.:

        $ mkdir ../build-tidy
        $ cd ../build-tidy
        $ ../tidy/configure --prefix=/usr
        $ make
        $ make install

I've had to resort to patching the Makefile, which *I'd rather not do*

Using the make file

build/gmake/make all CC="/opt/SUNWspro/bin/cc" CFLAGS="-xarch=generic64"

leads to error when the

/opt/SUNWspro/bin/cc -xarch=generic64  -D_DEBUG=1 -o obj/access.o -c
/users/mbana/Libs/test-recompile/1.46/src/access.c
"/users/mbana/Libs/test-recompile/1.46/src/tidy-int.h", line 17: cannot find
include file: "tidy.h"
"/export/nas02/users/mbana/Libs/test-recompile/1.46/src/forward.h", line 24:
cannot find include file: "platform.h"
"/users/mbana/Libs/test-recompile/1.46/src/forward.h", line 25: cannot find
include file: "tidy.h"
"/export/nas02/users/mbana/Libs/test-recompile/1.46/src/forward.h", line 59:
warning: no explicit type given
"/users/mbana/Libs/test-recompile/1.46/src/forward.h", line 59: syntax error
before or at: prvTidyg_default_allocator
"/users/mbana/Libs/test-recompile/1.46/src/forward.h", line 59: warning:
old-style declaration or incorrect type for: prvTidyg_default_allocator

Then I apply the following, perhaps, the only relevant part is removing the
GCC specific flag.

--- 1.46/build/gmake/Makefile    2010-07-19 10:37:05.000000000 +0100
+++ ../tidy/sources/1.46/build/gmake/Makefile    2010-07-15
13:01:07.000000000 +0100
@@ -53,13 +53,13 @@
 #  acknowledgment is not required but would be appreciated.
 #

-SHELL=/bin/sh
+SHELL=/usr/bin/sh

 PROJECT=tidy

 # Installation variables.  Spaces OK, only dir create and file copy
operations.
-runinst_prefix=/usr/local
-devinst_prefix=/usr/local
+runinst_prefix=/users/mbana/Libs/tidy/builds/1.46/sunx86_64
+devinst_prefix=/users/mbana/Libs/tidy/builds/1.46/sunx86_64

 bininst = ${runinst_prefix}/bin
 libinst = ${devinst_prefix}/lib
@@ -67,7 +67,7 @@
 maninst = ${devinst_prefix}/man

 # Internal variables. - No spaces allowed: libtool chokes on spaces in
directory names.
-TOPDIR = ../..
+TOPDIR = /users/mbana/Libs/tidy/sources/1.46
 INCDIR = ${TOPDIR}/include
 APPDIR = ${TOPDIR}/console
 SRCDIR = ${TOPDIR}/src
@@ -91,12 +91,12 @@
 # For optimised builds, flags such as "-O2" should be added and -D_DEBUG=1
 # disabled.
 CC= gcc
-CFLAGS= -g -pedantic -Wall -I $(INCDIR)
+#CFLAGS= -g -pedantic -Wall -I $(INCDIR) # uncommented as it's not
supported by sun
 # flags only supported with gcc 3.x
-CFLAGS += -Wunused-parameter
+#CFLAGS += -Wunused-parameter # uncommented as it's not supported by sun

-OTHERCFLAGS=
-OTHERCFLAGS+= -D_DEBUG=1
+#OTHERCFLAGS=
+#OTHERCFLAGS+= -D_DEBUG=1
 # OTHERCFLAGS+= -fvisibility=hidden
-DTIDY_EXPORT='__attribute__((visibility("default")))'
 ifdef SUPPORT_UTF16_ENCODINGS
 CFLAGS += -DSUPPORT_UTF16_ENCODINGS=$(SUPPORT_UTF16_ENCODINGS)
@@ -184,7 +184,7 @@

 $(OBJDIR)/%$(OBJSUF):    $(SRCDIR)/%.c $(HFILES) $(LIBHFILES) Makefile
     if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi
-    $(CC) $(CFLAGS) $(OTHERCFLAGS) -o $@ -c $<
+    $(CC) $(CFLAGS) $(OTHERCFLAGS) -I$(INCDIR) -o $@ -c $<

 $(BINDIR)/$(PROJECT):    $(APPDIR)/tidy.c $(HFILES) $(LIBRARY)
     if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
@@ -192,7 +192,7 @@

 $(BINDIR)/tab2space: $(APPDIR)/tab2space.c
     if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
-    $(CC) $(CFLAGS) $(OTHERCFLAGS) -o $@ $(APPDIR)/tab2space.c $(LIBS)
+    $(CC) $(CFLAGS) $(OTHERCFLAGS) -I$(INCDIR) -o $@ $(APPDIR)/tab2space.c
$(LIBS)

 $(HELPXML): $(BINDIR)/$(PROJECT)
     $(BINDIR)/$(PROJECT) -xml-help > $@


Can you please fix this as we depend on HTML Tidy.  I don't want to patch
the Makefile manually each time we decide to upgrade.

Please CC me on reply, as I'm not registered on the mailing list.

 —Mohamed

Received on Tuesday, 20 July 2010 07:03:23 UTC