forked from metajack/libstrophe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
143 lines (127 loc) · 4.04 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
AC_INIT([libstrophe], [trunk], [jack@metajack.im])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AC_PROG_LIBTOOL
AC_PROG_CC
dnl **********************************************************************
dnl DETECT_ICC ([ACTION-IF-YES], [ACTION-IF-NO])
dnl
dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
dnl sets the $ICC variable to "yes" or "no"
dnl **********************************************************************
AC_DEFUN([DETECT_ICC],
[
ICC="no"
AC_MSG_CHECKING([for icc in use])
if test "$GCC" = "yes"; then
dnl check if this is icc acting as gcc in disguise
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
AC_MSG_RESULT([no])
[$2],
AC_MSG_RESULT([yes])
[$1]
ICC="yes")
else
AC_MSG_RESULT([no])
[$2]
fi
])
DETECT_ICC([], [])
dnl **********************************************************************
dnl DETECT_SUNCC ([ACTION-IF-YES], [ACTION-IF-NO])
dnl
dnl check if this is the Sun Studio compiler, and if so run the ACTION-IF-YES
dnl sets the $SUNCC variable to "yes" or "no"
dnl **********************************************************************
AC_DEFUN([DETECT_SUNCC],
[
SUNCC="no"
AC_MSG_CHECKING([for Sun cc in use])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([], [dnl
#ifdef __SUNPRO_C
return 0;
#else
return 1;
#endif
])
],[
AC_MSG_RESULT([yes])
[$1]
SUNCC="yes"
], [
AC_MSG_RESULT([no])
[$2]
])
])
DETECT_SUNCC([CFLAGS="-mt $CFLAGS"], [])
AC_CHECK_HEADER(openssl/ssl.h, [], [AC_MSG_ERROR([couldn't find openssl headers, openssl required])])
# check for 'check' unit-testing framework
PKG_CHECK_MODULES([check], [check >= 0.9.4], [HAVE_CHECK=yes], [
HAVE_CHECK=no
echo "Regression tests will not be built"
])
AM_CONDITIONAL([HAVE_CHECK], [test x$HAVE_CHECK = xyes])
LIBXML2_REQUIRE=
AC_ARG_WITH([libxml2],
[AS_HELP_STRING([--with-libxml2], [use libxml2 for XML parsing])],
[with_libxml2=check],
[with_libxml2=no])
if test "x$with_libxml2" != xno; then
PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
[with_libxml2=yes; LIBXML2_REQUIRE="libxml-2.0"],
[AC_MSG_ERROR([couldn't find libxml2])])
else
AC_CHECK_FUNCS(memmove)
AC_C_BIGENDIAN([byteorder=1234], [byteorder=4321], [], [])
fi
AC_SUBST(LIBXML2_REQUIRE)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(vsnprintf)
if test "x$with_libxml2" = xyes; then
with_parser=libxml2
PARSER_NAME=libxml2
PARSER_CFLAGS=\$\(libxml2_CFLAGS\)
PARSER_LIBS=\$\(libxml2_LIBS\)
else
with_parser=builtin
PARSER_NAME=expat
PARSER_CFLAGS=\$\(builtin_CFLAGS\)
PARSER_LIBS=\$\(builtin_LIBS\)
fi
AC_MSG_NOTICE([libstrophe will use the $with_parser XML parser])
AC_SEARCH_LIBS([socket], [socket])
AC_CHECK_LIB([resolv], [main])
AM_CONDITIONAL([BUILD_EXPAT], [test x$with_parser = xbuiltin])
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
AC_DEFINE_UNQUOTED([BYTEORDER], [$byteorder])
AC_SUBST(PARSER_NAME)
AC_SUBST(PARSER_CFLAGS)
AC_SUBST(PARSER_LIBS)
dnl Let the compiler be a bit more picky. Please note that you cannot
dnl specify these flags to the compiler before AC_CHECK_FUNCS, because
dnl the test program will generate a compilation warning and hence fail
dnl to detect the function ;-)if test "$ICC" = "yes"
dnl Lines borrowed from memcached 1.4.2
if test "$ICC" = "yes"
then
dnl ICC trying to be gcc.
CFLAGS="$CFLAGS -diag-disable 187 -Wall -Werror"
AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
elif test "$GCC" = "yes"
then
GCC_VERSION=`$CC -dumpversion`
CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wstrict-prototypes -Wmissing-prototyp
es -Wmissing-declarations -Wredundant-decls"
case $GCC_VERSION in
4.4.*)
CFLAGS="$CFLAGS -fno-strict-aliasing"
;;
esac
AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
elif test "$SUNCC" = "yes"
then
CFLAGS="$CFLAGS -errfmt=error -errtags -errwarn=%all,no%E_ATTRIBUTE_UNKNOWN,no%E_EMPTY_TRANSLATION_UNIT -errshort=tags"
fi
AC_CONFIG_FILES([Makefile libstrophe.pc])
AC_OUTPUT