xpp: fix manpage of astribank_hexload
[dahdi/tools.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.59)
4  
5 m4_define([TOOLSVERSION],
6           m4_bpatsubst(m4_esyscmd([build_tools/make_version . dahdi/tools]),
7                        [\([0-9.]*\)\(\w\|\W\)*],
8                        [\1]))
9 AC_INIT(dahdi, TOOLSVERSION, www.asterisk.org)
10
11 # check existence of the package
12 AC_CONFIG_SRCDIR([dahdi_cfg.c])
13
14 AC_COPYRIGHT("dahdi-tools")
15 AC_REVISION($Revision$)
16
17 ac_default_prefix=/usr
18 if test ${sysconfdir} = '${prefix}/etc'; then
19    sysconfdir=/etc
20 fi
21 if test ${mandir} = '${prefix}/man'; then
22    mandir=/usr/share/man
23 fi
24
25 if test ${localstatedir} = '${prefix}/var'; then
26      localstatedir=/var
27 fi
28
29 # specify output header file
30 AC_CONFIG_HEADER(autoconfig.h)
31
32 # This needs to be before any macros that use the C compiler
33 AC_GNU_SOURCE
34
35 AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h])
36
37 AC_CHECK_TOOL([LD], [ld])
38
39 # Checks for programs.
40 AC_PROG_CC
41 AC_PROG_CPP
42 AC_PROG_INSTALL
43 AC_PROG_LN_S
44 AST_CHECK_GNU_MAKE
45
46 test_obj=conftest.o
47 AC_COMPILE_IFELSE(AC_LANG_SOURCE(),[
48         BDFNAME=`LANG=C objdump -f $test_obj | grep -e "$test_obj:" | sed "s/.*file format \(.*\)/\1/"`
49         BDFARCH=`LANG=C objdump -f $test_obj | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"`    
50 ],[])
51 AC_SUBST(BDFNAME)
52 AC_SUBST(BDFARCH)
53
54 # Set the default value of HOSTCC from CC if --host was not provided:
55 HOSTCC=${HOSTCC:=${CC}}
56 AC_SUBST(HOSTCC)
57
58 AC_PATH_PROG([GREP], [grep], :)
59 AC_PATH_PROG([SHELL], [sh], :)
60 AC_PATH_PROG([LN], [ln], :)
61
62 AC_PATH_PROG([WGET], [wget], :)
63 if test "${WGET}" != ":" ; then
64   DOWNLOAD=${WGET}
65 else
66   AC_PATH_PROG([FETCH], [fetch], [:])
67   DOWNLOAD=${FETCH}
68 fi
69 AC_SUBST(DOWNLOAD)
70
71 AC_LANG(C)
72
73 AC_ARG_ENABLE(dev-mode,
74         [  --enable-dev-mode    Turn on developer mode],
75         [case "${enableval}" in
76               y|ye|yes) DAHDI_DEVMODE=yes ;;
77               n|no)  DAHDI_DEVMODE=no ;;
78               *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode)  ;;
79         esac])
80 AC_SUBST(DAHDI_DEVMODE)
81
82 AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
83 if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
84         AC_MSG_RESULT(yes)
85         DAHDI_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
86 else
87         AC_MSG_RESULT(no)
88         DAHDI_DECLARATION_AFTER_STATEMENT=
89 fi
90 AC_SUBST(DAHDI_DECLARATION_AFTER_STATEMENT)
91
92 AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
93 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
94 AST_EXT_LIB_SETUP([USB], [usb], [usb])
95
96 AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
97 DAHDI23_DIR="${DAHDI_DIR}"
98 AST_C_DEFINE_CHECK([DAHDI23], [DAHDI_CONFIG_NTTE], [dahdi/user.h])
99 AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
100 AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h])
101
102 AC_CHECK_FUNCS([semtimedop])
103
104 PBX_HDLC=0
105 AC_MSG_CHECKING([for GENERIC_HDLC_VERSION version 4 in linux/hdlc.h])
106 AC_COMPILE_IFELSE(
107     [ AC_LANG_PROGRAM( [#include <linux/hdlc.h>],
108             [#if defined(GENERIC_HDLC_VERSION) && GENERIC_HDLC_VERSION >= 4
109                 int foo = 0;
110                 #else
111                 int foo = bar;
112                 #endif
113                 0])],
114         [AC_MSG_RESULT(yes)
115          PBX_HDLC=1],
116         [AC_MSG_RESULT(no)]
117 )
118 if test $PBX_HDLC = 0; then
119     AC_MSG_CHECKING([for GENERIC_HDLC_VERSION version 4 in linux/hdlc/ioctl.h])
120     AC_COMPILE_IFELSE(
121             [ AC_LANG_PROGRAM( [
122                     #include <sys/socket.h>
123                         #include <linux/if.h>],
124                         [#if defined(GENERIC_HDLC_VERSION) && GENERIC_HDLC_VERSION >= 4
125                         int foo = 0;
126                         #else
127                         int foo = bar;
128                         #endif
129                         0])],
130                 [AC_MSG_RESULT(yes)
131                  PBX_HDLC=1],
132                 [AC_MSG_RESULT(no)]
133         )
134 fi
135
136 if test "x${PBX_HDLC}" != "x1"; then
137    AC_MSG_NOTICE([GENERIC_HDLC_VERSION (version 4) not found, disabling sethdlc.])
138 fi
139
140 AC_SUBST(PBX_HDLC)
141
142 AC_ARG_WITH(selinux,
143         [AS_HELP_STRING([--with-selinux],
144                         [enable (with) / disable (without) SELinux])],
145         [USE_SELINUX=$withval],
146         [ if test ! -x /usr/sbin/sestatus; then 
147                 USE_SELINUX=no;
148           elif /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"; then
149                 USE_SELINUX=yes
150           fi
151         ]
152 )
153
154
155 AC_SUBST(USE_SELINUX)
156
157 # for asciidoc before ver. 7, the backend must be stated explicitly:
158 ASCIIDOC='asciidoc'
159 asciidoc_ver=`asciidoc --version 2>&1 | awk '/^asciidoc /{print $2}' | cut -d. -f 1 | head -n 1`
160 if test "$asciidoc_ver" != '' && test $asciidoc_ver -lt 7; then
161         ASCIIDOC="asciidoc -b xhtml"
162 fi
163 AC_SUBST(ASCIIDOC)
164
165 AC_ARG_WITH(ppp,
166             [AS_HELP_STRING([--with-ppp=PATH],[Use PPP support from PATH])],
167             [],
168             [with_ppp=check]
169             )
170 # somebody will fix that
171 default_ppp_path=/usr
172
173 case "$with_ppp" in
174         yes|check) ppp_path="$default_ppp_path";;
175         no) ppp_path='' ;;
176         *) ppp_path="$with_ppp" ;;
177 esac
178
179 level_file="$ppp_path/include/pppd/patchlevel.h"
180 PPP_VERSION=
181 if test "$ppp_path" != '' && test -r "$level_file"; then
182         PPPD_VERSION=`awk -F '"' '/VERSION/ { print $$2; }' $level_file`
183 fi
184
185 case "$with_ppp" in 
186         check|no) :;;
187         *) 
188         # If we asked explicitly for ppp support
189         if test "$PPPD_VERSION" = ''; then
190                 # but have not detected it
191                 AC_MSG_ERROR(failed to find pppd/patchlevel.h: no ppp support.)
192         fi
193         ;;
194 esac
195
196 if test "x${PBX_DAHDI}" != "x1"; then
197    AC_MSG_NOTICE([***])
198    AC_MSG_NOTICE([*** Building this package requires DAHDI support. *** ])
199    AC_MSG_NOTICE([*** Please install the dahdi-linux package. ***])
200    AC_MSG_NOTICE([***])
201    exit 1
202 fi
203
204 if test "x${PBX_DAHDI23}" != "x1"; then
205    AC_MSG_NOTICE([***])
206    AC_MSG_NOTICE([*** Building this package requires DAHDI support (>= 2.3) *** ])
207    AC_MSG_NOTICE([*** Please install a recent dahdi-linux package. ***])
208    AC_MSG_NOTICE([***])
209    exit 1
210 fi
211
212 AC_SUBST(PPPD_VERSION)
213
214 AC_CONFIG_FILES([build_tools/menuselect-deps makeopts])
215 AC_OUTPUT
216
217 AC_MSG_NOTICE(*** dahdi-tools build successfully configured ***)