configure.ac (6544B)
1 # This file is part of GNUnet. 2 # (C) 2001-2011, 2022 Christian Grothoff (and other contributing authors) 3 # 4 # GNUnet 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 2, or (at your 7 # option) any later version. 8 # 9 # GNUnet 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 GNUnet; 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.71]) 23 AC_INIT([gnunet-ext],[0.0.0],[bug-gnunet@gnu.org]) 24 AM_INIT_AUTOMAKE([tar-ustar]) 25 AM_CONFIG_HEADER(gnunet_ext_config.h) 26 27 AH_TOP([#define _GNU_SOURCE 1]) 28 29 AC_SEARCH_LIBS([strerror],[cposix]) 30 AC_PROG_AWK 31 AC_PROG_CC 32 AC_PROG_MKDIR_P 33 AC_PROG_CPP 34 AC_PROG_INSTALL 35 AC_PROG_LN_S 36 AC_PROG_MAKE_SET 37 38 AC_PROG_CC 39 AM_PROG_CC_STDC 40 m4_warn([obsolete], 41 [The preprocessor macro `STDC_HEADERS' is obsolete. 42 Except in unusual embedded environments, you can safely include all 43 ISO C90 headers unconditionally.])dnl 44 # Autoupdate added the next two lines to ensure that your configure 45 # script's behavior did not change. They are probably safe to remove. 46 AC_CHECK_INCLUDES_DEFAULT 47 AC_PROG_EGREP 48 49 AC_CANONICAL_HOST 50 51 # dynamic libraries/plugins 52 AC_DISABLE_STATIC 53 LT_INIT([disable-static dlopen]) 54 55 AC_SYS_LARGEFILE 56 AC_FUNC_FSEEKO 57 58 CFLAGS="-Wall $CFLAGS" 59 # use '-fno-strict-aliasing', but only if the compiler can take it 60 if gcc -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; 61 then 62 CFLAGS="-fno-strict-aliasing $CFLAGS" 63 fi 64 65 66 # Check system type 67 case "$host_os" in 68 *darwin* | *rhapsody* | *macosx*) 69 AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system]) 70 CFLAGS="-no-cpp-precomp $CFLAGS" 71 LDFLAGS="-flat_namespace -undefined suppress $LDFLAGS" 72 ;; 73 linux*) 74 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system]) 75 ;; 76 freebsd*) 77 AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) 78 AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system]) 79 ;; 80 openbsd*) 81 AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) 82 AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system]) 83 ;; 84 netbsd*) 85 AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) 86 AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system]) 87 ;; 88 *solaris*) 89 AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system]) 90 AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work]) 91 build_target="solaris" 92 ;; 93 *arm-linux*) 94 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system]) 95 ;; 96 *cygwin*) 97 AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) 98 AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) 99 AC_CHECK_LIB(intl, gettext) 100 LDFLAGS="$LDFLAGS -no-undefined" 101 build_target="cygwin" 102 ;; 103 *mingw*) 104 AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) 105 AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) 106 AC_DEFINE_UNQUOTED(_WIN32,1,[This is a Windows system]) 107 AC_CHECK_LIB(intl, gettext) 108 LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols -lws2_32" 109 CFLAGS="-mms-bitfields $CFLAGS" 110 build_target="mingw" 111 ;; 112 *) 113 AC_MSG_RESULT(Unrecognised OS $host_os) 114 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) 115 ;; 116 esac 117 118 AM_CONDITIONAL(MINGW, test "$build_target" = "mingw") 119 120 # check for gettext 121 AM_GNU_GETTEXT([external]) 122 AM_GNU_GETTEXT_VERSION([0.21]) 123 124 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]) 125 126 # test for GNUnet core 127 gnunet=0 128 lookin=${prefix} 129 backup_LDFLAGS="$LDFLAGS" 130 backup_CPPFLAGS="$CPPFLAGS" 131 GNUNET_LDFLAGS="" 132 GNUNET_CPPFLAGS="" 133 AC_MSG_CHECKING(for GNUnet core) 134 AC_ARG_WITH(gnunet, 135 [ --with-gnunet=PFX Base of GNUnet installation], 136 [AC_MSG_RESULT([$with_gnunet]) 137 case $with_gnunet in 138 no) 139 lookin="" 140 ;; 141 yes) 142 lookin="${prefix}" 143 ;; 144 *) 145 lookin="$with_gnunet" 146 ;; 147 esac 148 ], 149 [ 150 AC_MSG_RESULT([--with-gnunet not specified]) 151 PKG_CHECK_MODULES([GNUNET], [gnunetutil >= 0.9.0], gnunet=1) 152 ] 153 ) 154 155 if test "x$gnunet" == "x0" -a ! "x$lookin" == "x" 156 then 157 AC_MSG_CHECKING(for GNUnet util library in $lookin) 158 GNUNET_LDFLAGS="-L${lookin}/lib" 159 GNUNET_CPPFLAGS="-I${lookin}/include" 160 LDFLAGS="$GNUNET_LDFLAGS $backup_LDFLAGS" 161 CPPFLAGS="$GNUNET_CPPFLAGS $backup_CPPFLAGS" 162 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h], 163 AC_CHECK_LIB([gnunetutil], [GNUNET_xfree_], 164 [ 165 gnunet=1 166 EXT_LIB_PATH="-L${lookin}/lib $EXT_LIB_PATH" 167 ] 168 ),,[#include <gnunet/platform.h>] 169 ) 170 fi 171 172 if test "x$gnunet" == "x0" 173 then 174 AC_MSG_ERROR([gnunet-ext requires GNUnet]) 175 fi 176 177 178 179 # Linker hardening options 180 # Currently these options are ELF specific - you can't use this with MacOSX 181 AC_ARG_ENABLE(linker-hardening, 182 AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups), 183 [if test x$enableval = xyes; then 184 LDFLAGS="$LDFLAGS -z relro -z now" 185 fi]) 186 187 188 extra_logging=GNUNET_NO 189 AC_ARG_ENABLE([logging], 190 AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose,veryverbose ('yes' is the default)]), 191 [AS_IF([test "x$enableval" = "xyes"], [], 192 [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], 193 [test "x$enableval" = "xverbose"], [extra_logging=GNUNET_YES] 194 [test "x$enableval" = "xveryverbose"], [extra_logging=\(GNUNET_YES+1\)]) 195 ], []) 196 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) 197 198 199 AC_SUBST(GNUNET_CPPFLAGS) 200 AC_SUBST(GNUNET_LDFLAGS) 201 LDFLAGS="$backup_LDFLAGS" 202 CPPFLAGS="$backup_CPPFLAGS" 203 204 AC_DEFINE_DIR([PACKAGE_DATA], [datarootdir], [The directory for installing read-only architecture-independent data]) 205 206 # Set PACKAGE_SOURCE_DIR in gnunet_ext_config.h. 207 packagesrcdir=`cd $srcdir && pwd` 208 AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [source dir]) 209 210 AC_CONFIG_FILES([ po/Makefile.in 211 Makefile 212 src/Makefile 213 src/include/Makefile 214 src/ext/Makefile 215 src/ext/ext.conf 216 ]) 217 AC_OUTPUT