michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
309 stars 49 forks source link

configure script parameters not honored -- /usr/local "prefix" used regardless for "run" directory #219

Closed Corin-EU closed 2 years ago

Corin-EU commented 2 years ago

This relates to the latest papl r.1446335

As is standard for the GNU autotools "configure" script, parameters are provided to set paths, eg

        --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
       --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
       --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
       --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]

as well as others so that the prefix (default /usr/local)

However the paths for the state and run directories are hardcoded in config.h.in and config.h

           // Location of PAPPL state and spool data (when run as root)
          #define PAPPL_STATEDIR "/usr/local/var"

          // Location of PAPPL domain socket (when run as root)
         #define PAPPL_SOCKDIR "/usr/local/var/run"

It would be helpful if this code was modified to use those values as backups if the symbolic constants are not defined by the Makefile invocation which gets the specified value via localstatedir and runstatedir parameters when the Makefile is created by the configure script.

However as a test I deleted the Makefile, ran configure but no Makefile was created as is normally expected for the execution of configure.

Also, I edited the config.h.in file which I thought was being used to create the config.h and after editing it to change the STATEDIR and SOCKDIR paths, and then running confgure found that it had made no difference, so it appears that those lines in config.h.in are being iignored and configure is just stuffing the prefix value + var [+ run] into config.h regardless of the localstatedir and runstatedir being specified.

Although /usr/local/var and /usr/local/var/run are consistent with the default prefix /usr/local, I would suggest that for practical use, the defaults should be the system /var and system /run (/var/run is now almost always a symbolic link to /run, a transitory tmpfs directory)

Corin-EU commented 2 years ago

Upon further investigation, I made a mistake above about the behavior of configure.

For this project there is a fixed Makefile which pulls in the variables from Makedefs.

When I run configure with

       configure --prefix=/usr/local  --localstatedir=/var  --sharedstatedir=/run

the Makedefs file is generated with localstatedir and sharestedir withthe correct values of "/var" and "/run" but the problem remains that the generated "config.h" does not contain these values but the default values of "/usr/local/var" and "/usr/local/var/run" so the problem is at the level of the generation of the config.h

michaelrsweet commented 2 years ago

@Corin-EU I will update the defaults for this to use the localstatedir value (sharedstatedir never gets used), but I explicitly made these separate configure options (--with-papplstatedir and --with-papplsockdir) since these are the directories other applications will end up using and not necessarily where PAPPL gets installed...

michaelrsweet commented 2 years ago

[master 15bd0cd] Fix default values of PAPPL_SOCKDIR and PAPPL_STATEDIR, also update CUPS_SERVERROOT on macOS (Issue #219)

Corin-EU commented 2 years ago

Thank you for the fix.