1AC_PREREQ([2.61]) 2AC_INIT([eid-mw], 3 m4_esyscmd_s(scripts/build-aux/genver.sh), 4 [servicedesk@fedict.be],, 5 [http://eid.belgium.be]) 6 7AC_CONFIG_AUX_DIR([scripts/build-aux]) 8AC_CONFIG_SRCDIR([cardcomm]) 9AC_CONFIG_HEADERS([config.h]) 10AC_CONFIG_MACRO_DIR([scripts/m4]) 11AC_CANONICAL_HOST 12AM_SILENT_RULES([yes]) 13 14LT_INIT 15AM_INIT_AUTOMAKE([subdir-objects foreign tar-pax dist-zip serial-tests]) 16AM_SILENT_RULES([yes]) 17 18# Checks for programs. 19AC_PROG_CXX 20AX_CXX_COMPILE_STDCXX_11() 21AC_PROG_CPP 22AC_PROG_CC 23AC_PROG_LIBTOOL 24AC_PROG_INSTALL 25AC_PROG_LN_S 26AC_PROG_MKDIR_P 27PKG_PROG_PKG_CONFIG 28 29AC_CHECK_PROGS(PLANTUML, plantuml) 30AM_CONDITIONAL([PLANTUML], [test x$PLANTUML != x]) 31 32# Checks for header files. 33AC_CHECK_HEADERS([fcntl.h float.h limits.h netinet/in.h stdlib.h string.h sys/file.h sys/ioctl.h sys/time.h unistd.h malloc.h memory.h sys/timeb.h termios.h]) 34 35AM_GNU_GETTEXT([external]) 36 37AC_ARG_ENABLE([pinentry],AS_HELP_STRING([--disable-pinentry],[When enabled, uses pinentry for dialogs, rather than home-grown dialog boxes (requires libassuan)]),[assuan=$enableval],[assuan=detect]) 38if test x"$assuan" != x"no" 39then 40 AM_PATH_LIBASSUAN(2,[ASSUAN=y],[ASSUAN=n]) 41fi 42 43if test x"$assuan" = x"yes" -a x$ASSUAN = x"n" 44then 45 AC_MSG_ERROR([assuan-based dialogs requested, but libassuan could not be found]) 46fi 47 48AM_CONDITIONAL(ASSUAN,[test x"$ASSUAN" = x"y"]) 49###### pcsc-lite ########## 50PKG_CHECK_MODULES([PCSC],[libpcsclite >= 1.4.4], 51[ 52CPPFLAGS="$PCSC_CFLAGS $CPPFLAGS" 53LDFLAGS="$PCSC_LIBS $CPPFLAGS" 54]) 55 56AC_ARG_ENABLE([test-fuzzer],AS_HELP_STRING([--enable-test-fuzzer],[Build a version of eid-mw instrumented for fuzzing (not meant for production use!)]),[fuzzer=$enableval],[fuzzer=no]) 57AC_MSG_CHECKING([whether to build for fuzzing]) 58case $fuzzer in 59 yes|libfuzz) 60 case $CC in 61 *clang*) 62 AC_MSG_RESULT([yes, with libfuzz]) 63 AC_SUBST(FUZZING,["-fsanitize=fuzzer-no-link,address -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"]) 64 ;; 65 *) 66 AC_MSG_ERROR([Fuzzing with libfuzz only works with clang. Please set CC to clang version 6.0 or higher]) 67 ;; 68 esac 69 case $CXX in 70 *clang++*) 71 ;; 72 *) 73 AC_MSG_ERROR([Fuzzing with libfuzz only works with clang. Please set CXX to clang version 6.0 or higher]) 74 ;; 75 esac 76 ;; 77 afl) 78 AC_MSG_RESULT([yes, with AFL]) 79 CC=afl-$CC 80 CXX=afl-$CXX 81 AC_SUBST(FUZZING,["-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"]) 82 ;; 83 *) 84 fuzzer=no 85 AC_MSG_RESULT([no]) 86 ;; 87esac 88AM_CONDITIONAL([FUZZING], [test x$fuzzer != xno]) 89AM_CONDITIONAL([FUZZ_AFL], [test x$fuzzer = xafl]) 90 91AC_ARG_WITH([gtkvers], 92 [AS_HELP_STRING([--with-gtkvers],[select GTK version to use [default: 3 if available, falls back to 2 if not]; --without-gtkvers disables GTK altogether [note: this implies --disable-dialogs].])], 93 [gtkvers=$withval],[gtkvers=detect]) 94have_gtk=no 95AC_MSG_CHECKING([for wanted GTK version]) 96AC_MSG_RESULT($gtkvers) 97if test "$gtkvers" = "detect" -o "$gtkvers" = 3 98then 99 AC_MSG_CHECKING([for gtk3]) 100 PKG_CHECK_MODULES(GTK, [gtk+-3.0], [have_gtk=3], [have_gtk=no]) 101fi 102if test "$have_gtk" = "no" 103then 104 if test "$gtkvers" = "detect" -o "$gtkvers" = 4 105 then 106 AC_MSG_CHECKING([for gtk4]) 107 PKG_CHECK_MODULES(GTK, [gtk4], [have_gtk=4],[have_gtk=no]) 108 fi 109fi 110if test "$have_gtk" = "no" 111then 112 if test "$gtkvers" = 2 113 then 114 AC_MSG_ERROR([Gtk 2 is no longer supported, sorry]) 115 fi 116fi 117 118AC_DEFINE_UNQUOTED([HAVE_GTK], [$have_gtk], [Set to major version of libgtk]) 119 120if test "$have_gtk" = "no" 121then 122 if test "$gtkvers" != "no" 123 then 124 AC_MSG_ERROR([At least one version of GTK is recommended. If you do not wish the eID viewer or the PIN dialogs, please use --without-gtkvers.]) 125 fi 126fi 127 128AM_CONDITIONAL(GTK, [test "$have_gtk" != "no"]) 129if test "$have_gtk" != "no" 130then 131 PKG_CHECK_MODULES([XML2], [libxml-2.0]) 132 PKG_CHECK_MODULES([libproxy], [libproxy-1.0]) 133fi 134 135########################################################################### 136####### read user-specific requests from --enable directives ###### 137########################################################################### 138AC_MSG_CHECKING(whether to enable dialogs) 139default="yes" 140if test "$have_gtk" = "no" 141then 142 default=no 143fi 144NO_DIALOGS= 145AC_ARG_ENABLE(dialogs, AS_HELP_STRING([--enable-dialogs],[Turn off dialogs. default: on, unless gtk has been disabled]),, enable_dialogs=$default) 146if test "x$enable_dialogs" = "xno"; then 147 AC_MSG_RESULT(no) 148else 149 if test $have_gtk = no; then 150 AC_MSG_ERROR([You cannot combine --without-gtkvers and --enable-dialogs, as the dialogs require GTK]) 151 fi 152 AC_MSG_RESULT(yes) 153fi 154AM_CONDITIONAL([NO_DIALOGS],[test x$enable_dialogs = xno]) 155 156PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.30],[HAVE_GIO=1],[HAVE_GIO=0]) 157AC_DEFINE_UNQUOTED([HAVE_GIO], [$HAVE_GIO], [Define to 1 if you have a version of libgio >= 2.30]) 158if test "$HAVE_GIO" -gt 0; then 159GLIB_GSETTINGS 160fi 161AM_CONDITIONAL(HAVE_GIO, [test "$HAVE_GIO" = 1]) 162 163AC_ARG_ENABLE(p11v220, AS_HELP_STRING([--enable-p11v220], [Enable PKCS#11 v2.20 features (default off, uses PKCS#11 v2.11 instead)]),,[enable_p11v220=no]) 164 165AS_IF([test "$enable_p11v220" = "yes"], AC_DEFINE(PKCS11_V2_20,[],[Define this if you want PKCS#11 v2.20 features])) 166 167# Checks for typedefs, structures, and compiler characteristics. 168AC_HEADER_STDBOOL 169AC_C_INLINE 170AC_TYPE_SIZE_T 171AC_TYPE_UINT16_T 172AC_TYPE_UINT32_T 173AC_TYPE_INT32_T 174AC_TYPE_UINT8_T 175AC_TYPE_PID_T 176 177# Checks for library functions. 178AC_FUNC_ERROR_AT_LINE 179AC_FUNC_MALLOC 180AC_FUNC_REALLOC 181saved_CFLAGS=$CFLAGS 182export CFLAGS="$CFLAGS -Wno-error" 183AC_CHECK_FUNCS([gethostbyname socket strerror memchr memset mkdir select strchr strdup strerror strncasecmp strrchr strstr strtol strtoul vasprintf],,[AC_MSG_ERROR([missing required function])]) 184CFLAGS=$saved_CFLAGS 185 186# we only need libjpeg for the test suite, so don't worry if it's not available... 187AC_CHECK_LIB(jpeg, jpeg_mem_src, [HAVE_JPEGLIB=1; JPEG_LIBS='-ljpeg'], [HAVE_JPEGLIB=0]) 188AM_CONDITIONAL([JPEG], [test x$HAVE_JPEGLIB = x1]) 189AC_SUBST([JPEG_LIBS]) 190AC_DEFINE_UNQUOTED([HAVE_JPEGLIB], $HAVE_JPEGLIB, [Define to 1 if you have libjpeg installed]) 191 192PKG_CHECK_MODULES(SSL, "openssl", [HAVE_OPENSSL=1]) 193PKG_CHECK_VAR(SSL_PREFIX, "openssl", "exec_prefix",, AC_MSG_ERROR([Could not find exec_prefix for openssl])) 194AC_DEFINE_UNQUOTED([HAVE_OPENSSL], $HAVE_OPENSSL, [Define to 1 if you have OpenSSL installed]) 195AC_SUBST(SSL_PREFIX) 196 197PKG_CHECK_MODULES(CURL, "libcurl", [HAVE_CURL=1]) 198MAINVERSION=$(echo $PACKAGE_VERSION|sed -e 's/-.*$//') 199AC_DEFINE_UNQUOTED([MAINVERSION], $MAINVERSION, [do not change this]) 200AC_SUBST(MAINVERSION) 201CRYPTOKIMAJORVERS=$(echo $MAINVERSION|cut -d'.' -f1|sed -e 's/v//') 202CRYPTOKIMINORVERS=$(echo $MAINVERSION|cut -d'.' -f2) 203AS_IF([test -z "$CRYPTOKIMINORVERS"],[CRYPTOKIMINORVERS=0]) 204AC_DEFINE_UNQUOTED([CRYPTOKIMAJORVERS], $CRYPTOKIMAJORVERS, [major version of PKCS#11 library]) 205AC_DEFINE_UNQUOTED([CRYPTOKIMINORVERS], $CRYPTOKIMINORVERS, [minor version of PKCS#11 library]) 206 207# need dlopen() for the pincode plugin thing 208save_LIBS="$LIBS" 209LIBS="" 210AC_SEARCH_LIBS([dlopen], [dl],, [AC_MSG_ERROR([I need a dlopen() implementation])]) 211DL_LIBS="$LIBS" 212LIBS="$save_LIBS" 213AC_SUBST(DL_LIBS) 214 215p11kitsodir="" 216p11kitcfdir="" 217PKG_CHECK_MODULES(p11kit, "p11-kit-1", [HAVE_P11KIT=yes], [HAVE_P11KIT=no]) 218AC_ARG_ENABLE(p11kit, AS_HELP_STRING([--disable-p11kit], [disregard detection result of p11-kit, and do not install support files]), [if test $enableval = no; then HAVE_P11KIT=no; fi]) 219if test "$HAVE_P11KIT" = yes 220then 221 PKG_CHECK_VAR([p11kitsodir], "p11-kit-1", "p11_module_path",, [HAVE_P11KIT=0]) 222 PKG_CHECK_VAR([p11kit_libdir], "p11-kit-1", "libdir",, [HAVE_P11_KIT=0]) 223 if test ! -z "$p11kit_libdir"; then 224 p11kitsodir=$(echo $p11kitsodir|sed -e "s,$p11kit_libdir,\${libdir},g") 225 fi 226 PKG_CHECK_VAR([p11kitcfdir], "p11-kit-1", "p11_system_config_modules",, [HAVE_P11KIT=0]) 227 PKG_CHECK_VAR([p11kit_datarootdir], "p11-kit-1", "datarootdir",, [HAVE_P11_KIT=0]) 228 if test ! -z "$p11kit_datarootdir"; then 229 p11kitcfdir=$(echo $p11kitcfdir|sed -e "s,$p11kit_datarootdir,\${datarootdir},g") 230 fi 231fi 232AM_CONDITIONAL([P11KIT], [test "$HAVE_P11KIT" = yes]) 233 234pkgconfigdir="\$(libdir)/pkgconfig" 235pkcs11hincludedir="\$(includedir)/beid/rsaref220" 236AC_SUBST([pkgconfigdir]) 237AC_SUBST([pkcs11hincludedir]) 238AC_SUBST([p11kitsodir]) 239AC_SUBST([p11kitcfdir]) 240 241AC_CONFIG_FILES([Makefile 242 cardcomm/pkcs11/src/Makefile 243 cardcomm/pkcs11/src/cardlayer/uml/Makefile 244 cardcomm/pkcs11/src/libbeidpkcs11.pc 245 cardcomm/pkcs11/src/beidpkcs11.json 246 cardcomm/pkcs11/src/beidp11kit.json 247 cardcomm/pkcs11/src/dialogs/dialogsgtk/po/Makefile.in 248 doc/sdk/include/v240/Makefile 249 tests/unit/Makefile 250 tests/fuzz/Makefile 251 plugins_tools/util/Makefile 252 plugins_tools/aboutmw/gtk/Makefile 253 plugins_tools/aboutmw/gtk/po/Makefile.in 254 plugins_tools/chrome_pkcs11/Makefile 255 plugins_tools/eid-viewer/Makefile 256 plugins_tools/eid-viewer/test/Makefile 257 plugins_tools/eid-viewer/gtk/po/Makefile.in 258 plugins_tools/eid-viewer/gtk/eid-viewer.desktop.sh 259 plugins_tools/eid-viewer/uml/Makefile 260 rpm/eid-mw.spec]) 261AC_CONFIG_SUBDIRS([plugins_tools/xpi]) 262 263AC_OUTPUT 264