1 # configure.ac - for libassuan
2 # Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
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.
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.
37 VERSION=$PACKAGE_VERSION
39 AM_INIT_AUTOMAKE([foreign])
44 AC_CONFIG_SRCDIR(assuan.h)
45 AM_CONFIG_HEADER(config.h)
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",
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)
70 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
71 AC_MSG_ERROR([[No C-89 compiler found]])
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"
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
111 if test "$GCC" = yes; then
112 CFLAGS="$CFLAGS -fPIC -DPIC"
116 have_dosish_system=yes
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)
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
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
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"]))
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.
174 AC_CHECK_HEADERS([string.h locale.h sys/uio.h])
176 # Checks for typedefs, structures, and compiler characteristics.
186 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
187 [use_descriptor_passing=yes],
188 [use_descriptor_passing=no
191 *** Data structure for sending ancillary data missing.
192 *** Descriptor passing won't work.
197 #include <sys/types.h>
198 #include <sys/socket.h>
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])
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
226 *** No implementation of fopencookie or funopen available.
227 *** The assuan_get_data_fp feature won't work.
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>],
251 getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
252 assuan_cv_sys_so_peercred=yes,
253 assuan_cv_sys_so_peercred=no)
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])