configure.ac 3.75 KB
Newer Older
Ghislain MARY's avatar
Ghislain MARY committed
1
dnl Process this file with autoconf to produce a configure script.
2
AC_INIT([msopenh264],[1.2.0])
Ghislain MARY's avatar
Ghislain MARY committed
3 4 5

AC_CANONICAL_SYSTEM

6
AM_INIT_AUTOMAKE([tar-ustar foreign])
7
AC_CONFIG_HEADERS(config.h)
8

Ghislain MARY's avatar
Ghislain MARY committed
9 10
AC_MSG_CHECKING([warning make an error on compilation])
AC_ARG_ENABLE(strict,
11
[  --enable-strict         Enable error on compilation warning [default=yes]],
Ghislain MARY's avatar
Ghislain MARY committed
12 13 14 15 16
[wall_werror=$enableval],
[wall_werror=yes]
)


17 18 19 20 21 22 23 24 25 26
AC_ARG_ENABLE(decoder,
[  --disable-decoder       Disable decoder - encoder only configuration [default=no]],
[decoder_enabled=$enableval],
[decoder_enabled=yes]
)

if test "$decoder_enabled" = "yes" ; then
	AC_DEFINE(OPENH264_DECODER_ENABLED, 1, [whether decoder is compiled])
fi

Ghislain MARY's avatar
Ghislain MARY committed
27
dnl Checks for programs.
28
AC_PROG_CXX
Ghislain MARY's avatar
Ghislain MARY committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL


case $target_os in 
	*mingw*)
		mingw_found=yes
	;;
esac

AM_CONDITIONAL(BUILD_WIN32, test x$mingw_found = xyes)

AC_CONFIG_COMMANDS([libtool-hacking],[
if test "$mingw_found" = "yes" ; then
	AC_MSG_NOTICE([Hacking libtool to work with mingw...])
	sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
	cp -f ./libtool.tmp ./libtool
	rm -f ./libtool.tmp
fi
],[mingw_found=$mingw_found])


CFLAGS="$CFLAGS -Wall"


dnl Checks for header files.
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_WORDS_BIGENDIAN
if test x$ac_cv_c_bigendian = xyes ; then
	CFLAGS="$CFLAGS -D_BIGENDIAN"
fi

if test $GCC = yes && test $wall_werror = yes;  then
69
	CFLAGS="$CFLAGS -Werror -Wextra "
Ghislain MARY's avatar
Ghislain MARY committed
70 71
fi

72 73 74 75 76
if test $GCC = yes ; then
	CFLAGS="$CFLAGS -pthread"
	LDFLAGS="$LDFLAGS -pthread"
fi

77
PKG_CHECK_MODULES(MEDIASTREAMER, mediastreamer >= 2.14.0)
Ghislain MARY's avatar
Ghislain MARY committed
78 79 80 81 82 83 84 85 86

found_openh264=no
AC_ARG_WITH(openh264,
	[AS_HELP_STRING([--with-openh264], [Sets the installation prefix of the openh264 library. (default=$prefix)])],
	[ openh264prefix=${withval}],
	[ openh264prefix=$prefix ]
)
CPPFLAGS_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I${openh264prefix}/include -L${openh264prefix}/lib"
87 88
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
89 90 91 92 93 94 95
AC_CHECK_HEADERS([stdbool.h wels/codec_api.h],
		[ AC_CHECK_LIB(openh264, WelsCreateDecoder, [ OPENH264_LIBS="-lopenh264"; found_openh264=yes]) ],
		[],
		[[#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#endif
		]]
Ghislain MARY's avatar
Ghislain MARY committed
96 97
	)
AC_SUBST(OPENH264_LIBS)
98
AC_LANG_RESTORE
Ghislain MARY's avatar
Ghislain MARY committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
CPPFLAGS=$CPPFLAGS_save

if test "${found_openh264}" = "no"; then
	AC_MSG_ERROR([Could not find the openh264 library.])
fi

LDFLAGS="$LDFLAGS -rdynamic "

dnl define path of plugins:
PACKAGE_PLUGINS_DIR="\$(libdir)/mediastreamer/plugins"
AC_SUBST(PACKAGE_PLUGINS_DIR)

dnl ##################################################
dnl # Check for ESP Packager
dnl ##################################################

AC_PATH_PROG(EPM,epm,false)
AC_PATH_PROG(MKEPMLIST,mkepmlist,false)
AC_PATH_PROG(EPMINSTALL,epminstall,false)
AM_CONDITIONAL(WITH_EPM,test $EPM != false && test $MKEPMLIST != false && test $EPMINSTALL != false)


# Preferred packaging system, as per EPM terminology
case $target in
*-*-linux*)
	if test -f /etc/debian_version ; then
		EPM_PKG_EXT=deb
	else
     		EPM_PKG_EXT=rpm
     	fi
     	;;
*-hp-hpux*)
     	EPM_PKG_EXT=depot.gz;;
*-dec-osf*)
	EPM_PKG_EXT=setld;;
esac
AC_SUBST(EPM_PKG_EXT)

# System software User & Group names
case $target in
*-*-linux*)
	SYS_USER=root
	SYS_GROUP=root
	;;
*-*-hpux*|*-dec-osf*)
	SYS_USER=bin
	SYS_GROUP=bin
	;;
esac
AC_SUBST(SYS_USER)
AC_SUBST(SYS_GROUP)

# CPU Architecture
case $target_cpu in
i?86)		ARCH=i386;;
*)		ARCH=$target_cpu;;
esac
AC_SUBST(ARCH)

# Various other packaging variables, that can be over-ridden ad `make
# package' time
SUMMARY="A H264 codec mediastreamer plugin"
AC_SUBST(SUMMARY)
PACKAGER=anonymous
AC_SUBST(PACKAGER)
LICENSE=GPL
AC_SUBST(LICENSE)
VENDOR=Linphone
AC_SUBST(VENDOR)
RELEASE=1
AC_SUBST(RELEASE)


AC_OUTPUT(
Makefile
build/Makefile
build/vs/Makefile
src/Makefile
msopenh264.iss
)