1# configure.ac
2# Copyright (C) 1999 Robert Bihlmeyer <robbe@orcus.priv.at>
3# Copyright (C) 2001, 2002, 2003, 2004, 2007, 2015, 2016 g10 Code GmbH
4#
5# This file is part of PINENTRY.
6#
7# PINENTRY is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# PINENTRY is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, see <https://www.gnu.org/licenses/>.
19# SPDX-License-Identifier: GPL-2.0+
20
21# (Process this file with autoconf to produce a configure script.)
22AC_PREREQ([2.69])
23min_automake_version="1.14"
24
25# To build a release you need to create a tag with the version number
26# (git tag -s pinentry-n.m.k) and run "./autogen.sh --force".  Please
27# bump the version number immediately after the release, do another
28# commit, and a push so that the git magic is able to work.
29m4_define(mym4_version, [1.1.1])
30
31# Below is m4 magic to extract and compute the git revision number,
32# the decimalized short revision number, a beta version string and a
33# flag indicating a development version (mym4_isgit).  Note that the
34# m4 processing is done by autoconf and not during the configure run.
35m4_define([mym4_revision], m4_esyscmd([git branch -v 2>/dev/null \
36          | awk '/^\* / {printf "%s",$3}']))
37m4_define([mym4_revision_dec],
38          m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
39m4_define([mym4_betastring],
40          m4_esyscmd_s([git describe --match 'pinentry-[0-9].[0-9].*[0-9]' \
41                           --long|  awk -F- '$3!=0{print"-beta"$3}']))
42m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
43m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
44
45AC_INIT([pinentry],[mym4_full_version],[https://bugs.gnupg.org])
46
47AC_CONFIG_AUX_DIR([build-aux])
48AM_CONFIG_HEADER(config.h)
49AC_CONFIG_SRCDIR(pinentry/pinentry.h)
50AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
51
52AC_USE_SYSTEM_EXTENSIONS
53
54AM_MAINTAINER_MODE
55
56AC_CANONICAL_HOST
57
58AH_TOP([
59#ifndef PINENTRY_CONFIG_H_INCLUDED
60#define PINENTRY_CONFIG_H_INCLUDED
61
62/* Enable gpg-error's strerror macro under W32CE.  */
63#define GPG_ERR_ENABLE_ERRNO_MACROS 1
64])
65
66AH_BOTTOM([
67#endif /*PINENTRY_CONFIG_H_INCLUDED*/
68])
69
70
71dnl Checks for programs.
72AC_PROG_MAKE_SET
73AM_SANITY_CHECK
74missing_dir=`cd $ac_aux_dir && pwd`
75AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
76AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
77AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
78AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
79AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
80AC_PROG_CC
81AC_PROG_CPP
82AC_PROG_INSTALL
83AC_PROG_RANLIB
84# We need to check for cplusplus here because we may not do the test
85# for Qt and autoconf does does not allow that.
86AC_PROG_CXX
87AC_PROG_LN_S
88PKG_PROG_PKG_CONFIG
89AC_CHECK_TOOL(WINDRES, windres, :)
90AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog,
91               [build-aux/gitlog-to-changelog])
92
93
94have_dosish_system=no
95have_w32_system=no
96have_w32ce_system=no
97case "${host}" in
98    *-mingw32*)
99        AC_DEFINE(USE_ONLY_8DOT3,1,
100                  [Set this to limit filenames to the 8.3 format])
101        have_dosish_system=yes
102        have_w32_system=yes
103        case "${host}" in
104          *-mingw32ce*)
105            have_w32ce_system=yes
106            ;;
107          *)
108            AC_DEFINE(HAVE_DRIVE_LETTERS,1,
109                      [Defined if the OS supports drive letters.])
110            ;;
111        esac
112        ;;
113    i?86-emx-os2 | i?86-*-os2*emx )
114        # OS/2 with the EMX environment
115        AC_DEFINE(HAVE_DRIVE_LETTERS)
116        have_dosish_system=yes
117        ;;
118
119    i?86-*-msdosdjgpp*)
120        # DOS with the DJGPP environment
121        AC_DEFINE(HAVE_DRIVE_LETTERS)
122        have_dosish_system=yes
123        ;;
124esac
125
126if 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])
131fi
132AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
133
134if test "$have_w32_system" = yes; then
135   AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
136   if test "$have_w32ce_system" = yes; then
137      AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
138   fi
139fi
140AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
141AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
142
143
144
145
146dnl Checks for compiler features.
147if test "$GCC" = yes; then
148    # Check whether gcc does not emit a diagnositc for unknown -Wno-*
149    # options.  This is the case for gcc >= 4.6
150    AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
151    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
152#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
153#kickerror
154#endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
155    AC_MSG_RESULT($_gcc_silent_wno)
156
157    if test "$USE_MAINTAINER_MODE" = "yes"; then
158        CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
159        CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
160
161        if test x"$_gcc_silent_wno" = xyes ; then
162          _gcc_warn=yes
163        else
164          AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
165          _gcc_cflags_save=$CFLAGS
166          CFLAGS="-Wno-missing-field-initializers"
167          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
168                            [_gcc_warn=yes],[_gcc_warn=no])
169          AC_MSG_RESULT($_gcc_warn)
170          CFLAGS=$_gcc_cflags_save;
171        fi
172        if test x"$_gcc_warn" = xyes ; then
173          CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
174        fi
175
176        AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
177        _gcc_cflags_save=$CFLAGS
178        CFLAGS="-Wdeclaration-after-statement"
179        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_warn=yes,_gcc_warn=no)
180        AC_MSG_RESULT($_gcc_warn)
181        CFLAGS=$_gcc_cflags_save;
182        if test x"$_gcc_warn" = xyes ; then
183          CFLAGS="$CFLAGS -Wdeclaration-after-statement"
184        fi
185
186    else
187        # Not in maintainer mode: Use standard warnings.
188        CFLAGS="$CFLAGS -Wall"
189    fi
190
191    CPPFLAGS="$CPPFLAGS -Wall"
192
193    if test x"$_gcc_silent_wno" = xyes ; then
194      _gcc_warn=yes
195    else
196      AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
197      _gcc_cflags_save=$CFLAGS
198      CFLAGS="-Wno-pointer-sign"
199      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[_gcc_warn=yes],[_gcc_warn=no])
200      AC_MSG_RESULT($_gcc_warn)
201      CFLAGS=$_gcc_cflags_save;
202    fi
203    if test x"$_gcc_warn" = xyes ; then
204       CFLAGS="$CFLAGS -Wno-pointer-sign"
205    fi
206
207    AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
208    _gcc_cflags_save=$CFLAGS
209    CFLAGS="-Wpointer-arith"
210    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_warn=yes,_gcc_warn=no)
211    AC_MSG_RESULT($_gcc_warn)
212    CFLAGS=$_gcc_cflags_save;
213    if test x"$_gcc_warn" = xyes ; then
214       CFLAGS="$CFLAGS -Wpointer-arith"
215    fi
216fi
217
218
219# Checks for header files.
220AC_HEADER_STDC
221AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h utime.h wchar.h)
222
223dnl Checks for library functions.
224AC_CHECK_FUNCS(seteuid stpcpy mmap stat)
225GNUPG_CHECK_MLOCK
226
227dnl Checks for standard types.
228AC_TYPE_UINT32_T
229
230# Common libraries and cflags.
231COMMON_CFLAGS=
232COMMON_LIBS=
233AC_SUBST(COMMON_CFLAGS)
234AC_SUBST(COMMON_LIBS)
235
236dnl Checks for libgpg-error
237#
238# libgpg-error is a library with error codes shared between GnuPG
239# related projects.
240#
241NEED_GPG_ERROR_VERSION=1.16
242have_gpg_error=no
243
244AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
245                  have_gpg_error=yes,have_gpg_error=no)
246COMMON_CFLAGS="$GPG_ERROR_CFLAGS $COMMON_CFLAGS"
247COMMON_LIBS="$GPG_ERROR_LIBS $COMMON_LIBS"
248
249AC_DEFINE_UNQUOTED(GPG_ERR_ENABLE_GETTEXT_MACROS, 1,
250                   [Under Windows we use the gettext code from libgpg-error])
251
252AC_DEFINE_UNQUOTED(GPG_ERR_ENABLE_ERRNO_MACROS, 1,
253                   [Under WindowsCE we use the strerror replacement from libgpg-error.])
254
255
256dnl Checks for libassuan.
257#
258# libassuan is used for IPC
259#
260NEED_LIBASSUAN_API=2
261NEED_LIBASSUAN_VERSION=2.1.0
262have_libassuan=no
263AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
264                  have_libassuan=yes,have_libassuan=no)
265if test "$have_libassuan" = "yes"; then
266  AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
267                     [version of the libassuan library])
268fi
269
270COMMON_CFLAGS="$LIBASSUAN_CFLAGS $COMMON_CFLAGS"
271COMMON_LIBS="$LIBASSUAN_LIBS $COMMON_LIBS"
272
273
274dnl Checks for libsecmem.
275GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
276GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
277
278dnl Check for libcap
279AC_ARG_WITH([libcap], AS_HELP_STRING([--without-libcap],
280            [Disable support for capabilities library]))
281
282if test "x$with_libcap" != "xno"; then
283  AC_PATH_PROG(SETCAP, setcap, :, "$PATH:/sbin:/usr/sbin")
284  AC_CHECK_LIB(cap, cap_set_proc, [
285    AC_DEFINE(USE_CAPABILITIES,1,[The capabilities support library is installed])
286    LIBCAP=-lcap
287  ])
288fi
289AC_SUBST(LIBCAP)
290
291dnl
292dnl Check for curses pinentry program.
293dnl
294AC_ARG_ENABLE(pinentry-curses,
295            AS_HELP_STRING([--enable-pinentry-curses],[build curses pinentry]),
296            pinentry_curses=$enableval, pinentry_curses=maybe)
297AC_ARG_ENABLE(fallback-curses,
298            AS_HELP_STRING([--enable-fallback-curses],[include curses fallback]),
299            fallback_curses=$enableval, fallback_curses=maybe)
300
301dnl
302dnl Checks for curses libraries.  Deal correctly with $pinentry_curses = maybe
303dnl and $fallback_curses = maybe.
304dnl
305if test "$pinentry_curses" != "no" -o "$fallback_curses" != "no"; then
306  IU_LIB_CURSES
307fi
308if test "$LIBCURSES"; then
309  if test "$pinentry_curses" != "no"; then
310    pinentry_curses=yes
311  fi
312  if test "$fallback_curses" != "no"; then
313    fallback_curses=yes
314    AC_DEFINE(FALLBACK_CURSES, 1,
315     [The GUI pinentries should fall back to curses if X is not available.])
316  fi
317else
318  if test "$pinentry_curses" = "yes" -o "$fallback_curses" = "yes"; then
319    AC_MSG_ERROR([[
320***
321*** The curses library is required. The latest version of
322*** ncurses is always available from ftp://ftp.gnu.org/gnu/ncurses/.
323***]])
324  fi
325  pinentry_curses=no
326  fallback_curses=no
327fi
328AM_CONDITIONAL(BUILD_LIBPINENTRY_CURSES,
329              test "$pinentry_curses" = "yes" -o "$fallback_curses" = "yes")
330AM_CONDITIONAL(BUILD_PINENTRY_CURSES, test "$pinentry_curses" = "yes")
331AM_CONDITIONAL(FALLBACK_CURSES, test "$fallback_curses" = "yes")
332
333if test "$pinentry_curses" = "yes"; then
334  AC_DEFINE(PINENTRY_CURSES, 1,
335           [The Curses version of Pinentry is to be build])
336fi
337
338
339dnl
340dnl Check for tty pinentry program.
341dnl
342AC_ARG_ENABLE(pinentry-tty,
343            AS_HELP_STRING([--enable-pinentry-tty],[build tty pinentry]),
344            pinentry_tty=$enableval, pinentry_tty=maybe)
345AM_CONDITIONAL(BUILD_PINENTRY_TTY, test "$pinentry_tty" = "yes")
346
347if test "$pinentry_tty" = "yes"; then
348  AC_DEFINE(PINENTRY_TTY, 1,
349           [The TTY version of Pinentry is to be build])
350fi
351
352
353dnl
354dnl Additional checks pinentry Curses.
355dnl
356if test "$pinentry_curses" = "yes" \
357        -o "$fallback_curses" = "yes" ; then
358  AM_ICONV
359  if test "$am_cv_func_iconv" != "yes"; then
360    AC_MSG_ERROR([[
361***
362*** The iconv function is required.  You can specify its location
363*** using the --with-libiconv-prefix=PREFIX option to configure.
364***]])
365  fi
366fi
367
368dnl
369dnl Check for emacs pinentry program.
370dnl
371AC_ARG_ENABLE(pinentry-emacs,
372            AS_HELP_STRING([--enable-pinentry-emacs],[build emacs pinentry]),
373            pinentry_emacs=$enableval, pinentry_emacs=no)
374AC_ARG_ENABLE(inside-emacs,
375            AS_HELP_STRING([--enable-inside-emacs],[include emacs hack]),
376            inside_emacs=$enableval, inside_emacs=maybe)
377
378if test "$pinentry_emacs" != "no" -o "$inside_emacs" != "no"; then
379  AC_MSG_CHECKING([if Unix domain socket is supported])
380  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
381#include <sys/socket.h>
382#include <sys/un.h>
383]], [[int s = socket (AF_UNIX, SOCK_STREAM, 0);]])],[_unixsock_works=yes],[_unixsock_works=no])
384  AC_MSG_RESULT($_unixsock_works)
385  if test "$_unixsock_works" = "yes"; then
386    if test "$pinentry_emacs" != "no"; then
387      pinentry_emacs=yes
388    fi
389    if test "$inside_emacs" != "no"; then
390      inside_emacs=yes
391      AC_DEFINE(INSIDE_EMACS, 1,
392                [The GUI pinentries should respect INSIDE_EMACS envvar.])
393    fi
394  else
395    if test "$pinentry_emacs" = "yes" -o "$inside_emacs" = "yes"; then
396      AC_MSG_ERROR([[
397***
398*** Support for Unix domain sockets is required.
399***]])
400    fi
401    pinentry_emacs=no
402    inside_emacs=no
403  fi
404fi
405
406AM_CONDITIONAL(BUILD_LIBPINENTRY_EMACS,
407              test "$pinentry_emacs" = "yes" -o "$inside_emacs" = "yes")
408AM_CONDITIONAL(BUILD_PINENTRY_EMACS, test "$pinentry_emacs" = "yes")
409AM_CONDITIONAL(INSIDE_EMACS, test "$inside_emacs" = "yes")
410
411if test "$pinentry_emacs" = "yes"; then
412  AC_DEFINE(PINENTRY_EMACS, 1,
413            [The Emacs version of Pinentry is to be build])
414fi
415
416
417
418dnl
419dnl Check for EFL pinentry programs.
420dnl
421AC_ARG_ENABLE(pinentry-efl,
422            AS_HELP_STRING([--enable-pinentry-efl],[build EFL pinentry]),
423            pinentry_efl=$enableval, pinentry_efl=maybe)
424
425dnl check for pkg-config
426if test "$pinentry_efl" != "no"; then
427	AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
428	if test x"${PKG_CONFIG}" = xno ; then
429		pinentry_efl=no
430	fi
431fi
432
433if test "$pinentry_efl" != "no"; then
434	AC_MSG_CHECKING([for efl])
435	"${PKG_CONFIG}" --exists 'elementary >= 1.18'
436	if test $? -ne 0 ; then
437		AC_MSG_RESULT([no])
438		AC_MSG_WARN([efl >= 1.18 is required for efl pinentry])
439		pinentry_efl=no
440	else
441		AC_MSG_RESULT([yes])
442		EFL_CFLAGS=`"${PKG_CONFIG}" --cflags ecore-x elementary`
443		EFL_LIBS=`"${PKG_CONFIG}" --libs ecore-x elementary`
444		AC_SUBST(EFL_CFLAGS)
445		AC_SUBST(EFL_LIBS)
446		if test "$pinentry_efl" != "no"
447		then
448			pinentry_efl=yes
449		fi
450	fi
451fi
452AM_CONDITIONAL(BUILD_PINENTRY_EFL, test "$pinentry_efl" = "yes")
453
454dnl
455dnl Check for GTK+-2 / GNOME3 pinentry programs.
456dnl
457AC_ARG_ENABLE(pinentry-gtk2,
458            AS_HELP_STRING([--enable-pinentry-gtk2],[build GTK+-2 pinentry]),
459            pinentry_gtk_2=$enableval, pinentry_gtk_2=maybe)
460
461AC_ARG_ENABLE(pinentry-gnome3,
462            AS_HELP_STRING([--enable-pinentry-gnome3],[build GNOME 3 pinentry]),
463            pinentry_gnome_3=$enableval, pinentry_gnome_3=maybe)
464
465dnl check if the module gtk+-2.0 exists
466if test "$pinentry_gtk_2" != "no"; then
467	PKG_CHECK_MODULES(
468		GTK2,
469		[gtk+-2.0 >= 2.12.0],
470		[
471			test "$pinentry_gtk_2" != "no" && pinentry_gtk_2=yes
472			test "$pinentry_gnome_3" != "no" && pinentry_gnome_3=yes
473		],
474		[
475			AC_MSG_WARN([pkg-config could not find the module gtk+-2.0])
476			pinentry_gtk_2=no
477		]
478	)
479fi
480AM_CONDITIONAL(BUILD_PINENTRY_GTK_2, test "$pinentry_gtk_2" = "yes")
481
482if test "$pinentry_gnome_3" != "no"; then
483	PKG_CHECK_MODULES(
484		GNOME3,
485		[gcr-3,gcr-base-3],
486		[
487			pinentry_gnome_3=yes
488			AC_DEFINE(GCR_API_SUBJECT_TO_CHANGE, 1, [Nod nod])
489		],
490		[
491			AC_MSG_WARN([pkg-config could not find the module gcr-3,gcr-base-3])
492			pinentry_gnome_3=no
493		]
494	)
495fi
496
497AM_CONDITIONAL(BUILD_PINENTRY_GNOME_3, test "$pinentry_gnome_3" = "yes")
498
499dnl
500dnl Check for libsecret.
501dnl
502AC_ARG_ENABLE(libsecret,
503            AS_HELP_STRING([--enable-libsecret],
504            [optionally cache passphrases using libsecret]),
505            libsecret=$enableval, libsecret=maybe)
506
507dnl check if the module libsecret exists
508if test "$libsecret" != "no"; then
509	PKG_CHECK_MODULES(
510		LIBSECRET,
511		[libsecret-1],
512		[libsecret=yes],
513		[
514			AC_MSG_WARN([pkg-config could not find the module libsecret-1])
515			libsecret=no
516		]
517	)
518fi
519AM_CONDITIONAL(BUILD_WITH_LIBSECRET, test "$libsecret" = "yes")
520if test "$libsecret" = "yes"; then
521  AC_DEFINE(HAVE_LIBSECRET, 1,
522    [The pinentries should optionally cache the passphrase using libsecret.])
523
524  COMMON_CFLAGS="$LIBSECRET_CFLAGS $COMMON_CFLAGS"
525  COMMON_LIBS="$LIBSECRET_LIBS $COMMON_LIBS"
526fi
527
528dnl
529dnl Check for Qt pinentry program.
530dnl
531AC_ARG_ENABLE(pinentry-qt,
532            AS_HELP_STRING([--enable-pinentry-qt],[build qt pinentry]),
533            pinentry_qt=$enableval, pinentry_qt=maybe)
534
535
536dnl
537dnl Checks for qt libraries.  Deal correctly with $pinentry_qt = maybe.
538dnl Tries to find Qt5, falls back on Qt4
539dnl
540if test "$pinentry_qt" != "no"; then
541  FIND_QT
542  if test "$have_qt4_libs" != "yes" -a "$have_qt5_libs" != "yes"; then
543    if test "$pinentry_qt" = "yes"; then
544        AC_MSG_ERROR([[
545    ***
546    *** Qt4 (QtCore, QtGui) or Qt5 (Qt5Core, Qt5Gui, Qt5Widgets) is required.
547    ***]])
548    else
549        pinentry_qt=no
550    fi
551  fi
552fi
553
554AC_SUBST(PINENTRY_QT_CFLAGS)
555AC_SUBST(PINENTRY_QT_LIBS)
556AC_SUBST(PINENTRY_QT_LDFLAGS)
557AC_SUBST(MOC)
558
559dnl If we have come so far, qt pinentry can be build.
560if test "$pinentry_qt" != "no"; then
561    pinentry_qt=yes
562fi
563AM_CONDITIONAL(BUILD_PINENTRY_QT, test "$pinentry_qt" = "yes")
564if test "$pinentry_qt" = "yes"; then
565  AC_DEFINE(PINENTRY_QT, 1, [The qt version of Pinentry is to be build])
566  if test "$have_qt4_libs" = "yes"; then
567    pinentry_qt_lib_version="(Qt4)"
568  else
569    pinentry_qt_lib_version="(Qt5)"
570  fi
571fi
572
573dnl
574dnl Check for TQt pinentry program.
575dnl
576AC_ARG_ENABLE(pinentry-tqt,
577	      AS_HELP_STRING([--enable-pinentry-tqt],[build tqt pinentry]),
578	      pinentry_tqt=$enableval, pinentry_tqt=no)
579
580if test "$pinentry_tqt" != "no"; then
581
582  if test "$pinentry_qt" = "yes"; then
583    AC_MSG_ERROR([[
584    ***
585    *** Building both Qt and TQt pinentries is not supported.
586    *** Use --disable-pinentry-qt if you want the TQt pinentry.
587    ***]])
588  fi
589
590  PKG_CHECK_MODULES(PINENTRY_TQT, tqt,
591                    have_tqt_libs=yes,
592                    [PKG_CHECK_MODULES(PINENTRY_TQT, tqt-mt,
593                     have_tqt_libs=yes, have_tqt_libs=no)])
594
595  if test "$have_tqt_libs" = "yes"; then
596    AC_CHECK_TOOL([TQT_MOC], tqmoc, "no")
597  fi
598
599  if test "$have_tqt_libs" = "yes" -a "$TQT_MOC" != "no"; then
600    pinentry_tqt=yes
601  else
602    AC_MSG_WARN([TQt is not found])
603    pinentry_tqt=no
604  fi
605
606fi
607AM_CONDITIONAL(BUILD_PINENTRY_TQT, test "$pinentry_tqt" = "yes")
608
609#
610# Check whether we should build the W32 pinentry.  This is actually
611# the simplest check as we do this only for that platform.
612#
613pinentry_w32=no
614test $have_w32_system = yes && pinentry_w32=yes
615AM_CONDITIONAL(BUILD_PINENTRY_W32, test "$pinentry_w32" = "yes")
616
617dnl
618dnl Check for FLTK pinentry program.
619dnl
620AC_ARG_ENABLE(pinentry-fltk,
621    AS_HELP_STRING([--enable-pinentry-fltk],[build FLTK 1.3 pinentry]),
622           pinentry_fltk=$enableval, pinentry_fltk=maybe)
623
624dnl check for fltk-config
625if test "$pinentry_fltk" != "no"; then
626   AC_PATH_PROG(FLTK_CONFIG, fltk-config, no)
627   if test x"${FLTK_CONFIG}" = xno ; then
628       AC_MSG_WARN([fltk-config is not found])
629       pinentry_fltk=no
630   fi
631fi
632
633dnl check for FLTK libraries and set flags
634if test "$pinentry_fltk" != "no"; then
635   AC_MSG_CHECKING([for FLTK 1.3])
636   FLTK_VERSION=`${FLTK_CONFIG} --api-version`
637   if test ${FLTK_VERSION} != "1.3" ; then
638       AC_MSG_RESULT([no])
639       AC_MSG_WARN([FLTK 1.3 not found (available $FLTK_VERSION)])
640       pinentry_fltk=no
641   else
642       AC_MSG_RESULT([yes])
643       FLTKCFLAGS=`${FLTK_CONFIG} --cflags`
644       FLTKCXXFLAGS=`${FLTK_CONFIG} --cxxflags`
645       FLTKLIBS=`${FLTK_CONFIG} --ldflags`
646       AC_SUBST(FLTKCFLAGS)
647       AC_SUBST(FLTKCXXFLAGS)
648       AC_SUBST(FLTKLIBS)
649       pinentry_fltk=yes
650   fi
651fi
652AM_CONDITIONAL(BUILD_PINENTRY_FLTK, test "$pinentry_fltk" = "yes")
653
654# Figure out the default pinentry.  We are very conservative here.
655# Please change the order only after verifying that the preferred
656# pinentry really is better (more feature-complete and more secure).
657
658if test "$pinentry_gtk_2" = "yes"; then
659  PINENTRY_DEFAULT=pinentry-gtk-2
660else
661  if test "$pinentry_qt" = "yes"; then
662    PINENTRY_DEFAULT=pinentry-qt
663  else
664    if test "$pinentry_gnome_3" = "yes"; then
665      PINENTRY_DEFAULT=pinentry-gnome3
666    else
667      if test "$pinentry_curses" = "yes"; then
668        PINENTRY_DEFAULT=pinentry-curses
669      else
670        if test "$pinentry_tty" = "yes"; then
671          PINENTRY_DEFAULT=pinentry-tty
672        else
673          if test "$pinentry_w32" = "yes"; then
674            PINENTRY_DEFAULT=pinentry-w32
675          else
676            if test "$pinentry_fltk" = "yes"; then
677              PINENTRY_DEFAULT=pinentry-fltk
678            else
679              if test "$pinentry_tqt" = "yes"; then
680                PINENTRY_DEFAULT=pinentry-tqt
681              else
682                if test "$pinentry_efl" = "yes"; then
683                  PINENTRY_DEFAULT=pinentry-efl
684                else
685                  AC_MSG_ERROR([[No pinentry enabled.]])
686                fi
687              fi
688            fi
689          fi
690        fi
691      fi
692    fi
693  fi
694fi
695AC_SUBST(PINENTRY_DEFAULT)
696
697#
698# Print errors here so that they are visible all
699# together and the user can acquire them all together.
700#
701die=no
702if test "$have_gpg_error" = "no"; then
703   die=yes
704   AC_MSG_NOTICE([[
705***
706*** You need libgpg-error to build this program.
707**  This library is for example available at
708***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
709*** (at least version $NEED_GPG_ERROR_VERSION is required.)
710***]])
711fi
712
713if test "$have_libassuan" = "no"; then
714   die=yes
715   AC_MSG_NOTICE([[
716***
717*** You need libassuan to build this program.
718*** This library is for example available at
719***   ftp://ftp.gnupg.org/gcrypt/libassuan/
720*** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
721***]])
722fi
723
724if test "$die" = "yes"; then
725    AC_MSG_ERROR([[
726***
727*** Required libraries not found. Please consult the above messages
728*** and install them before running configure again.
729***]])
730fi
731
732
733
734#
735# To avoid double inclusion of config.h which might happen at some
736# places, we add the usual double inclusion protection at the top of
737# config.h.
738#
739AH_TOP([
740#ifndef GNUPG_CONFIG_H_INCLUDED
741#define GNUPG_CONFIG_H_INCLUDED
742])
743
744#
745# Stuff which goes at the bottom of config.h.
746#
747AH_BOTTOM([
748#ifdef GPG_ERR_SOURCE_DEFAULT
749# error GPG_ERR_SOURCE_DEFAULT already defined
750#endif
751#define GPG_ERR_SOURCE_DEFAULT  GPG_ERR_SOURCE_PINENTRY
752#endif /*GNUPG_CONFIG_H_INCLUDED*/
753])
754
755build_doc=yes
756AC_ARG_ENABLE([doc], AS_HELP_STRING([--disable-doc],
757                                    [do not build the documentation]),
758                     build_doc=$enableval, build_doc=yes)
759AM_CONDITIONAL([BUILD_DOC], [test "x$build_doc" != xno])
760
761
762AC_CONFIG_FILES([
763m4/Makefile
764secmem/Makefile
765pinentry/Makefile
766curses/Makefile
767tty/Makefile
768efl/Makefile
769emacs/Makefile
770gtk+-2/Makefile
771gnome3/Makefile
772qt/Makefile
773tqt/Makefile
774w32/Makefile
775fltk/Makefile
776doc/Makefile
777Makefile
778])
779
780AC_OUTPUT
781
782AC_MSG_NOTICE([
783
784	Pinentry v${VERSION} has been configured as follows:
785
786	Revision:  mym4_revision  (mym4_revision_dec)
787	Platform:  $host
788
789	Curses Pinentry ..: $pinentry_curses
790	TTY Pinentry .....: $pinentry_tty
791	Emacs Pinentry ...: $pinentry_emacs
792	EFL Pinentry .....: $pinentry_efl
793	GTK+-2 Pinentry ..: $pinentry_gtk_2
794	GNOME 3 Pinentry .: $pinentry_gnome_3
795	Qt Pinentry ......: $pinentry_qt $pinentry_qt_lib_version
796	TQt Pinentry .....: $pinentry_tqt
797	W32 Pinentry .....: $pinentry_w32
798	FLTK Pinentry ....: $pinentry_fltk
799
800	Fallback to Curses: $fallback_curses
801	Emacs integration : $inside_emacs
802
803	libsecret ........: $libsecret
804
805	Default Pinentry .: $PINENTRY_DEFAULT
806])
807