Review Board 1.7.16


Check to make sure we can successfully link libsrtp in a shared library

Review Request #857 - Created Aug. 11, 2010 and submitted

Terry Wilson
/trunk/
Reviewers
asterisk-dev
kpfleming
Asterisk
libsrtp ships in many distros without being compiled with the -fPIC flag for 64-bit machines. The upstream Makefile/configure scripts don't ever add the -fPIC option and only ship the static library. I have notified upstream, but even if they fix it we need to check for the problem in older versions. This patch attempts to detect problems linking libsrtp in a shared library.
Tested on 64-bit with and without -fPIC compiled libsrtp.

Diff revision 1 (Latest)

  1. /trunk/configure.ac: Loading...
  2. /trunk/configure: Loading...
/trunk/configure.ac
Revision 281765 New Change
[20] 1804 lines
[+20]
1805
    AST_CHECK_OSPTK([3], [6], [0])
1805
    AST_CHECK_OSPTK([3], [6], [0])
1806
fi
1806
fi
1807

    
   
1807

   
1808
AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h])
1808
AST_EXT_LIB_CHECK([SRTP], [srtp], [srtp_init], [srtp/srtp.h])
1809

    
   
1809

   

    
   
1810
if test "$PBX_SRTP" = "1";

    
   
1811
then

    
   
1812
    saved_libs="${LIBS}"

    
   
1813
    saved_ldflags="${LDFLAGS}"

    
   
1814
    LIBS="${LIBS} -lsrtp"

    
   
1815
    LDFLAGS="${LDFLAGS} -shared -fPIC"

    
   
1816
    AC_MSG_CHECKING(for the ability of -lsrtp to be linked in a shared object)

    
   
1817
    AC_LINK_IFELSE(

    
   
1818
    [

    
   
1819
        AC_LANG_PROGRAM(

    
   
1820
            [#include <srtp/srtp.h>],

    
   
1821
            [srtp_init();]

    
   
1822
        )

    
   
1823
    ],

    
   
1824
    [ AC_MSG_RESULT(yes) ],

    
   
1825
    [

    
   
1826
        AC_MSG_RESULT(no)

    
   
1827
        AC_MSG_NOTICE(***)

    
   
1828
        AC_MSG_NOTICE(*** libsrtp could not be linked as a shared object)

    
   
1829
        AC_MSG_NOTICE(*** try compiling libsrtp manually and configuring with)

    
   
1830
        AC_MSG_NOTICE(*** ./configure CFLAGS=-fPIC --prefix=/usr)

    
   
1831
        AC_MSG_NOTICE(*** replacing /usr with the prefix of your choice)

    
   
1832
        exit 1

    
   
1833
    ]

    
   
1834
    )

    
   
1835
    LIBS="${saved_libs}"

    
   
1836
    LDFLAGS="${saved_ldflags}"

    
   
1837
fi

    
   
1838

   
1810
AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
1839
AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
1811

    
   
1840

   
1812
AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
1841
AST_EXT_LIB_CHECK([HOARD], [hoard], [malloc], [])
1813

    
   
1842

   
1814
AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
1843
AST_EXT_LIB_CHECK([FREETDS], [sybdb], [dbinit], [sybdb.h])
[+20] [20] 235 lines
/trunk/configure
Revision UNKNOWN New Change
 
  1. /trunk/configure.ac: Loading...
  2. /trunk/configure: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.