1 dnl GnuPG's check for Pth.
2 dnl Copyright (C) 2003 Free Software Foundation, Inc.
4 dnl This file is free software; as a special exception the author gives
5 dnl unlimited permission to copy and/or distribute it, with or without
6 dnl modifications, as long as this notice is preserved.
8 dnl This file is distributed in the hope that it will be useful, but
9 dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # GNUPG_PTH_VERSION_CHECK(REQUIRED)
15 # If the version is sufficient, HAVE_PTH will be set to yes.
17 # Taken and modified from the m4 macros which come with Pth.
18 AC_DEFUN([GNUPG_PTH_VERSION_CHECK],
20 _pth_version=`$PTH_CONFIG --version | awk 'NR==1 {print [$]3}'`
21 _req_version="ifelse([$1],,1.2.0,$1)"
23 AC_MSG_CHECKING(for PTH - version >= $_req_version)
24 for _var in _pth_version _req_version; do
25 eval "_val=\"\$${_var}\""
26 _major=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\1/'`
27 _minor=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\2/'`
28 _rtype=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\3/'`
29 _micro=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\4/'`
35 _hex=`echo dummy | awk '{ printf("%d%02d%1d%02d", major, minor, rtype, micro); }' \
36 "major=$_major" "minor=$_minor" "rtype=$_rtype" "micro=$_micro"`
37 eval "${_var}_hex=\"\$_hex\""
40 if test ".$_pth_version_hex" != .; then
41 if test ".$_req_version_hex" != .; then
42 if test $_pth_version_hex -ge $_req_version_hex; then
47 if test $have_pth = yes; then
49 AC_MSG_CHECKING([whether PTH installation is sane])
50 AC_CACHE_VAL(gnupg_cv_pth_is_sane,[
51 _gnupg_pth_save_cflags=$CFLAGS
52 _gnupg_pth_save_ldflags=$LDFLAGS
53 _gnupg_pth_save_libs=$LIBS
54 CFLAGS="$CFLAGS `$PTH_CONFIG --cflags`"
55 LDFLAGS="$LDFLAGS `$PTH_CONFIG --ldflags`"
56 LIBS="$LIBS `$PTH_CONFIG --libs --all`"
57 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pth.h>
60 gnupg_cv_pth_is_sane=yes,
61 gnupg_cv_pth_is_sane=no)
62 CFLAGS=$_gnupg_pth_save_cflags
63 LDFLAGS=$_gnupg_pth_save_ldflags
64 LIBS=$_gnupg_pth_save_libs
66 if test $gnupg_cv_pth_is_sane != yes; then
69 AC_MSG_RESULT($gnupg_cv_pth_is_sane)
77 # GNUPG_PATH_PTH([MINIMUM_VERSION])
79 # On return $have_pth is set as well as HAVE_PTH is defined and
80 # PTH_CLFAGS and PTH_LIBS are AS_SUBST.
82 AC_DEFUN([GNUPG_PATH_PTH],
83 [ AC_ARG_WITH(pth-prefix,
84 AC_HELP_STRING([--with-pth-prefix=PFX],
85 [prefix where GNU Pth is installed (optional)]),
86 pth_config_prefix="$withval", pth_config_prefix="")
87 if test x$pth_config_prefix != x ; then
88 PTH_CONFIG="$pth_config_prefix/bin/pth-config"
90 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
91 tmp=ifelse([$1], ,1.3.7,$1)
92 if test "$PTH_CONFIG" != "no"; then
93 GNUPG_PTH_VERSION_CHECK($tmp)
94 if test $have_pth = yes; then
95 PTH_CFLAGS=`$PTH_CONFIG --cflags`
96 PTH_LIBS=`$PTH_CONFIG --ldflags`
97 PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
98 AC_DEFINE(HAVE_PTH, 1,
99 [Defined if the GNU Pth is available])
106 # socklen.m4 serial 4
107 dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
108 dnl This file is free software; the Free Software Foundation
109 dnl gives unlimited permission to copy and/or distribute it,
110 dnl with or without modifications, as long as this notice is preserved.
112 dnl From Albert Chin, Windows fixes from Simon Josefsson.
114 dnl Check for socklen_t: historically on BSD it is an int, and in
115 dnl POSIX 1g it is a type of its own, but some platforms use different
116 dnl types for the argument to getsockopt, getpeername, etc. So we
117 dnl have to test to find something that will work.
119 dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
120 dnl it there first. That file is included by gnulib's socket_.h, which
121 dnl all users of this module should include. Cygwin must not include
123 AC_DEFUN([gl_TYPE_SOCKLEN_T],
124 [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
125 AC_CHECK_TYPE([socklen_t], ,
126 [AC_MSG_CHECKING([for socklen_t equivalent])
127 AC_CACHE_VAL([gl_cv_gl_cv_socklen_t_equiv],
128 [# Systems have either "struct sockaddr *" or
129 # "void *" as the second argument to getpeername
130 gl_cv_socklen_t_equiv=
131 for arg2 in "struct sockaddr" void; do
132 for t in int size_t "unsigned int" "long int" "unsigned long int"; do
134 [#include <sys/types.h>
135 #include <sys/socket.h>
137 int getpeername (int, $arg2 *, $t *);],
139 getpeername (0, 0, &len);],
140 [gl_cv_socklen_t_equiv="$t"])
141 test "$gl_cv_socklen_t_equiv" != "" && break
143 test "$gl_cv_socklen_t_equiv" != "" && break
146 if test "$gl_cv_socklen_t_equiv" = ""; then
147 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
149 AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
150 AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv],
151 [type to use in place of socklen_t if not defined])],
152 [#include <sys/types.h>
153 #if HAVE_SYS_SOCKET_H
154 # include <sys/socket.h>
155 #elif HAVE_WS2TCPIP_H
156 # include <ws2tcpip.h>
158 # sys_socket_h.m4 serial 2
159 dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
160 dnl This file is free software; the Free Software Foundation
161 dnl gives unlimited permission to copy and/or distribute it,
162 dnl with or without modifications, as long as this notice is preserved.
164 dnl From Simon Josefsson.
166 AC_DEFUN([gl_HEADER_SYS_SOCKET],
168 AC_CHECK_HEADERS_ONCE([sys/socket.h])
169 if test $ac_cv_header_sys_socket_h = yes; then
172 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
173 dnl the check for those headers unconditional; yet cygwin reports
174 dnl that the headers are present but cannot be compiled (since on
175 dnl cygwin, all socket information should come from sys/socket.h).
176 AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
177 SYS_SOCKET_H='sys/socket.h'
179 AC_SUBST(SYS_SOCKET_H)
181 # autobuild.m4 serial 2 (autobuild-3.3)
182 # Copyright (C) 2004 Simon Josefsson
184 # This file is free software, distributed under the terms of the GNU
185 # General Public License. As a special exception to the GNU General
186 # Public License, this file may be distributed as part of a program
187 # that contains a configuration script generated by Autoconf, under
188 # the same distribution terms as the rest of that program.
190 # This file can can be used in projects which are not available under
191 # the GNU General Public License or the GNU Library General Public
192 # License but which still want to provide support for Autobuild.
194 # Usage: AB_INIT([MODE]).
197 AC_REQUIRE([AC_CANONICAL_BUILD])
198 AC_REQUIRE([AC_CANONICAL_HOST])
200 AC_MSG_NOTICE([autobuild project... ${PACKAGE_NAME:-$PACKAGE}])
201 AC_MSG_NOTICE([autobuild revision... ${PACKAGE_VERSION:-$VERSION}])
203 if test "$hostname"; then
204 AC_MSG_NOTICE([autobuild hostname... $hostname])
206 ifelse([$1],[],,[AC_MSG_NOTICE([autobuild mode... $1])])
207 date=`date +%Y%m%d-%H%M%S`
208 if test "$?" != 0; then
211 if test "$date"; then
212 AC_MSG_NOTICE([autobuild timestamp... $date])