Browse Source

Update build scripts for recent btpd changes. Also use only one makefile.

master
Richard Nyberg 16 years ago
parent
commit
50a313570f
6 changed files with 116 additions and 84 deletions
  1. +54
    -1
      Makefile.am
  2. +0
    -20
      btpd/Makefile.am
  3. +0
    -11
      cli/Makefile.am
  4. +62
    -32
      configure.ac
  5. +0
    -8
      evloop/Makefile.am
  6. +0
    -12
      misc/Makefile.am

+ 54
- 1
Makefile.am View File

@@ -1,2 +1,55 @@
SUBDIRS=@subdirs@ misc btpd cli
AM_CFLAGS=-std=c99 -Wall @WARNNPS@
AM_CPPFLAGS=-I$(top_srcdir)/misc -I$(top_srcdir)/evloop @openssl_CPPFLAGS@ -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D@EVLOOP_METHOD@
AM_LDFLAGS=@openssl_LDFLAGS@

bin_PROGRAMS=btpd/btpd cli/btcli cli/btinfo
noinst_LIBRARIES=misc/libmisc.a evloop/libevloop.a

EXTRA_DIST=COPYRIGHT CHANGES

# btpd
btpd_btpd_SOURCES=\
btpd/active.c btpd/active.h btpd/addrinfo.c\
btpd/btpd.c btpd/btpd.h\
btpd/cli_if.c btpd/content.c btpd/content.h\
btpd/download.c btpd/download_subr.c btpd/download.h\
btpd/http_tr_if.c\
btpd/main.c\
btpd/nameconn.c btpd/net.c btpd/net.h btpd/net_types.h\
btpd/net_buf.c btpd/net_buf.h\
btpd/opts.c btpd/opts.h\
btpd/peer.c btpd/peer.h\
btpd/thread_cb.c btpd/tlib.c btpd/tlib.h btpd/torrent.c btpd/torrent.h\
btpd/tracker_req.c btpd/tracker_req.h\
btpd/upload.c btpd/upload.h\
btpd/util.c
btpd_btpd_CFLAGS=-pthread $(AM_CFLAGS)
btpd_btpd_LDADD=misc/libmisc.a evloop/libevloop.a -lcrypto -lm @CLOCKLIB@

# btinfo
cli_btinfo_SOURCES=cli/btinfo.c
cli_btinfo_LDADD=misc/libmisc.a -lcrypto -lm

# btcli
cli_btcli_SOURCES=cli/btcli.c cli/btcli.h cli/add.c cli/del.c cli/list.c cli/kill.c cli/start.c cli/stop.c cli/stat.c
cli_btcli_LDADD=misc/libmisc.a -lcrypto -lm

# libmisc
misc_libmisc_a_SOURCES=\
misc/benc.c misc/benc.h\
misc/btpd_if.c misc/btpd_if.h misc/ipcdefs.h\
misc/metainfo.c misc/metainfo.h\
misc/hashtable.c misc/hashtable.h\
misc/http_client.c misc/http_client.h\
misc/iobuf.c misc/iobuf.h\
misc/queue.h\
misc/stream.c misc/stream.h\
misc/subr.c misc/subr.h

# evloop
EXTRA_evloop_libevloop_a_SOURCES=evloop/epoll.c evloop/kqueue.c evloop/poll.c
evloop_libevloop_a_SOURCES=\
evloop/evloop.h\
evloop/timeheap.c evloop/timeheap.h evloop/timer.c
evloop_libevloop_a_LIBADD=@EVLOOP_IMPL@
evloop_libevloop_a_DEPENDENCIES=@EVLOOP_IMPL@

+ 0
- 20
btpd/Makefile.am View File

@@ -1,20 +0,0 @@
bin_PROGRAMS=btpd
btpd_SOURCES=\
active.c active.h addrinfo.c\
btpd.c btpd.h\
cli_if.c content.c content.h\
download.c download_subr.c download.h\
http_tr_if.c\
main.c\
nameconn.c net.c net.h net_types.h\
net_buf.c net_buf.h\
opts.c opts.h\
peer.c peer.h\
thread_cb.c tlib.c tlib.h torrent.c torrent.h\
tracker_req.c tracker_req.h\
upload.c upload.h\
util.c

btpd_LDADD=../misc/libmisc.a ../libevent/libevent.a -lcrypto -lm
btpd_CPPFLAGS=-I$(top_srcdir)/misc -I$(top_srcdir)/libevent @openssl_CPPFLAGS@
btpd_LDFLAGS=@openssl_LDFLAGS@

+ 0
- 11
cli/Makefile.am View File

@@ -1,11 +0,0 @@
bin_PROGRAMS=btinfo btcli

btinfo_SOURCES=btinfo.c
btinfo_LDADD=../misc/libmisc.a -lcrypto -lm
btinfo_CPPFLAGS=-I$(top_srcdir)/misc @openssl_CPPFLAGS@
btinfo_LDFLAGS=@openssl_LDFLAGS@

