Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostly Autoconf cleanups #240

Merged
merged 7 commits into from
Dec 16, 2016
Merged

Mostly Autoconf cleanups #240

merged 7 commits into from
Dec 16, 2016

Conversation

wferi
Copy link
Contributor

@wferi wferi commented Dec 7, 2016

A couple of small things I noticed during packaging the 1.0.1 release. They don't make a big difference for a small project like libqb, but I decided to offer them for the sake of consistency and future-proofing.
Especially for pthreads, where I switched to the standard macro from the Autoconf Archive.
I couldn't fully test this on systems where gethostbyname or the socket functions aren't in libc, so some corrections might be needed if you support them for real.
Please consider incorporating these patches.

@jnpkrn
Copy link
Contributor

jnpkrn commented Dec 7, 2016

Minor nitpicks:

  • could you please stick with common commit message prefixes
    and style that has been exercised lately
    (build: [configure:], Fix typos:)?
  • it's entirely fine to merge the single-change spelling fixes
  • the first commit's message contains typo on its own (defualt)

@@ -466,10 +466,8 @@ AC_ARG_ENABLE([coverage],
AC_ARG_ENABLE([slow-tests],
[AS_HELP_STRING([--enable-slow-tests],[build and run slow tests])])

if test x"$with_check" = xyes; then
AC_ARG_ENABLE([syslog-tests],
[AS_HELP_STRING([--enable-syslog-tests],[build and run syslog tests])])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you advise as to whether this conditional is sensible, please?
My original intention was to lay an egg as carefully as possible because
libtool warns that foo_LDFLAGS = -module is not portable.

Any idea of having this portability tested in some minimalistic way
and turning "syslog-tests" on automatically if positive?

Or is it more a spurious warning of libtool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see any such warning. Where and how do you get it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, cannot reproduce that easily, it might have been on FreeBSD 10.2 VM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced on Linux box, but had to go back in history:

$ make distclean
$ git co -b syslog-test  642f74d
$ ./autogen.sh && ./configure --enable-syslog-tests && make check
...
*** Warning: Linking the executable log.test against the loadable module
*** _syslog_override.so is not portable!
...

Hard to say what resolved this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ebcff54 did. Looks like portability is a concern for installed artifacts only. According to SO and the included link, only Mac OS X is affected.

Copy link
Contributor

@jnpkrn jnpkrn Dec 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, just have discovered that commit too; nice to have this positive
side effect :-)

In the new light, I would suggest dropping --enable-syslog-tests
and enabling it unconditionally when the test suite is enabled as a whole.
I intend to do it subsequently on top of your PR, but feel free to drop
it right now without attempting to rectify anything related needlessly.

wferi added 4 commits December 8, 2016 14:10
The [ default="no" ] branches were sense- and (mostly) harmless.
So let's use the more friendly syntax.
This reduces overlinking of qb-blackbox.  Being a seldom used executable,
the gains are mostly theoretical, but at least this silences warnings
from some QA tools.
@wferi
Copy link
Contributor Author

wferi commented Dec 8, 2016

I implemented your nits and reordered that patches. The last two (GitHub doesn't show them in ancestry order) may not be necessary if you intend to drop the --enable-syslog-tests option altogether. I can take them back if you prefer.

@jnpkrn
Copy link
Contributor

jnpkrn commented Dec 8, 2016

@wferi please have a look at #241 if it works for you (dropped the
last two commits, the rest is reused untouched).

@wferi
Copy link
Contributor Author

wferi commented Dec 8, 2016

#241 works for me perfectly, thanks.
Closing this.

@wferi wferi closed this Dec 8, 2016
@jnpkrn
Copy link
Contributor

jnpkrn commented Dec 8, 2016 via email

AX_SAVE_FLAGS
AC_SEARCH_LIBS([dlopen],[dl],,[AC_MSG_ERROR([cannot find dlopen() function])])
AC_SUBST([dlopen_LIBS],[$LIBS])
AX_RESTORE_FLAGS
Copy link
Contributor

@jnpkrn jnpkrn Dec 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wferi, discussed with @chrissie-c, she raised concerns about "keeping large(ish) chunks of other people's code in there just for simple things, it's just more stuff to keep up-to-date" and I must admit there's some grain of truth in it as all we really need here is just to backup+restore LIBS, nothing more, nothing less. Would you mind reopening this PR (if possible, I am not sure) and reflecting this comment, please? Indeed, I can do it as another follow up, but better to keep history clean.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right there you don't even need to save LIBS, because it's empty. It's a little more interesting around the pthread function tests, where we also manipulate CFLAGS (which might be set by the user). Sure, all uses of AX_SAVE/RESTORE_FLAGS could easily be replaced by custom code. I decided to use them in this pull request, though, mostly for demo.
The main point is that they save you from thinking globally when doing local changes: you gain modularity and composability. You are free to add more involved checks (possibly requiring other flag changes) inside the save/restore pair or reorder them at will. They also reduce the room for error (I might be biased, but a couple of weeks ago I found the insidious CFLAGS="-I/usr/include/security $CLFAGS" and CPPFLAGS="$ac_save_CFLAGS" in the same configure.ac — after far too much head scratching).
Concerning the other point, all three macro files are straight from the Autoconf Archive. They seldom need updates, and when they do, it's a simple replace. Another option is requiring the archive to be installed for building libqb from Git.

@wferi wferi reopened this Dec 9, 2016
@jnpkrn
Copy link
Contributor

jnpkrn commented Dec 12, 2016 via email

