Re: Gutenprint 5.3.5-pre1 Release

Greg Troxel <[email protected]> Wed, 10 Jul 2024 20:26:56 -0400
Newsgroups gmane.linux.printing.gimp-print.devel
Message-ID <[email protected]>
BLUF:
  - configure.ac should be modified to remove "-D_POSIX_C_SOURCE=200809L"
  - configure.ac should remove the --std=c99 and add AC_PROG_CC_C99

Matt Broughton <[email protected]> writes:

> It does build fine on macos 12.7.5 with -std=c99.  I was going on what
> the previous macos maintainer indicated needed to be changed.  I am
> wondering if the macos builds ever used -std=c99.

Pedantically C is a language family and K&R C, ANSI C, c99, c11, c23
etc. are languages.  But that terminology doesn't help and people call
them "language family variants" or some such.  A compiler typically
supports multiple variants, and has a default for one of them.
Strictly, a program should specify --std=cNN for the variant it is
written in.  But I think the default -- so far -- is almost always c99
so often this doesn't happen.

  https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html

So the --std=c99 seems right to me.

> configure line19887---
>   for stp_ac_arg in -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wwrite-strings -Werror-implicit-function-declaration -Winline -Wformat=2 -finline-limit=131072 -Wformat -Werror=format-security -D_POSIX_C_SOURCE=200809L -std=c99 ; do

The real question is what is in the configure.ac and why.  For
5.3.5-pre1, it's just coded to use those flags on gcc.  But it also
thinks clang is a kind of gcc, probably because clang has had to be very
compatible to survive (a bug in the gcc-using community, but that's off
topic).

  dnl Compiler flags                                                                                                                                                                                                            
  if test x$ac_compiler_gnu = "xyes"; then
    STP_ADD_COMPILER_ARGS([-Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wwrite-strings -Werror-implicit-function-declaration -Winline -Wformat=2 -finline-limit=131072 \
  -Wformat -Werror=format-security] -D_POSIX_C_SOURCE=200809L -std=c99,, [GNUCFLAGS])
    if test x${USE_MAINTAINER_MODE} = xyes ; then
      STP_ADD_COMPILER_ARGS([ -pedantic -Waggregate-return -Wcast-qual -Wshadow -Wredundant-decls],, [GNUCFLAGS])
    fi
    if test x$ENABLE_DEBUG = xyes ; then
      STP_ADD_COMPILER_ARG([-g])
      STP_ADD_COMPILER_ARG([-Og])
    else
      STP_ADD_FIRST_COMPILER_ARG([-O3 -O2 -O1 -O])
    fi
  else
    if test x$ENABLE_DEBUG = xyes ; then
      STP_ADD_COMPILER_ARG([-g])
      STP_ADD_COMPILER_ARG([-Og])
    else
      STP_ADD_FIRST_COMPILER_ARG([-O])
    fi
  fi
  if test x$ENABLE_PROFILE = xyes ; then
    STP_ADD_COMPILER_ARG([-pg])
  fi
  AC_SUBST(GNUCFLAGS)

I'm guessing that the args in brackets are added if they work in a test
compile, and otherwise skipped.

I would say that:

  1) I am unclear on if standards require that compilers that implement c99
  accept --std=c99, and if there are any compilers that implement c99
  but don't take the option.  I would tend to use autoconf's macro:

     https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/C-Compiler.html
     AC_PROG_CC_C99

  and drop c99 from this stanza.  But I don't think it's causing trouble
  how it is.

  2) Setting _POSIX_C_SOURCE seems like it was done for some reason  in
  the past that may or may not be true and is causing trouble.   I would
  just remove it, and if it's needed in some particular situation, add
  it only in that situation, with a huge comment explaining.


I dropped the define of _POSIX_C_SOURCE from configure (by patching
configure), and that resulted in the build succeeding and the packaging
step failing with the following, which is glorious -- basically "gdt has
not updated the list of installed files to cover the improvements in
5.3.5-pre1"!

  => Checking file-check results for gutenprint-lib-5.3.5-pre1nb31
  ERROR: ************************************************************
  ERROR: The following files are in /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg but not in the PLIST:
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/libexec/cups/filter/commandtodyesub
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/5.3/xml/escp2/inks/pro_ultrachrome_d6s.xml
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/5.3/xml/escp2/inputslots/cutter_roll_only.xml
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/5.3/xml/escp2/media/pro_ultrachrome_d6s.xml
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/5.3/xml/escp2/model/model_136.xml
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/5.3/xml/escp2/qualitypresets/surelab.xml
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/a2128.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/book1.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/c1723.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/c193.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/c1974.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/c199.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/c38.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/c463.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/c47.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/f14.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/ln10.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/x1675.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/x1740.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/x2159.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/x270.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/x66.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/x78.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/gutenprint/doc/reference-html/x961.html
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/locale/hr/LC_MESSAGES/gutenprint.mo
  ERROR:         /tmp/work/print/gutenprint-lib/work/.destdir/usr/pkg/share/locale/hr/gutenprint_hr.po

I ran make check, and it passed ppds and is still going.
I don't have an inkjet printer any more, but from my viewpoint the only
thing wrong is the POSIX_C_SOURCE define.