@ -1,263 +0,0 @@ | |||
SHELL := @SHELL@ | |||
# Support out-of-tree builds | |||
srcdir := @srcdir@ | |||
VPATH := @srcdir@ | |||
prefix := @prefix@ | |||
exec_prefix := @exec_prefix@ | |||
datarootdir := @datarootdir@ | |||
bindir := @bindir@ | |||
datadir := @datadir@ | |||
sysconfdir := @sysconfdir@ | |||
libdir := @libdir@ | |||
includedir := @includedir@ | |||
sbindir := @sbindir@ | |||
localstatedir := @localstatedir@ | |||
systemdsystemunitdir := @systemdsystemunitdir@ | |||
CXX := @CXX@ | |||
CXXFLAGS := -I$(srcdir)/include -Iinclude @CPPFLAGS@ @CXXFLAGS@ | |||
LDFLAGS := @LDFLAGS@ | |||
LIBS := @LIBS@ | |||
LIBZNC := @LIBZNC@ | |||
LIBZNCDIR:= @LIBZNCDIR@ | |||
MODDIR := @MODDIR@ | |||
DATADIR := @DATADIR@ | |||
PKGCONFIGDIR := $(libdir)/pkgconfig | |||
INSTALL := @INSTALL@ | |||
INSTALL_PROGRAM := @INSTALL_PROGRAM@ | |||
INSTALL_SCRIPT := @INSTALL_SCRIPT@ | |||
INSTALL_DATA := @INSTALL_DATA@ | |||
GIT := @GIT@ | |||
SED := @SED@ | |||
GTEST_DIR := @GTEST_DIR@ | |||
GMOCK_DIR := @GMOCK_DIR@ | |||
ifeq "$(GTEST_DIR)" "" | |||
GTEST_DIR := $(srcdir)/third_party/googletest/googletest | |||
endif | |||
ifeq "$(GMOCK_DIR)" "" | |||
GMOCK_DIR := $(srcdir)/third_party/googletest/googlemock | |||
endif | |||
qt_CFLAGS := @qt_CFLAGS@ -fPIC -std=c++11 -pthread | |||
qt_LIBS := @qt_LIBS@ -pthread | |||
# Force the simple internal regex engine to get consistent behavior on all platforms. | |||
# See https://code.google.com/p/chromium/issues/detail?id=317224 for more details. | |||
GTEST_FLAGS := -DGTEST_HAS_POSIX_RE=0 -I$(GMOCK_DIR)/include -I$(GTEST_DIR)/include | |||
# Silence warnings about overload virtual Csock::Write(), and missing field | |||
# initializers in both gtest and gmock | |||
GTEST_FLAGS += -Wno-overloaded-virtual -Wno-missing-field-initializers | |||
LIB_SRCS := ZNCString.cpp Csocket.cpp znc.cpp IRCNetwork.cpp User.cpp IRCSock.cpp \ | |||
Client.cpp Chan.cpp Nick.cpp Server.cpp Modules.cpp MD5.cpp Buffer.cpp Utils.cpp \ | |||
FileUtils.cpp HTTPSock.cpp Template.cpp ClientCommand.cpp Socket.cpp SHA256.cpp \ | |||
WebModules.cpp Listener.cpp Config.cpp ZNCDebug.cpp Threads.cpp version.cpp Query.cpp \ | |||
SSLVerifyHost.cpp Message.cpp Translation.cpp | |||
LIB_SRCS := $(addprefix src/,$(LIB_SRCS)) | |||
BIN_SRCS := src/main.cpp | |||
LIB_OBJS := $(patsubst %cpp,%o,$(LIB_SRCS)) | |||
BIN_OBJS := $(patsubst %cpp,%o,$(BIN_SRCS)) | |||
TESTS := StringTest ConfigTest UtilsTest ThreadTest NickTest ClientTest NetworkTest \ | |||
MessageTest ModulesTest IRCSockTest QueryTest BufferTest UserTest | |||
TESTS := $(addprefix test/,$(addsuffix .o,$(TESTS))) | |||
CLEAN := znc src/*.o test/*.o core core.* .version_extra .depend modules/.depend \ | |||
unittest $(LIBZNC) | |||
DISTCLEAN := Makefile config.log config.status znc-buildmod include/znc/zncconfig.h \ | |||
modules/Makefile man/Makefile znc.pc znc-uninstalled.pc test/Makefile | |||
CXXFLAGS += -D_MODDIR_=\"$(MODDIR)\" -D_DATADIR_=\"$(DATADIR)\" | |||
ifneq "$(V)" "" | |||
VERBOSE=1 | |||
endif | |||
ifeq "$(VERBOSE)" "" | |||
Q=@ | |||
E=@echo | |||
C=-s | |||
else | |||
Q= | |||
E=@\# | |||
C= | |||
endif | |||
.PHONY: all man modules clean distclean install version_extra_recompile test | |||
.SECONDARY: | |||
all: znc man modules $(LIBZNC) | |||
@echo "" | |||
@echo " ZNC was successfully compiled." | |||
@echo " Use '$(MAKE) install' to install ZNC to '$(prefix)'." | |||
ifeq "$(LIBZNC)" "" | |||
OBJS := $(BIN_OBJS) $(LIB_OBJS) | |||
znc: $(OBJS) | |||
$(E) Linking znc... | |||
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) | |||
else | |||
znc: $(BIN_OBJS) $(LIBZNC) | |||
$(E) Linking znc... | |||
$(Q)$(CXX) $(LDFLAGS) -o $@ $(BIN_OBJS) -L. -lznc -Wl,-rpath,$(LIBZNCDIR) $(LIBS) | |||
$(LIBZNC): $(LIB_OBJS) | |||
$(E) Linking $(LIBZNC)... | |||
$(Q)$(CXX) $(LDFLAGS) -shared -o $@ $(LIB_OBJS) $(LIBS) -Wl,--out-implib=libznc.dll.a | |||
endif | |||
unittest: $(LIB_OBJS) test/gtest-all.o test/gmock-all.o test/gmock-main.o $(TESTS) | |||
$(E) Linking unit test... | |||
$(Q)$(CXX) $(LDFLAGS) -o $@ $(LIB_OBJS) test/gtest-all.o test/gmock-all.o test/gmock-main.o $(TESTS) $(LIBS) | |||
inttest: test/Integration.o test/Int-gtest-all.o test/Int-gmock-all.o | |||
$(E) Linking integration test... | |||
$(Q)g++ -std=c++11 -o $@ test/Integration.o test/Int-gtest-all.o test/Int-gmock-all.o $(LIBS) $(qt_LIBS) | |||
man: | |||
@$(MAKE) -C man $(C) | |||
modules: $(LIBZNC) include/znc/Csocket.h | |||
@$(MAKE) -C modules $(C) | |||
clean: | |||
rm -rf $(CLEAN) | |||
@$(MAKE) -C modules clean; | |||
@$(MAKE) -C man clean | |||
distclean: clean | |||
rm -rf $(DISTCLEAN) | |||
src/%.o: src/%.cpp Makefile include/znc/Csocket.h | |||
@mkdir -p .depend src | |||
$(E) Building core object $*... | |||
$(Q)$(CXX) $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/$*.dep -MT $@ | |||
test/%.o: test/%.cpp Makefile include/znc/Csocket.h | |||
@mkdir -p .depend test | |||
$(E) Building test object $*... | |||
$(Q)$(CXX) $(CXXFLAGS) $(GTEST_FLAGS) -c -o $@ $< -MD -MF .depend/$*.test.dep -MT $@ | |||
test/gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc Makefile | |||
@mkdir -p .depend test | |||
$(E) Building test object gtest-all... | |||
$(Q)$(CXX) $(CXXFLAGS) $(GTEST_FLAGS) -I$(GTEST_DIR) -c -o $@ $< -MD -MF .depend/gtest-all.dep -MT $@ | |||
test/gmock-all.o: $(GMOCK_DIR)/src/gmock-all.cc Makefile | |||
@mkdir -p .depend test | |||
$(E) Building test object gmock-all... | |||
$(Q)$(CXX) $(CXXFLAGS) $(GTEST_FLAGS) -I$(GMOCK_DIR) -c -o $@ $< -MD -MF .depend/gmock-all.dep -MT $@ | |||
test/gmock-main.o: $(GMOCK_DIR)/src/gmock_main.cc Makefile | |||
@mkdir -p .depend test | |||
$(E) Building test object gmock-main... | |||
$(Q)$(CXX) $(CXXFLAGS) $(GTEST_FLAGS) -c -o $@ $< -MD -MF .depend/gmock-main.dep -MT $@ | |||
# Qt fails under TSAN, so CXXFLAGS/LDFLAGS can't be used. | |||
test/Integration.o: test/integration/autoconf-all.cpp Makefile | |||
@mkdir -p .depend test | |||
$(E) Building test object Integration... | |||
$(Q)g++ $(qt_CFLAGS) $(GTEST_FLAGS) -I$(srcdir)/test/integration/framework -c -o $@ $< -MD -MF .depend/Integration.test.dep -MT $@ '-DZNC_BIN_DIR="$(bindir)"' '-DZNC_SRC_DIR="$(realpath $(srcdir))"' | |||
test/Int-gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc Makefile | |||
@mkdir -p .depend test | |||
$(E) Building test object Int-gtest-all... | |||
$(Q)g++ $(qt_CFLAGS) $(GTEST_FLAGS) -I$(GTEST_DIR) -c -o $@ $< -MD -MF .depend/Int-gtest-all.dep -MT $@ | |||
test/Int-gmock-all.o: $(GMOCK_DIR)/src/gmock-all.cc Makefile | |||
@mkdir -p .depend test | |||
$(E) Building test object Int-gmock-all... | |||
$(Q)g++ $(qt_CFLAGS) $(GTEST_FLAGS) -I$(GMOCK_DIR) -c -o $@ $< -MD -MF .depend/Int-gmock-all.dep -MT $@ | |||
test/Int-gmock-main.o: $(GMOCK_DIR)/src/gmock_main.cc Makefile | |||
@mkdir -p .depend test | |||
$(E) Building test object Int-gmock-main... | |||
$(Q)g++ $(qt_CFLAGS) $(GTEST_FLAGS) -c -o $@ $< -MD -MF .depend/Int-gmock-main.dep -MT $@ | |||
ifneq "THIS_IS_NOT_TARBALL" "" | |||
# If git commit was changed since previous build, add a phony target to dependencies, forcing version.o to be recompiled | |||
# Nightlies have pregenerated version.cpp | |||
src/version.cpp: Makefile version.sh $(shell if [ x`cat .version_extra 2> /dev/null` != x`$(srcdir)/version.sh "$(GIT)" 3>&2 2> /dev/null` ]; then echo version_extra_recompile; fi) | |||
@mkdir -p .depend src | |||
$(E) Building source file version.cpp... | |||
$(Q)WRITE_OUTPUT=yes $(srcdir)/version.sh "$(GIT)" > .version_extra 2> /dev/null | |||
CLEAN += src/version.cpp | |||
endif | |||
CLEAN += src/Csocket.cpp include/znc/Csocket.h | |||
src/Csocket.cpp: third_party/Csocket/Csocket.cc | |||
@rm -f $@ | |||
@mkdir -p src | |||
@sed -e 's:#include "Csocket.h":#include <znc/Csocket.h>:' $^ > $@ | |||
include/znc/Csocket.h: third_party/Csocket/Csocket.h | |||
@rm -f $@ | |||
@mkdir -p include/znc | |||
@sed -e 's:#include "defines.h":#include <znc/defines.h>:' $^ > $@ | |||
third_party/Csocket/Csocket.h third_party/Csocket/Csocket.cc: | |||
@echo It looks like git submodules are not initialized. Run: git submodule update --init --recursive | |||
@exit 1 | |||
znc.service: znc.service.in | |||
@sed -e "s:\@CMAKE_INSTALL_FULL_BINDIR\@:$(bindir):" $^ > $@ | |||
CLEAN += znc.service | |||
install: znc znc.service $(LIBZNC) | |||
test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir) | |||
test -d $(DESTDIR)$(includedir)/znc || $(INSTALL) -d $(DESTDIR)$(includedir)/znc | |||
test -d $(DESTDIR)$(PKGCONFIGDIR) || $(INSTALL) -d $(DESTDIR)$(PKGCONFIGDIR) | |||
test -d $(DESTDIR)$(MODDIR) || $(INSTALL) -d $(DESTDIR)$(MODDIR) | |||
test -d $(DESTDIR)$(DATADIR) || $(INSTALL) -d $(DESTDIR)$(DATADIR) | |||
cp -R $(srcdir)/webskins $(DESTDIR)$(DATADIR) | |||
find $(DESTDIR)$(DATADIR)/webskins -type d -exec chmod 0755 '{}' \; | |||
find $(DESTDIR)$(DATADIR)/webskins -type f -exec chmod 0644 '{}' \; | |||
$(INSTALL_PROGRAM) znc $(DESTDIR)$(bindir) | |||
$(INSTALL_SCRIPT) znc-buildmod $(DESTDIR)$(bindir) | |||
$(INSTALL_DATA) $(srcdir)/include/znc/*.h $(DESTDIR)$(includedir)/znc | |||
$(INSTALL_DATA) include/znc/*.h $(DESTDIR)$(includedir)/znc | |||
$(INSTALL_DATA) znc.pc $(DESTDIR)$(PKGCONFIGDIR) | |||
@$(MAKE) -C modules install DESTDIR=$(DESTDIR); | |||
if test -n "$(LIBZNC)"; then \ | |||
test -d $(DESTDIR)$(LIBZNCDIR) || $(INSTALL) -d $(DESTDIR)$(LIBZNCDIR) || exit 1 ; \ | |||
$(INSTALL_PROGRAM) $(LIBZNC) $(DESTDIR)$(LIBZNCDIR) || exit 1 ; \ | |||
$(INSTALL_PROGRAM) libznc.dll.a $(DESTDIR)$(libdir) || exit 1 ; \ | |||
fi | |||
@$(MAKE) -C man install DESTDIR=$(DESTDIR) | |||
@HAVE_SYSTEMD_TRUE@test -d $(DESTDIR)$(systemdsystemunitdir) || $(INSTALL) -d $(DESTDIR)$(systemdsystemunitdir) | |||
@HAVE_SYSTEMD_TRUE@$(INSTALL_DATA) $(srcdir)/znc.service $(DESTDIR)$(systemdsystemunitdir) | |||
@echo "" | |||
@echo "******************************************************************" | |||
@echo " ZNC was successfully installed." | |||
@echo " You can use '$(bindir)/znc --makeconf'" | |||
@echo " to generate a config file." | |||
@echo "" | |||
@echo " If you need help with using ZNC, please visit our wiki at:" | |||
@echo " https://znc.in" | |||
uninstall: | |||
rm $(DESTDIR)$(bindir)/znc | |||
rm $(DESTDIR)$(bindir)/znc-buildmod | |||
rm $(DESTDIR)$(includedir)/znc/*.h | |||
rm $(DESTDIR)$(PKGCONFIGDIR)/znc.pc | |||
rm -rf $(DESTDIR)$(DATADIR)/webskins | |||
if test -n "$(LIBZNC)"; then \ | |||
rm $(DESTDIR)$(LIBZNCDIR)/$(LIBZNC) || exit 1 ; \ | |||
rmdir $(DESTDIR)$(LIBZNCDIR) || exit 1 ; \ | |||
fi | |||
@$(MAKE) -C man uninstall DESTDIR=$(DESTDIR) | |||
@if test -n "modules"; then \ | |||
$(MAKE) -C modules uninstall DESTDIR=$(DESTDIR); \ | |||
fi | |||
rmdir $(DESTDIR)$(bindir) | |||
rmdir $(DESTDIR)$(includedir)/znc | |||
rmdir $(DESTDIR)$(PKGCONFIGDIR) | |||
@echo "Successfully uninstalled, but empty directories were left behind" | |||
test: unittest | |||
$(Q)./unittest | |||
# This test uses files at <prefix>/lib/znc, which is less than ideal, especially from build scripts of distros. | |||
# That's why it's a separate make target. | |||
test2: inttest | |||
$(Q)./inttest | |||
-include $(wildcard .depend/*.dep) |
@ -1,44 +0,0 @@ | |||
#!/bin/sh | |||
# Run this to generate all the initial makefiles, etc. | |||
# This is based on various examples which can be found everywhere. | |||
set -e | |||
FLAGS=${FLAGS--Wall} | |||
ACLOCAL=${ACLOCAL-aclocal} | |||
AUTOHEADER=${AUTOHEADER-autoheader} | |||
AUTOCONF=${AUTOCONF-autoconf} | |||
AUTOMAKE=${AUTOMAKE-automake} | |||
ACLOCAL_FLAGS="${ACLOCAL_FLAGS--I m4} ${FLAGS}" | |||
AUTOHEADER_FLAGS="${AUTOHEADER_FLAGS} ${FLAGS}" | |||
AUTOCONF_FLAGS="${AUTOCONF_FLAGS} ${FLAGS}" | |||
AUTOMAKE_FLAGS="${AUTOMAKE_FLAGS---add-missing} ${FLAGS}" | |||
die() { | |||
echo "$@" | |||
exit 1 | |||
} | |||
do_cmd() { | |||
echo "Running '$@'" | |||
$@ | |||
} | |||
test -f configure.ac || die "No configure.ac found." | |||
which pkg-config > /dev/null || die "ERROR: pkg-config not found. Install pkg-config and run $0 again" | |||
# Generate aclocal.m4 for use by autoconf | |||
do_cmd $ACLOCAL $ACLOCAL_FLAGS | |||
# Generate zncconfig.h.in for configure | |||
do_cmd $AUTOHEADER $AUTOHEADER_FLAGS | |||
# Generate configure | |||
do_cmd $AUTOCONF $AUTOCONF_FLAGS | |||
# Copy config.sub, config.guess, install.sh, ... | |||
# This will complain that we don't use automake, let's just ignore that | |||
do_cmd $AUTOMAKE $AUTOMAKE_FLAGS || true | |||
test -f config.guess -a -f config.sub -a -f install-sh || | |||
die "Automake didn't install config.guess, config.sub and install-sh!" | |||
echo "(Yes, automake is supposed to fail, ignore that)" | |||
echo | |||
echo "You may now run ./configure." |
@ -1 +0,0 @@ | |||
autogen.sh |
@ -1,752 +0,0 @@ | |||
dnl This redefines AC_PROG_CC to a version which errors out instead. This is | |||
dnl because all our tests should be done with the C++ compiler. This should | |||
dnl catch stuff which accidentally uses the C compiler. | |||
AC_DEFUN([AC_PROG_CC], [m4_errprint(__file__:__line__[: Something is trying to use the C compiler. Since this is a C++ project, this should not happen! | |||
])m4_exit(1)]) | |||
dnl Needed for AC_PATH_PROGS_FEATURE_CHECK which was added in 2.62 | |||
AC_PREREQ([2.62]) | |||
dnl Keep the version number in sync with version.h! | |||
AC_INIT([znc], [1.9.x]) | |||
LIBZNC_VERSION=1.9.x | |||
AC_CONFIG_MACRO_DIR([m4]) | |||
AC_CONFIG_SRCDIR([src/znc.cpp]) | |||
AC_LANG([C++]) | |||
AC_CONFIG_HEADERS([include/znc/zncconfig.h]) | |||
AH_TOP([#ifndef ZNCCONFIG_H | |||
#define ZNCCONFIG_H]) | |||
AH_BOTTOM([#endif /* ZNCCONFIG_H */]) | |||
AC_DEFUN([ZNC_AUTO_FAIL], [ | |||
# This looks better in the summary at the end | |||
$1="not found" | |||
if test "x$old_$1" != "xauto" ; then | |||
AC_MSG_ERROR([$2]) | |||
else | |||
AC_MSG_WARN([$3]) | |||
fi | |||
]) | |||
# AC_PROG_CXX sets CXXFLAGS to "-O2 -g" if it is unset which we don't want | |||
CXXFLAGS="$CXXFLAGS " | |||
AC_PROG_CXX | |||
# "Optional" because we want custom error message | |||
AX_CXX_COMPILE_STDCXX_11([noext], [optional]) | |||
if test x"$HAVE_CXX11" != x1; then | |||
AC_MSG_ERROR([Upgrade your compiler. GCC 4.8+ and Clang 3.2+ are known to work.]) | |||
fi | |||
appendLib () { | |||
if test "$LIBS" != ""; then | |||
LIBS="$LIBS $*" | |||
else | |||
LIBS=$* | |||
fi | |||
} | |||
appendCXX () { | |||
if test "$CXXFLAGS" != ""; then | |||
CXXFLAGS="$CXXFLAGS $*" | |||
else | |||
CXXFLAGS=$* | |||
fi | |||
} | |||
appendMod () { | |||
if test "$MODFLAGS" != ""; then | |||
MODFLAGS="$MODFLAGS $*" | |||
else | |||
MODFLAGS=$* | |||
fi | |||
} | |||
appendLD () { | |||
if test "$LDFLAGS" != ""; then | |||
LDFLAGS="$LDFLAGS $*" | |||
else | |||
LDFLAGS=$* | |||
fi | |||
} | |||
AC_PROG_INSTALL | |||
AC_PROG_GREP | |||
AC_PROG_SED | |||
AC_CANONICAL_HOST | |||
AC_SYS_LARGEFILE | |||
ZNC_VISIBILITY | |||
AC_PATH_PROG([GIT], [git]) | |||
PKG_PROG_PKG_CONFIG() | |||
AC_ARG_ENABLE( [debug], | |||
AS_HELP_STRING([--enable-debug], [enable debugging]), | |||
[DEBUG="$enableval"], | |||
[DEBUG="no"]) | |||
AC_ARG_ENABLE( [ipv6], | |||
AS_HELP_STRING([--disable-ipv6], [disable ipv6 support]), | |||
[IPV6="$enableval"], | |||
[IPV6="yes"]) | |||
AC_ARG_ENABLE( [openssl], | |||
AS_HELP_STRING([--disable-openssl], [disable openssl]), | |||
[SSL="$enableval"], | |||
[SSL="auto"]) | |||
AC_ARG_ENABLE( [zlib], | |||
AS_HELP_STRING([--disable-zlib], [disable zlib]), | |||
[ZLIB="$enableval"], | |||
[ZLIB="auto"]) | |||
AC_ARG_ENABLE( [perl], | |||
AS_HELP_STRING([--enable-perl], [enable perl]), | |||
[PERL="$enableval"], | |||
[PERL="no"]) | |||
AC_ARG_ENABLE( [python], | |||
AS_HELP_STRING([--enable-python[[[=python3]]]], [enable python. | |||
By default python3.pc of pkg-config is used, but you can use | |||
another name, for example python-3.1]), | |||
[PYTHON="$enableval"], | |||
[PYTHON="no"]) | |||
AC_ARG_ENABLE( [swig], | |||
AS_HELP_STRING([--enable-swig], [Enable automatic generation of source files needed for modperl/modpython. | |||
This value is ignored if perl and python are disabled. | |||
Usually no need to enable it. | |||
]), | |||
[USESWIG="$enableval"], | |||
[USESWIG="auto"]) | |||
AC_ARG_ENABLE( [cyrus], | |||
AS_HELP_STRING([--enable-cyrus], [enable cyrus]), | |||
[if test "$enableval" = "yes" ; then CYRUS=1; fi],) | |||
AC_ARG_ENABLE( [optimization], | |||
AS_HELP_STRING([--disable-optimization], [Disable some compiler optimizations to | |||
decrease memory usage while compiling]), | |||
[OPTIMIZE="$enableval"], | |||
[OPTIMIZE="yes"]) | |||
AC_ARG_ENABLE( [tdns], | |||
AS_HELP_STRING([--disable-tdns], [disable threads usage for DNS resolving]), | |||
[TDNS="$enableval"], | |||
[TDNS="auto"]) | |||
AC_ARG_ENABLE( [run-from-source], | |||
AS_HELP_STRING([--enable-run-from-source], [ZNC will be runnable without installation]), | |||
[if test "x$enableval" = "xyes" ; then | |||
AC_DEFINE([RUN_FROM_SOURCE], [1], | |||
[Define if ZNC should be runnable without installation]) | |||
fi | |||
RUNFROMSOURCE="$enableval"], | |||
[RUNFROMSOURCE="no"]) | |||
AC_ARG_ENABLE( [poll], | |||
AS_HELP_STRING([--disable-poll], [use select() instead of poll()]), | |||
[POLL="$enableval"], | |||
[POLL="yes"]) | |||
AC_ARG_WITH( [gtest], | |||
AS_HELP_STRING([--with-gtest=DIR], [Path to directory with src/gtest-all.cc file. | |||
If not specified, git submodule will be used. | |||
If it is not available either, "make test" will fail.])) | |||
if test "x$with_gtest" != xno; then | |||
AC_SUBST([GTEST_DIR], [$with_gtest]) | |||
fi | |||
AC_ARG_WITH([gmock], | |||
AS_HELP_STRING([--with-gmock=DIR], [Path to directory with src/gmock-all.cc and src/gmock_main.cc files. | |||
If not specified, git submodule will be used. | |||
If it is not available either, "make test" will fail.])) | |||
if test "x$with_gmock" != xno; then | |||
AC_SUBST([GMOCK_DIR], [$with_gmock]) | |||
fi | |||
AC_ARG_WITH([systemdsystemunitdir], | |||
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), | |||
[ | |||
if test x"$with_systemdsystemunitdir" = xyes; then | |||
with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) | |||
fi | |||
]) | |||
if test "x$with_systemdsystemunitdir" != xno; then | |||
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) | |||
fi | |||
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) | |||
case "${host_os}" in | |||
freebsd*) | |||
# -D__GNU_LIBRARY__ makes this work on fbsd 4.11 | |||
appendCXX -I/usr/local/include -D__GNU_LIBRARY__ | |||
appendLib -L/usr/local/lib -lcompat | |||
appendMod -L/usr/local/lib | |||
;; | |||
solaris*) | |||
appendLib -lsocket -lnsl -lresolv | |||
ISSUN=1 | |||
;; | |||
cygwin) | |||
# We don't want to use -std=gnu++11 instead of -std=c++11, but among other things, -std=c++11 defines __STRICT_ANSI__ which makes cygwin not to compile: undefined references to strerror_r, to fdopen, to strcasecmp, etc (their declarations in system headers are between ifdef) | |||
appendCXX -U__STRICT_ANSI__ | |||
ISCYGWIN=1 | |||
;; | |||
darwin*) | |||
ISDARWIN=1 | |||
AC_PATH_PROG([BREW], [brew]) | |||
if test -n "$BREW"; then | |||
# add default homebrew paths | |||
if test "x$HAVE_ICU" != "xno"; then | |||
AC_MSG_CHECKING([icu4c via homebrew]) | |||
icu4c_prefix=`$BREW --prefix icu4c` | |||
if test -n "$icu4c_prefix"; then | |||
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$icu4c_prefix/lib/pkgconfig" | |||
AC_MSG_RESULT([$icu4c_prefix]) | |||
else | |||
AC_MSG_RESULT([no]) | |||
fi | |||
fi | |||
if test "x$PYTHON" != "xno"; then | |||
brew_python_pc="$PYTHON" | |||
# This is duplication of non-darwin python logic below... | |||
if test "x$brew_python_pc" = "xyes"; then | |||
brew_python_pc="python3" | |||
fi | |||
AC_MSG_CHECKING([python3 via homebrew]) | |||
python3_prefix=`$BREW --prefix python3` | |||
if test -n "$python3_prefix"; then | |||
python3_prefix=`find "$python3_prefix/" -name $brew_python_pc.pc | head -n1` | |||
if test -n "$python3_prefix"; then | |||
python3_prefix=`dirname "$python3_prefix"` | |||
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$python3_prefix" | |||
AC_MSG_RESULT([$python3_prefix]) | |||
else | |||
AC_MSG_RESULT([no $brew_python_pc.pc found]) | |||
fi | |||
else | |||
AC_MSG_RESULT([no]) | |||
fi | |||
fi | |||
if test "x$SSL" != "xno"; then | |||
AC_MSG_CHECKING([openssl via homebrew]) | |||
openssl_prefix=`$BREW --prefix openssl` | |||
if test -n "$openssl_prefix"; then | |||
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$openssl_prefix/lib/pkgconfig" | |||
AC_MSG_RESULT([$openssl_prefix]) | |||
else | |||
AC_MSG_RESULT([no]) | |||
fi | |||
fi | |||
fi | |||
;; | |||
esac | |||
if test "$DEBUG" != "no"; then | |||
appendCXX -ggdb3 | |||
AC_DEFINE([_DEBUG], [1], [Define for debugging]) | |||
if test "x$ISCYGWIN" != x1; then | |||
# These enable some debug options in g++'s STL, e.g. invalid use of iterators | |||
# But they cause crashes on cygwin while loading modules | |||
AC_DEFINE([_GLIBCXX_DEBUG], [1], [Enable extra debugging checks in libstdc++]) | |||
AC_DEFINE([_GLIBCXX_DEBUG_PEDANTIC], [1], [Enable extra debugging checks in libstdc++]) | |||
fi | |||
else | |||
if test "x$OPTIMIZE" = "xyes"; then | |||
appendCXX -O2 | |||
# In old times needed to define _FORTIFY_SOURCE to 2 ourself. | |||
# Then GCC started to define it itself to 2. It was ok. | |||
# But then GCC 4.7 started to define it to 0 or 2 depending on optimization level, and it started to conflict with our define. | |||
AC_MSG_CHECKING([whether compiler predefines _FORTIFY_SOURCE]) | |||
AC_COMPILE_IFELSE([ | |||
AC_LANG_PROGRAM([[ | |||
]], [[ | |||
#ifndef _FORTIFY_SOURCE | |||
#error "Just checking, nothing fatal here" | |||
#endif | |||
]]) | |||
], [ | |||
AC_MSG_RESULT([yes]) | |||
], [ | |||
AC_MSG_RESULT([no]) | |||
appendCXX "-D_FORTIFY_SOURCE=2" | |||
]) | |||
fi | |||
fi | |||
if test "$IPV6" != "no"; then | |||
AC_DEFINE([HAVE_IPV6], [1], [Define if IPv6 support is enabled]) | |||
fi | |||
if test "x$GXX" = "xyes"; then | |||
appendCXX -Wall -W -Wno-unused-parameter -Woverloaded-virtual -Wshadow | |||
fi | |||
if test "$POLL" = "yes"; then | |||
# poll() is broken on Mac OS, it fails with POLLNVAL for pipe()s. | |||
if test -n "$ISDARWIN" | |||
then | |||
# Did they give us --enable-poll? | |||
if test -n "$enable_poll" | |||
then | |||
# Yes, they asked for this. | |||
AC_MSG_WARN([poll() is known to be broken on Mac OS X. You have been warned.]) | |||
else | |||
# No, our default value of "yes" got applied. | |||
AC_MSG_WARN([poll() is known to be broken on Mac OS X. Using select() instead.]) | |||
AC_MSG_WARN([Use --enable-poll for forcing poll() to be used.]) | |||
POLL=no | |||
fi | |||
fi | |||
if test "$POLL" = "yes"; then | |||
AC_DEFINE([CSOCK_USE_POLL], [1], [Use poll() instead of select()]) | |||
fi | |||
fi | |||
AC_CHECK_LIB( gnugetopt, getopt_long,) | |||
AC_CHECK_FUNCS([lstat getopt_long getpassphrase clock_gettime tcsetattr]) | |||
# ----- Check for dlopen | |||
AC_SEARCH_LIBS([dlopen], [dl], [], | |||
[AC_MSG_ERROR([Could not find dlopen. ZNC will not work on this box until you upgrade this ancient system or at least install the necessary system libraries.])]) | |||
# ----- Check for pthreads | |||
AX_PTHREAD([ | |||
AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.]) | |||
appendCXX "$PTHREAD_CFLAGS" | |||
appendLib "$PTHREAD_LIBS" | |||
], [ | |||
AC_MSG_ERROR([This compiler/OS doesn't seem to support pthreads.]) | |||
]) | |||
# Note that old broken systems, such as OpenBSD, NetBSD, which don't support AI_ADDRCONFIG, also have thread-unsafe getaddrinfo(). | |||
# Gladly, they fixed thread-safety before support of AI_ADDRCONFIG, so this can be abused to detect the thread-safe getaddrinfo(). | |||
# | |||
# TODO: drop support of blocking DNS at some point. OpenBSD supports AI_ADDRCONFIG since Nov 2014, and their getaddrinfo() is thread-safe since Nov 2013. NetBSD's one is thread-safe since ages ago. | |||
DNS_TEXT=blocking | |||
if test "x$TDNS" != "xno"; then | |||
old_TDNS=$TDNS | |||
AC_MSG_CHECKING([whether getaddrinfo() supports AI_ADDRCONFIG]) | |||
AC_COMPILE_IFELSE([ | |||
AC_LANG_PROGRAM([[ | |||
#include <sys/types.h> | |||
#include <sys/socket.h> | |||
#include <netdb.h> | |||
]], [[ | |||
int x = AI_ADDRCONFIG; | |||
(void) x; | |||
]]) | |||
], [ | |||
AC_MSG_RESULT([yes]) | |||
TDNS=yes | |||
], [ | |||
AC_MSG_RESULT([no]) | |||
TDNS=no | |||
]) | |||
if test "x$TDNS" = "xyes"; then | |||
DNS_TEXT=threads | |||
AC_DEFINE([HAVE_THREADED_DNS], [1], [Define if threaded DNS is enabled]) | |||
else | |||
ZNC_AUTO_FAIL([TDNS], | |||
[support for threaded DNS not found. Try --disable-tdns. | |||
Disabling it may result in a slight performance decrease but will not have any other side-effects], | |||
[support for threaded DNS not found, so DNS resolving will be blocking]) | |||
fi | |||
fi | |||
# ----- Check for openssl | |||
SSL_TEXT="$SSL" | |||
if test "x$SSL" != "xno"; then | |||
old_SSL=$SSL | |||
PKG_CHECK_MODULES([openssl], [openssl], [ | |||
appendLib "$openssl_LIBS" | |||
appendCXX "$openssl_CFLAGS" | |||
], [ | |||
# Don't reorder this! | |||
# On some arches libssl depends on libcrypto without linking to it :( | |||
AC_CHECK_LIB( crypto, BIO_new,, SSL=no ; SSL_TEXT="no (libcrypt not found)" ) | |||
AC_CHECK_LIB( ssl, SSL_shutdown,, SSL=no ; SSL_TEXT="no (libssl not found)" ) | |||
]) | |||
if test "x$SSL" != "xno"; then | |||
AC_MSG_CHECKING([whether openssl is usable]) | |||
AC_LINK_IFELSE([ | |||
AC_LANG_PROGRAM([[ | |||
#include <openssl/ssl.h> | |||
#include <openssl/dh.h> | |||
]], [[ | |||
SSL_CTX* ctx = SSL_CTX_new(SSLv23_method()); | |||
SSL* ssl = SSL_new(ctx); | |||
DH* dh = DH_new(); | |||
DH_free(dh); | |||
SSL_free(ssl); | |||
SSL_CTX_free(ctx); | |||
]]) | |||
], [ | |||
AC_MSG_RESULT([yes]) | |||
], [ | |||
AC_MSG_RESULT([no]) | |||
SSL=no | |||
SSL_TEXT="no (openssl not usable)" | |||
]) | |||
fi | |||
if test "x$SSL" = "xno" ; then | |||
ZNC_AUTO_FAIL([SSL], | |||
[OpenSSL not found. Try --disable-openssl.], | |||
[OpenSSL was not found and thus disabled]) | |||
NOSSL=1 | |||
else | |||
AC_DEFINE([HAVE_LIBSSL], [1], [Define if openssl is enabled]) | |||
SSL=yes | |||
SSL_TEXT=yes | |||
fi | |||
else | |||
NOSSL=1 | |||
SSL_TEXT="no (explicitly disabled)" | |||
fi | |||
# ----- Check for zlib | |||
old_ZLIB="$ZLIB" | |||
ZLIB_TEXT="$ZLIB" | |||
if test "x$ZLIB" != "xno"; then | |||
AC_MSG_CHECKING([whether zlib is usable]) | |||
my_saved_LIBS="$LIBS" | |||
appendLib "-lz" | |||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |||
#include "zlib.h" | |||
]], [[ | |||
z_stream zs; | |||
(void) deflateInit2(&zs, 0, 0, 0, 0, 0); | |||
(void) deflate(&zs, 0); | |||
]]) | |||
], [ | |||
AC_MSG_RESULT([yes]) | |||
ZLIB=yes | |||
ZLIB_TEXT=yes | |||
], [ | |||
AC_MSG_RESULT([no]) | |||
ZLIB=no | |||
ZLIB_TEXT="no (libz not found)" | |||
]) | |||
if test "x$ZLIB" = "xno"; then | |||
ZNC_AUTO_FAIL([ZLIB], | |||
[zlib was not found. Try --disable-zlib], | |||
[zlib was not found and thus disabled]) | |||
LIBS="$my_saved_LIBS" | |||
else | |||
AC_DEFINE([HAVE_ZLIB], [1], [Define if zlib is available]) | |||
fi | |||
fi | |||
AC_ARG_ENABLE( [charset], | |||
AS_HELP_STRING([--disable-charset], [disable ICU support]), | |||
[HAVE_ICU="$enableval"], | |||
[HAVE_ICU="auto"]) | |||
if test "x$HAVE_ICU" != "xno" | |||
then | |||
old_HAVE_ICU="$HAVE_ICU" | |||
PKG_CHECK_MODULES([icu], [icu-uc], [ | |||
appendLib "$icu_LIBS" | |||
appendCXX "$icu_CFLAGS" | |||
HAVE_ICU=yes | |||
AC_DEFINE([HAVE_ICU], [1], [Enable ICU library for Unicode handling]) | |||
AC_DEFINE([U_USING_ICU_NAMESPACE], [0], [Do not clutter global namespace with ICU C++ stuff]) | |||
], [ | |||
ZNC_AUTO_FAIL([HAVE_ICU], | |||
[support for charset conversion not found. Try --disable-charset.], | |||
[support for charset conversion not found and thus disabled]) | |||
HAVE_ICU="no (icu-uc not found via pkg-config)" | |||
]) | |||
fi | |||
# For integration test only | |||
PKG_CHECK_MODULES([qt], [Qt5Network >= 5.4], [], [:]) | |||
AC_ARG_WITH( [module-prefix], | |||
AS_HELP_STRING([--with-module-prefix], [module object code [LIBDIR/znc]]), | |||
[MODDIR=$withval], | |||
[MODDIR="${libdir}/znc"] ) | |||
AC_ARG_WITH( [module-data-prefix], | |||
AS_HELP_STRING([--with-module-data-prefix=DIR], | |||
[static module data (webadmin skins) [DATADIR/znc]]), | |||
[DATADIR=$withval], | |||
[DATADIR="${datadir}/znc"] ) | |||
appendMod "$CXXFLAGS" | |||
appendMod "$CFLAG_VISIBILITY" | |||
if test -z "$ISSUN" -a -z "$ISDARWIN" -a -z "$ISCYGWIN"; then | |||
# This is an unknown compiler flag on some OS | |||
appendLD -Wl,--export-dynamic | |||
fi | |||
if test -z "$ISCYGWIN" ; then | |||
# cygwin doesn't need -fPIC, everything else does (for modules) | |||
# warning: -fPIC ignored for target (all code is position independent) | |||
appendMod -fPIC | |||
else | |||
# But cygwin does want most of ZNC in a shared lib | |||
# See https://cygwin.com/ml/cygwin-apps/2015-07/msg00108.html for the reasoning behind the name. | |||
LIBZNC="cygznc-${LIBZNC_VERSION}.dll" | |||
LIBZNCDIR="$bindir" | |||
# See above about __STRICT_ANSI__ | |||
qt_CFLAGS="$qt_CFLAGS -U__STRICT_ANSI__" | |||
fi | |||
if test -z "$ISDARWIN"; then | |||
MODLINK="-shared" | |||
else | |||
# Mac OS X differentiates between shared libs (-dynamiclib) | |||
# and loadable modules (-bundle). | |||
MODLINK="-bundle -flat_namespace -undefined suppress" | |||
# TODO test if -twolevel_namespace and/or | |||
# -undefined dynamic_lookup work | |||
# (dynamic_lookup might only work on 10.4 and later) | |||
fi | |||
if test "x$PERL" != xno -o "x$PYTHON" != xno; then | |||
old_USESWIG="$USESWIG" | |||
if test "x$USESWIG" != "xno"; then | |||
AC_PROG_SWIG([3.0.0]) | |||
test -z "$SWIG" && USESWIG=no | |||
if test "x$USESWIG" = xno -a "x$old_USESWIG" = yes; then | |||
AC_MSG_ERROR([Could not found appropriate SWIG installation. Check config.log for details.]) | |||
fi | |||
fi | |||
if test -r "$srcdir/modules/modperl/generated.tar.gz" -a -r "$srcdir/modules/modpython/generated.tar.gz"; then | |||
AC_MSG_NOTICE([modperl/modpython files are found, disabling SWIG]) | |||
USESWIG=no | |||
fi | |||
if test "x$USESWIG" = xno; then | |||
if test ! -r "$srcdir/modules/modperl/generated.tar.gz" -o ! -r "$srcdir/modules/modpython/generated.tar.gz"; then | |||
AC_MSG_ERROR([Can not build modperl/modpython. Either install SWIG, or build ZNC from a tarball, or disable modperl/modpython. Check config.log for details.]) | |||
else | |||
AC_MSG_NOTICE([modperl/modpython files are found, no SWIG needed]) | |||
fi | |||
USESWIG="not needed" | |||
SWIG="" | |||
else | |||
USESWIG=yes | |||
fi | |||
else | |||
if test "x$USESWIG" = "xyes"; then | |||
AC_MSG_WARN([swig is used only for perl and python, but both are disabled. Disabling swig.]) | |||
fi | |||
USESWIG='not needed' | |||
fi | |||
PERL_TEXT="$PERL" | |||
if test "x$PERL" != "xno"; then | |||
old_PERL="$PERL" | |||
AC_PATH_PROG([PERL_BINARY], [perl], []) | |||
if test -n "$PERL_BINARY" && eval "$PERL_BINARY -e'use 5.010'"; then | |||
my_saved_LDFLAGS="$LDFLAGS" | |||
appendLD `$PERL_BINARY -MExtUtils::Embed -e ccopts -e ldopts` | |||
AC_CHECK_LIB(perl, perl_alloc, | |||
[: No, we do not want autoconf to do sth automatically], | |||
PERL="no" ; PERL_TEXT="no (libperl not found)") | |||
LDFLAGS="$my_saved_LDFLAGS" | |||
else | |||
PERL="no" | |||
PERL_TEXT="no (perl binary not found or too old)" | |||
fi | |||
if test "x$PERL" = "xno"; then | |||
ZNC_AUTO_FAIL([PERL], | |||
[perl not found. Try --disable-perl.], | |||
[perl was not found and thus disabled]) | |||
PERL_BINARY="" | |||
else | |||
PERL="yes" | |||
PERL_TEXT="yes" | |||
fi | |||
fi | |||
PYTHON_TEXT="$PYTHON" | |||
if test "x$PYTHON" != "xno"; then | |||
# Default value for just --enable-python | |||
if test "x$PYTHON" = "xyes"; then | |||
PYTHON="python3" | |||
fi | |||
old_PYTHON="$PYTHON" | |||
if test -z "$PKG_CONFIG"; then | |||
AC_MSG_ERROR([pkg-config is required for modpython.]) | |||
fi | |||
PKG_CHECK_MODULES([python], [$PYTHON-embed >= 3.3],, [ | |||
PKG_CHECK_MODULES([python], [$PYTHON >= 3.3],, AC_MSG_ERROR([$PYTHON.pc not found or is wrong. Try --disable-python or install python3.])) | |||
]) | |||
my_saved_LIBS="$LIBS" | |||
my_saved_CXXFLAGS="$CXXFLAGS" | |||
appendLib $python_LIBS | |||
appendCXX $python_CFLAGS | |||
AC_CHECK_FUNC([Py_Initialize], [], [PYTHON="no" ; PYTHON_TEXT="no (libpython not found)"]) | |||
if test "x$PYTHON" != "xno"; then | |||
# Yes, modpython depends on perl. | |||
AC_PATH_PROG([PERL_BINARY], [perl]) | |||
if test -z "$PERL_BINARY"; then | |||
AC_MSG_ERROR([To compile modpython you need to be able to execute perl scripts. Try --disable-python or install perl.]) | |||
fi | |||
LIBS="$my_saved_LIBS" | |||
CXXFLAGS="$my_saved_CXXFLAGS" | |||
fi | |||
if test "x$HAVE_ICU" != "xyes"; then | |||
AC_MSG_ERROR([Modpython requires ZNC to be compiled with charset support, but ICU library not found. Try --disable-python or install libicu.]) | |||
fi | |||
if test "x$PYTHON" = "xno"; then | |||
ZNC_AUTO_FAIL([PYTHON], | |||
[python not found. Try --disable-python.], | |||
[python was not found and thus disabled]) | |||
PYTHONCFG_BINARY="" | |||
else | |||
PYTHON="yes" | |||
PYTHON_TEXT="yes" | |||
fi | |||
fi | |||
if test -n "$CYRUS"; then | |||
AC_CHECK_LIB( sasl2, sasl_server_init, | |||
[: Dont let autoconf add -lsasl2, Makefile handles that], | |||
AC_MSG_ERROR([could not find libsasl2. Try --disable-cyrus.])) | |||
fi | |||
# Check if we want modtcl | |||
AC_ARG_ENABLE( [tcl], | |||
AS_HELP_STRING([--enable-tcl], [enable modtcl]), | |||
[TCL="$enableval"], | |||
[TCL="no"]) | |||
AC_ARG_WITH( [tcl-flags], | |||
AS_HELP_STRING([--with-tcl-flags=FLAGS], | |||
[The flags needed for compiling and linking modtcl]), | |||
[TCL_FLAGS="$withval"],) | |||
if test x"$TCL" = "xyes" | |||
then | |||
AC_ARG_WITH( [tcl], | |||
AS_HELP_STRING([--with-tcl=DIR], | |||
[directory containing tclConfig.sh]), | |||
TCL_DIR="${withval}") | |||
# This will need to be extended in the future, but I don't think | |||
# it's a good idea to stuff a shitload of random stuff in here right now | |||
for path in $TCL_DIR /usr/lib /usr/lib/tcl8.4 /usr/lib/tcl8.5 /usr/lib/tcl8.6 | |||
do | |||
file="${path}/tclConfig.sh" | |||
AC_MSG_CHECKING([for ${file}]) | |||
if test -r ${file} | |||
then | |||
TCL_CONF=${file} | |||
AC_MSG_RESULT([yes]) | |||
break | |||
fi | |||
AC_MSG_RESULT([no]) | |||
done | |||
if test x"${TCL_CONF}" = x | |||
then | |||
# They --enable-tcl'd, so give them some sane default | |||
TCL_FLAGS="-I/usr/include/tcl -ltcl" | |||
AC_MSG_WARN([Could not find tclConfig.sh, using some sane defaults.]) | |||
else | |||
AC_MSG_CHECKING([modtcl flags]) | |||
. ${TCL_CONF} | |||
# eval because those vars depend on other vars in there | |||
eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" | |||
eval "TCL_INCLUDE_SPEC=\"${TCL_INCLUDE_SPEC}\"" | |||
TCL_FLAGS="$TCL_INCLUDE_SPEC $TCL_LIB_SPEC" | |||
AC_MSG_RESULT([$TCL_FLAGS]) | |||
fi | |||
my_saved_LIBS="$LIBS" | |||
appendLib "$TCL_FLAGS" | |||
AC_CHECK_FUNC([Tcl_CreateInterp], [TCL_TEST=yes], [TCL_TEST=no]) | |||
if test x"$TCL_TEST" = "xno"; then | |||
AC_MSG_ERROR([tcl not found, try --disable-tcl, or install tcl properly. If tcl is installed to a non-standard path, use --enable-tcl --with-tcl=/path]) | |||
fi | |||
LIBS="$my_saved_LIBS" | |||
fi | |||
AC_CACHE_CHECK([for GNU make], [ac_cv_path_GNUMAKE], [ | |||
AC_PATH_PROGS_FEATURE_CHECK([GNUMAKE], [make gmake], [[ | |||
if $ac_path_GNUMAKE --version | $GREP GNU > /dev/null; then | |||
ac_cv_path_GNUMAKE=$ac_path_GNUMAKE | |||
ac_path_GNUMAKE_found=: | |||
fi | |||
]], [AC_MSG_ERROR([could not find GNU make])] | |||
) | |||
]) | |||
GNUMAKE=`echo $ac_cv_path_GNUMAKE | $SED "s%.*/%%"` | |||
# this is in the end, for not trying to include it when it doesn't exist yet | |||
appendCXX "-include znc/zncconfig.h" | |||
appendMod "-include znc/zncconfig.h" | |||
AC_SUBST([CXXFLAGS]) | |||
AC_SUBST([CPPFLAGS]) | |||
AC_SUBST([MODFLAGS]) | |||
AC_SUBST([LDFLAGS]) | |||
AC_SUBST([LIBS]) | |||
AC_SUBST([LIBZNC]) | |||
AC_SUBST([LIBZNCDIR]) | |||
AC_SUBST([ISCYGWIN]) | |||
AC_SUBST([MODLINK]) | |||
AC_SUBST([NOSSL]) | |||
AC_SUBST([TCL_FLAGS]) | |||
AC_SUBST([CYRUS]) | |||
AC_SUBST([MODDIR]) | |||
AC_SUBST([DATADIR]) | |||
AC_SUBST([PERL]) | |||
AC_SUBST([PYTHON]) | |||
AC_SUBST([SWIG]) | |||
AC_SUBST([python_CFLAGS]) | |||
AC_SUBST([python_LIBS]) | |||
AC_SUBST([qt_CFLAGS]) | |||
AC_SUBST([qt_LIBS]) | |||
AC_CONFIG_FILES([Makefile]) | |||
AC_CONFIG_FILES([znc-buildmod]) | |||
AC_CONFIG_FILES([man/Makefile]) | |||
AC_CONFIG_FILES([znc.pc]) | |||
AC_CONFIG_FILES([znc-uninstalled.pc]) | |||
AC_CONFIG_FILES([modules/Makefile]) | |||
AC_OUTPUT | |||
if test "x$ISCYGWIN" = x1; then | |||
# Side effect of undefining __STRICT_ANSI__ | |||
# http://llvm.org/bugs/show_bug.cgi?id=13530 | |||
echo >> include/znc/zncconfig.h | |||
echo '#ifndef ZNCCONFIG_H_ADDITIONS' >> include/znc/zncconfig.h | |||
echo '#define ZNCCONFIG_H_ADDITIONS' >> include/znc/zncconfig.h | |||
echo '#ifdef __clang__' >> include/znc/zncconfig.h | |||
echo 'struct __float128;' >> include/znc/zncconfig.h | |||
echo '#endif' >> include/znc/zncconfig.h | |||
echo '#endif' >> include/znc/zncconfig.h | |||
fi | |||
echo | |||
echo ZNC AC_PACKAGE_VERSION configured | |||
echo | |||
echo "The configure script is deprecated and will be removed from ZNC" | |||
echo "in some future version. Use either CMake or the convenience wrapper" | |||
echo "configure.sh which takes the same parameters as configure." | |||
echo | |||
echo "prefix: $prefix" | |||
echo "debug: $DEBUG" | |||
echo "ipv6: $IPV6" | |||
echo "openssl: $SSL_TEXT" | |||
echo "dns: $DNS_TEXT" | |||
echo "perl: $PERL_TEXT" | |||
echo "python: $PYTHON_TEXT" | |||
echo "swig: $USESWIG" | |||
if test x"$CYRUS" = "x" ; then | |||
echo "cyrus: no" | |||
else | |||
echo "cyrus: yes" | |||
fi | |||
if test x"$TCL_FLAGS" = "x" ; then | |||
echo "tcl: no" | |||
else | |||
echo "tcl: yes" | |||
fi | |||
echo "charset: $HAVE_ICU" | |||
echo "zlib: $ZLIB_TEXT" | |||
echo "run from src: $RUNFROMSOURCE" | |||
echo | |||
echo "Now you can run \"$GNUMAKE\" to compile ZNC" | |||
@ -1,5 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<error> | |||
<code>8</code> | |||
<message>File was not found</message> | |||
</error> |
@ -1,210 +0,0 @@ | |||
dnl @synopsis AC_PROG_SWIG([major.minor.micro]) | |||
dnl | |||
dnl NOTICE: for new code, use http://www.gnu.org/s/autoconf-archive/ax_pkg_swig.html instead. | |||
dnl | |||
dnl This macro searches for a SWIG installation on your system. If | |||
dnl found you should call SWIG via $(SWIG). You can use the optional | |||
dnl first argument to check if the version of the available SWIG is | |||
dnl greater than or equal to the value of the argument. It should have | |||
dnl the format: N[.N[.N]] (N is a number between 0 and 999. Only the | |||
dnl first N is mandatory.) | |||
dnl | |||
dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks | |||
dnl that the swig package is this version number or higher. | |||
dnl | |||
dnl In configure.in, use as: | |||
dnl | |||
dnl AC_PROG_SWIG(1.3.17) | |||
dnl SWIG_ENABLE_CXX | |||
dnl SWIG_MULTI_MODULE_SUPPORT | |||
dnl SWIG_PYTHON | |||
dnl | |||
dnl @category InstalledPackages | |||
dnl @author Sebastian Huber <sebastian-huber@web.de> | |||
dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca> | |||
dnl @author Rafael Laboissiere <rafael@laboissiere.net> | |||
dnl @author Andrew Collier <abcollier@yahoo.com> | |||
dnl @version 2004-09-20 | |||
dnl | |||
dnl Modified by Alexey Sokolov <alexey@asokolov.org> on 2012-08-08 | |||
dnl @license GPLWithACException | |||
dnl | |||
dnl NOTICE: for new code, use http://www.gnu.org/s/autoconf-archive/ax_pkg_swig.html instead. | |||
AC_DEFUN([AC_PROG_SWIG],[ | |||
SWIG_ERROR="" | |||
if test -n "$1"; then | |||
# Calculate the required version number components | |||
[required=$1] | |||
[required_major=`echo $required | sed 's/[^0-9].*//'`] | |||
if test -z "$required_major" ; then | |||
[required_major=0] | |||
fi | |||
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`] | |||
[required_minor=`echo $required | sed 's/[^0-9].*//'`] | |||
if test -z "$required_minor" ; then | |||
[required_minor=0] | |||
fi | |||
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`] | |||
[required_patch=`echo $required | sed 's/[^0-9].*//'`] | |||
if test -z "$required_patch" ; then | |||
[required_patch=0] | |||
fi | |||
fi | |||
# for "python 3 abc set" and "PyInt_FromSize_t in python3" checks | |||
cat <<-END > conftest-python.i | |||
%module conftest; | |||
%include <pyabc.i> | |||
%include <std_set.i> | |||
%template(SInt) std::set<int>; | |||
END | |||
# check if perl has std::...::size_type defined. Don't add new tests to this .i; it'll break this test due to check for "NewPointerObj((" | |||
cat <<-END > conftest-perl.i | |||
%module conftest; | |||
%include <std_vector.i> | |||
%include <std_list.i> | |||
%include <std_deque.i> | |||
%template() std::vector<int>; | |||
%template() std::list<int>; | |||
%template() std::deque<int>; | |||
std::vector<int>::size_type checkVector(); | |||
std::list<int>::size_type checkList(); | |||
std::deque<int>::size_type checkDeque(); | |||
END | |||
SWIG_installed_versions="" | |||
AC_CACHE_CHECK([for SWIG >= $1], [znc_cv_path_SWIG], [ | |||
AC_PATH_PROGS_FEATURE_CHECK([SWIG], [swig swig2.0 swig3.0], [ | |||
echo trying $ac_path_SWIG >&AS_MESSAGE_LOG_FD | |||
$ac_path_SWIG -version >&AS_MESSAGE_LOG_FD | |||
[swig_version=`$ac_path_SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] | |||
if test -n "$swig_version"; then | |||
swig_right_version=1 | |||
SWIG_installed_versions="$SWIG_installed_versions $swig_version " | |||
if test -n "$required"; then | |||
# Calculate the available version number components | |||
[available=$swig_version] | |||
[available_major=`echo $available | sed 's/[^0-9].*//'`] | |||
if test -z "$available_major" ; then | |||
[available_major=0] | |||
fi | |||
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`] | |||
[available_minor=`echo $available | sed 's/[^0-9].*//'`] | |||
if test -z "$available_minor" ; then | |||
[available_minor=0] | |||
fi | |||
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`] | |||
[available_patch=`echo $available | sed 's/[^0-9].*//'`] | |||
if test -z "$available_patch" ; then | |||
[available_patch=0] | |||
fi | |||
if test $available_major -lt $required_major; then | |||
swig_right_version=0 | |||
elif test $available_major -eq $required_major; then | |||
if test $available_minor -lt $required_minor; then | |||
swig_right_version=0 | |||
elif test $available_minor -eq $required_minor; then | |||
if test $available_patch -lt $required_patch; then | |||
swig_right_version=0 | |||
fi | |||
fi | |||
fi | |||
fi | |||
if test $swig_right_version -eq 1; then | |||
# "python 3 abc set", "PyInt_FromSize_t in python3" and "perl size_type" checks | |||
echo "checking behavior of this SWIG" >&AS_MESSAGE_LOG_FD | |||
$ac_path_SWIG -python -py3 -c++ -shadow conftest-python.i >&AS_MESSAGE_LOG_FD && \ | |||
echo "python wrapper created" >&AS_MESSAGE_LOG_FD && \ | |||
echo "testing std::set... ">&AS_MESSAGE_LOG_FD && \ | |||
grep SInt_discard conftest.py > /dev/null 2>&1 && \ | |||
echo "std::set works" >&AS_MESSAGE_LOG_FD && \ | |||
echo "testing PyInt_FromSize_t..." >&AS_MESSAGE_LOG_FD && \ | |||
grep '#define PyInt_FromSize_t' conftest-python_wrap.cxx > /dev/null 2>&1 && \ | |||
echo "PyInt_FromSize_t is defined" >&AS_MESSAGE_LOG_FD && \ | |||
$ac_path_SWIG -perl -c++ -shadow conftest-perl.i >&AS_MESSAGE_LOG_FD && \ | |||
echo "perl wrapper created" >&AS_MESSAGE_LOG_FD && \ | |||
echo "testing size_type..." >&AS_MESSAGE_LOG_FD && \ | |||
test 0 -eq `grep -c 'NewPointerObj((' conftest-perl_wrap.cxx` && \ | |||
echo "size_type work" >&AS_MESSAGE_LOG_FD && \ | |||
znc_cv_path_SWIG=$ac_path_SWIG \ | |||
ac_path_SWIG_found=: | |||
if test "x$ac_path_SWIG_found" != "x:"; then | |||
echo "fail" >&AS_MESSAGE_LOG_FD | |||
fi | |||
rm -f conftest-python_wrap.cxx conftest.py | |||
rm -f conftest-perl_wrap.cxx conftest.pm | |||
else | |||
echo "SWIG version >= $1 is required. You have '$swig_version'" >&AS_MESSAGE_LOG_FD | |||
fi | |||
fi | |||
echo end trying $ac_path_SWIG >&AS_MESSAGE_LOG_FD | |||
]) | |||
]) | |||
rm -f conftest-python.i conftest-perl.i | |||
if test -n "$SWIG_installed_versions"; then | |||
AC_MSG_NOTICE([Following SWIG versions are found:$SWIG_installed_versions]) | |||
fi | |||
AC_SUBST([SWIG], [$znc_cv_path_SWIG]) | |||
if test -n "$SWIG"; then | |||
SWIG_LIB=`$SWIG -swiglib` | |||
fi | |||
AC_SUBST([SWIG_LIB]) | |||
]) | |||
# SWIG_ENABLE_CXX() | |||
# | |||
# Enable SWIG C++ support. This affects all invocations of $(SWIG). | |||
AC_DEFUN([SWIG_ENABLE_CXX],[ | |||
AC_REQUIRE([AC_PROG_SWIG]) | |||
AC_REQUIRE([AC_PROG_CXX]) | |||
SWIG="$SWIG -c++" | |||
]) | |||
# SWIG_MULTI_MODULE_SUPPORT() | |||
# | |||
# Enable support for multiple modules. This effects all invocations | |||
# of $(SWIG). You have to link all generated modules against the | |||
# appropriate SWIG runtime library. If you want to build Python | |||
# modules for example, use the SWIG_PYTHON() macro and link the | |||
# modules against $(SWIG_PYTHON_LIBS). | |||
# | |||
AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[ | |||
AC_REQUIRE([AC_PROG_SWIG]) | |||
SWIG="$SWIG -noruntime" | |||
]) | |||
# SWIG_PYTHON([use-shadow-classes = {no, yes}]) | |||
# | |||
# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS), | |||
# and $(SWIG_PYTHON_OPT) output variables. | |||
# | |||
# $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate | |||
# code for Python. Shadow classes are enabled unless the value of the | |||
# optional first argument is exactly 'no'. If you need multi module | |||
# support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use | |||
# $(SWIG_PYTHON_LIBS) to link against the appropriate library. It | |||
# contains the SWIG Python runtime library that is needed by the type | |||
# check system for example. | |||
AC_DEFUN([SWIG_PYTHON],[ | |||
AC_REQUIRE([AC_PROG_SWIG]) | |||
AC_REQUIRE([AC_PYTHON_DEVEL]) | |||
test "x$1" != "xno" || swig_shadow=" -noproxy" | |||
AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow]) | |||
AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS]) | |||
]) | |||
@ -1,169 +0,0 @@ | |||
# ============================================================================ | |||
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html | |||
# ============================================================================ | |||
# | |||
# SYNOPSIS | |||
# | |||
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) | |||
# | |||
# DESCRIPTION | |||
# | |||
# Check for baseline language coverage in the compiler for the C++11 | |||
# standard; if necessary, add switches to CXXFLAGS to enable support. | |||
# | |||
# The first argument, if specified, indicates whether you insist on an | |||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. | |||
# -std=c++11). If neither is specified, you get whatever works, with | |||
# preference for an extended mode. | |||
# | |||
# The second argument, if specified 'mandatory' or if left unspecified, | |||
# indicates that baseline C++11 support is required and that the macro | |||
# should error out if no mode with that support is found. If specified | |||
# 'optional', then configuration proceeds regardless, after defining | |||
# HAVE_CXX11 if and only if a supporting mode is found. | |||
# | |||
# LICENSE | |||
# | |||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> | |||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com> | |||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> | |||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> | |||
# | |||
# Copying and distribution of this file, with or without modification, are | |||
# permitted in any medium without royalty provided the copyright notice | |||
# and this notice are preserved. This file is offered as-is, without any | |||
# warranty. | |||
#serial 5 | |||
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ | |||
#include <map> | |||
template <typename T> | |||
struct check | |||
{ | |||
static_assert(sizeof(int) <= sizeof(T), "not big enough"); | |||
}; | |||
struct Base { | |||
virtual void f() {} | |||
}; | |||
struct Child : public Base { | |||
virtual void f() override {} | |||
}; | |||
typedef check<check<bool>> right_angle_brackets; | |||
int a; | |||
decltype(a) b; | |||
typedef check<int> check_type; | |||
check_type c; | |||
check_type&& cr = static_cast<check_type&&>(c); | |||
auto d = a; | |||
auto l = [](){}; | |||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae | |||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this | |||
namespace test_template_alias_sfinae { | |||
struct foo {}; | |||
template<typename T> | |||
using member = typename T::member_type; | |||
template<typename T> | |||
void func(...) {} | |||
template<typename T> | |||
void func(member<T>*) {} | |||
void test(); | |||
void test() { | |||
func<foo>(0); | |||
} | |||
} | |||
void test_map() { | |||
std::map<int, int> m; | |||
m.emplace(2, 4); | |||
} | |||
]]) | |||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl | |||
m4_if([$1], [], [], | |||
[$1], [ext], [], | |||
[$1], [noext], [], | |||
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl | |||
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], | |||
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true], | |||
[$2], [optional], [ax_cxx_compile_cxx11_required=false], | |||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) | |||
AC_LANG_PUSH([C++])dnl | |||
ac_success=no | |||
AC_CACHE_CHECK(whether $CXX supports C++11 features by default, | |||
ax_cv_cxx_compile_cxx11, | |||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], | |||
[ax_cv_cxx_compile_cxx11=yes], | |||
[ax_cv_cxx_compile_cxx11=no])]) | |||
if test x$ax_cv_cxx_compile_cxx11 = xyes; then | |||
ac_success=yes | |||
fi | |||
m4_if([$1], [noext], [], [dnl | |||
if test x$ac_success = xno; then | |||
for switch in -std=gnu++11 -std=gnu++0x; do | |||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) | |||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, | |||
$cachevar, | |||
[ac_save_CXXFLAGS="$CXXFLAGS" | |||
CXXFLAGS="$CXXFLAGS $switch" | |||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], | |||
[eval $cachevar=yes], | |||
[eval $cachevar=no]) | |||
CXXFLAGS="$ac_save_CXXFLAGS"]) | |||
if eval test x\$$cachevar = xyes; then | |||
CXXFLAGS="$CXXFLAGS $switch" | |||
ac_success=yes | |||
break | |||
fi | |||
done | |||
fi]) | |||
m4_if([$1], [ext], [], [dnl | |||
if test x$ac_success = xno; then | |||
for switch in -std=c++11 -std=c++0x; do | |||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) | |||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, | |||
$cachevar, | |||
[ac_save_CXXFLAGS="$CXXFLAGS" | |||
CXXFLAGS="$CXXFLAGS $switch" | |||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], | |||
[eval $cachevar=yes], | |||
[eval $cachevar=no]) | |||
CXXFLAGS="$ac_save_CXXFLAGS"]) | |||
if eval test x\$$cachevar = xyes; then | |||
CXXFLAGS="$CXXFLAGS $switch" | |||
ac_success=yes | |||
break | |||
fi | |||
done | |||
fi]) | |||
AC_LANG_POP([C++]) | |||
if test x$ax_cxx_compile_cxx11_required = xtrue; then | |||
if test x$ac_success = xno; then | |||
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) | |||
fi | |||
else | |||
if test x$ac_success = xno; then | |||
HAVE_CXX11=0 | |||
AC_MSG_NOTICE([No compiler with C++11 support was found]) | |||
else | |||
HAVE_CXX11=1 | |||
AC_DEFINE(HAVE_CXX11,1, | |||
[define if the compiler supports basic C++11 syntax]) | |||
fi | |||
AC_SUBST(HAVE_CXX11) | |||
fi | |||
]) |
@ -1,310 +0,0 @@ | |||
# =========================================================================== | |||
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html | |||
# =========================================================================== | |||
# | |||
# SYNOPSIS | |||
# | |||
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | |||
# | |||
# DESCRIPTION | |||
# | |||
# This macro figures out how to build C programs using POSIX threads. It | |||
# sets the PTHREAD_LIBS output variable to the threads library and linker | |||
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler | |||
# flags that are needed. (The user can also force certain compiler | |||
# flags/libs to be tested by setting these environment variables.) | |||
# | |||
# Also sets PTHREAD_CC to any special C compiler that is needed for | |||
# multi-threaded programs (defaults to the value of CC otherwise). (This | |||
# is necessary on AIX to use the special cc_r compiler alias.) | |||
# | |||
# NOTE: You are assumed to not only compile your program with these flags, | |||
# but also link it with them as well. e.g. you should link with | |||
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS | |||
# | |||
# If you are only building threads programs, you may wish to use these | |||
# variables in your default LIBS, CFLAGS, and CC: | |||
# | |||
# LIBS="$PTHREAD_LIBS $LIBS" | |||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | |||
# CC="$PTHREAD_CC" | |||
# | |||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant | |||
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name | |||
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). | |||
# | |||
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the | |||
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with | |||
# PTHREAD_CFLAGS. | |||
# | |||
# ACTION-IF-FOUND is a list of shell commands to run if a threads library | |||
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it | |||
# is not found. If ACTION-IF-FOUND is not specified, the default action | |||
# will define HAVE_PTHREAD. | |||
# | |||
# Please let the authors know if this macro fails on any platform, or if | |||
# you have any other suggestions or comments. This macro was based on work | |||
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help | |||
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by | |||
# Alejandro Forero Cuervo to the autoconf macro repository. We are also | |||
# grateful for the helpful feedback of numerous users. | |||
# | |||
# Updated for Autoconf 2.68 by Daniel Richard G. | |||
# | |||
# LICENSE | |||
# | |||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> | |||
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG> | |||
# | |||
# This program is free software: you can redistribute it and/or modify it | |||
# under the terms of the GNU General Public License as published by the | |||
# Free Software Foundation, either version 3 of the License, or (at your | |||
# option) any later version. | |||
# | |||
# This program is distributed in the hope that it will be useful, but | |||
# WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |||
# Public License for more details. | |||
# | |||
# You should have received a copy of the GNU General Public License along | |||
# with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | |||
# As a special exception, the respective Autoconf Macro's copyright owner | |||
# gives unlimited permission to copy, distribute and modify the configure | |||
# scripts that are the output of Autoconf when processing the Macro. You | |||
# need not follow the terms of the GNU General Public License when using | |||
# or distributing such scripts, even though portions of the text of the | |||
# Macro appear in them. The GNU General Public License (GPL) does govern | |||
# all other use of the material that constitutes the Autoconf Macro. | |||
# | |||
# This special exception to the GPL applies to versions of the Autoconf | |||
# Macro released by the Autoconf Archive. When you make and distribute a | |||
# modified version of the Autoconf Macro, you may extend this special | |||
# exception to the GPL to apply to your modified version as well. | |||
#serial 17 | |||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) | |||
AC_DEFUN([AX_PTHREAD], [ | |||
AC_REQUIRE([AC_CANONICAL_HOST]) | |||
AC_LANG_PUSH([C++]) | |||
ax_pthread_ok=no | |||
# We used to check for pthread.h first, but this fails if pthread.h | |||
# requires special compiler flags (e.g. on True64 or Sequent). | |||
# It gets checked for in the link test anyway. | |||
# First of all, check if the user has set any of the PTHREAD_LIBS, | |||
# etcetera environment variables, and if threads linking works using | |||
# them: | |||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then | |||
save_CXXFLAGS="$CXXFLAGS" | |||
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" | |||
save_LIBS="$LIBS" | |||
LIBS="$PTHREAD_LIBS $LIBS" | |||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CXXFLAGS=$PTHREAD_CFLAGS]) | |||
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) | |||
AC_MSG_RESULT($ax_pthread_ok) | |||
if test x"$ax_pthread_ok" = xno; then | |||
PTHREAD_LIBS="" | |||
PTHREAD_CFLAGS="" | |||
fi | |||
LIBS="$save_LIBS" | |||
CXXFLAGS="$save_CXXFLAGS" | |||
fi | |||
# We must check for the threads library under a number of different | |||
# names; the ordering is very important because some systems | |||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the | |||
# libraries is broken (non-POSIX). | |||
# Create a list of thread flags to try. Items starting with a "-" are | |||
# C compiler flags, and other items are library names, except for "none" | |||
# which indicates that we try without any flags at all, and "pthread-config" | |||
# which is a program returning the flags for the Pth emulation library. | |||
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" | |||
# The ordering *is* (sometimes) important. Some notes on the | |||
# individual items follow: | |||
# pthreads: AIX (must check this before -lpthread) | |||
# none: in case threads are in libc; should be tried before -Kthread and | |||
# other compiler flags to prevent continual compiler warnings | |||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) | |||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) | |||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) | |||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) | |||
# -pthreads: Solaris/gcc | |||
# -mthreads: Mingw32/gcc, Lynx/gcc | |||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it | |||
# doesn't hurt to check since this sometimes defines pthreads too; | |||
# also defines -D_REENTRANT) | |||
# ... -mt is also the pthreads flag for HP/aCC | |||
# pthread: Linux, etcetera | |||
# --thread-safe: KAI C++ | |||
# pthread-config: use pthread-config program (for GNU Pth library) | |||
case "${host_cpu}-${host_os}" in | |||
*solaris*) | |||
# On Solaris (at least, for some versions), libc contains stubbed | |||
# (non-functional) versions of the pthreads routines, so link-based | |||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/ | |||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather | |||