blob: a5ffaed3a106e1f7f48a8464d7ef351242111886 [file] [log] [blame]
Tomas Cejka50c076e2014-03-18 15:31:10 +01001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.63])
5AC_INIT([mod_netconf], [1.0.0], [cejkat@cesnet.cz])
6AM_INIT_AUTOMAKE([silent-rules])
7AM_SILENT_RULES([yes])
8
9USERNAME=`git config --get user.name`
10USERMAIL=`git config --get user.email`
11AC_SUBST(USERNAME)
12AC_SUBST(USERMAIL)
13
14RELEASE=1
15AC_SUBST(RELEASE)
16LIBS="-lnetconf -ljson"
17
18if test "x$webguidir" == x; then
19 webguidir="/var/www"
20fi
21AC_ARG_VAR(webguidir, [Installation directory for webgui [/var/www]])
22AC_SUBST(webguidir)
23
24AC_ARG_VAR(httpdmoduledir, [Installation directory for Apache module, leave unset to use Apache default.])
25AC_SUBST(httpdmoduledir)
26
27if test "x$httpdconfddir" == x; then
28 httpdconfddir="/etc/httpd/conf.d"
29fi
30AC_ARG_VAR(httpdconfddir, [Directory for Apache configuration files [/etc/httpd/conf.d]])
31AC_SUBST(httpdconfddir)
32
33if test "x$webguiname" == x; then
34 webguiname="netconfwebgui"
35fi
36AC_ARG_VAR(webguiname, [Installation directory name for webgui [netconfwebgui]])
37AC_SUBST(webguiname)
38
39# Checks for programs.
40AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME],[name of the apxs executable [[apxs]]]), [APXS="$with_apxs"])
41if test -z "${APXS}"; then
42AC_PATH_PROGS(APXS, [apxs2 apxs], [no], [$PATH:/usr/sbin:/usr/local/apache2/bin])
43else
44AC_MSG_ERROR([Apxs for Apache module compilation and installation was not found.])
45fi
46
47# Check for rpmbuild
48AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
49AC_CHECK_PROG(HTTPD, [httpd], [yes], [""])
50AC_PATH_PROGS(APACHECTL, apachectl apache2ctl, no, [$PATH:/usr/sbin])
51
52if test "x$APACHECTL" != xno; then
53 AC_MSG_CHECKING([for php5_module in apache])
54 $APACHECTL -M 2> /dev/null | grep php5_module > /dev/null && AC_MSG_RESULT([yes]) || AC_MSG_ERROR(["php5_module was not found."])
55else
56AC_MSG_ERROR([apachectl was not found])
57fi
58
59AC_PATH_PROGS(PHP, php, [no], [$PATH])
60if test "x$PHP" != xno; then
61 for i in dom json xml pdo intl sysvsem; do
62 AC_MSG_CHECKING([for php module $i])
63 php -m | grep "$i" > /dev/null && AC_MSG_RESULT([yes]) || AC_MSG_ERROR([not found])
64 done
65else
66AC_MSG_ERROR([php was not found])
67fi
68AC_SUBST(PHP)
69
70
71# Check for rpmbuild
72AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
73RPM_RELEASE=1
74AC_SUBST(RPM_RELEASE)
75AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)
76
77# Checks for libraries.
78# save clean LIBS and CFLAGS
79SAVEDTEMP_LIBS=$LIBS
80SAVEDTEMP_CFLAGS=$CFLAGS
81#AC_CHECK_LIB([apr-1], [apr_hash_make])
82#AC_CHECK_LIB([aprutil-1], [apr_sha1_init])
83#AC_CHECK_LIB([netconf], [nc_session_connect])
84#AC_CHECK_LIB([json], [json_object_new_object])
85PKG_CHECK_MODULES([json], [json])
86PKG_CHECK_MODULES([websockets], [libwebsockets])
87PKG_CHECK_MODULES([apr], [apr-1])
88PKG_CHECK_MODULES([aprutil], [apr-util-1])
89PKG_CHECK_MODULES([netconf], [libnetconf])
90PKG_CHECK_MODULES([xml], [libxml-2.0])
91#$apr_CFLAGS $aprutil_CFLAGS
92#$apr_LIBS $aprutil_LIBS
93CFLAGS="$json_CFLAGS $websockets_CFLAGS $netconf_CFLAGS $xml_CFLAGS"
94LIBS="$json_LIBS $websockets_LIBS $netconf_LIBS $xml_LIBS"
95CPPFLAGS="$xml_CPPFLAGS"
96
97AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS"
98 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
99 CC="$PTHREAD_CC"],
100 [AC_MSG_ERROR([pthread not found])]
101 )
102SAVED_LIBS=$LIBS
103SAVED_CFLAGS=$CFLAGS
104
105AC_SUBST(SAVED_LIBS)
106AC_SUBST(SAVED_CFLAGS)
107
108AC_ARG_WITH([notifications],
109[AC_HELP_STRING([--without-notifications], [Disable notifications])],
110AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
111[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
112CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"]),
113[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
114CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"])
115
116# Checks for header files.
117AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
118
119# Checks for typedefs, structures, and compiler characteristics.
120AC_TYPE_INT64_T
121AC_TYPE_SIZE_T
122AC_TYPE_SSIZE_T
123
124# Checks for library functions.
125AC_FUNC_MALLOC
126AC_FUNC_REALLOC
127AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
128
129AC_CONFIG_FILES([Makefile
130 src/Makefile
131 ])
132AC_OUTPUT
133
134echo
135echo
136echo "------------------------------------------------------------------------"
137echo "$PACKAGE $VERSION"
138echo "------------------------------------------------------------------------"
139echo
140echo
141echo "Configuration Options Summary:"
142echo
143echo "Documentation..........: ${build_doc}"
144echo
145echo "Compilation............: make (or gmake)"
146echo " asxs.................: $ASXS"
147echo " LIBS.................: $LIBS"
148echo " CFLAGS...............: $CFLAGS"
149echo
150echo "Components"
151echo " mod_netconf..........: $with_modnetconf"
152echo " webgui frontend......: $with_webgui"
153echo " pyang plugins........: $with_pyang"
154echo
155echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
156echo " prefix...............: $prefix"
157echo " python module dir....: $pyplugindir"
158echo " webgui dir...........: $webguidir"
159echo " webgui name..........: $webguiname"
160echo " httpdmoduledir.......: $(test -z "$httpdmoduledir" && echo "Apache default path" || echo "$httpdmoduledir")"
161echo " httpdconfddir........: $(test -z "$httpdconfddir" && echo "Apache default path" || echo "$httpdconfddir")"
162echo " run composer install.: $composerinstall"
163echo
164