summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 850942a51f40d720e250e445b99590619bb9d125 (plain)
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
dnl
dnl release information
dnl
AC_INIT(csoap, 1.1.0)

dnl
dnl version information
dnl
csoap_version=1:1:0
nanohttp_version=1:1:0

AC_CONFIG_SRCDIR([nanohttp/nanohttp-server.c])
AC_CONFIG_SRCDIR([libcsoap/soap-server.c])
AM_INIT_AUTOMAKE

csoap_release=`echo $VERSION | awk -F. '{print $1"."$2}'`
AC_SUBST(csoap_release)
AC_SUBST(csoap_version)
csoap_version_dotted=`echo $csoap_version | sed 's/:/./g'`
AC_SUBST(csoap_version_dotted)

nanohttp_release=$csoap_release
AC_SUBST(nanohttp_release)
AC_SUBST(nanohttp_version)

AM_CONFIG_HEADER(config.h)

AC_LANG_C
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL

AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h malloc.h netdb.h netinet/in.h stdint.h stdlib.h signal.h pthread.h string.h sys/socket.h sys/time.h unistd.h io.h stdio.h stdarg.h errno.h ctype.h openssl/rand.h openssl/err.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM

AC_TYPE_SIGNAL

AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)

AC_FUNC_MALLOC
AC_FUNC_VPRINTF
AC_FUNC_STRFTIME
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([gethostbyname inet_ntoa memmove memset mkdir select socket strchr strdup strncasecmp strpbrk strspn strstr strtol])

if test x_$build_os = x_solaris2.8; then
  CFLAGS="$CFLAGS -D_REENTRANT"
fi

AC_CHECK_FUNCS([localtime_r strtok_r])

# ------------------------------------------
# Check socket library (for Solaris)
# ------------------------------------------
AC_CHECK_LIB(socket, socket, [LIBSOCKET="-lsocket"])
AC_SUBST(LIBSOCKET)

AC_CHECK_LIB(nsl, inet_ntoa, [LIBNSL="-lnsl"])
AC_CHECK_LIB(nsl, gethostbyname, [LIBNSL="-lnsl"])
AC_SUBST(LIBNSL)

AM_PATH_XML2(2.6.0,CFLAGS="$CFLAGS $XML_CPPFLAGS"; LDFLAGS="$LDFLAGS $XML_LIBS",exit 1)

# ------------------------------------------
# Check ssl library 
# Original work at: http://autoconf-archive.cryp.to/check_ssl.html
# ------------------------------------------
AC_DEFUN([CHECK_SSL],
[AC_MSG_CHECKING(if ssl is wanted)
AC_ARG_WITH(ssl,
[  --with-ssl=PFX	will check PFX for ssl library
  --with-ssl		will check /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr for ssl library
],
[   AC_MSG_RESULT(yes)
    for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
        ssldir="$dir"
        if test -f "$dir/include/openssl/ssl.h"; then
            found_ssl="yes";
            CFLAGS="$CFLAGS -I$ssldir/include/openssl";
            break;
        fi
        if test -f "$dir/include/ssl.h"; then
            found_ssl="yes";
            CFLAGS="$CFLAGS -I$ssldir/include";
            break
        fi
    done
    if test x_$found_ssl != x_yes; then
        AC_MSG_ERROR(Cannot find ssl libraries
		Please goto http://www.openssl.org and install OpenSSL or
		install it from your os distribution)
    else
        printf "OpenSSL found in $ssldir\n";
        LIBS="$LIBS -lssl -lcrypto";
        LDFLAGS="$LDFLAGS -L$ssldir/lib";
        AC_DEFINE(HAVE_SSL,1,Define to 1 if you have requested --with-ssl)
    fi
],
[
    AC_MSG_RESULT(no)
])
])dnl

CHECK_SSL

AC_OUTPUT(Makefile 
libcsoap/Makefile 
nanohttp/Makefile 
examples/Makefile
examples/nanohttp/Makefile
examples/csoap/Makefile
libcsoap.pc
csoap-config)