blob: e03c84cb902cd5fc1458d52ca3acc0bd85f1e454 [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
Tomas Cejkaf02a9842014-03-20 15:54:56 +010047AM_CONDITIONAL([MANUAL_CONFD], [test -n "$with_apxs" ])
48
Tomas Cejka50c076e2014-03-18 15:31:10 +010049# Check for rpmbuild
50AC_CHECK_PROG(RPMBUILD, [rpmbuild], [rpmbuild], [""])
51AC_CHECK_PROG(HTTPD, [httpd], [yes], [""])
52AC_PATH_PROGS(APACHECTL, apachectl apache2ctl, no, [$PATH:/usr/sbin])
53
54if test "x$APACHECTL" != xno; then
55 AC_MSG_CHECKING([for php5_module in apache])
56 $APACHECTL -M 2> /dev/null | grep php5_module > /dev/null && AC_MSG_RESULT([yes]) || AC_MSG_ERROR(["php5_module was not found."])
57else
58AC_MSG_ERROR([apachectl was not found])
59fi
60
61AC_PATH_PROGS(PHP, php, [no], [$PATH])
62if test "x$PHP" != xno; then
63 for i in dom json xml pdo intl sysvsem; do
64 AC_MSG_CHECKING([for php module $i])
65 php -m | grep "$i" > /dev/null && AC_MSG_RESULT([yes]) || AC_MSG_ERROR([not found])
66 done
67else
68AC_MSG_ERROR([php was not found])
69fi
70AC_SUBST(PHP)
71
72
73# Check for rpmbuild
74AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, [""])
75RPM_RELEASE=1
76AC_SUBST(RPM_RELEASE)
77AM_CONDITIONAL(MAKE_RPMS, test x$RPMBUILD != x)
78
79# Checks for libraries.
80# save clean LIBS and CFLAGS
81SAVEDTEMP_LIBS=$LIBS
82SAVEDTEMP_CFLAGS=$CFLAGS
83#AC_CHECK_LIB([apr-1], [apr_hash_make])
84#AC_CHECK_LIB([aprutil-1], [apr_sha1_init])
85#AC_CHECK_LIB([netconf], [nc_session_connect])
86#AC_CHECK_LIB([json], [json_object_new_object])
87PKG_CHECK_MODULES([json], [json])
88PKG_CHECK_MODULES([websockets], [libwebsockets])
89PKG_CHECK_MODULES([apr], [apr-1])
90PKG_CHECK_MODULES([aprutil], [apr-util-1])
91PKG_CHECK_MODULES([netconf], [libnetconf])
92PKG_CHECK_MODULES([xml], [libxml-2.0])
93#$apr_CFLAGS $aprutil_CFLAGS
94#$apr_LIBS $aprutil_LIBS
95CFLAGS="$json_CFLAGS $websockets_CFLAGS $netconf_CFLAGS $xml_CFLAGS"
96LIBS="$json_LIBS $websockets_LIBS $netconf_LIBS $xml_LIBS"
97CPPFLAGS="$xml_CPPFLAGS"
98
99AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS"
100 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
101 CC="$PTHREAD_CC"],
102 [AC_MSG_ERROR([pthread not found])]
103 )
104SAVED_LIBS=$LIBS
105SAVED_CFLAGS=$CFLAGS
106
107AC_SUBST(SAVED_LIBS)
108AC_SUBST(SAVED_CFLAGS)
109
110AC_ARG_WITH([notifications],
111[AC_HELP_STRING([--without-notifications], [Disable notifications])],
112AS_IF([test "x$with_notifications" == "xno"],[CFLAGS="$CFLAGS"],
113[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
114CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"]),
115[AC_CHECK_LIB([websockets], [libwebsocket_create_context])
116CFLAGS="$CFLAGS -DWITH_NOTIFICATIONS"])
117
118# Checks for header files.
119AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
120
121# Checks for typedefs, structures, and compiler characteristics.
122AC_TYPE_INT64_T
123AC_TYPE_SIZE_T
124AC_TYPE_SSIZE_T
125
126# Checks for library functions.
127AC_FUNC_MALLOC
128AC_FUNC_REALLOC
129AC_CHECK_FUNCS([getdelim gettimeofday memset socket strdup strerror])
130
131AC_CONFIG_FILES([Makefile
132 src/Makefile
133 ])
134AC_OUTPUT
135
136echo
137echo
138echo "------------------------------------------------------------------------"
139echo "$PACKAGE $VERSION"
140echo "------------------------------------------------------------------------"
141echo
142echo
143echo "Configuration Options Summary:"
144echo
145echo "Documentation..........: ${build_doc}"
146echo
147echo "Compilation............: make (or gmake)"
148echo " asxs.................: $ASXS"
149echo " LIBS.................: $LIBS"
150echo " CFLAGS...............: $CFLAGS"
151echo
152echo "Components"
153echo " mod_netconf..........: $with_modnetconf"
154echo " webgui frontend......: $with_webgui"
155echo " pyang plugins........: $with_pyang"
156echo
157echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
158echo " prefix...............: $prefix"
159echo " python module dir....: $pyplugindir"
160echo " webgui dir...........: $webguidir"
161echo " webgui name..........: $webguiname"
162echo " httpdmoduledir.......: $(test -z "$httpdmoduledir" && echo "Apache default path" || echo "$httpdmoduledir")"
163echo " httpdconfddir........: $(test -z "$httpdconfddir" && echo "Apache default path" || echo "$httpdconfddir")"
164echo " run composer install.: $composerinstall"
165echo
166