Added assuan_socket_connect_fd() and assuan_set_finish_handler().
[libpwmd.git] / assuan / configure.ac
blobac4be32ab898e061641c7e13d69f561f602795eb
1 # configure.ac - for libassuan
2 # Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
3
4 # This file is part of Assuan.
6 # Assuan is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU Lesser General Public License as
8 # published by the Free Software Foundation; either version 2.1 of
9 # the License, or (at your option) any later version.
11 # Assuan is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this program; if not, see <http://www.gnu.org/licenses/>.
19 # Process this file with autoconf to produce a configure script.
21 AC_PREREQ(2.61)
22 min_automake_version="1.10"
24 # Remember to change the version number immediately *after* a release.
25 # Set my_issvn to "yes" for non-released code.  Remember to run an
26 # "svn up" and "autogen.sh" right before creating a distribution.
27 m4_define([my_version], [1.1.0])
28 m4_define([my_issvn], [yes])
30 m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \
31             || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
32 AC_INIT([libassuan], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
33         [bug-libassuan@gnupg.org])
34 # Note, that this is not yet available as a shared library.
36 PACKAGE=$PACKAGE_NAME
37 VERSION=$PACKAGE_VERSION
39 AM_INIT_AUTOMAKE([foreign])
40 AM_MAINTAINER_MODE
41 AC_GNU_SOURCE
42 AC_DISABLE_SHARED
43 AC_PROG_LIBTOOL
44 AC_CONFIG_SRCDIR(assuan.h)
45 AM_CONFIG_HEADER(config.h)
46 AC_CANONICAL_HOST
47 AB_INIT
50 AC_SUBST(PACKAGE)
51 AC_SUBST(VERSION)
52 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
53 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
54 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
55                                         [Bug report address])
59 # Checks for programs.
60 missing_dir=`cd $ac_aux_dir && pwd`
61 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
62 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
63 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
64 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
65 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
66 AC_PROG_AWK
67 AC_PROG_CC
68 AC_PROG_CPP
69 AM_PROG_CC_C_O
70 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
71   AC_MSG_ERROR([[No C-89 compiler found]])
73 AC_PROG_INSTALL
74 AC_PROG_LN_S
75 AC_PROG_MAKE_SET
76 #AC_PROG_RANLIB
77 #AC_ARG_PROGRAM
79 if test "$GCC" = yes; then
80     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
82     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
83     _gcc_cflags_save=$CFLAGS
84     CFLAGS="-Wpointer-arith"
85     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
86     AC_MSG_RESULT($_gcc_wopt)
87     CFLAGS=$_gcc_cflags_save;
88     if test x"$_gcc_wopt" = xyes ; then
89        CFLAGS="$CFLAGS -Wpointer-arith"
90     fi
94 AH_BOTTOM([
95 #define _ASSUAN_IN_LIBASSUAN 1
97 /* We explicitly need to disable PTH's soft mapping as Debian
98    currently enables it by default for no reason. */
99 #define PTH_SYSCALL_SOFT 0
105 # Options depending on the host OS.
107 have_dosish_system=no
108 have_w32_system=no
109 case "${host}" in
110     *-linux*)
111         if test "$GCC" = yes; then
112           CFLAGS="$CFLAGS -fPIC -DPIC"
113         fi
114         ;;
115     *-mingw32*)
116         have_dosish_system=yes
117         have_w32_system=yes
118         ;;
119     *-solaris*)
120         AC_DEFINE(_XOPEN_SOURCE, 500, Activate extensions on Solaris)
121         AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Activate extensions on Solaris)
122         AC_DEFINE(__EXTENSIONS__, 1, Activate extensions on Solaris)
123         ;;
124 esac
126 if test "$have_dosish_system" = yes; then
127    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
128              [Defined if we run on some of the PCDOS like systems 
129               (DOS, Windoze. OS/2) with special properties like
130               no file modes])
132 dnl AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
134 if test "$have_w32_system" = yes; then
135    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
137 dnl AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
140 # See whether we can build a Pth enabled version
142 GNUPG_PATH_PTH
143 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
146 # Check for network libraries.  They are needed for tests.
147 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
148         [NETLIBS="-lsocket $NETLIBS"]))
149 AC_SUBST(NETLIBS)
151 # For src/libassuan-config.in
152 LIBASSUAN_CONFIG_LIB="-lassuan"
153 LIBASSUAN_CONFIG_CFLAGS=""
154 LIBASSUAN_CONFIG_API_VERSION="1"
155 LIBASSUAN_CONFIG_THREAD_MODULES=
156 if test "$have_pth" = yes; then
157 LIBASSUAN_CONFIG_THREAD_MODULES="pth"
159 LIBASSUAN_CONFIG_EXTRA_LIBS=
160 if test "$have_w32_system" = yes; then
161   LIBASSUAN_CONFIG_EXTRA_LIBS="$LIBASSUAN_CONFIG_EXTRA_LIBS -lws2_32"
163 if test x"$NETLIBS" != x; then
164   LIBASSUAN_CONFIG_EXTRA_LIBS="$LIBASSUAN_CONFIG_EXTRA_LIBS $NETLIBS"
166 AC_SUBST(LIBASSUAN_CONFIG_LIB)
167 AC_SUBST(LIBASSUAN_CONFIG_CFLAGS)
168 AC_SUBST(LIBASSUAN_CONFIG_API_VERSION)
169 AC_SUBST(LIBASSUAN_CONFIG_THREAD_MODULES)
170 AC_SUBST(LIBASSUAN_CONFIG_EXTRA_LIBS)
172 # Checks for header files.
173 AC_HEADER_STDC
174 AC_CHECK_HEADERS([string.h locale.h sys/uio.h])
176 # Checks for typedefs, structures, and compiler characteristics.
177 AC_C_CONST
178 AC_C_INLINE
179 AC_TYPE_SIZE_T
180 AC_TYPE_SIGNAL
181 AC_DECL_SYS_SIGLIST
183 gl_HEADER_SYS_SOCKET
184 gl_TYPE_SOCKLEN_T
186 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
187                 [use_descriptor_passing=yes],
188                 [use_descriptor_passing=no
189                  AC_MSG_WARN([
191 *** Data structure for sending ancillary data missing.
192 *** Descriptor passing won't work.
193 ***])],[
194 #include <stdlib.h>
195 #include <stddef.h>
196 #include <stdio.h>
197 #include <sys/types.h>
198 #include <sys/socket.h>
199 #include <sys/un.h>
200 #if HAVE_SYS_UIO_H
201 #include <sys/uio.h>
202 #endif
203 #include <unistd.h>
204        ])
205 if test "$use_descriptor_passing" = "yes"; then
206  AC_DEFINE(USE_DESCRIPTOR_PASSING, 1,
207             [Defined if descriptor passing is supported])
209 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
212 # Checks for library functions.
214 AC_CHECK_FUNCS([flockfile funlockfile nanosleep])
216 # Check for funopen
217 AC_CHECK_FUNCS(funopen)
218 if test $ac_cv_func_funopen != yes; then
219     # No funopen but we can implement that in terms of fopencookie.
220     AC_CHECK_FUNCS(fopencookie)
221     if test $ac_cv_func_fopencookie = yes; then
222         AC_LIBOBJ(funopen)
223     else
224         AC_MSG_WARN([
226 *** No implementation of fopencookie or funopen available.
227 *** The assuan_get_data_fp feature won't work.
228 ***])
229     fi
231 AM_CONDITIONAL(WITH_FUNOPEN, test "$ac_cv_func_fopencookie" = "yes")
234 AC_REPLACE_FUNCS(isascii)
235 AC_REPLACE_FUNCS(putc_unlocked)
236 AC_REPLACE_FUNCS(memrchr)
237 AC_REPLACE_FUNCS(stpcpy)
238 # Check for unistd.h for setenv replacement function.
239 AC_CHECK_HEADERS(unistd.h)
240 AC_REPLACE_FUNCS(setenv)
244 # Check for the getsockopt SO_PEERCRED
246 AC_MSG_CHECKING(for SO_PEERCRED)
247 AC_CACHE_VAL(assuan_cv_sys_so_peercred,
248       [AC_TRY_COMPILE([#include <sys/socket.h>], 
249          [struct ucred cr; 
250           int cl = sizeof cr;
251           getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
252           assuan_cv_sys_so_peercred=yes,
253           assuan_cv_sys_so_peercred=no)
254        ])
255 AC_MSG_RESULT($assuan_cv_sys_so_peercred) 
256 if test $assuan_cv_sys_so_peercred = yes; then
257   AC_DEFINE(HAVE_SO_PEERCRED, 1,
258             [Defined if SO_PEERCRED is supported (Linux specific)])
264 # Create the config files.
265 AC_CONFIG_FILES([Makefile])
267 AC_OUTPUT