diff --git a/.gitignore b/.gitignore
index b66db10..d0079b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,17 +1,18 @@
/aclocal.m4
/autom4te.cache
/config.h.in
/configure
/config.log
/config.status
/libtool
/stamp-h1
/config.h
src/npth.h
src/npth-config
w32/npth-config
Makefile.in
Makefile
.deps/
.libs/
*~
+/VERSION
diff --git a/Makefile.am b/Makefile.am
index 7451af2..9a4ee72 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,63 +1,63 @@
# Makefile.am - Top level Makefile for npth.
# Copyright (C) 2011 g10 Code GmbH
#
# This file is part of nPth.
#
# nPth is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# nPth is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see .
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = npth-config.in npth.m4 npth.spec.in autogen.sh autogen.rc HACKING
+EXTRA_DIST = npth-config.in npth.m4 npth.spec.in autogen.sh autogen.rc \
+ HACKING VERSION
bin_SCRIPTS = npth-config
m4datadir = $(datadir)/aclocal
m4data_DATA = npth.m4
if RUN_TESTS
tests = tests
else
tests =
endif
if HAVE_W32_SYSTEM
npthdir = w32
else
npthdir = src
endif
SUBDIRS = ${npthdir} ${tests}
# Fix the version of the spec file and create a file named VERSION
# to be used for patch's Prereq: feature.
dist-hook: gen-ChangeLog
@set -e; \
sed -e 's/@pkg_version@/$(VERSION)/g' \
$(top_srcdir)/npth.spec.in > $(distdir)/npth.spec
- echo "$(VERSION)" > $(distdir)/VERSION
gen_start_date = 2011-12-01T00:00:00
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d $(top_srcdir)/.git; then \
(cd $(top_srcdir) && \
gitlog-to-changelog \
--append-dot --tear-off \
--amend=build-aux/git-log-fix \
--since=$(gen_start_date) ) > $(distdir)/cl-t; \
cat $(top_srcdir)/build-aux/git-log-footer >> $(distdir)/cl-t;\
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
diff --git a/autogen.sh b/autogen.sh
index 471193c..9b36158 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,393 +1,513 @@
#! /bin/sh
# autogen.sh
-# Copyright (C) 2003, 2014 g10 Code GmbH
+# Copyright (C) 2003, 2014, 2017, 2018 g10 Code GmbH
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# This is a generic script to create the configure script and handle cross
# build environments. It requires the presence of a autogen.rc file to
# configure it for the respective package. It is maintained as part of
# GnuPG and source copied by other packages.
#
-# Version: 2014-01-10
+# Version: 2018-07-10
configure_ac="configure.ac"
cvtver () {
awk 'NR==1 {split($NF,A,".");X=1000000*A[1]+1000*A[2]+A[3];print X;exit 0}'
}
check_version () {
if [ $(( `("$1" --version || echo "0") | cvtver` >= $2 )) = 1 ]; then
return 0
fi
echo "**Error**: "\`$1\'" not installed or too old." >&2
echo ' Version '$3' or newer is required.' >&2
[ -n "$4" ] && echo ' Note that this is part of '\`$4\''.' >&2
DIE="yes"
return 1
}
fatal () {
echo "autogen.sh:" "$*" >&2
DIE=yes
}
info () {
if [ -z "${SILENT}" ]; then
- echo "autogen.sh:" "$*"
+ echo "autogen.sh:" "$*" >&2
fi
}
die_p () {
if [ "$DIE" = "yes" ]; then
echo "autogen.sh: Stop." >&2
exit 1
fi
}
replace_sysroot () {
configure_opts=$(echo $configure_opts | sed "s#@SYSROOT@#${w32root}#g")
extraoptions=$(echo $extraoptions | sed "s#@SYSROOT@#${w32root}#g")
}
# Allow to override the default tool names
AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
DIE=no
FORCE=
SILENT=
+PRINT_HOST=no
+PRINT_BUILD=no
tmp=$(dirname "$0")
tsdir=$(cd "${tmp}"; pwd)
if [ -n "${AUTOGEN_SH_SILENT}" ]; then
SILENT=" --silent"
fi
if test x"$1" = x"--help"; then
- echo "usage: ./autogen.sh [--silent] [--force] [--build-TYPE] [ARGS]"
+ echo "usage: ./autogen.sh [OPTIONS] [ARGS]"
+ echo " Options:"
+ echo " --silent Silent operation"
+ echo " --force Pass --force to autoconf"
+ echo " --find-version Helper for configure.ac"
+ echo " --git-build Run all commands to build from a Git"
+ echo " --print-host Print only the host triplet"
+ echo " --print-build Print only the build platform triplet"
+ echo " --build-TYPE Configure to cross build for TYPE"
+ echo ""
+ echo " ARGS are passed to configure in --build-TYPE mode."
+ echo " Configuration for this script is expected in autogen.rc"
exit 0
fi
if test x"$1" = x"--silent"; then
SILENT=" --silent"
shift
fi
if test x"$1" = x"--force"; then
FORCE=" --force"
shift
fi
+if test x"$1" = x"--print-host"; then
+ PRINT_HOST=yes
+ shift
+fi
+if test x"$1" = x"--print-build"; then
+ PRINT_BUILD=yes
+ shift
+fi
# Reject unsafe characters in $HOME, $tsdir and cwd. We consider spaces
# as unsafe because it is too easy to get scripts wrong in this regard.
am_lf='
'
case `pwd` in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
fatal "unsafe working directory name" ;;
esac
case $tsdir in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
fatal "unsafe source directory: \`$tsdir'" ;;
esac
case $HOME in
*[\;\\\"\#\$\&\'\`$am_lf\ \ ]*)
fatal "unsafe home directory: \`$HOME'" ;;
esac
die_p
# List of variables sourced from autogen.rc. The strings '@SYSROOT@' in
# these variables are replaced by the actual system root.
configure_opts=
extraoptions=
# List of optional variables sourced from autogen.rc and ~/.gnupg-autogen.rc
w32_toolprefixes=
w32_extraoptions=
w32ce_toolprefixes=
w32ce_extraoptions=
w64_toolprefixes=
w64_extraoptions=
amd64_toolprefixes=
# End list of optional variables sourced from ~/.gnupg-autogen.rc
# What follows are variables which are sourced but default to
# environment variables or lacking them hardcoded values.
#w32root=
#w32ce_root=
#w64root=
#amd64root=
# Convenience option to use certain configure options for some hosts.
myhost=""
myhostsub=""
case "$1" in
+ --find-version)
+ myhost="find-version"
+ SILENT=" --silent"
+ shift
+ ;;
+ --git-build)
+ myhost="git-build"
+ shift
+ ;;
--build-w32)
myhost="w32"
shift
;;
--build-w32ce)
myhost="w32"
myhostsub="ce"
shift
;;
--build-w64)
myhost="w32"
myhostsub="64"
shift
;;
--build-amd64)
myhost="amd64"
shift
;;
--build*)
fatal "**Error**: invalid build option $1"
shift
;;
*)
;;
esac
die_p
+# **** GIT BUILD ****
+# This is a helper to build from git.
+if [ "$myhost" = "git-build" ]; then
+ tmp="$(pwd)"
+ cd "$tsdir" || fatal "error cd-ing to $tsdir"
+ ./autogen.sh || fatal "error running ./autogen.sh"
+ cd "$tmp" || fatal "error cd-ing back to $tmp"
+ die_p
+ "$tsdir"/configure || fatal "error running $tsdir/configure"
+ die_p
+ make || fatal "error running make"
+ die_p
+ make check || fatal "error running male check"
+ die_p
+ exit 0
+fi
+# **** end GIT BUILD ****
+
+
# Source our configuration
if [ -f "${tsdir}/autogen.rc" ]; then
. "${tsdir}/autogen.rc"
fi
# Source optional site specific configuration
if [ -f "$HOME/.gnupg-autogen.rc" ]; then
info "sourcing extra definitions from $HOME/.gnupg-autogen.rc"
. "$HOME/.gnupg-autogen.rc"
fi
+
+# **** FIND VERSION ****
+# This is a helper for the configure.ac M4 magic
+# Called
+# ./autogen.sh --find-version PACKAGE MAJOR MINOR [MICRO]
+# returns a complete version string with automatic beta numbering.
+if [ "$myhost" = "find-version" ]; then
+ package="$1"
+ major="$2"
+ minor="$3"
+ micro="$4"
+
+ if [ -z "$package" -o -z "$major" -o -z "$minor" ]; then
+ echo "usage: ./autogen.sh --find-version PACKAGE MAJOR MINOR [MICRO]" >&2
+ exit 1
+ fi
+
+ if [ -z "$micro" ]; then
+ matchstr1="$package-$major.[0-9]*"
+ matchstr2="$package-$major-base"
+ vers="$major.$minor"
+ else
+ matchstr1="$package-$major.$minor.[0-9]*"
+ matchstr2="$package-$major.$minor-base"
+ vers="$major.$minor.$micro"
+ fi
+
+ beta=no
+ if [ -e .git ]; then
+ ingit=yes
+ tmp=$(git describe --match "${matchstr1}" --long 2>/dev/null)
+ tmp=$(echo "$tmp" | sed s/^"$package"//)
+ if [ -n "$tmp" ]; then
+ tmp=$(echo "$tmp" | sed s/^"$package"// \
+ | awk -F- '$3!=0 && $3 !~ /^beta/ {print"-beta"$3}')
+ else
+ tmp=$(git describe --match "${matchstr2}" --long 2>/dev/null \
+ | awk -F- '$4!=0{print"-beta"$4}')
+ fi
+ [ -n "$tmp" ] && beta=yes
+ rev=$(git rev-parse --short HEAD | tr -d '\n\r')
+ rvd=$((0x$(echo ${rev} | dd bs=1 count=4 2>/dev/null)))
+ else
+ ingit=no
+ beta=yes
+ tmp="-unknown"
+ rev="0000000"
+ rvd="0"
+ fi
+
+ echo "$package-$vers$tmp:$beta:$ingit:$vers$tmp:$vers:$tmp:$rev:$rvd:"
+ exit 0
+fi
+# **** end FIND VERSION ****
+
+
+if [ ! -f "$tsdir/build-aux/config.guess" ]; then
+ fatal "$tsdir/build-aux/config.guess not found"
+ exit 1
+fi
+build=`$tsdir/build-aux/config.guess`
+if [ $PRINT_BUILD = yes ]; then
+ echo "$build"
+ exit 0
+fi
+
+
+
# ******************
# W32 build script
# ******************
if [ "$myhost" = "w32" ]; then
- if [ ! -f "$tsdir/build-aux/config.guess" ]; then
- fatal "$tsdir/build-aux/config.guess not found"
- exit 1
- fi
- build=`$tsdir/build-aux/config.guess`
-
case $myhostsub in
ce)
w32root="$w32ce_root"
[ -z "$w32root" ] && w32root="$HOME/w32ce_root"
toolprefixes="$w32ce_toolprefixes arm-mingw32ce"
extraoptions="$extraoptions $w32ce_extraoptions"
;;
64)
w32root="$w64root"
[ -z "$w32root" ] && w32root="$HOME/w64root"
toolprefixes="$w64_toolprefixes x86_64-w64-mingw32"
extraoptions="$extraoptions $w64_extraoptions"
;;
*)
[ -z "$w32root" ] && w32root="$HOME/w32root"
toolprefixes="$w32_toolprefixes i686-w64-mingw32 i586-mingw32msvc"
toolprefixes="$toolprefixes i386-mingw32msvc mingw32"
extraoptions="$extraoptions $w32_extraoptions"
;;
esac
info "Using $w32root as standard install directory"
replace_sysroot
# Locate the cross compiler
crossbindir=
for host in $toolprefixes; do
if ${host}-gcc --version >/dev/null 2>&1 ; then
crossbindir=/usr/${host}/bin
conf_CC="CC=${host}-gcc"
break;
fi
done
if [ -z "$crossbindir" ]; then
fatal "cross compiler kit not installed"
if [ -z "$myhostsub" ]; then
info "Under Debian GNU/Linux, you may install it using"
info " apt-get install mingw32 mingw32-runtime mingw32-binutils"
fi
die_p
fi
+ if [ $PRINT_HOST = yes ]; then
+ echo "$host"
+ exit 0
+ fi
if [ -f "$tsdir/config.log" ]; then
if ! head $tsdir/config.log | grep "$host" >/dev/null; then
fatal "Please run a 'make distclean' first"
die_p
fi
fi
$tsdir/configure --enable-maintainer-mode ${SILENT} \
--prefix=${w32root} \
- --host=${host} --build=${build} \
+ --host=${host} --build=${build} SYSROOT=${w32root} \
+ PKG_CONFIG_LIBDIR=${w32root}/lib/pkgconfig \
${configure_opts} ${extraoptions} "$@"
rc=$?
exit $rc
fi
# ***** end W32 build script *******
# ***** AMD64 cross build script *******
# Used to cross-compile for AMD64 (for testing)
if [ "$myhost" = "amd64" ]; then
- shift
- if [ ! -f $tsdir/build-aux/config.guess ]; then
- echo "$tsdir/build-aux/config.guess not found" >&2
- exit 1
- fi
- build=`$tsdir/build-aux/config.guess`
-
[ -z "$amd64root" ] && amd64root="$HOME/amd64root"
info "Using $amd64root as standard install directory"
replace_sysroot
toolprefixes="$amd64_toolprefixes x86_64-linux-gnu amd64-linux-gnu"
# Locate the cross compiler
crossbindir=
for host in $toolprefixes ; do
if ${host}-gcc --version >/dev/null 2>&1 ; then
crossbindir=/usr/${host}/bin
conf_CC="CC=${host}-gcc"
break;
fi
done
if [ -z "$crossbindir" ]; then
echo "Cross compiler kit not installed" >&2
echo "Stop." >&2
exit 1
fi
+ if [ $PRINT_HOST = yes ]; then
+ echo "$host"
+ exit 0
+ fi
if [ -f "$tsdir/config.log" ]; then
if ! head $tsdir/config.log | grep "$host" >/dev/null; then
echo "Please run a 'make distclean' first" >&2
exit 1
fi
fi
$tsdir/configure --enable-maintainer-mode ${SILENT} \
--prefix=${amd64root} \
--host=${host} --build=${build} \
${configure_opts} ${extraoptions} "$@"
rc=$?
exit $rc
fi
# ***** end AMD64 cross build script *******
# Grep the required versions from configure.ac
autoconf_vers=`sed -n '/^AC_PREREQ(/ {
s/^.*(\(.*\))/\1/p
q
}' ${configure_ac}`
autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
automake_vers=`sed -n '/^min_automake_version=/ {
s/^.*="\(.*\)"/\1/p
q
}' ${configure_ac}`
automake_vers_num=`echo "$automake_vers" | cvtver`
if [ -d "${tsdir}/po" ]; then
gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
s/^.*\[\(.*\)])/\1/p
q
}' ${configure_ac}`
gettext_vers_num=`echo "$gettext_vers" | cvtver`
else
gettext_vers="n/a"
fi
if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
then
echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
exit 1
fi
if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
fi
if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
fi
if [ "$gettext_vers" != "n/a" ]; then
if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
fi
fi
if [ "$DIE" = "yes" ]; then
cat </dev/null 2>/dev/null; then
+ [ -z "${SILENT}" ] && CP="$CP -v"
+ fi
if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
[ -z "${SILENT}" ] && cat <.
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
min_automake_version="1.14"
# To build a release you need to create a tag with the version number
# (git tag -s npth-n.m) and run "./autogen.sh --force". Please bump
# the version number immediately after the release and do another
# commit and push so that the git magic is able to work.
# See below for the LT versions.
-m4_define(my_version, [1.6])
+m4_define([mym4_package],[npth])
+m4_define([mym4_major], [1])
+m4_define([mym4_minor], [6])
+
+# To start a new development series, i.e a new major or minor number
+# you need to mark an arbitrary commit before the first beta release
+# with an annotated tag. For example a 2.1 branch starts off with
+# the tag "foo-2.1-base". This is used as the base for counting
+# beta numbers before the first release of a series.
# Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a
-# flag indicating a development version (my_isgit). The latter works
-# by requiring the final tag in the repository.
-m4_define([git_revision],
- m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
-m4_define([git_revision_dec],
- m4_esyscmd_s([echo $((0x$(echo ]git_revision[|head -c 4)))]))
-m4_define([git_betastring],
- m4_esyscmd_s([git describe --match 'npth-[0-9].*[0-9]' --long|\
- awk -F- '$3!=0{print"-beta"$3}']))
-m4_define([my_isgit],m4_if(git_betastring,[],[no],[yes]))
-m4_define([my_full_version],[my_version[]git_betastring])
-
-AC_INIT([npth],[my_full_version],[gnupg-devel@gnupg.org])
-
+# flag indicating a development version (mym4_isbeta). Note that the
+# m4 processing is done by autoconf and not during the configure run.
+m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
+ mym4_package mym4_major mym4_minor),[:]))
+m4_define([mym4_isbeta], m4_argn(2, mym4_verslist))
+m4_define([mym4_version], m4_argn(4, mym4_verslist))
+m4_define([mym4_revision], m4_argn(7, mym4_verslist))
+m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
+m4_esyscmd([echo ]mym4_version[>VERSION])
+AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org])
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
# (Interfaces added: AGE++)
-# (Interfaces removed/changed: AGE=0)
+# (Interfaces removed: AGE=0)
#
LIBNPTH_LT_CURRENT=1
LIBNPTH_LT_AGE=1
LIBNPTH_LT_REVISION=1
+################################################
+
+AC_SUBST(LIBNPTH_LT_CURRENT)
+AC_SUBST(LIBNPTH_LT_AGE)
+AC_SUBST(LIBNPTH_LT_REVISION)
+
+VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x00" mym4_major mym4_minor)
+AC_SUBST(VERSION_NUMBER)
# If the API is changed in an incompatible way: increment the next counter.
NPTH_CONFIG_API_VERSION=1
##############################################
-PACKAGE=$PACKAGE_NAME
-VERSION=$PACKAGE_VERSION
-
AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
+AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([src/npth.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
-AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AM_SILENT_RULES
# Enable GNU extensions on systems that have them.
AC_GNU_SOURCE
AH_VERBATIM([_REENTRANT],
[#ifndef _REENTRANT
# define _REENTRANT 1
#endif])
# Checks for programs.
AC_PROG_CC
-AC_SUBST(LIBNPTH_LT_CURRENT)
-AC_SUBST(LIBNPTH_LT_AGE)
-AC_SUBST(LIBNPTH_LT_REVISION)
-
-AC_SUBST(PACKAGE)
-AC_SUBST(VERSION)
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
-
run_tests="yes"
AC_ARG_ENABLE(tests,
AC_HELP_STRING([--disable-tests], [disable tests]),
run_tests=$enableval)
AM_CONDITIONAL(RUN_TESTS, test "$run_tests" = "yes")
# Don't default to build static libs.
LT_PREREQ([2.2.6])
LT_INIT([win32-dll disable-static])
LT_LANG([Windows Resource])
# For now we hardcode the use of version scripts. It would be better
# to write a test for this or even implement this within libtool.
have_ld_version_script=no
case "${host}" in
*-*-linux*)
have_ld_version_script=yes
;;
*-*-gnu*)
have_ld_version_script=yes
;;
*-apple-darwin*)
AC_SEARCH_LIBS([dispatch_semaphore_create],[dispatch],
[AC_DEFINE([HAVE_LIB_DISPATCH],1,[Defined if we have libdispatch])])
;;
*-*-aix*)
have_fork_unsafe_semaphore=yes
;;
*-*-dragonfly*|*-*-freebsd*|*-*-netbsd*|*-*-hpux*)
LIBS="-lpthread $LIBS"
AC_SEARCH_LIBS([sem_init],[rt])
;;
esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_fork_unsafe_semaphore" = yes; then
AC_DEFINE(HAVE_FORK_UNSAFE_SEMAPHORE, 1, [Defined if we have fork-unsafe semaphore])
fi
# Set some default values
config_libs="-lnpth $LIBS"
have_w32_system=no
have_w32ce_system=no
have_w64_system=no
# Define OS macros
case "${host}" in
x86_64-*mingw32*)
have_w64_system=yes
;;
*-mingw32ce*)
have_w32ce_system=yes
;;
esac
case "${host}" in
*-mingw32ce*|*-mingw32*)
have_w32_system=yes
;;
*)
;;
esac
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1,
[Defined if we run on any kind of W32 API based system])
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
if test "$have_w64_system" = yes; then
AC_DEFINE(HAVE_W64_SYSTEM,1,
[Defined if we run on a 64 bit W32 API based system])
fi
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
#
# Generate values for the DLL version info
#
if test "$have_w32_system" = yes; then
BUILD_ISODATE=`date --iso-8601`
changequote(,)dnl
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}git_revision_dec"
fi
AC_SUBST(BUILD_ISODATE)
AC_SUBST(BUILD_FILEVERSION)
AC_ARG_ENABLE([build-timestamp],
AC_HELP_STRING([--enable-build-timestamp],
[set an explicit build timestamp for reproducibility.
(default is the current time in ISO-8601 format)]),
[if test "$enableval" = "yes"; then
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
else
BUILD_TIMESTAMP="$enableval"
fi],
[BUILD_TIMESTAMP=""])
AC_SUBST(BUILD_TIMESTAMP)
AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
[The time this package was configured for a build])
#
# Checks for header files.
#
# fixme: For what do we need the sys/socket test?
AC_CHECK_HEADERS([sys/socket.h sys/select.h unistd.h sys/time.h time.h \
signal.h])
INSERT_SYS_SELECT_H=
if test x"$ac_cv_header_sys_select_h" = xyes; then
INSERT_SYS_SELECT_H="include "
fi
AC_SUBST(INSERT_SYS_SELECT_H)
if test x"$ac_cv_header_sys_time_h" = xyes; then
INSERT_SYS_TIME_H="include "
fi
AC_SUBST(INSERT_SYS_TIME_H)
if test x"$ac_cv_header_time_h" = xyes; then
INSERT_TIME_H="include "
fi
AC_SUBST(INSERT_TIME_H)
if test x"$ac_cv_header_signal_h" = xyes; then
INSERT_SIGNAL_H="include "
fi
AC_SUBST(INSERT_SIGNAL_H)
# Some systems lack socklen_t - provide a replacement.
gl_TYPE_SOCKLEN_T
case "${host}" in
*-*-mingw32*)
# socklen_t may or may not be defined depending on what headers
# are included. To be safe we use int as this is the actual type.
INSERT_SOCKLEN_T="define _npth_socklen_t int"
;;
*)
if test ".$gl_cv_socklen_t_equiv" = "."; then
INSERT_SOCKLEN_T="define _npth_socklen_t socklen_t"
else
INSERT_SOCKLEN_T="define _npth_socklen_t ${gl_cv_socklen_t_equiv}"
fi
esac
AC_SUBST(INSERT_SOCKLEN_T)
#
# Checks for typedefs, structures, and compiler characteristics.
#
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
#
# Checks for libraries and functions.
#
# We test for pthread_detach because glibc 2.22 includes
# pthread_create but not pthread_detach.
if test "$have_w32_system" = no; then
AC_SEARCH_LIBS([pthread_detach],[pthread])
case "x$ac_cv_search_pthread_detach" in
xno)
have_pthread=no
;;
xnone\ required)
have_pthread=yes
;;
*)
have_pthread=yes
config_libs="$config_libs $ac_cv_search_pthread_detach"
;;
esac
if test "$have_pthread" != no; then
AC_DEFINE(HAVE_PTHREAD,1,[Define if we have pthread.])
AC_CHECK_FUNCS([pthread_tryjoin_np pthread_setname_np pthread_getname_np])
AC_CHECK_FUNCS([pthread_mutex_timedlock])
AC_CHECK_FUNCS([pthread_rwlock_rdlock pthread_rwlock_wrlock])
AC_CHECK_FUNCS([pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
AC_CHECK_FUNCS([pthread_rwlock_tryrdlock pthread_rwlock_trywrlock])
AC_CHECK_FUNCS([pthread_atfork])
fi
fi
AC_CHECK_FUNCS([select pselect gettimeofday])
npth_LIBSOCKET
config_libs="$config_libs $LIBSOCKET"
# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
# programs in the package would end up linked with that potentially-shared
# library, inducing unnecessary run-time overhead.
LIB_CLOCK_GETTIME=
AC_SUBST([LIB_CLOCK_GETTIME])
gl_saved_libs=$LIBS
AC_SEARCH_LIBS([clock_gettime], [rt posix4],
[if test "$ac_cv_search_clock_gettime" != "none required"; then
LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
config_libs="$config_libs $LIB_CLOCK_GETTIME"
fi
AC_DEFINE([HAVE_CLOCK_GETTIME],1,
[Define to 1 if you have the `clock_gettime' function.])
])
LIBS=$gl_saved_libs
#
# Set NETLIBS
#
if test "$have_w32ce_system" = yes; then
NETLIBS="-lws2 $NETLIBS"
elif test "$have_w32_system" = yes; then
NETLIBS="-lws2_32 $NETLIBS"
fi
AC_SUBST(NETLIBS)
#
# Substitutions to set generated files in a Emacs buffer to read-only.
#
AC_SUBST(emacs_local_vars_begin, [['Local][ ][Variables:']])
AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
AC_SUBST(emacs_local_vars_end, ['End:'])
#
# Substitution used for npth-config
#
NPTH_CONFIG_LIBS="$config_libs"
NPTH_CONFIG_CFLAGS=""
NPTH_CONFIG_HOST="$host"
AC_SUBST(NPTH_CONFIG_API_VERSION)
AC_SUBST(NPTH_CONFIG_LIBS)
AC_SUBST(NPTH_CONFIG_CFLAGS)
AC_SUBST(NPTH_CONFIG_HOST)
#
# Last check.
#
die=no
if test "$have_w32_system" = no; then
if test "$have_pthread" = "no"; then
die=yes
AC_MSG_NOTICE([[
***
*** You need Pthread to build this program.
*** Normally, this library comes with your system. On Windows, you can use:
*** http://sourceware.org/pthreads-win32/
***]])
fi
fi
if test "$die" = "yes"; then
AC_MSG_ERROR([[
***
*** Required libraries not found. Please consult the above messages
*** and install them before running configure again.
***]])
fi
#
# Write output
#
AC_CONFIG_FILES([Makefile
src/npth.h
src/Makefile
w32/Makefile
tests/Makefile])
AC_CONFIG_FILES(npth-config, chmod +x npth-config)
AC_OUTPUT
echo "
- $PACKAGE_NAME-$PACKAGE_VERSION prepared for make
+ $PACKAGE_NAME v$PACKAGE_VERSION prepared for make
- Revision: git_revision (git_revision_dec)
+ Revision: mym4_revision (mym4_revision_dec)
Platform: $host
"