mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 05:33:01 +01:00
Merge pull request #149 from Ansa89/without-autotools
Remove autotools dependency
This commit is contained in:
commit
4cf545d334
39
.travis.yml
39
.travis.yml
@ -4,56 +4,45 @@ compiler:
|
||||
- clang
|
||||
|
||||
before_script:
|
||||
#installing libsodium, needed for Core
|
||||
# Installing yasm (needed for compiling vpx) and openal
|
||||
- sudo apt-get -yq install yasm libopenal-dev
|
||||
# Installing libsodium, needed for toxcore
|
||||
- git clone git://github.com/jedisct1/libsodium.git > /dev/null
|
||||
- cd libsodium
|
||||
- git checkout tags/0.4.2 > /dev/null
|
||||
- ./autogen.sh > /dev/null
|
||||
- ./configure > /dev/null
|
||||
- make check -j3 > /dev/null
|
||||
- make check -j2 || make check || exit 1 > /dev/null
|
||||
- sudo make install > /dev/null
|
||||
- cd ..
|
||||
#installing yasm, needed for compiling vpx
|
||||
- sudo apt-get install yasm > /dev/null
|
||||
#installing libconfig, needed for DHT_bootstrap_daemon
|
||||
- wget http://www.hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz > /dev/null
|
||||
- tar -xvzf libconfig-1.4.9.tar.gz > /dev/null
|
||||
- cd libconfig-1.4.9
|
||||
- ./configure > /dev/null
|
||||
- make -j3 > /dev/null
|
||||
- sudo make install > /dev/null
|
||||
- cd ..
|
||||
#installing libopus, needed for audio encoding/decoding
|
||||
# Installing libopus, needed for audio encoding/decoding
|
||||
- wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz > /dev/null
|
||||
- tar xzf opus-1.0.3.tar.gz > /dev/null
|
||||
- cd opus-1.0.3
|
||||
- ./configure > /dev/null
|
||||
- make -j3 > /dev/null
|
||||
- make -j2 || make || exit 1 > /dev/null
|
||||
- sudo make install > /dev/null
|
||||
- cd ..
|
||||
#installing vpx
|
||||
# Installing vpx
|
||||
- git clone http://git.chromium.org/webm/libvpx.git > /dev/null
|
||||
- cd libvpx
|
||||
- ./configure --enable-shared > /dev/null
|
||||
- make -j3 >/dev/null
|
||||
- make -j2 || make || exit 1 > /dev/null
|
||||
- sudo make install > /dev/null
|
||||
- cd ..
|
||||
#creating libraries links and updating cache
|
||||
# Creating libraries links and updating cache
|
||||
- sudo ldconfig > /dev/null
|
||||
# creating librarys' links and updating cache
|
||||
- sudo ldconfig
|
||||
- git clone https://github.com/irungentoo/ProjectTox-Core.git toxcore
|
||||
# Installing toxcore
|
||||
- git clone https://github.com/irungentoo/toxcore.git toxcore
|
||||
- cd toxcore
|
||||
- autoreconf -i
|
||||
- ./configure --disable-tests --disable-ntox --disable-daemon --enable-av
|
||||
- make -j2
|
||||
- make -j2 || make || exit 1
|
||||
- sudo make install
|
||||
- cd ..
|
||||
- sudo apt-get install libopenal-dev -yq
|
||||
script:
|
||||
- autoreconf -i
|
||||
- ./configure
|
||||
- make -j2
|
||||
- cd build
|
||||
- make -j2 || make || exit 1
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
SUBDIRS = build misc
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
100
build/Makefile
Normal file
100
build/Makefile
Normal file
@ -0,0 +1,100 @@
|
||||
TOXIC_VERSION = 0.4.2
|
||||
REV = $(shell git rev-list HEAD --count)
|
||||
VERSION = $(TOXIC_VERSION)_r$(REV)
|
||||
|
||||
LIBS = libtoxcore ncurses
|
||||
|
||||
CFLAGS ?= $(USER_CFLAGS) -DTOXICVER="\"$(VERSION)\"" -std=gnu99 -pthread
|
||||
LDFLAGS ?= $(USER_LDFLAGS)
|
||||
SRC_DIR = ../src
|
||||
DESTDIR ?= /usr/local
|
||||
|
||||
OBJ = chat.o chat_commands.o configdir.o dns.o execute.o
|
||||
OBJ += file_senders.o friendlist.o global_commands.o groupchat.o line_info.o
|
||||
OBJ += log.o misc_tools.o prompt.o settings.o toxic.o toxic_strings.o windows.o
|
||||
|
||||
# Variables for audio support
|
||||
AUDIO_LIBS = libtoxav openal
|
||||
AUDIO_CFLAGS = -D_SUPPORT_AUDIO
|
||||
AUDIO_OBJ = device.o audio_call.o
|
||||
|
||||
# Check on wich system we are running
|
||||
UNAME_S = $(shell uname -s)
|
||||
ifeq ($(UNAME_S), Linux)
|
||||
CFLAGS +=
|
||||
LDFLAGS += -ldl -lresolv
|
||||
endif
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
CFLAGS +=
|
||||
LDFLAGS +=
|
||||
endif
|
||||
ifeq ($(UNAME_S), Solaris)
|
||||
CFLAGS +=
|
||||
LDFLAGS +=
|
||||
endif
|
||||
|
||||
# Check on which platform we are running
|
||||
UNAME_M = $(shell uname -m)
|
||||
ifeq ($(UNAME_M), x86_64)
|
||||
CFLAGS +=
|
||||
LDFLAGS +=
|
||||
endif
|
||||
ifneq ($(filter %86, $(UNAME_M)),)
|
||||
CFLAGS +=
|
||||
LDFLAGS +=
|
||||
endif
|
||||
ifneq ($(filter arm%, $(UNAME_M)),)
|
||||
CFLAGS +=
|
||||
LDFLAGS +=
|
||||
endif
|
||||
|
||||
# Check if we can build audio
|
||||
CHECK_AUDIO_LIBS = $(shell pkg-config $(AUDIO_LIBS) || echo -n "error")
|
||||
ifneq ($(CHECK_AUDIO_LIBS), error)
|
||||
LIBS += $(AUDIO_LIBS)
|
||||
CFLAGS += $(AUDIO_CFLAGS)
|
||||
OBJ += $(AUDIO_OBJ)
|
||||
else
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
MISSING_AUDIO_LIBS = $(shell for lib in $(AUDIO_LIBS) ; do if ! pkg-config $$lib ; then echo $$lib ; fi ; done)
|
||||
$(warning WARNING -- Toxic will be compiled without audio support)
|
||||
$(warning WARNING -- You need these libraries for audio support)
|
||||
$(warning WARNING -- $(MISSING_AUDIO_LIBS))
|
||||
endif
|
||||
endif
|
||||
|
||||
# Check if we can build Toxic
|
||||
CHECK_LIBS = $(shell pkg-config $(LIBS) || echo -n "error")
|
||||
ifneq ($(CHECK_LIBS), error)
|
||||
CFLAGS += $(shell pkg-config --cflags $(LIBS))
|
||||
LDFLAGS += $(shell pkg-config --libs $(LIBS))
|
||||
else
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
MISSING_LIBS = $(shell for lib in $(LIBS) ; do if ! pkg-config $$lib ; then echo $$lib ; fi ; done)
|
||||
$(warning ERROR -- Cannot compile Toxic)
|
||||
$(warning ERROR -- You need these libraries)
|
||||
$(warning ERROR -- $(MISSING_LIBS))
|
||||
$(error ERROR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Targets
|
||||
all: toxic
|
||||
|
||||
toxic: $(OBJ)
|
||||
$(CC) $(CFLAGS) -o toxic $(OBJ) $(LDFLAGS)
|
||||
|
||||
install: toxic
|
||||
mkdir -pv $(DESTDIR)/bin
|
||||
install -m 0755 toxic $(DESTDIR)/bin
|
||||
|
||||
%.o: $(SRC_DIR)/%.c
|
||||
$(CC) $(CFLAGS) -o $*.o -c $(SRC_DIR)/$*.c
|
||||
$(CC) -MM $(CFLAGS) $(SRC_DIR)/$*.c > $*.d
|
||||
|
||||
clean:
|
||||
rm -rf *.d *.o toxic
|
||||
|
||||
-include $(OBJ:.o=.d)
|
||||
|
||||
.PHONY: clean all install
|
@ -1,72 +0,0 @@
|
||||
#Don't change this unless needed, else you'll break stuff
|
||||
|
||||
bin_PROGRAMS = toxic
|
||||
|
||||
|
||||
toxic_SOURCES = $(top_srcdir)/src/toxic.c \
|
||||
$(top_srcdir)/src/toxic.h \
|
||||
$(top_srcdir)/src/chat.h \
|
||||
$(top_srcdir)/src/chat.c \
|
||||
$(top_srcdir)/src/configdir.h \
|
||||
$(top_srcdir)/src/configdir.c \
|
||||
$(top_srcdir)/src/prompt.h \
|
||||
$(top_srcdir)/src/prompt.c \
|
||||
$(top_srcdir)/src/friendlist.h \
|
||||
$(top_srcdir)/src/friendlist.c \
|
||||
$(top_srcdir)/src/windows.c \
|
||||
$(top_srcdir)/src/windows.h \
|
||||
$(top_srcdir)/src/groupchat.c \
|
||||
$(top_srcdir)/src/groupchat.h \
|
||||
$(top_srcdir)/src/global_commands.c \
|
||||
$(top_srcdir)/src/global_commands.h \
|
||||
$(top_srcdir)/src/chat_commands.c \
|
||||
$(top_srcdir)/src/chat_commands.h \
|
||||
$(top_srcdir)/src/execute.c \
|
||||
$(top_srcdir)/src/execute.h \
|
||||
$(top_srcdir)/src/misc_tools.c \
|
||||
$(top_srcdir)/src/misc_tools.h \
|
||||
$(top_srcdir)/src/toxic_strings.c \
|
||||
$(top_srcdir)/src/toxic_strings.h \
|
||||
$(top_srcdir)/src/log.c \
|
||||
$(top_srcdir)/src/log.h \
|
||||
$(top_srcdir)/src/file_senders.c \
|
||||
$(top_srcdir)/src/file_senders.h \
|
||||
$(top_srcdir)/src/line_info.c \
|
||||
$(top_srcdir)/src/line_info.h \
|
||||
$(top_srcdir)/src/settings.c \
|
||||
$(top_srcdir)/src/settings.h \
|
||||
$(top_srcdir)/src/dns.c \
|
||||
$(top_srcdir)/src/dns.h
|
||||
|
||||
toxic_CFLAGS = -I$(top_srcdir) \
|
||||
$(NCURSES_CFLAGS) \
|
||||
$(LIBSODIUM_CFLAGS) \
|
||||
$(LIBTOXCORE_CFLAGS) \
|
||||
$(PTHREAD_CFLAGS)
|
||||
|
||||
toxic_CPPFLAGS = '-DTOXICVER="$(TOXIC_VERSION)"'
|
||||
|
||||
toxic_LDADD = $(LIBTOXCORE_LDFLAGS) \
|
||||
$(LIBSODIUM_LDFLAGS) \
|
||||
$(NCURSES_LIBS) \
|
||||
$(LIBTOXCORE_LIBS) \
|
||||
$(LIBSODIUM_LIBS) \
|
||||
$(WINSOCK2_LIBS) \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
|
||||
# For audio support
|
||||
if BUILD_AV
|
||||
|
||||
toxic_SOURCES += $(top_srcdir)/src/audio_call.c \
|
||||
$(top_srcdir)/src/audio_call.h \
|
||||
$(top_srcdir)/src/device.c \
|
||||
$(top_srcdir)/src/device.h
|
||||
|
||||
toxic_CFLAGS += $(LIBTOXAV_CFLAGS) \
|
||||
$(OPENAL_CFLAGS) \
|
||||
-Wimplicit-function-declaration
|
||||
|
||||
toxic_LDADD += $(LIBTOXAV_LIBS) \
|
||||
$(OPENAL_LIBS)
|
||||
endif
|
510
configure.ac
510
configure.ac
@ -1,510 +0,0 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.65])
|
||||
AC_INIT([toxic], [0.4.2], [https://tox.im/])
|
||||
AC_CONFIG_AUX_DIR(configure_aux)
|
||||
AC_CONFIG_SRCDIR([src/toxic.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AM_INIT_AUTOMAKE([1.10 -Wall])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
if test "x${prefix}" = "xNONE"; then
|
||||
prefix="${ac_default_prefix}"
|
||||
fi
|
||||
|
||||
DEPSEARCH=
|
||||
LIBTOXCORE_SEARCH_HEADERS=
|
||||
LIBTOXCORE_SEARCH_LIBS=
|
||||
LIBSODIUM_SEARCH_HEADERS=
|
||||
LIBSODIUM_SEARCH_LIBS=
|
||||
|
||||
LIBTOXCORE_FOUND="no"
|
||||
NCURSES_FOUND="no"
|
||||
NCURSES_WIDECHAR_SUPPORT="no"
|
||||
|
||||
AC_ARG_WITH(dependency-search,
|
||||
AC_HELP_STRING([--with-dependency-search=DIR],
|
||||
[search for dependencies in DIR, i.e. look for libraries in
|
||||
DIR/lib and for headers in DIR/include]),
|
||||
[
|
||||
DEPSEARCH="$withval"
|
||||
]
|
||||
)
|
||||
|
||||
if test -n "$DEPSEARCH"; then
|
||||
CFLAGS="$CFLAGS -I$DEPSEARCH/include"
|
||||
CPPFLAGS="$CPPFLAGS -I$DEPSEARCH/include"
|
||||
LDFLAGS="$LDFLAGS -L$DEPSEARCH/lib"
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$DEPSEARCH/lib/pkgconfig:/usr/local/lib/pkgconfig
|
||||
else
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(libtoxcore-headers,
|
||||
AC_HELP_STRING([--with-libtoxcore-headers=DIR],
|
||||
[search for libtoxcore header files in DIR/tox]),
|
||||
[
|
||||
LIBTOXCORE_SEARCH_HEADERS="$withval"
|
||||
AC_MSG_NOTICE([Will search for libtoxcore header files in $withval])
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(libtoxcore-libs,
|
||||
AC_HELP_STRING([--with-libtoxcore-libs=DIR],
|
||||
[search for libtoxcore libraries in DIR]),
|
||||
[
|
||||
LIBTOXCORE_SEARCH_LIBS="$withval"
|
||||
AC_MSG_NOTICE([Will search for libtoxcore libraries in $withval])
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(libsodium-headers,
|
||||
AC_HELP_STRING([--with-libsodium-headers=DIR],
|
||||
[search for libsodium header files in DIR]),
|
||||
[
|
||||
LIBSODIUM_SEARCH_HEADERS="$withval"
|
||||
AC_MSG_NOTICE([Will search for libsodium header files in $withval])
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(libsodium-libs,
|
||||
AC_HELP_STRING([--with-libsodium-libs=DIR],
|
||||
[search for libsodium libraries in DIR]),
|
||||
[
|
||||
LIBSODIUM_SEARCH_LIBS="$withval"
|
||||
AC_MSG_NOTICE([Will search for libsodium libraries in $withval])
|
||||
]
|
||||
)
|
||||
|
||||
WIN32=no
|
||||
MACH=no
|
||||
AC_CANONICAL_HOST
|
||||
case $host_os in
|
||||
*mingw*)
|
||||
WIN32="yes"
|
||||
;;
|
||||
darwin*)
|
||||
MACH=yes
|
||||
;;
|
||||
*freebsd*)
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
CFLAGS="$CFLAGS -I/usr/local/include"
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
AC_CHECK_HEADERS(
|
||||
[limits.h locale.h stdint.h stdlib.h string.h unistd.h wchar.h wctype.h],
|
||||
[],
|
||||
[ AC_MSG_ERROR([required header is missing on your system]) ])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_STDBOOL
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UINT16_T
|
||||
AC_TYPE_UINT32_T
|
||||
AC_TYPE_UINT64_T
|
||||
AC_TYPE_UINT8_T
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS(
|
||||
[iswprint memmove memset mkdir setlocale strchr strdup],
|
||||
[],
|
||||
[ AC_MSG_ERROR([required library function is missing on your system])])
|
||||
|
||||
AX_PTHREAD( [], [ AC_MSG_ERROR([pthreads not found on your system]) ])
|
||||
|
||||
# pkg-config based tests
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test "x$WIN32" != "xyes"; then
|
||||
PKG_CHECK_MODULES([NCURSES], [ncursesw],
|
||||
[
|
||||
NCURSES_FOUND="yes"
|
||||
NCURSES_WIDECHAR_SUPPORT="yes"
|
||||
],
|
||||
[
|
||||
NCURSES_WIDECHAR_SUPPORT="no"
|
||||
PKG_CHECK_MODULES([NCURSES], [ncurses],
|
||||
[
|
||||
NCURSES_FOUND="yes"
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([$NCURSES_PKG_ERRORS])
|
||||
])
|
||||
])
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([pkg-config was not found on your sytem])
|
||||
fi
|
||||
|
||||
if (test "x$NCURSES_FOUND" = "xno") && (test "x$WIN32" != "xyes"); then
|
||||
AC_PATH_PROG([CURSES_CONFIG], [ncursesw5-config], [no])
|
||||
if test "x$CURSES_CONFIG" != "xno"; then
|
||||
AC_MSG_CHECKING(ncurses cflags)
|
||||
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
|
||||
AC_MSG_RESULT($NCURSES_CFLAGS)
|
||||
|
||||
AC_MSG_CHECKING(ncurses libraries)
|
||||
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
|
||||
AC_MSG_RESULT($NCURSES_LIBS)
|
||||
|
||||
AC_SUBST(NCURSES_CFLAGS)
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
NCURSES_FOUND="yes"
|
||||
NCURSES_WIDECHAR_SUPPORT="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if (test "x$NCURSES_FOUND" = "xno") && (test "x$WIN32" != "xyes"); then
|
||||
unset ac_cv_path_CURSES_CONFIG
|
||||
AC_PATH_PROG([CURSES_CONFIG], [ncursesw5.4-config], [no])
|
||||
if test "x$CURSES_CONFIG" != "xno"; then
|
||||
AC_MSG_CHECKING(ncurses cflags)
|
||||
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
|
||||
AC_MSG_RESULT($NCURSES_CFLAGS)
|
||||
|
||||
AC_MSG_CHECKING(ncurses libraries)
|
||||
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
|
||||
AC_MSG_RESULT($NCURSES_LIBS)
|
||||
|
||||
AC_SUBST(NCURSES_CFLAGS)
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
NCURSES_FOUND="yes"
|
||||
NCURSES_WIDECHAR_SUPPORT="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if (test "x$NCURSES_FOUND" = "xno") && (test "x$WIN32" != "xyes"); then
|
||||
unset ac_cv_path_CURSES_CONFIG
|
||||
AC_PATH_PROG([CURSES_CONFIG], [ncurses5-config], [no])
|
||||
if test "x$CURSES_CONFIG" != "xno"; then
|
||||
AC_MSG_CHECKING(ncurses cflags)
|
||||
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
|
||||
AC_MSG_RESULT($NCURSES_CFLAGS)
|
||||
|
||||
AC_MSG_CHECKING(ncurses libraries)
|
||||
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
|
||||
AC_MSG_RESULT($NCURSES_LIBS)
|
||||
|
||||
AC_SUBST(NCURSES_CFLAGS)
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
NCURSES_FOUND="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if (test "x$NCURSES_FOUND" = "xno") && (test "x$WIN32" != "xyes"); then
|
||||
unset ac_cv_path_CURSES_CONFIG
|
||||
AC_PATH_PROG([CURSES_CONFIG], [ncurses5.4-config], [no])
|
||||
if test "x$CURSES_CONFIG" != "xno"; then
|
||||
AC_MSG_CHECKING(ncurses cflags)
|
||||
NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags`
|
||||
AC_MSG_RESULT($NCURSES_CFLAGS)
|
||||
|
||||
AC_MSG_CHECKING(ncurses libraries)
|
||||
NCURSES_LIBS=`${CURSES_CONFIG} --libs`
|
||||
AC_MSG_RESULT($NCURSES_LIBS)
|
||||
|
||||
AC_SUBST(NCURSES_CFLAGS)
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
NCURSES_FOUND="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$NCURSES_FOUND" = "xno"; then
|
||||
AC_CHECK_HEADER([curses.h],
|
||||
[],
|
||||
[
|
||||
AC_MSG_ERROR([headers for the ncurses library were not found on your system])
|
||||
]
|
||||
)
|
||||
|
||||
if test "x$WIN32" = "xyes"; then
|
||||
dnl Check if pdcurses provides wide char support
|
||||
NCURSES_WIDECHAR_SUPPORT="no"
|
||||
AC_CHECK_LIB([pdcurses], [clear],
|
||||
[],
|
||||
[
|
||||
AC_MSG_ERROR([required library pdcurses was not found on your system])
|
||||
]
|
||||
)
|
||||
|
||||
AC_CHECK_LIB(ws2_32, main,
|
||||
[
|
||||
WINSOCK2_LIBS="-lws2_32"
|
||||
AC_SUBST(WINSOCK2_LIBS)
|
||||
],
|
||||
[
|
||||
AC_MSG_ERROR([required library winsock2 was not found on the system, please check your MinGW installation])
|
||||
]
|
||||
)
|
||||
AC_DEFINE([_WIN32_WINNT], [0x501],
|
||||
[enable getaddrinfo/freeaddrinfo on XP and higher])
|
||||
else
|
||||
AC_CHECK_LIB([ncursesw], [wget_wch],
|
||||
[
|
||||
NCURSES_WIDECHAR_SUPPORT="yes"
|
||||
],
|
||||
[
|
||||
unset ac_cv_lib_ncursesw_wget_wch
|
||||
AC_CHECK_LIB([ncursesw], [wget_wch],
|
||||
[
|
||||
NCURSES_WIDECHAR_SUPPORT="yes"
|
||||
],
|
||||
[
|
||||
NCURSES_WIDECHAR_SUPPORT="no"
|
||||
AC_CHECK_LIB([ncurses], [clear],
|
||||
[],
|
||||
[
|
||||
unset ac_cv_lib_ncurses_clear
|
||||
AC_CHECK_LIB([ncurses], [clear],
|
||||
[],
|
||||
[
|
||||
AC_MSG_ERROR([required library ncurses was not found on your system])
|
||||
],
|
||||
[
|
||||
-ltinfo
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
[
|
||||
-ltinfo
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
PKG_CHECK_MODULES(LIBTOXCORE, [libtoxcore],
|
||||
[
|
||||
LIBTOXCORE_FOUND="yes"
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS])
|
||||
])
|
||||
fi
|
||||
|
||||
if test "x$LIBTOXCORE_FOUND" = "xno"; then
|
||||
LIBSODIUM_LIBS=
|
||||
LIBSODIUM_LDFLAGS=
|
||||
LDFLAGS_SAVE="$LDFLAGS"
|
||||
if test -n "$LIBSODIUM_SEARCH_LIBS"; then
|
||||
LDFLAGS="$LDFLAGS -L$LIBSODIUM_SEARCH_LIBS"
|
||||
AC_CHECK_LIB(sodium, randombytes_random,
|
||||
[
|
||||
LIBSODIUM_LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS"
|
||||
LIBSODIUM_LIBS="-lsodium"
|
||||
],
|
||||
[
|
||||
AC_MSG_ERROR([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS])
|
||||
]
|
||||
)
|
||||
else
|
||||
AC_CHECK_LIB(sodium, randombytes_random,
|
||||
[],
|
||||
[
|
||||
AC_MSG_ERROR([required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
LDFLAGS="$LDFLAGS_SAVE"
|
||||
AC_SUBST(LIBSODIUM_LIBS)
|
||||
AC_SUBST(LIBSODIUM_LDFLAGS)
|
||||
|
||||
|
||||
|
||||
LIBTOXCORE_CFLAGS=
|
||||
CFLAGS_SAVE="$CFLAGS"
|
||||
CPPFLAGS_SAVE="$CPPFLAGS"
|
||||
|
||||
if test -n "$LIBTOXCORE_SEARCH_HEADERS"; then
|
||||
CFLAGS="$CFLAGS -I$LIBTOXCORE_SEARCH_HEADERS"
|
||||
CPPFLAGS="$CPPFLAGS -I$LIBTOXCORE_SEARCH_HEADERS"
|
||||
AC_CHECK_HEADER([tox/tox.h],
|
||||
[
|
||||
LIBTOXCORE_CFLAGS="-I$LIBTOXCORE_SEARCH_HEADERS"
|
||||
],
|
||||
[
|
||||
AC_MSG_ERROR([headers for the toxcore library were not found on your system])
|
||||
]
|
||||
)
|
||||
else
|
||||
AC_CHECK_HEADER([tox/tox.h],
|
||||
[],
|
||||
[
|
||||
AC_MSG_ERROR([headers for the toxcore library were not found on your system])
|
||||
],
|
||||
)
|
||||
fi
|
||||
CFLAGS="$CFLAGS_SAVE"
|
||||
CPPFLAGS="$CPPFLAGS_SAVE"
|
||||
AC_SUBST(LIBTOXCORE_CFLAGS)
|
||||
|
||||
LIBTOXCORE_LIBS=
|
||||
LIBTOXCORE_LDFLAGS=
|
||||
LDFLAGS_SAVE="$LDFLAGS"
|
||||
if test -n "$LIBTOXCORE_SEARCH_LIBS"; then
|
||||
LDFLAGS="$LDFLAGS $LIBSODIUM_LDFLAGS -L$LIBTOXCORE_SEARCH_LIBS"
|
||||
AC_CHECK_LIB([toxcore], [tox_new],
|
||||
[
|
||||
LIBTOXCORE_LDFLAGS="-L$LIBTOXCORE_SEARCH_LIBS"
|
||||
LIBTOXCORE_LIBS="-ltoxcore"
|
||||
],
|
||||
[
|
||||
AC_MSG_ERROR([required library toxcore was not found on your system])
|
||||
],
|
||||
[
|
||||
$WINSOCK2_LIBS
|
||||
$LIBSODIUM_LIBS
|
||||
]
|
||||
)
|
||||
else
|
||||
LDFLAGS="$LDFLAGS $LIBSODIUM_LDFLAGS"
|
||||
AC_CHECK_LIB([toxcore], [tox_new],
|
||||
[],
|
||||
[
|
||||
AC_MSG_ERROR([required library toxcore was not found on your system])
|
||||
],
|
||||
[
|
||||
$WINSOCK2_LIBS
|
||||
$LIBSODIUM_LIBS
|
||||
]
|
||||
)
|
||||
fi
|
||||
LDFLAGS="$LDFLAGS_SAVE"
|
||||
AC_SUBST(LIBTOXCORE_LIBS)
|
||||
AC_SUBST(LIBTOXCORE_LDFLAGS)
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER([resolv.h], [],
|
||||
[
|
||||
AC_MSG_ERROR([resolv.h header was not found on your system])
|
||||
])
|
||||
|
||||
AC_CHECK_LIB(resolv, __res_init, [],
|
||||
[
|
||||
AC_MSG_ERROR([libresolv library was not found on your system])
|
||||
])
|
||||
|
||||
####
|
||||
#### A/V Stuff
|
||||
|
||||
AV_SEARCH_DIR=
|
||||
BUILD_AV="yes"
|
||||
|
||||
AC_ARG_WITH(libtoxav-prefix,
|
||||
AC_HELP_STRING([--with-libtoxav-prefix=DIR],
|
||||
[search for libtoxav in DIR, i.e. look for libraries in
|
||||
DIR/lib and for headers in DIR/include]),
|
||||
[
|
||||
AV_SEARCH_DIR="$withval"
|
||||
]
|
||||
)
|
||||
|
||||
if test -n "$AV_SEARCH_DIR"; then
|
||||
CFLAGS="$CFLAGS -I$AV_SEARCH_DIR/include"
|
||||
CPPFLAGS="$CPPFLAGS -I$AV_SEARCH_DIR/include"
|
||||
LDFLAGS="$LDFLAGS -L$AV_SEARCH_DIR/lib"
|
||||
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$AV_SEARCH_DIR/lib/pkgconfig
|
||||
else
|
||||
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
|
||||
fi
|
||||
|
||||
# Check if specified enable
|
||||
AC_ARG_ENABLE([av],
|
||||
[AC_HELP_STRING([--disable-av], [build AV support libraries (default: auto)]) ],
|
||||
[
|
||||
if test "x$enableval" = "xno"; then
|
||||
BUILD_AV="no"
|
||||
elif test "x$enableval" = "xyes"; then
|
||||
BUILD_AV="yes"
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
# Check for A/V library
|
||||
|
||||
if test "x$BUILD_AV" = "xyes"; then
|
||||
PKG_CHECK_MODULES([OPENAL], [openal],
|
||||
[],
|
||||
[
|
||||
if test "x$MACH" = "xyes"; then
|
||||
CFLAGS="$CFLAGS -framework OpenAL"
|
||||
AC_CHECK_HEADER([OpenAL/al.h],
|
||||
[
|
||||
OPENAL_CFLAGS="-framework OpenAL"
|
||||
OPENAL_LIBS="-framework OpenAL"
|
||||
AC_SUBST(OPENAL_CFLAGS)
|
||||
AC_SUBST(OPENAL_LIBS)
|
||||
],
|
||||
[
|
||||
AC_MSG_NOTICE([No openal framework; disabling A/V support])
|
||||
BUILD_AV="no"
|
||||
]
|
||||
)
|
||||
CFLAGS="$CFLAGS_SAVE"
|
||||
else
|
||||
AC_MSG_NOTICE([No openal library; disabling A/V support])
|
||||
BUILD_AV="no"
|
||||
fi
|
||||
])
|
||||
fi
|
||||
|
||||
if test "x$BUILD_AV" = "xyes"; then
|
||||
PKG_CHECK_MODULES([LIBTOXAV], [libtoxav],
|
||||
[
|
||||
AC_CHECK_HEADER([tox/toxav.h],
|
||||
[
|
||||
# Place define for audio support
|
||||
AC_DEFINE([_SUPPORT_AUDIO], [], [Is audio supported])
|
||||
AC_MSG_NOTICE([Building with audio support])
|
||||
],
|
||||
[
|
||||
AC_MSG_NOTICE([No A/V headers; disabling A/V support])
|
||||
BUILD_AV="no"
|
||||
],)
|
||||
],
|
||||
[
|
||||
AC_MSG_NOTICE([No A/V library; disabling A/V support])
|
||||
BUILD_AV="no"
|
||||
])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_AV, test "x$BUILD_AV" = "xyes")
|
||||
|
||||
TOXIC_VERSION="$PACKAGE_VERSION"
|
||||
AC_PATH_PROG([GIT], [git], [no])
|
||||
if test "x$GIT" != "xno"; then
|
||||
if test -d ${srcdir}/.git; then
|
||||
TOXIC_VERSION="${TOXIC_VERSION}_r`${GIT} rev-list HEAD --count`"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(TOXIC_VERSION)
|
||||
|
||||
eval PACKAGE_DATADIR="${datadir}/${PACKAGE}"
|
||||
eval PACKAGE_DATADIR="${PACKAGE_DATADIR}"
|
||||
AC_DEFINE_UNQUOTED(PACKAGE_DATADIR, "$PACKAGE_DATADIR", [toxic data directory])
|
||||
|
||||
if test "x$NCURSES_WIDECHAR_SUPPORT" = "xyes"; then
|
||||
AC_DEFINE([HAVE_WIDECHAR], [1], [ncurses wide char support available])
|
||||
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1],
|
||||
[enable X/Open Portability Guide functionality])
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
misc/Makefile
|
||||
build/Makefile])
|
||||
AC_OUTPUT
|
317
m4/ax_pthread.m4
317
m4/ax_pthread.m4
@ -1,317 +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 20
|
||||
|
||||
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_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$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"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
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_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
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
|
||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
for flag in $ax_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
# need a special flag -Kthread to make this header compile.)
|
||||
# We check for pthread_join because it is in -lpthread on IRIX
|
||||
# while pthread_create is in libc. We check for pthread_attr_init
|
||||
# due to DEC craziness with -lpthreads. We check for
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||
static void routine(void *a) { a = 0; }
|
||||
static void *start_routine(void *a) { return a; }],
|
||||
[pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th, 0, start_routine, 0);
|
||||
pthread_join(th, 0);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_cleanup_push(routine, 0);
|
||||
pthread_cleanup_pop(0) /* ; */])],
|
||||
[ax_pthread_ok=yes],
|
||||
[])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT($ax_pthread_ok)
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||
[int attr = $attr; return attr /* ; */])],
|
||||
[attr_name=$attr; break],
|
||||
[])
|
||||
done
|
||||
AC_MSG_RESULT($attr_name)
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case ${host_os} in
|
||||
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||
osf* | hpux*) flag="-D_REENTRANT";;
|
||||
solaris*)
|
||||
if test "$GCC" = "yes"; then
|
||||
flag="-D_REENTRANT"
|
||||
else
|
||||
flag="-mt -D_REENTRANT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT(${flag})
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||
ax_cv_PTHREAD_PRIO_INHERIT, [
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||
])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
|
||||
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: compile with *_r variant
|
||||
if test "x$GCC" != xyes; then
|
||||
case $host_os in
|
||||
aix*)
|
||||
AS_CASE(["x/$CC"],
|
||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||
[#handle absolute path differently from PATH based program lookup
|
||||
AS_CASE(["x$CC"],
|
||||
[x/*],
|
||||
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$ax_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
:
|
||||
else
|
||||
ax_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_POP
|
||||
])dnl AX_PTHREAD
|
199
m4/pkg.m4
199
m4/pkg.m4
@ -1,199 +0,0 @@
|
||||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
# serial 1 (pkg-config-0.24)
|
||||
#
|
||||
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
#
|
||||
# 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 2 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
# ----------------------------------
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi[]dnl
|
||||
])# PKG_PROG_PKG_CONFIG
|
||||
|
||||
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
# Check to see whether a particular set of modules exists. Similar
|
||||
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
#
|
||||
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
# only at the first occurence in configure.ac, so if the first place
|
||||
# it's called might be skipped (such as if it is within an "if", you
|
||||
# have to call PKG_CHECK_EXISTS manually
|
||||
# --------------------------------------------------------------
|
||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
||||
m4_default([$2], [:])
|
||||
m4_ifvaln([$3], [else
|
||||
$3])dnl
|
||||
fi])
|
||||
|
||||
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
||||
# ---------------------------------------------
|
||||
m4_define([_PKG_CONFIG],
|
||||
[if test -n "$$1"; then
|
||||
pkg_cv_[]$1="$$1"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
PKG_CHECK_EXISTS([$3],
|
||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes ],
|
||||
[pkg_failed=yes])
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi[]dnl
|
||||
])# _PKG_CONFIG
|
||||
|
||||
# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
# -----------------------------
|
||||
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi[]dnl
|
||||
])# _PKG_SHORT_ERRORS_SUPPORTED
|
||||
|
||||
|
||||
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
# [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
#
|
||||
# Note that if there is a possibility the first call to
|
||||
# PKG_CHECK_MODULES might not happen, you should be sure to include an
|
||||
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
||||
#
|
||||
#
|
||||
# --------------------------------------------------------------
|
||||
AC_DEFUN([PKG_CHECK_MODULES],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||
|
||||
pkg_failed=no
|
||||
AC_MSG_CHECKING([for $1])
|
||||
|
||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||
|
||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.])
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
AC_MSG_RESULT([no])
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
||||
else
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
m4_default([$4], [AC_MSG_ERROR(
|
||||
[Package requirements ($2) were not met:
|
||||
|
||||
$$1_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT])[]dnl
|
||||
])
|
||||
elif test $pkg_failed = untried; then
|
||||
AC_MSG_RESULT([no])
|
||||
m4_default([$4], [AC_MSG_FAILURE(
|
||||
[The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
||||
])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||
AC_MSG_RESULT([yes])
|
||||
$3
|
||||
fi[]dnl
|
||||
])# PKG_CHECK_MODULES
|
||||
|
||||
|
||||
# PKG_INSTALLDIR(DIRECTORY)
|
||||
# -------------------------
|
||||
# Substitutes the variable pkgconfigdir as the location where a module
|
||||
# should install pkg-config .pc files. By default the directory is
|
||||
# $libdir/pkgconfig, but the default can be changed by passing
|
||||
# DIRECTORY. The user can override through the --with-pkgconfigdir
|
||||
# parameter.
|
||||
AC_DEFUN([PKG_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
||||
[with_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
]) dnl PKG_INSTALLDIR
|
||||
|
||||
|
||||
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
|
||||
# -------------------------
|
||||
# Substitutes the variable noarch_pkgconfigdir as the location where a
|
||||
# module should install arch-independent pkg-config .pc files. By
|
||||
# default the directory is $datadir/pkgconfig, but the default can be
|
||||
# changed by passing DIRECTORY. The user can override through the
|
||||
# --with-noarch-pkgconfigdir parameter.
|
||||
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([noarch-pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
||||
[with_noarch_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
]) dnl PKG_NOARCH_INSTALLDIR
|
@ -1 +0,0 @@
|
||||
dist_pkgdata_DATA = DHTnodes
|
Loading…
Reference in New Issue
Block a user