anastasis-gtk

Demonstrator GUI for Anastasis
Log | Files | Refs | README | LICENSE

configure.ac (13952B)


      1 # This file is part of Anastasis.
      2 # (C) 2001--2025 Christian Grothoff (and other contributing authors)
      3 #
      4 # Anastasis is free software; you can redistribute it and/or modify
      5 # it under the terms of the GNU General Public License as published
      6 # by the Free Software Foundation; either version 3, or (at your
      7 # option) any later version.
      8 #
      9 # Anastasis is distributed in the hope that it will be useful, but
     10 # WITHOUT ANY WARRANTY; without even the implied warranty of
     11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 # General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License
     15 # along with Anastasis; see the file COPYING.  If not, write to the
     16 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17 # Boston, MA 02110-1301, USA.
     18 #
     19 #
     20 # Process this file with autoconf to produce a configure script.
     21 #
     22 AC_PREREQ([2.69])
     23 AC_INIT([Anastasis GTK],[0.7.0],[bug-anastasis@gnu.org],[anastasis-gtk])
     24 AC_CONFIG_AUX_DIR([build-aux])
     25 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax])
     26 AC_CONFIG_HEADERS([anastasis_gtk_config.h])
     27 
     28 AH_TOP([#define _GNU_SOURCE  1])
     29 
     30 # pretty build rules
     31 AM_SILENT_RULES([yes])
     32 
     33 AC_PROG_AWK
     34 AM_PROG_CC_C_O
     35 AC_PROG_MKDIR_P
     36 AC_PROG_CPP
     37 AC_PROG_CC
     38 AC_PROG_INSTALL
     39 AC_PROG_LN_S
     40 AC_PROG_MAKE_SET
     41 AC_CANONICAL_HOST
     42 
     43 # dynamic libraries/plugins
     44 AC_DISABLE_STATIC
     45 LT_INIT
     46 
     47 AC_CHECK_PROG([DPKG_ARCH], [dpkg-architecture], [yes], [no])
     48 if test "x$DPKG_ARCH" = "xyes"; then
     49   MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH`
     50 else
     51   MULTIARCH=""
     52 fi
     53 
     54 
     55 AC_SYS_LARGEFILE
     56 AC_FUNC_FSEEKO
     57 AC_TYPE_UID_T
     58 
     59 CFLAGS="-Wall $CFLAGS"
     60 # use '-fno-strict-aliasing', but only if the compiler can take it
     61 AS_IF([gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1],
     62  [CFLAGS="-fno-strict-aliasing $CFLAGS"])
     63 
     64 # Default to unix configuration
     65 ENABLE_ON_UNIX=""
     66 ENABLE_ON_W32="#"
     67 # Check system type
     68 AS_CASE(["$host_os"],
     69   [*darwin* | *rhapsody* | *macosx*],[
     70      AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system])
     71      CFLAGS="-no-cpp-precomp $CFLAGS"
     72      LDFLAGS="-flat_namespace -undefined suppress $LDFLAGS"
     73   ],
     74   [linux*],[
     75      AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
     76   ],
     77   [freebsd*],[
     78      AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
     79      AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system])
     80   ],
     81   [openbsd*],[
     82      AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
     83      AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system])
     84   ],
     85   [netbsd*],[
     86      AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system])
     87      AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system])
     88   ],
     89   [*solaris*],[
     90      AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
     91      AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
     92      build_target="solaris"
     93   ],
     94   [*arm-linux*],[
     95      AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
     96   ],
     97   [*cygwin*],[
     98      AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
     99      AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
    100      AC_CHECK_LIB(intl, gettext)
    101      ENABLE_ON_W32=""
    102      ENABLE_ON_UNIX="#"
    103      build_target="cygwin"
    104   ],
    105   [*mingw*],[
    106      AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
    107      AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
    108      AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system])
    109      AC_CHECK_LIB(intl, gettext)
    110      LDFLAGS="$LDFLAGS -Wl,--export-all-symbols -lws2_32"
    111      CFLAGS="-mms-bitfields -D__USE_MINGW_ANSI_STDIO=1 $CFLAGS"
    112      LIBS="$LIBS -lws2_32 -lplibc -lole32"
    113      ENABLE_ON_W32=""
    114      ENABLE_ON_UNIX="#"
    115      build_target="mingw"
    116    ],
    117    [
    118      AC_MSG_RESULT(Unrecognised OS $host_os)
    119      AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
    120    ])
    121 
    122 AM_CONDITIONAL(MINGW,   test "$build_target" = "mingw")
    123 
    124 AC_MSG_CHECKING(for magic_open -lmagic)
    125 SAVED_AM_LDFLAGS=$AM_LDFLAGS
    126 AC_CHECK_LIB(magic, magic_open,
    127   [AC_CHECK_HEADERS([magic.h],,
    128    AC_MSG_ERROR([anastasis-gtk requires magic.h]))],
    129   AC_MSG_ERROR([anastasis-gtk requires libmagic]))
    130 
    131 
    132 AC_SUBST(ENABLE_ON_UNIX)
    133 AC_SUBST(ENABLE_ON_W32)
    134 
    135 GN_LIB_LDFLAGS="-export-dynamic -no-undefined"
    136 AC_SUBST(GN_LIB_LDFLAGS)
    137 
    138 # check for gettext
    139 AM_GNU_GETTEXT_VERSION([0.19.3])
    140 AM_GNU_GETTEXT([external])
    141 
    142 AC_CHECK_HEADERS([errno.h stdio.h unistd.h locale.h sys/stat.h sys/types.h langinfo.h libintl.h unistd.h stddef.h argz.h sys/socket.h netinet/in.h stdarg.h])
    143 
    144 AC_CHECK_FUNCS([getpwnam])
    145 
    146 AC_CHECK_DECLS([_stati64], [], [], [[#include <sys/stat.h>]])
    147 
    148 # Save before checks clobber them
    149 CFLAGS_SAVE=$CFLAGS
    150 LDFLAGS_SAVE=$LDFLAGS
    151 LIBS_SAVE=$LIBS
    152 
    153 # check for libcurl
    154 LIBCURL_CHECK_CONFIG(,7.34.0,[curl=1],[curl=0])
    155 
    156 # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
    157 AS_IF([test "x$curl" = x1],[
    158  AC_CHECK_HEADER([curl/curl.h],
    159   [AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=1],[curl=0],[[#include <curl/curl.h>]])],
    160   [curl=0])
    161 ])
    162 
    163 # libcurl should be mutually exclusive
    164 AS_IF([test "$curl" = 1],
    165       AM_CONDITIONAL(HAVE_LIBCURL, true)
    166       AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl])
    167       [LIBCURL_LIBS="-lcurl"],
    168       [AC_MSG_ERROR([FATAL: No libcurl])])
    169 
    170 AC_SUBST([LIBCURL_LIBS])
    171 
    172 # restore LIBS & CPPFLAGS
    173 LIBS=$SAVE_LIBS
    174 CPPFLAGS=$SAVE_CPPFLAGS
    175 
    176 
    177 # Check for GNUnet's libgnunetutil.
    178 libgnunetutil=0
    179 AC_MSG_CHECKING([for libgnunetutil])
    180 AC_ARG_WITH(gnunet,
    181             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
    182             [AC_MSG_RESULT([given as $with_gnunet])],
    183             [AC_MSG_RESULT(not given)
    184              with_gnunet=yes])
    185 AS_CASE([$with_gnunet],
    186         [yes], [],
    187         [no], [AC_MSG_ERROR([--with-gnunet is required])],
    188         [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib $LDFLAGS"
    189          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
    190 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
    191  [AC_CHECK_LIB([gnunetutil],
    192                [GNUNET_SCHEDULER_run],
    193                [libgnunetutil=1])])
    194 AS_IF([test $libgnunetutil != 1],
    195   [AC_MSG_ERROR([[
    196 ***
    197 *** You need libgnunetutil >= 0.20.0 to build this program.
    198 *** This library is part of GNUnet, available at
    199 ***   https://gnunet.org
    200 *** ]])])
    201 
    202 
    203 AC_SUBST(GNUNET_CFLAGS)
    204 AC_SUBST(GNUNET_CPPFLAGS)
    205 AC_SUBST(GNUNET_LIBS)
    206 
    207 
    208 # test for libqrencode
    209 qrencode=0
    210 QR_LIBS="-lqrencode"
    211 AC_MSG_CHECKING(for libqrencode)
    212 AC_ARG_WITH(qrencode,
    213    [  --with-qrencode=PFX    Base of libqrencode installation],
    214    [AC_MSG_RESULT([$with_qrencode])
    215     AS_CASE([$with_qrencode],
    216       [no],[],
    217       [yes],[
    218         AC_CHECK_HEADERS(qrencode.h,qrencode=1)
    219       ],
    220       [
    221         CPPFLAGS="-I$with_qrencode/include $CPPFLAGS"
    222         QR_CFLAGS="-I$with_qrencode/include"
    223         QR_LIBS="-L$with_qrencode/lib/$MULTIARCH -L$with_qrencode/lib/ -lqrencode"
    224         AC_CHECK_HEADERS(qrencode.h,qrencode=1)
    225       ])
    226    ],
    227    [AC_MSG_RESULT([--with-qrencode not specified])
    228     AC_CHECK_HEADERS(qrencode.h,qrencode=1)])
    229 
    230 AS_IF([test "$qrencode" != 1],
    231  [AC_MSG_ERROR([anastasis-gtk requires libqrencode])])
    232 
    233 AC_SUBST(QR_CFLAGS)
    234 AC_SUBST(QR_LIBS)
    235 
    236 
    237 
    238 
    239 # test for libhpdf / libharu
    240 haru=0
    241 HPDF_LIBS="-lhpdf"
    242 AC_MSG_CHECKING(for libharu)
    243 AC_ARG_WITH(haru,
    244    [  --with-haru=PFX    Base of libhpdf installation],
    245    [AC_MSG_RESULT([$with_haru])
    246     AS_CASE([$with_haru],
    247       [no],[],
    248       [yes],[
    249         AC_CHECK_HEADERS(hpdf.h,[haru=1])
    250       ],
    251       [
    252         CPPFLAGS="-I$with_haru/include $CPPFLAGS"
    253         HPDF_CFLAGS="-I$with_haru/include"
    254         HPDF_LIBS="-L$with_haru/lib/$MULTIARCH -L$with_haru/lib/ -lhpdf"
    255         AC_CHECK_HEADERS(hpdf.h,[haru=1])
    256       ])
    257    ],
    258    [AC_MSG_RESULT([--with-haru not specified])
    259     AC_CHECK_HEADERS(hpdf.h,[haru=1])])
    260 
    261 AS_IF([test "$haru" != 1],
    262  [AC_MSG_RESULT([libharu not found, PDF support disabled])])
    263 
    264 AC_DEFINE_UNQUOTED([HAVE_LIBHPDF],[$haru],[1 if libhpdf is enabled, 0 otherwise])
    265 AM_CONDITIONAL([HPDF_ENABLED], [test "$haru" = "1"])
    266 
    267 AC_SUBST(HPDF_CFLAGS)
    268 AC_SUBST(HPDF_LIBS)
    269 
    270 
    271 
    272 # test for libanastasis
    273 anastasis=0
    274 AC_MSG_CHECKING(for libanastasis)
    275 AC_ARG_WITH(anastasis,
    276    [  --with-anastasis=PFX    base of libanastasis installation],
    277    [AC_MSG_RESULT([$with_anastasis])
    278     AS_CASE([$with_anastasis],
    279       [no],[],
    280       [yes],[
    281         AC_CHECK_HEADERS([anastasis/anastasis_service.h],
    282           AC_CHECK_LIB([anastasisrest], [ANASTASIS_get_config],
    283             [anastasis=1]))
    284       ],[
    285         LDFLAGS="-L$with_anastasis/lib/$MULTIARCH -L$with_anastasis/lib/ $LDFLAGS"
    286         CPPFLAGS="-I$with_anastasis/include $CPPFLAGS"
    287         AC_CHECK_HEADERS([anastasis/anastasis_service.h],
    288           AC_CHECK_LIB([anastasisrest], [ANASTASIS_get_config],
    289             EXT_LIB_PATH="-L$with_anastasis/lib/$MULTIARCH -L$with_anastasis/lib/ $EXT_LIB_PATH"
    290             [anastasis=1]))
    291       ])
    292    ],
    293    [AC_MSG_RESULT([--with-anastasis not specified])
    294     AC_CHECK_HEADERS([anastasis/anastasis_service.h],
    295      AC_CHECK_LIB([anastasisrest], [ANASTASIS_get_config],
    296       [anastasis=1]))])
    297 
    298 
    299 AS_IF([test "$anastasis" != 1],
    300 [
    301  AC_MSG_ERROR([anastasis-gtk requires libanastasis])
    302 ])
    303 
    304 
    305 # check for libmicrohttpd
    306 microhttpd=0
    307 AC_MSG_CHECKING([for microhttpd])
    308 AC_ARG_WITH([microhttpd],
    309             [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])],
    310             [AC_MSG_RESULT([given as $with_microhttpd])],
    311             [AC_MSG_RESULT([not given])
    312              with_microhttpd=yes])
    313 AS_CASE([$with_microhttpd],
    314         [yes], [],
    315         [no], [AC_MSG_ERROR([--with-microhttpd is required])],
    316         [LDFLAGS="-L$with_microhttpd/lib/$MULTIARCH -L$with_microhttpd/lib $LDFLAGS"
    317          CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"])
    318 AC_CHECK_LIB(microhttpd,MHD_start_daemon,
    319   [AC_CHECK_HEADER([microhttpd.h],[microhttpd=1])])
    320 AS_IF([test $microhttpd = 0],
    321   [AC_MSG_ERROR([[
    322 ***
    323 *** You need libmicrohttpd to build this program.
    324 *** ]])])
    325 
    326 
    327 AC_MSG_CHECKING(for gtk)
    328 without_gtk=true
    329 PKG_CHECK_MODULES([GTK], [gtk+-3.0])
    330 
    331 CFLAGS="$CFLAGS $GTK_CFLAGS"
    332 CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
    333 LIBS="$LIBS $GTK_LIBS"
    334 AC_CHECK_HEADERS([glib.h gmodule.h gtk/gtk.h gdk/gdk.h],,AC_MSG_ERROR([anastasis-gtk requires GTK]))
    335 
    336 
    337 # test for Glade
    338 glade=0
    339 lookin=${prefix}
    340 GLADE_CPPFLAGS=""
    341 GLADE_LDFLAGS=""
    342 GLADE_CFLAGS=""
    343 AC_MSG_CHECKING(for Glade core)
    344 AC_ARG_WITH(glade,
    345    [  --with-glade=PFX       Base of Glade installation (found with pkg-config if omitted)],
    346    [AC_MSG_RESULT([$with_glade])
    347     AS_CASE([$with_glade],
    348       [no],[lookin=""],
    349       [yes],[lookin="${prefix}"],
    350       [lookin="$with_glade"])
    351    ],
    352    [
    353      AC_MSG_RESULT([--with-glade not specified])
    354      PKG_CHECK_MODULES([GLADE], [gladeui-2.0 >= 3.10.0], glade=2)
    355    ]
    356 )
    357 
    358 AS_IF([test "x$glade" = "x0" -a ! "x$lookin" = "x"],
    359 [
    360   AC_MSG_CHECKING([for Glade3 in $lookin])
    361   GLADE_LIBS="-L${lookin}/lib/$MULTIARCH -L${lookin}/lib"
    362   GLADE_CFLAGS="-I${lookin}/include/libgladeui-2.0"
    363   GLADE_CPPFLAGS="-I${lookin}/include/libgladeui-2.0"
    364   LIBS="$GLADE_LIBS $LIBS"
    365   CFLAGS="$GLADE_CFLAGS $CFLAGS"
    366   CPPFLAGS="$GLADE_CPPFLAGS $CPPFLAGS"
    367   AC_CHECK_HEADERS([glib.h gmodule.h gtk/gtk.h gdk/gdk.h gdk/gdkpixbuf.h gladeui/glade.h],
    368      AC_CHECK_LIB([gladeui-2], [glade_xml_node_new],
    369           [glade=2])
    370   )
    371 ])
    372 AS_IF([test "x$glade" = "x0"],
    373  [AC_MSG_ERROR([anastasis-gtk requires Glade3 (library and headers)])])
    374 
    375 CFLAGS="$GLADE_CFLAGS $CFLAGS"
    376 CPPFLAGS="$GLADE_CFLAGS $CPPFLAGS"
    377 
    378 AC_SUBST(GLADE_CFLAGS)
    379 AC_SUBST(GLADE_LIBS)
    380 
    381 
    382 # Adam shostack suggests the following for Windows:
    383 # -D_FORTIFY_SOURCE=2 -fstack-protector-all
    384 AC_ARG_ENABLE(gcc-hardening,
    385    AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
    386 [AS_IF([test x$enableval = xyes],[
    387     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all"
    388     CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
    389     CFLAGS="$CFLAGS --param ssp-buffer-size=1"
    390     LDFLAGS="$LDFLAGS -pie"
    391 ])])
    392 
    393 
    394 # Linker hardening options
    395 # Currently these options are ELF specific - you can't use this with MacOSX
    396 AC_ARG_ENABLE(linker-hardening,
    397   AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
    398 [AS_IF([test x$enableval = xyes],[
    399    LDFLAGS="$LDFLAGS -z relro -z now"
    400  ])])
    401 
    402 
    403 extra_logging=GNUNET_NO
    404 AC_ARG_ENABLE([logging],
    405    AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose,veryverbose ('yes' is the default)]),
    406    [AS_IF([test "x$enableval" = "xyes"], [],
    407           [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
    408           [test "x$enableval" = "xverbose"], [extra_logging=GNUNET_YES]
    409           [test "x$enableval" = "xveryverbose"], [extra_logging=\(GNUNET_YES+1\)])
    410    ], [])
    411 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])
    412 
    413 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h], [],
    414                  AC_MSG_ERROR([compiling anastasis-gtk requires libgnunetutil]))
    415 
    416 AC_CHECK_LIB(gladeui-1,glade_xml_node_new, [],
    417              [
    418              AC_CHECK_LIB(gladeui-2,glade_xml_node_new,,
    419                           AC_MSG_ERROR([gnunet-gtk requires glade3]))
    420              ]
    421             )
    422 
    423 AC_CHECK_HEADERS([gtk/gtkx.h])
    424 
    425 AC_DEFINE_DIR([PACKAGE_DATA], [datarootdir], [The directory for installing read-only architecture-independent data])
    426 
    427 packagesrcdir=`cd $srcdir && pwd`
    428 AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [source dir])
    429 
    430 GN_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
    431 
    432 AC_SUBST(GN_PLUGIN_LDFLAGS)
    433 
    434 AC_SUBST(ANASTASIS_GTK_VERSION3, $PACKAGE_VERSION, [version of the program])
    435 AC_SUBST(ANASTASIS_GTK_YEARFROM, [2020], [year of the first release])
    436 AS_IF([test -n "$SOURCE_DATE_EPOCH"],
    437       [thisyear=$(date --utc --date="@SOURCE_DATE_EPOCH" +%Y)],
    438       [thisyear=$(date +%Y)])
    439 AC_SUBST(ANASTASIS_GTK_YEARTO, ${thisyear}, [year of the most current release])
    440 
    441 AC_CONFIG_FILES([
    442 Makefile
    443 contrib/Makefile
    444 doc/Makefile
    445 doc/doxygen/Makefile
    446 src/Makefile
    447 src/anastasis/Makefile
    448 src/include/Makefile
    449 src/util/Makefile
    450 src/testing/Makefile
    451 pixmaps/Makefile
    452 po/Makefile.in
    453 po/Makefile
    454 anastasis-gtk.desktop
    455 ])
    456 AC_OUTPUT