Make format_vorbis_ogg compile on OpenBSD
[asterisk/asterisk.git] / configure.ac
index cbe7880..29379d3 100644 (file)
@@ -32,14 +32,28 @@ case "${host_os}" in
      CPPFLAGS=-I/usr/local/include
      LDFLAGS=-L/usr/local/lib
      ;;
-
+     openbsd*)
+     ac_default_prefix=/usr/local
+     if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
+        if test ${sysconfdir} = '${prefix}/etc'; then
+           sysconfdir=/etc
+        fi
+        if test ${mandir} = '${prefix}/man'; then
+           mandir=/usr/share/man
+        fi
+     fi
+     CPPFLAGS=-I/usr/local/include
+     LDFLAGS=-L/usr/local/lib
+     ;;
      *)
      ac_default_prefix=/usr
-     if test ${sysconfdir} = '${prefix}/etc'; then
-        sysconfdir=/etc
-     fi
-     if test ${mandir} = '${prefix}/man'; then
-        mandir=/usr/share/man
+     if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
+        if test ${sysconfdir} = '${prefix}/etc'; then
+           sysconfdir=/etc
+        fi
+        if test ${mandir} = '${prefix}/man'; then
+           mandir=/usr/share/man
+        fi
      fi
      ;;
 esac
@@ -179,8 +193,9 @@ ACX_PTHREAD
 
 AC_LANG(C)
 
-AC_ARG_ENABLE(dev-mode,
-       [  --enable-dev-mode    Turn on developer mode],
+AC_ARG_ENABLE([dev-mode],
+       [AS_HELP_STRING([--enable-dev-mode],
+               [Turn on developer mode])],
        [case "${enableval}" in
              y|ye|yes) AST_DEVMODE=yes ;;
              n|no)  AST_DEVMODE=no ;;
@@ -213,9 +228,11 @@ AST_EXT_LIB_SETUP([GSM], [External GSM library], [gsm], [, use 'internal' GSM ot
 AST_EXT_LIB_SETUP([GTK], [gtk libraries], [gtk])
 AST_EXT_LIB_SETUP([GTK2], [gtk2 libraries], [gtk2])
 AST_EXT_LIB_SETUP([GMIME], [GMime library], [gmime])
+AST_EXT_LIB_SETUP([HOARD], [Hoard Memory Allocator], [hoard])
 AST_EXT_LIB_SETUP([ICONV], [Iconv Library], [iconv])
 AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber Library], [iksemel])
 AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
+AST_EXT_LIB_SETUP([IODBC], [iODBC], [iodbc])
 AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux Library], [isdnnet])
 AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack])
 AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
@@ -226,7 +243,6 @@ AST_EXT_LIB_SETUP([NBS], [Network Broadcast Sound], [nbs])
 AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
 AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
-AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [odbc])
 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
@@ -234,6 +250,7 @@ AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
+AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
 AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
 AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
@@ -252,6 +269,7 @@ AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
 AST_EXT_LIB_SETUP([TERMCAP], [Termcap], [termcap])
 AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
+AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
 AST_EXT_LIB_SETUP([USB], [usb], [usb])
 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
@@ -326,8 +344,19 @@ AC_CHECK_HEADER([sys/poll.h],
    [HAS_POLL=1]
    AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]),
    )
+
+AC_ARG_ENABLE([internal-poll],
+       [AS_HELP_STRING([--enable-internal-poll],
+               [Use Asterisk's poll implementation])],
+       [case "${enableval}" in
+               y|ye|yes) HAS_POLL="";;
+               n|no) HAS_POLL="${HAS_POLL}" ;;
+               *) AC_MSG_ERROR(bad value ${enableval} for --enable-internal-poll) ;;
+       esac])
 AC_SUBST(HAS_POLL)
 
+
+
 # https support (in main/http.c) uses funopen on BSD systems,
 # fopencookie on linux
 AC_CHECK_FUNCS([funopen fopencookie])
@@ -477,14 +506,24 @@ AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
 
 AC_MSG_CHECKING(for -fno-strict-overflow)
 if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-   AC_MSG_RESULT(yes)
-   AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
+       AC_MSG_RESULT(yes)
+       AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
 else
        AC_MSG_RESULT(no)
        AST_NO_STRICT_OVERFLOW=
 fi
 AC_SUBST(AST_NO_STRICT_OVERFLOW)
 
+AC_MSG_CHECKING(for -Wshadow)
+if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       AC_MSG_RESULT(yes)
+       AST_SHADOW_WARNINGS=-Wshadow
+else
+       AC_MSG_RESULT(no)
+       AST_SHADOW_WARNINGS=
+fi
+AC_SUBST(AST_SHADOW_WARNINGS)
+
 AC_MSG_CHECKING(for sysinfo)
 AC_LINK_IFELSE(
         AC_LANG_PROGRAM([#include <sys/sysinfo.h>],
@@ -602,7 +641,7 @@ AST_EXT_LIB_CHECK([STRTOD], [c], [strtod], [stdlib.h])
 AST_EXT_LIB_CHECK([FLOOR], [m], [floor])
 AST_EXT_LIB_CHECK([CEIL], [m], [ceil])
 
-AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h])
+AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
 
 GSM_INTERNAL="yes"
 AC_SUBST(GSM_INTERNAL)
@@ -1200,6 +1239,8 @@ if test "${USE_IMAP_TK}" != "no"; then
        LIBS="${saved_libs}"
 fi
 
+AST_EXT_LIB_CHECK([IODBC], [iodbc], [SQLConnect], [sql.h], [-lpthread])
+
 AST_EXT_LIB_CHECK([JACK], [jack], [jack_activate], [jack/jack.h])
 
 # Needed by unixodbc
@@ -1231,6 +1272,12 @@ AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
 
 AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
 
+PBX_ODBC=0
+if test "$PBX_IODBC" = "1" -o "$PBX_UNIXODBC" = "1"; then
+   PBX_ODBC=1
+fi
+AC_SUBST(PBX_ODBC)
+
 AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
 
 # Non-glibc platforms require libexecinfo for backtrace support
@@ -1295,11 +1342,15 @@ AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_get_version], [libpri.h])
 
+AST_EXT_LIB_CHECK([PRI_INBANDDISCONNECT], [pri], [pri_set_inbanddisconnect], [libpri.h])
+
+AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
+
 AST_C_COMPILE_CHECK([SPANDSP], [
                #if SPANDSP_RELEASE_DATE < 20080516
                #error "spandsp 0.0.5 or greater is required"
                #endif
-       ], [spandsp/version.h])
+       ], [spandsp/version.h], , [minimum version of SpanDSP])
 
 if test "x${PBX_SPANDSP}" = "x1" ; then
        # We found the correct version in the header, now let's make sure it links
@@ -1407,7 +1458,9 @@ then
     AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl])
 fi
 
-AST_EXT_TOOL_CHECK([GMIME], [gmime])
+AST_EXT_TOOL_CHECK([GMIME], [gmime], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
+
+AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
 
 AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
 
@@ -1423,7 +1476,12 @@ AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h],
 
 AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
 
-AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
+if test "${OSARCH}" = "OpenBSD";
+then
+       AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -logg])
+else
+       AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
+fi
 
 AC_LANG_PUSH(C++)