btcli_SOURCES=btcli.c btcli.h add.c del.c list.c kill.c start.c stop.c stat.c
btcli_LDADD=../misc/libmisc.a -lcrypto -lm
btcli_CPPFLAGS=-I$(top_srcdir)/misc @openssl_CPPFLAGS@
btcli_LDFLAGS=@openssl_LDFLAGS@

+ 62
- 32
configure.ac View File

@@ -1,48 +1,78 @@
AC_INIT(btpd, 0.13, btpd@murmeldjur.se)

AM_INIT_AUTOMAKE([foreign])
AM_INIT_AUTOMAKE([foreign subdir-objects])

AC_CONFIG_FILES([Makefile btpd/Makefile misc/Makefile cli/Makefile])
AC_CONFIG_FILES([Makefile])

AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_RANLIB

CFLAGS="$CFLAGS -std=c99"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64"

AC_ARG_WITH(openssl,
[ --with-openssl=dir use openssl installed in dir],
[
AC_SUBST(openssl_LDFLAGS,["-L${withval}/lib -Wl,-rpath=${withval}/lib"])
AC_SUBST(openssl_CPPFLAGS,"-I${withval}/include")
],
[])

AC_ARG_WITH(warn,
[ --with-warn=level select warning preset (no,all,allerr)],
[
case $withval in
no)
;;
all)
CFLAGS="$CFLAGS -Wall -Wno-pointer-sign"
;;
allerr)
CFLAGS="$CFLAGS -Wall -Wno-pointer-sign -Werror"
;;
*)
echo "Warning preset \"$withval\" not recognized. See --help."
exit 1
;;
esac
],
[])
AC_SUBST(openssl_LDFLAGS,["-L${withval}/lib -Wl,-rpath=${withval}/lib"])
AC_SUBST(openssl_CPPFLAGS,"-I${withval}/include"))

AC_ARG_WITH(evloop-method,
[ --with-evloop-method select evloop method (epoll,poll,kqueue)],
evloop_methods=$withval,
evloop_methods="epoll kqueue poll")

AC_SEARCH_LIBS(clock_gettime, rt,
AC_SUBST(CLOCKLIB, $LIBS)
LIBS=""
,
echo btpd needs clock_gettime.
exit 1)

echo -n "checking whether compiler accepts -Wno-pointer-sign... "
old_CFLAGS=$CFLAGS
CFLAGS="-Wno-pointer-sign"
AC_COMPILE_IFELSE(int main(void) { return 0; },
AC_SUBST(WARNNPS,"-Wno-pointer-sign")
echo yes
,
echo no)
CFLAGS=$old_CFLAGS

old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $openssl_LDFLAGS"
AC_CHECK_LIB(crypto, SHA1_Final, :, echo Must have openssl; exit 1)
AC_CHECK_LIB(crypto, SHA1_Final,, echo "btpd needs openssl's libraries and headers."; exit 1)
LDFLAGS=$old_LDFLAGS
LIBS=""

AC_CONFIG_SUBDIRS([libevent])
for m in $evloop_methods; do
case $m in
epoll)
AC_CHECK_FUNC(epoll_wait,[
AC_SUBST(EVLOOP_IMPL,"evloop/epoll.${OBJEXT}")
AC_SUBST(EVLOOP_METHOD,EVLOOP_EPOLL)
break],)
;;
kqueue)
AC_CHECK_FUNC(kqueue,[
AC_SUBST(EVLOOP_IMPL,"evloop/kqueue.${OBJEXT}")
AC_SUBST(EVLOOP_METHOD,EVLOOP_KQUEUE)
break],)
;;
poll)
AC_CHECK_FUNC(poll,[
AC_SUBST(EVLOOP_IMPL,"evloop/poll.${OBJEXT}")
AC_SUBST(EVLOOP_METHOD,EVLOOP_POLL)
break],)
break
;;
*)
echo "$m is not a valid evloop method. See --help."
exit 1
;;
esac
done
if test x$EVLOOP_METHOD == x; then
echo "no suitable evloop method found."
exit 1
else
echo selected evloop method $EVLOOP_METHOD.
fi

AC_OUTPUT

+ 0
- 8
evloop/Makefile.am View File

@@ -1,8 +0,0 @@
noinst_LIBRARIES=libevloop.a
EXTRA_libevloop_a_SOURCES=epoll.c poll.c
libevloop_a_SOURCES=\
evloop.h\
timeheap.c timeheap.h timer.c
CFLAGS=@CFLAGS@ -D@EVLOOP_METHOD@ -I$(top_srcdir)/misc
libevloop_a_LIBADD=@EVLOOP_IMPL@
libevloop_a_DEPENDENCIES=@EVLOOP_IMPL@

+ 0
- 12
misc/Makefile.am View File

@@ -1,12 +0,0 @@
noinst_LIBRARIES=libmisc.a
libmisc_a_SOURCES=\
benc.c benc.h\
btpd_if.c btpd_if.h ipcdefs.h\
metainfo.c metainfo.h\
hashtable.c hashtable.h\
http_client.c http_client.h\
iobuf.c iobuf.h\
queue.h\
stream.c stream.h\
subr.c subr.h
libmisc_a_CPPFLAGS=-I$(top_srcdir)/libevent @openssl_CPPFLAGS@

Loading…
Cancel
Save