-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathconfigure.ac
109 lines (98 loc) · 3.46 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(t_libeasy, 1.0.17-21.el6, )
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/io/easy_io.h])
AC_PREFIX_DEFAULT(/usr)
AC_CANONICAL_HOST
AM_PROG_AS
build_mac=no
# Detect the target system
case "${host_os}" in
darwin*)
build_mac=yes
;;
*)
;;
esac
AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"])
if test "$build_mac" = "yes"; then
if [[ "no$OPENSSL_DIR" = "no" ]]; then
echo "You are building under OSX please note that you should specify your openssl linking path like:"
echo "OPENSSL_DIR=/usr/local/Cellar/openssl/1.0.2t ./bootstrap.sh"
exit 1
fi
LDFLAGS="$LDFLAGS -L$OPENSSL_DIR/lib"
CFLAGS="$CFLAGS -I$OPENSSL_DIR/include"
CPPFLAGS="$CPPFLAGS -I$OPENSSL_DIR/include"
fi
## gcc version
GCC_VER_GTE48=$(echo `gcc -dumpversion | cut -f1-2 -d.` \>= 4.4 | sed -e 's/\./*100+/g' | bc )
AM_CONDITIONAL([GCC_LEGACY], [test "$GCC_VER_GTE48" = "0"])
# Checks for programs.
AC_PROG_CXX
AC_PROG_LN_S
AC_PROG_LIBTOOL
AC_PROG_RANLIB
if test "x$prefix" = "xNONE" ; then
prefix="/usr/local"
fi
includedir=${prefix}/include/easy
PRESET_CFLAGS="$CFLAGS"
PRESET_CPPFLAGS="$CPPFLAGS"
PRESET_LDFLAGS="$LDFLAGS"
CFLAGS="-g $PRESET_CFLAGS -Wall -Werror -fPIC -fno-strict-aliasing"
CPPFLAGS="$PRESET_CPPFLAGS -D_GNU_SOURCE -D__STDC_LIMIT_MACROS"
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/inotify.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CHECK_LIB([pthread], [pthread_create], [], exit 1)
AC_CHECK_LIB([ssl], [SSL_CTX_new], [], exit 1)
AC_CHECK_LIB([crypto], [X509_free], [], exit 1)
# ceil is a built-in function, remove -Werror
CFLAGS="-g $PRESET_CFLAGS -Wall -fPIC -fno-strict-aliasing"
AC_CHECK_LIB([m], [ceil], [], exit 1)
# restore CFLAGS
CFLAGS="-g $PRESET_CFLAGS -Wall -Werror -fPIC -fno-strict-aliasing"
MOSTLYCLEANFILES=
AC_SUBST(MOSTLYCLEANFILES)
AC_ARG_WITH([gcov], AS_HELP_STRING([--with-gcov], [enable code coverage(default is NO)]), [
if test "$withval" = "yes"; then
CFLAGS="${PRESET_CFLAGS} -Wall -Werror -fPIC -ggdb3 -fprofile-arcs -ftest-coverage"
LDFLAGS="-lgcov ${PRESET_LDFLAGS} -fprofile-arcs -ftest-coverage"
fi
])
MOSTLYCLEANFILES="*.gcno *.gcda"
DEFAULT_INCLUDES="-I`pwd`/src/include/ -I`pwd`/src/util/"
DEFAULT_INCLUDES="$DEFAULT_INCLUDES -I`pwd`/src/thread/ -I`pwd`/src/thread/colib -I`pwd`/src/io/ -I`pwd`/src/memory/ -I`pwd`/src/packet/ -I`pwd`/src/packet/http -I."
VERSION_MAP="`pwd`/src/libeasy.map"
AC_SUBST(DEFAULT_INCLUDES)
AC_SUBST(VERSION_MAP)
PRESET_LDADD="`pwd`/src/.libs/libeasy.la"
AC_SUBST(PRESET_LDADD)
AC_CONFIG_FILES([Makefile
src/Makefile
src/include/Makefile
src/util/Makefile
src/thread/Makefile
src/thread/colib/Makefile
src/io/Makefile
src/packet/Makefile
src/memory/Makefile
test/Makefile
test/include/Makefile
test/util/Makefile
test/thread/Makefile
test/io/Makefile
test/packet/Makefile
test/memory/Makefile
sample/Makefile
])
AC_OUTPUT
if test -f libtool; then
sed -i -e '/^soname_spec=/ s/major/{major}.\\${age}/g' libtool
sed -i -e '/^library_names_spec=/ s/major/{major}.\\${age}/g' libtool
fi