@wferi
Copy link
Contributor Author

wferi commented Dec 12, 2016 via email

@wferi
Copy link
Contributor Author

wferi commented Dec 12, 2016

... and the Travis checks failed. On code which is exactly the same as 2908242 in #241. Is this failure genuine? Or maybe the ipc.test has some race? The HPPA buildd failed differently. (Hurd and kFreeBSD also fail some tests.)

@jnpkrn
Copy link
Contributor

jnpkrn commented Dec 12, 2016 via email

@chrissie-c
Copy link
Contributor

The timeout for the stress test has to be HUGE on some platforms. I think it's set to an hour or so even from *BSD

@chrissie-c chrissie-c merged commit 8fad8ac into ClusterLabs:master Dec 16, 2016
chrissie-c added a commit that referenced this pull request Dec 16, 2016
PR #240 + addendum (drop syslog-tests opt-in switch)
@jnpkrn
Copy link
Contributor

jnpkrn commented Dec 16, 2016

It now causes a following problem with EL6:
https://copr-be.cloud.fedoraproject.org/results/%40ClusterLabs/devel/epel-6-x86_64/00490031-libqb/build.log.gz

autoreconf: running: /usr/bin/autoconf
configure:19163: error: possibly undefined macro: AS_VAR_COPY
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

Note that I already encountered something similar with pacemaker,
where solution was to use AS_VAR_GET instead:

ClusterLabs/pacemaker@36f7196#diff-a5522b90382504dc530177f63ced5209R46

@wferi, if you are OK with such a change, I'll go ahead along with
resetting serial to minimal value (currently unsure if 0 or 1).

@wferi
Copy link
Contributor Author

wferi commented Dec 18, 2016

@jnpkrn, what do you think about introducing a "legacy" M4 file like for example https://github.com/varnishcache/varnish-cache/blob/master/varnish-legacy.m4? Definitions of missing macros could be put there as needed in the future. We could start with something like

# For compatibility with autoconf < 2.63b
m4_ifndef([AS_VAR_COPY],
  [m4_define([AS_VAR_COPY],
     [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])

which is basically a conditionalized copy of the AS_VAR_COPY definition in /usr/share/autoconf/m4sugar/m4sh.m4.

@jnpkrn
Copy link
Contributor

jnpkrn commented Dec 21, 2016 via email

@wferi
Copy link
Contributor Author

wferi commented Dec 21, 2016 via email

@wferi
Copy link
Contributor Author

wferi commented May 31, 2017

Thanks for the merge, @jnpkrn.
How did you solve the problem of AS_VAR_COPY being undefined under EL6 in the end?

@jnpkrn
Copy link
Contributor

jnpkrn commented May 31, 2017 via email

@inouekazu
Copy link
Contributor

inouekazu commented Jul 31, 2017

wferi commented on 31 May
How did you solve the problem of AS_VAR_COPY being undefined under EL6 in the end?

I made a patch inouekazu@4b3c4c7. how is it?


I pulled request it #267.

@wferi
Copy link
Contributor Author

wferi commented Jul 31, 2017

I made a patch inouekazu/libqb@4b3c4c7. how is it?

Looks fine, but is it enough to fix the EL6 build, as @jnpkrn queried?

@inouekazu
Copy link
Contributor

Looks fine, but is it enough to fix the EL6 build, as @jnpkrn queried?

Yes. I checked with RHEL 6.9.

[root@rhel69-1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.9 (Santiago)

[root@rhel69-1 ~]# git clone https://github.com/ClusterLabs/libqb
[root@rhel69-1 ~]# cd libqb

[root@rhel69-1 libqb]# vi m4/ax_compat.m4
# For compatibility with autoconf < 2.63b
m4_ifndef([AS_VAR_COPY],
  [AC_DEFUN([AS_VAR_COPY],
     [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])

[root@rhel69-1 libqb]# ./autogen.sh
(snip)
examples/Makefile.am: installing `build-aux/depcomp'
autoreconf: Leaving directory `.'
Now run ./configure and make

[root@rhel69-1 libqb]# ./configure
(snip)

libqb configuration:
  Version                  = 1.0.2.18-333f
  Prefix                   = /usr
  Executables              = ${exec_prefix}/sbin
  Man pages                = ${datarootdir}/man
  Doc dir                  = ${datarootdir}/doc/${PACKAGE_TARNAME}
  Libraries                = /usr/lib64
  Header files             = ${prefix}/include
  Arch-independent files   = ${datarootdir}
  State information        = /var
  System configuration     = /etc
  SOCKETDIR                = /var/run
  Features                 =  epoll gcc__sync attribute-section

libqb build info:
  Optimization             =
  Debug options            =
  Extra compiler warnings  =
  Env. defined CFLAG       = -g -O2
  Env. defined CPPFLAGS    =
  Env. defined LDFLAGS     =
  ANSI defined CPPFLAGS    =
  Coverage     CFLAGS      =
  Coverage     LDFLAGS     =
  Fatal War.   CFLAGS      =
  Final        CFLAGS      = -g -O2       -Wall -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wcast-align -Wbad-function-cast -Wmissing-format-attribute -Wfloat-equal -Wformat=2 -Woverlength-strings -Winit-self -Wuninitialized -Wunknown-pragmas -Wno-unused-parameter -Wno-format-nonliteral
  Final        CPPFLAGS    =
  Final        LDFLAGS     =
[root@rhel69-1 libqb]#

@wferi wferi deleted the autoconf branch October 12, 2017 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants