2009-09-10 18:09:56 +00:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
"""
|
|
|
|
* weighttp - a lightweight and simple webserver benchmarking tool
|
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Copyright (c) 2009 Thomas Porzelt
|
|
|
|
*
|
|
|
|
* License:
|
|
|
|
* MIT, see COPYING file
|
|
|
|
"""
|
|
|
|
|
|
|
|
import Options
|
|
|
|
|
|
|
|
# the following two variables are used by the target "waf dist"
|
2009-09-30 21:32:20 +00:00
|
|
|
VERSION='0.2'
|
2009-09-10 18:09:56 +00:00
|
|
|
APPNAME='weighttp'
|
|
|
|
|
|
|
|
# these variables are mandatory ('/' are converted automatically)
|
|
|
|
srcdir = '.'
|
|
|
|
blddir = 'build'
|
|
|
|
|
|
|
|
|
|
|
|
def set_options(opt):
|
|
|
|
opt.tool_options('compiler_cc')
|
|
|
|
|
|
|
|
# ./waf configure options
|
|
|
|
#opt.add_option('--with-xyz', action='store_true', help='with xyz', dest = 'xyz', default = False)
|
|
|
|
|
|
|
|
|
|
|
|
def configure(conf):
|
|
|
|
conf.env['CCFLAGS'] += [
|
|
|
|
'-std=gnu99', '-Wall', '-Wshadow', '-W', '-pedantic', '-g', '-g2', '-O2', '-Wmissing-declarations',
|
|
|
|
'-Wdeclaration-after-statement', '-Wno-pointer-sign', '-Wcast-align', '-Winline', '-Wsign-compare',
|
2009-09-10 20:08:42 +00:00
|
|
|
'-Wnested-externs', '-Wpointer-arith', '-Wbad-function-cast', '-Wmissing-prototypes',
|
2009-11-01 14:11:57 +00:00
|
|
|
'-fPIC', '-fno-strict-aliasing',
|
2009-09-10 18:09:56 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
conf.check_tool('compiler_cc')
|
|
|
|
|
|
|
|
# check for libev
|
|
|
|
conf.check(lib='ev', uselib_store='ev', mandatory=True)
|
|
|
|
conf.check(header_name='ev.h', uselib='ev', mandatory=True)
|
|
|
|
|
|
|
|
# check for libpthread
|
|
|
|
conf.check(lib='pthread', uselib_store='pthread', mandatory=True)
|
|
|
|
conf.check(header_name='pthread.h', uselib='pthread', mandatory=True)
|
|
|
|
|
|
|
|
# check for needed headers
|
|
|
|
conf.check(header_name='unistd.h')
|
|
|
|
conf.check(header_name='stdint.h')
|
|
|
|
conf.check(header_name='fcntl.h')
|
|
|
|
conf.check(header_name='inttypes.h')
|
|
|
|
|
|
|
|
# check for needed functions
|
|
|
|
#conf.check(function_name='writev', header_name='sys/uio.h', define_name='HAVE_WRITEV')
|
|
|
|
|
|
|
|
|
|
|
|
def build(bld):
|
|
|
|
bld.new_task_gen(
|
|
|
|
features = 'cc cprogram',
|
|
|
|
source = ['src/client.c', 'src/weighttp.c', 'src/worker.c'],
|
2009-09-10 21:53:14 +00:00
|
|
|
defines = ['HAVE_CONFIG_H=1', 'VERSION="' + VERSION + '"'],
|
2009-09-10 18:09:56 +00:00
|
|
|
includes = '.',
|
|
|
|
uselib = 'ev pthread',
|
|
|
|
target = 'weighttp'
|
|
|
|
)
|