Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ if (WITH_GSM)
if (GSM_FOUND)
message(STATUS "gsm OK")
set(HAVE_GSM TRUE)
# Whether we should include <gsm.h> or <gsm/gsm.h>
if (GSM_INCLUDE_TOP)
set(HAVE_GSM_H TRUE)
else (GSM_INCLUDE_TOP)
set(HAVE_GSM_GSM_H TRUE)
endif (GSM_INCLUDE_TOP)

include_directories(${GSM_INCLUDE_DIR})
else (GSM_FOUND)
Expand Down
16 changes: 15 additions & 1 deletion cmake/FindGsm.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
FIND_PATH(GSM_INCLUDE_DIR gsm/gsm.h)
# Some distributions only ship a top-level `gsm.h`
IF (NOT GSM_INCLUDE_DIR)
FIND_PATH(GSM_INCLUDE_DIR gsm.h)
IF (GSM_INCLUDE_DIR)
# Let the caller know about this alternate location
SET(GSM_INCLUDE_TOP TRUE)
ENDIF (GSM_INCLUDE_DIR)
ENDIF (NOT GSM_INCLUDE_DIR)

FIND_LIBRARY(GSM_LIBRARY NAMES gsm)

IF(GSM_INCLUDE_DIR AND GSM_LIBRARY)
Expand All @@ -7,7 +16,12 @@ ENDIF(GSM_INCLUDE_DIR AND GSM_LIBRARY)

IF(GSM_FOUND)
IF (NOT Gsm_FIND_QUIETLY)
MESSAGE(STATUS "Found gsm includes: ${GSM_INCLUDE_DIR}/gsm/config.h")
IF (GSM_INCLUDE_TOP)
SET(gsm_include_file "gsm.h")
ELSE (GSM_INCLUDE_TOP)
SET(gsm_include_file "gsm/gsm.h")
ENDIF (GSM_INCLUDE_TOP)
MESSAGE(STATUS "Found gsm includes: ${GSM_INCLUDE_DIR}/${gsm_include_file}")
MESSAGE(STATUS "Found gsm library: ${GSM_LIBRARY}")
ENDIF (NOT Gsm_FIND_QUIETLY)
ELSE(GSM_FOUND)
Expand Down
4 changes: 4 additions & 0 deletions src/audio/audio_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@

#ifdef HAVE_GSM
extern "C" {
#ifdef HAVE_GSM_GSM_H
#include <gsm/gsm.h>
#else
#include <gsm.h>
#endif
}
#else
#include "gsm/inc/gsm.h"
Expand Down
4 changes: 4 additions & 0 deletions src/audio/audio_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@

#ifdef HAVE_GSM
extern "C" {
#ifdef HAVE_GSM_GSM_H
#include <gsm/gsm.h>
#else
#include <gsm.h>
#endif
}
#else
#include "gsm/inc/gsm.h"
Expand Down
6 changes: 0 additions & 6 deletions src/audio/audio_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
#include "twinkle_rtp_session.h"
#include "twinkle_config.h"

#ifdef HAVE_GSM
#include <gsm/gsm.h>
#else
#include "gsm/inc/gsm.h"
#endif

using namespace std;
using namespace ost;

Expand Down
2 changes: 2 additions & 0 deletions twinkle_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#cmakedefine HAVE_BCG729
#cmakedefine HAVE_BCG729_ANNEX_B
#cmakedefine HAVE_GSM
#cmakedefine HAVE_GSM_H
#cmakedefine HAVE_GSM_GSM_H

#cmakedefine HAVE_UNISTD_H
#cmakedefine HAVE_LINUX_TYPES_H
Expand Down