source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: 1.13 backport: Autodetect if -lrt is needed for nanosleep(3).
Date: Wed, 20 Jul 2016 09:14:38 -0500 (EST)	[thread overview]
Message-ID: <3062564062628349984.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
1.13 backport: Autodetect if -lrt is needed for nanosleep(3).

Tags:
----
VERSION_1_13

Modified Files:
--------------
    mdocml:
        Makefile
        configure
        configure.local.example

Revision Data
-------------
Index: configure.local.example
===================================================================
RCS file: /home/cvs/mdocml/mdocml/configure.local.example,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -Lconfigure.local.example -Lconfigure.local.example -u -p -r1.14 -r1.14.2.1
--- configure.local.example
+++ configure.local.example
@@ -129,11 +129,17 @@ BINM_SOELIM=msoelim		# default is "soeli
 
 LD_OHASH="-lutil"
 
-# Some platforms may need additional linker flags to link against libmandoc
-# that are not autodetected.
-# For example, Solaris 9 and 10 need -lrt for nanosleep(2).
+# Some platforms may need an additional linker flag for nanosleep(2).
+# If none is needed or it is -lrt, it is autodetected.
+# Otherwise, set the following variable.
 
-LDADD="-lrt"
+LD_NANOSLEEP="-lrt"
+
+# Some platforms might need additional linker flags to link against
+# libmandoc that are not autodetected, though no such cases are
+# currently known.
+
+LDADD="-lm"
 
 # Some systems may want to set additional linker flags for all the
 # binaries, not only for those using libmandoc, for example for
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/mdocml/Makefile,v
retrieving revision 1.488
retrieving revision 1.488.2.1
diff -LMakefile -LMakefile -u -p -r1.488 -r1.488.2.1
--- Makefile
+++ Makefile
@@ -27,6 +27,7 @@ TESTSRCS	 = test-dirent-namlen.c \
 		   test-isblank.c \
 		   test-mkdtemp.c \
 		   test-mmap.c \
+		   test-nanosleep.c \
 		   test-ohash.c \
 		   test-pledge.c \
 		   test-progname.c \
Index: configure
===================================================================
RCS file: /home/cvs/mdocml/mdocml/configure,v
retrieving revision 1.43
retrieving revision 1.43.2.1
diff -Lconfigure -Lconfigure -u -p -r1.43 -r1.43.2.1
--- configure
+++ configure
@@ -1,5 +1,7 @@
 #!/bin/sh
 #
+# $Id$
+#
 # Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
 #
 # Permission to use, copy, modify, and distribute this software for any
@@ -39,6 +41,7 @@ CFLAGS="-g -W -Wall -Wmissing-prototypes
 CFLAGS="${CFLAGS} -Wno-unused-parameter"
 LDADD=
 LDFLAGS=
+LD_NANOSLEEP=
 LD_OHASH=
 LD_SQLITE3=
 STATIC="-static"
@@ -54,6 +57,7 @@ HAVE_GETSUBOPT=
 HAVE_ISBLANK=
 HAVE_MKDTEMP=
 HAVE_MMAP=
+HAVE_NANOSLEEP=
 HAVE_PLEDGE=
 HAVE_PROGNAME=
 HAVE_REALLOCARRAY=
@@ -241,6 +245,20 @@ else
 	runtest sqlite3_errstr SQLITE3_ERRSTR "${LD_SQLITE3}" || true
 fi
 
+# --- nanosleep ---
+if [ -n "${LD_NANOSLEEP}" ]; then
+	runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" || true
+elif singletest nanosleep NANOSLEEP; then
+	:
+elif runtest nanosleep NANOSLEEP "-lrt"; then
+	LD_NANOSLEEP="-lrt"
+fi
+if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then
+	echo "FATAL: nanosleep: no" 1>&2
+	echo "FATAL: nanosleep: no" 1>&3
+	exit 1
+fi
+
 # --- ohash ---
 if ismanual ohash "${HAVE_OHASH}"; then
 	:
@@ -256,7 +274,7 @@ if [ "${HAVE_OHASH}" -eq 0 ]; then
 fi
 
 # --- LDADD ---
-LDADD="${LDADD} ${LD_SQLITE3} ${LD_OHASH} -lz"
+LDADD="${LDADD} ${LD_SQLITE3} ${LD_NANOSLEEP} ${LD_OHASH} -lz"
 echo "LDADD=\"${LDADD}\"" 1>&2
 echo "LDADD=\"${LDADD}\"" 1>&3
 echo 1>&3
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2016-07-20 14:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3062564062628349984.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).