Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | # Copyright (C) 1999-2005 Open Source Telecom Corporation. |
| 2 | # Copyright (C) 2006-2010 David Sugar, Tycho Softworks. |
| 3 | # |
| 4 | # This file is free software; as a special exception the author gives |
| 5 | # unlimited permission to copy and/or distribute it, with or without |
| 6 | # modifications, as long as this notice is preserved. |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, but |
| 9 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the |
| 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 11 | |
| 12 | AC_INIT(src/ccrtp/rtp.h) |
| 13 | |
| 14 | cfg_options="" |
| 15 | if test -z "$*" ; then |
| 16 | if test -f ~/.configure ; then |
| 17 | cfg_options=`grep ^ccrtp: ~/.configure | sed -e s/^ccrtp://` |
| 18 | elif test -f /etc/configure.conf ; then |
| 19 | cfg_options=`grep ^ccrtp: /etc/configure.conf | sed -e s/^ccrtp://` |
| 20 | fi |
| 21 | fi |
| 22 | |
| 23 | if test ! -z "$cfg_options" ; then |
| 24 | echo "using ~/.configure defaults...$cfg_options" |
| 25 | case "$SHELL" in |
| 26 | */bash*) |
| 27 | exec $SHELL $0 $cfg_options |
| 28 | exit -1 |
| 29 | ;; |
| 30 | esac |
| 31 | exec $0 $cfg_options |
| 32 | exit -1 |
| 33 | fi |
| 34 | |
| 35 | VERSION="1.8.0" |
| 36 | REQUIRES="1.3.0" |
| 37 | LT_RELEASE="1.8" |
| 38 | LT_VERSION="0:0" |
| 39 | AC_CONFIG_AUX_DIR(autoconf) |
| 40 | AC_CANONICAL_SYSTEM |
| 41 | AC_PROG_CPP |
| 42 | AC_PROG_CXXCPP |
| 43 | AC_PROG_CXX |
| 44 | # OST_PROG_CC_POSIX |
| 45 | AM_PROG_LIBTOOL |
| 46 | AM_INIT_AUTOMAKE(ccrtp,[$VERSION]) |
| 47 | AM_CONFIG_HEADER(src/config.h) |
| 48 | |
| 49 | AC_C_RESTRICT |
| 50 | AC_C_VOLATILE |
| 51 | AC_C_INLINE |
| 52 | |
| 53 | if test -z "$PKG_CONFIG_PATH" ; then |
| 54 | PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" |
| 55 | fi |
| 56 | |
| 57 | if test "$prefix" != "NONE" ; then |
| 58 | PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$PKG_CONFIG_PATH" |
| 59 | fi |
| 60 | |
| 61 | export PKG_CONFIG_PATH |
| 62 | |
| 63 | # use "-no-undefined" on Cygwin to force (trigger) libtool to create |
| 64 | # the shared lib. If this is not set this library |
| 65 | # is not created. Be sure that the LIBS variable above contains _all_ |
| 66 | # libraries necessary to build ours, Cygwin does not allow undefined |
| 67 | # symbols. |
| 68 | case $host in |
| 69 | # *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) |
| 70 | *-*-cygwin*) |
| 71 | LDFLAGS="$LDFLAGS -no-undefined" |
| 72 | ;; |
| 73 | *) |
| 74 | ;; |
| 75 | esac |
| 76 | |
| 77 | # SRTP support |
| 78 | AC_ARG_ENABLE(srtp, |
| 79 | AS_HELP_STRING([--enable-srtp], |
| 80 | [enable SRTP support (default enabled)])) |
| 81 | if test -z "$enable_srtp"; then |
| 82 | enable_srtp="yes" |
| 83 | AC_DEFINE(SRTP_SUPPORT, [], [SRTP support]) |
| 84 | fi |
| 85 | |
| 86 | AM_CONDITIONAL(SRTP_OPENSSL, test "$openssl" = "true") |
| 87 | AM_CONDITIONAL(SRTP_GCRYPT, test "$gcrypt" = "true") |
| 88 | # availability of gcrypt or openSSL crypto library if SRTP support is enabled |
| 89 | if test "${enable_srtp}" = "yes" |
| 90 | then |
| 91 | openssl="false" |
| 92 | gcrypt="false" |
| 93 | AM_PATH_LIBGCRYPT_CCRTP([1:1.2.3], |
| 94 | [AC_CHECK_HEADERS([gcrypt.h], |
| 95 | [], AC_MSG_ERROR([libgcrypt headers not found.])) |
| 96 | LIBS="$LIBGCRYPT_LIBS $LIBS" |
| 97 | gcrypt="true" |
| 98 | ], |
| 99 | [AC_CHECK_LIB([crypto], |
| 100 | [EVP_CipherInit_ex], |
| 101 | [AC_CHECK_HEADERS([openssl/bn.h openssl/aes.h openssl/sha.h], |
| 102 | [], AC_MSG_ERROR([OpenSSL headers not found.])) |
| 103 | LIBS="-lcrypto $LIBS" |
| 104 | openssl="true" |
| 105 | ], |
| 106 | [AC_MSG_ERROR([Cannot find libgcrypt or OpenSSL crypto library.])] |
| 107 | ) |
| 108 | ] |
| 109 | ) |
| 110 | AM_CONDITIONAL(SRTP_OPENSSL, test "$openssl" = "true") |
| 111 | AM_CONDITIONAL(SRTP_GCRYPT, test "$gcrypt" = "true") |
| 112 | |
| 113 | fi |
| 114 | |
| 115 | OST_PROG_COMMON |
| 116 | OST_PROG_LIBVER |
| 117 | OST_PROG_LIBRARY(CCXX,[$LT_VERSION]) |
| 118 | OST_AUTOMAKE_MODE |
| 119 | OST_MAINTAINER_MODE |
| 120 | PKG_CHECK_MODULES(COMMON, libccgnu2 >= $REQUIRES) |
| 121 | CXXFLAGS="$CXXFLAGS $COMMON_CFLAGS" |
| 122 | COMMON_LIBPATH=`pkg-config --variable=libdir libccgnu2` |
| 123 | GNULIBS="-L$COMMON_LIBPATH $COMMON_LIBS $LIBS" |
| 124 | AC_SUBST(GNULIBS) |
| 125 | # OST_CC_ENDIAN - now in Common C++ |
| 126 | # Are we using the GNU compiler? |
| 127 | if test $GCC = yes ; then |
| 128 | WARN_FLAGS="-fno-strict-aliasing -Wall -ansi -pedantic" |
| 129 | else |
| 130 | WARN_FLAGS="" |
| 131 | fi |
| 132 | AC_SUBST(WARN_FLAGS) |
| 133 | |
| 134 | OST_DEBUG |
| 135 | |
| 136 | dnl --with-nana: check for nana, the GNU assertion checking and logging library |
| 137 | AC_ARG_WITH(nana,[ --with-nana use GNU nana for asserts and logging],[ |
| 138 | AC_CHECK_HEADER(nana.h, [ |
| 139 | AC_CHECK_HEADERS(DL.h, [ |
| 140 | AC_CHECK_LIB(nana, main) |
| 141 | ]) |
| 142 | ]) |
| 143 | ]) |
| 144 | |
| 145 | KDOC_DIR="\$(top_srcdir)/doc" |
| 146 | AC_SUBST(LT_RELEASE) |
| 147 | AC_SUBST(KDOC_DIR) |
| 148 | |
| 149 | AC_PATH_PROG(DOXYGEN, doxygen, no) |
| 150 | AC_SUBST(DOXYGEN) |
| 151 | AM_CONDITIONAL(DOXY, test "$DOXYGEN" != "no") |
| 152 | |
| 153 | LIB_VERSION=`echo $LT_RELEASE | sed -e 's/[\.]/_/'` |
| 154 | LIB_MAJOR=`echo $LT_VERSION | sed -e 's/[:].*$//'` |
| 155 | |
| 156 | AC_SUBST(LIB_VERSION) |
| 157 | AC_SUBST(LIB_MAJOR) |
| 158 | |
| 159 | AC_OUTPUT(Makefile m4/Makefile src/Makefile src/ccrtp/Makefile |
| 160 | doc/Makefile demo/Makefile phone/Makefile w32/Makefile ccrtp.spec |
| 161 | libccrtp.spec ccrtp.list libccrtp1.pc src/ccrtp/crypto/Makefile) |