Disable libpth by default.
[libpwmd.git] / assuan / configure.ac
blobc9412ec7fc83ec745c40f0498ef27209b39ba444
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 AM_CONFIG_HEADER(config.h)
45 AC_CANONICAL_HOST
46 AB_INIT
49 AC_SUBST(PACKAGE)
50 AC_SUBST(VERSION)
51 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
52 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
53 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
54                                         [Bug report address])
58 # Checks for programs.
59 missing_dir=`cd $ac_aux_dir && pwd`
60 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
61 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
62 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
63 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
64 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
65 AC_PROG_AWK
66 AC_PROG_CC
67 AC_PROG_CPP
68 AM_PROG_CC_C_O
69 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
70   AC_MSG_ERROR([[No C-89 compiler found]])
72 AC_PROG_INSTALL
73 AC_PROG_LN_S
74 AC_PROG_MAKE_SET
75 #AC_PROG_RANLIB
76 #AC_ARG_PROGRAM
78 if test "$GCC" = yes; then
79     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
81     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
82     _gcc_cflags_save=$CFLAGS
83     CFLAGS="-Wpointer-arith"
84     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
85     AC_MSG_RESULT($_gcc_wopt)
86     CFLAGS=$_gcc_cflags_save;
87     if test x"$_gcc_wopt" = xyes ; then
88        CFLAGS="$CFLAGS -Wpointer-arith"
89     fi
93 AH_BOTTOM([
94 #define _ASSUAN_IN_LIBASSUAN 1
96 /* We explicitly need to disable PTH's soft mapping as Debian
97    currently enables it by default for no reason. */
98 #define PTH_SYSCALL_SOFT 0
104 # Options depending on the host OS.
106 have_dosish_system=no
107 have_w32_system=no
108 case "${host}" in
109     *-linux*)
110         if test "$GCC" = yes; then
111           CFLAGS="$CFLAGS -fPIC -DPIC"
112         fi
113         ;;
114     *-mingw32*)
115         have_dosish_system=yes
116         have_w32_system=yes
117         ;;
118     *-solaris*)
119         AC_DEFINE(_XOPEN_SOURCE, 500, Activate extensions on Solaris)
120         AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Activate extensions on Solaris)
121         AC_DEFINE(__EXTENSIONS__, 1, Activate extensions on Solaris)
122         ;;
123 esac
125 if test "$have_dosish_system" = yes; then
126    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
127              [Defined if we run on some of the PCDOS like systems 
128               (DOS, Windoze. OS/2) with special properties like
129               no file modes])
131 dnl AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
133 if test "$have_w32_system" = yes; then
134    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
136 dnl AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
139 # See whether we can build a Pth enabled version
141 GNUPG_PATH_PTH
142 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes" && test "$with_pth" = "yes")
145 # Check for network libraries.  They are needed for tests.
146 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
147         [NETLIBS="-lsocket $NETLIBS"]))
148 AC_SUBST(NETLIBS)
150 # For src/libassuan-config.in
151 LIBASSUAN_CONFIG_LIB="-lassuan"
152 LIBASSUAN_CONFIG_CFLAGS=""
153 LIBASSUAN_CONFIG_API_VERSION="1"
154 LIBASSUAN_CONFIG_THREAD_MODULES=
155 if test "$have_pth" = yes; then
156 LIBASSUAN_CONFIG_THREAD_MODULES="pth"
158 LIBASSUAN_CONFIG_EXTRA_LIBS=
159 if test "$have_w32_system" = yes; then
160   LIBASSUAN_CONFIG_EXTRA_LIBS="$LIBASSUAN_CONFIG_EXTRA_LIBS -lws2_32"
162 if test x"$NETLIBS" != x; then
163   LIBASSUAN_CONFIG_EXTRA_LIBS="$LIBASSUAN_CONFIG_EXTRA_LIBS $NETLIBS"
165 AC_SUBST(LIBASSUAN_CONFIG_LIB)
166 AC_SUBST(LIBASSUAN_CONFIG_CFLAGS)
167 AC_SUBST(LIBASSUAN_CONFIG_API_VERSION)
168 AC_SUBST(LIBASSUAN_CONFIG_THREAD_MODULES)
169 AC_SUBST(LIBASSUAN_CONFIG_EXTRA_LIBS)
171 # Checks for header files.
172 AC_HEADER_STDC
173 AC_CHECK_HEADERS([string.h locale.h sys/uio.h])
175 # Checks for typedefs, structures, and compiler characteristics.
176 AC_C_CONST
177 AC_C_INLINE
178 AC_TYPE_SIZE_T
179 AC_TYPE_SIGNAL
180 AC_DECL_SYS_SIGLIST
182 gl_HEADER_SYS_SOCKET
183 gl_TYPE_SOCKLEN_T
185 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
186                 [use_descriptor_passing=yes],
187                 [use_descriptor_passing=no
188                  AC_MSG_WARN([
190 *** Data structure for sending ancillary data missing.
191 *** Descriptor passing won't work.
192 ***])],[
193 #include <stdlib.h>
194 #include <stddef.h>
195 #include <stdio.h>
196 #include <sys/types.h>
197 #include <sys/socket.h>
198 #include <sys/un.h>
199 #if HAVE_SYS_UIO_H
200 #include <sys/uio.h>
201 #endif
202 #include <unistd.h>
203        ])
204 if test "$use_descriptor_passing" = "yes"; then
205  AC_DEFINE(USE_DESCRIPTOR_PASSING, 1,
206             [Defined if descriptor passing is supported])
208 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
211 # Checks for library functions.
213 AC_CHECK_FUNCS([flockfile funlockfile nanosleep])
215 # Check for funopen
216 AC_CHECK_FUNCS(funopen)
217 if test $ac_cv_func_funopen != yes; then
218     # No funopen but we can implement that in terms of fopencookie.
219     AC_CHECK_FUNCS(fopencookie)
220     if test $ac_cv_func_fopencookie = yes; then
221         LIBOBJS="$LIBOBJS funopen"
222     else
223         AC_MSG_WARN([
225 *** No implementation of fopencookie or funopen available.
226 *** The assuan_get_data_fp feature won't work.
227 ***])
228     fi
230 AM_CONDITIONAL(WITH_FUNOPEN, test "$ac_cv_func_fopencookie" = "yes")
233 AC_REPLACE_FUNCS(isascii)
234 AC_REPLACE_FUNCS(putc_unlocked)
235 AC_REPLACE_FUNCS(memrchr)
236 AC_REPLACE_FUNCS(stpcpy)
237 # Check for unistd.h for setenv replacement function.
238 AC_CHECK_HEADERS(unistd.h)
239 AC_REPLACE_FUNCS(setenv)
243 # Check for the getsockopt SO_PEERCRED
245 AC_MSG_CHECKING(for SO_PEERCRED)
246 AC_CACHE_VAL(assuan_cv_sys_so_peercred,
247       [AC_TRY_COMPILE([#include <sys/socket.h>], 
248          [struct ucred cr; 
249           int cl = sizeof cr;
250           getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
251           assuan_cv_sys_so_peercred=yes,
252           assuan_cv_sys_so_peercred=no)
253        ])
254 AC_MSG_RESULT($assuan_cv_sys_so_peercred) 
255 if test $assuan_cv_sys_so_peercred = yes; then
256   AC_DEFINE(HAVE_SO_PEERCRED, 1,
257             [Defined if SO_PEERCRED is supported (Linux specific)])
263 # Create the config files.
264 AC_CONFIG_FILES([Makefile])
266 Xsed="sed -e s/^X//"
267 LTLIBOBJS=`echo X"$LIBOBJS"| [$Xsed -e "s,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,"]`
268 AC_SUBST(LTLIBOBJS)
270 AC_OUTPUT