Browse Your Downloaded Videos on Internet: PHP based video webserver that exposes a local path containing videos to the internet.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

946 lines
34 KiB

  1. ## @id $Id$
  2. ## 1 2 3 4 5 6 7 8
  3. ## 45678901234567890123456789012345678901234567890123456789012345678901234567890
  4. # m4_esyscmd_s does not exist on centos 5 and 6
  5. m4_define([mrw_esyscmd_s], [m4_normalize(m4_esyscmd([$1]))])
  6. # define least version number from subversion's revision number:
  7. # it is taken modulo 256 due to a bug on Apple's MaxOSX
  8. m4_define(x_least, m4_ifdef([x_least_fix], [x_least_fix],
  9. m4_ifdef([x_least_diff],
  10. mrw_esyscmd_s([
  11. VCS_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-checkout"
  12. for path in . .. ../.. ../../..; do
  13. if test -d .svn; then
  14. svn upgrade 1>&2 > /dev/null || true
  15. VCS_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p')
  16. if test -n "${VCS_REVISION}"; then break; fi
  17. elif test -d .git; then
  18. VCS_REVISION=$(git rev-list --all --count)
  19. if test -n "${VCS_REVISION}"; then break; fi
  20. fi
  21. done
  22. echo $ECHO_N $(($VCS_REVISION))
  23. ]), mrw_esyscmd_s([
  24. VCS_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-checkout"
  25. for path in . .. ../.. ../../..; do
  26. if test -d .svn; then
  27. svn upgrade 1>&2 > /dev/null || true
  28. VCS_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p')
  29. if test -n "${VCS_REVISION}"; then break; fi
  30. elif test -d .git; then
  31. VCS_REVISION=$(git rev-list --all --count)
  32. if test -n "${VCS_REVISION}"; then break; fi
  33. fi
  34. done
  35. # Mac does not support LEAST > 255
  36. echo $ECHO_N $(($VCS_REVISION%256))]))))
  37. # define version number from subversion's revision number:
  38. # it is taken modulo 256 due to a bug on Apple's MacOSX
  39. # add to x_minor if revision number is > 256
  40. m4_define(x_minor_diff, m4_ifdef([x_least_fix], 0, mrw_esyscmd_s([
  41. VCS_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-checkout"
  42. for path in . .. ../.. ../../..; do
  43. if test -d .svn; then
  44. svn upgrade 1>&2 > /dev/null || true
  45. VCS_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p')
  46. if test -n "${VCS_REVISION}"; then break; fi
  47. elif test -d .git; then
  48. VCS_REVISION=$(git rev-list --all --count)
  49. if test -n "${VCS_REVISION}"; then break; fi
  50. fi;
  51. done
  52. # Mac does not support LEAST > 255
  53. echo $ECHO_N $(($VCS_REVISION/256))])))
  54. # setup version number
  55. m4_define(x_version, [x_major.m4_ifdef([x_least_diff], x_minor, m4_eval(x_minor+x_minor_diff)).m4_eval(m4_ifdef([x_least_diff], [x_least-x_least_diff], [x_least]))])
  56. ## bugreport mail address is taken from <user@host> in first line of AUTHORS
  57. m4_define(x_bugreport, mrw_esyscmd_s([
  58. head -1 AUTHORS | \
  59. sed -n 's,.*<\([-_.a-z0-9A-Z]*@[-_.a-z0-9A-Z]*\)>.*,\1,gp'
  60. ]))
  61. m4_include(ax_check_qt.m4)
  62. AC_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR])
  63. AC_DEFUN([AX_DEFINE_DIR], [
  64. prefix_NONE=
  65. exec_prefix_NONE=
  66. test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
  67. test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
  68. dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
  69. dnl refers to ${prefix}. Thus we have to use `eval' twice.
  70. eval ax_define_dir="\"[$]$2\""
  71. eval ax_define_dir="\"$ax_define_dir\""
  72. AC_SUBST($1, "$ax_define_dir")
  73. AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3])
  74. test "$prefix_NONE" && prefix=NONE
  75. test "$exec_prefix_NONE" && exec_prefix=NONE
  76. ])
  77. # add target dependencies to an existing makefile.in
  78. # - parameters:
  79. # $1 = existing target
  80. # $2 = new dependency for that target
  81. # $3 = filename of makefile.in
  82. AC_DEFUN([AX_ADD_MAKEFILE_TARGET_DEP], [
  83. sh_add_makefile_target_dep() {
  84. sed -i -e ':a;/^'${1}':.*\\$/{N;s/\\\n//;ta};s/^'${1}':.*$/& '${2}'/' "${srcdir}/${3}"
  85. if ! egrep -q "${1}:.* ${2}" "${srcdir}/${3}"; then
  86. echo "${1}: ${2}" >> "${srcdir}/${3}"
  87. fi
  88. }
  89. sh_add_makefile_target_dep "$1" "$2" "$3"
  90. if test "$1" != ".PHONY"; then
  91. sh_add_makefile_target_dep ".PHONY" "$2" "$3"
  92. fi
  93. ])
  94. # Same as AC_SUBST, but adds -Dname="value" option to CPPFLAGS and a
  95. # notz only a @name@ replacement, but also a @name_ENCODED@ one to be
  96. # used in code.
  97. # - parameters:
  98. # $1 = variable name
  99. AC_DEFUN([AX_SUBST], [
  100. [$1]_ENCODED=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,')
  101. [$1]_ENCODED=${[$1]_ENCODED//\"/\\\"}
  102. [$1]_ENCODED=${[$1]_ENCODED//\'/\'\"\'\"\'}
  103. [$1]_ENCODED=${[$1]_ENCODED//#/\\#}
  104. AM_CPPFLAGS+=" '-D$1=\"${[$1]_ENCODED}\"'"
  105. AC_SUBST([$1])
  106. AC_SUBST([$1]_ENCODED)
  107. AC_SUBST(AM_CPPFLAGS)
  108. ])
  109. # must be called on the right position in configure.ac
  110. #
  111. # configure.ac must start with:
  112. #
  113. # m4_define(x_package_name, YOUR_PACKAGE_NAME) # project's name
  114. # m4_define(x_major, MAJOR_NUMBER) # project's major version
  115. # m4_define(x_minor, MINOR_NUMBER) # project's minor version
  116. # m4_include(ax_init_standard_project.m4)
  117. # AC_INIT(x_package_name, x_version, x_bugreport, x_package_name)
  118. # AM_INIT_AUTOMAKE([1.9 tar-pax parallel-tests color-tests])
  119. # AX_INIT_STANDARD_PROJECT
  120. #
  121. # you change nothing but: YOUR_PACKAGE_NAME, MAJOR_NUMBER, MINOR_NUMBER
  122. #
  123. # configures the basic environment
  124. AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
  125. PREFIX=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${prefix}")
  126. AX_SUBST(PREFIX)
  127. SYSCONFDIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${sysconfdir}")
  128. AX_SUBST(SYSCONFDIR)
  129. DATADIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${datadir}")
  130. AX_SUBST(DATADIR)
  131. PKGDATADIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${DATADIR}/${PACKAGE_NAME}")
  132. AX_SUBST(PKGDATADIR)
  133. LOCALSTATEDIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${localstatedir}")
  134. AX_SUBST(LOCALSTATEDIR)
  135. AC_MSG_CHECKING([target platfrom])
  136. UNIX=1
  137. MINGW=
  138. MACOSX=
  139. for h in ${target} ${target_os} ${host} ${host_os} \
  140. ${build} ${build_os} $(uname -s 2> /dev/null); do
  141. p="$h is generic Unix"
  142. case "$h" in
  143. (*mingw*)
  144. UNIX=; MINGW=1; p="MinGW"; break;;
  145. (*Darwin*|*darwin*|*rhapsody*|*macosx*)
  146. UNIX=; MACOSX=1; p="MacOSX"; break;;
  147. esac
  148. done
  149. AC_MSG_RESULT($p)
  150. AM_CONDITIONAL(UNIX, test "$UNIX" = "1")
  151. AM_CONDITIONAL(MINGW, test "$MINGW" = "1")
  152. AM_CONDITIONAL(MACOSX, test "$MACOSX" = "1")
  153. AX_SUBST(UNIX)
  154. AX_SUBST(MINGW)
  155. AX_SUBST(MACOSX)
  156. AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_TARNAME//[^a-zA-Z0-9]/_}'"
  157. AX_SUBST(NUMBERS)
  158. AX_SUBST(HOME)
  159. if test -f README.md; then
  160. README=$(tail -n +3 README.md)
  161. DESCRIPTION=$(head -1 README.md)
  162. else
  163. README=$(tail -n +3 README)
  164. DESCRIPTION=$(head -1 README)
  165. fi
  166. README_ESCAPED=$(echo "$README" | sed ':a;N;$!ba;s/\n/\\n/g;s,",\\",g')
  167. if which pandoc 2>&1 > /dev/null; then
  168. README_HTML=$(echo "$README" | pandoc -f markdown_github -t html | sed ':a;N;$!ba;s,\\\(.\),\\\\<span>\1</span>,g;s/\n/\\n/g;s,",\\",g;s, ,\&nbsp;\&nbsp;,g')
  169. else
  170. README_HTML="${README}"
  171. fi
  172. AX_SUBST(README)
  173. _AM_SUBST_NOTMAKE([README])
  174. AX_SUBST(README_ESCAPED)
  175. _AM_SUBST_NOTMAKE([README_ESCAPED])
  176. AX_SUBST(README_HTML)
  177. _AM_SUBST_NOTMAKE([README_HTML])
  178. AX_SUBST(DESCRIPTION)
  179. _AM_SUBST_NOTMAKE([DESCRIPTION])
  180. LICENSE=$(echo $(head -1 COPYING))
  181. AX_SUBST(LICENSE)
  182. COPYING=$(<COPYING)
  183. AX_SUBST(COPYING)
  184. _AM_SUBST_NOTMAKE([COPYING])
  185. AUTHOR=$(head -1 AUTHORS)
  186. AUTHOR_NAME=$(echo $AUTHOR | sed 's, *[[<(]].*$,,')
  187. AUTHOR_URL=$(echo $AUTHOR | sed 's,.*(\(http[[^)]]*\)).*,\1,')
  188. AUTHOR_MAIL=$(echo $AUTHOR | sed 's,.*<\(.*@.*\)>.*,\1,')
  189. AX_SUBST(AUTHOR)
  190. _AM_SUBST_NOTMAKE([AUTHOR])
  191. AX_SUBST(AUTHOR_NAME)
  192. AX_SUBST(AUTHOR_URL)
  193. AX_SUBST(AUTHOR_MAIL)
  194. PROJECT_URL="${PROJECT_URL:-${AUTHOR_URL}/projects/${PACKAGE_NAME}}"
  195. SOURCE_DOWNLOAD="${SOURCE_DOWNLOAD:-${AUTHOR_URL}/downloads/${PACKAGE_NAME}}"
  196. AX_SUBST(PROJECT_URL)
  197. AX_SUBST(SOURCE_DOWNLOAD)
  198. DISTRO=$(lsb_release -sc 2>/dev/null || uname -s 2>/dev/null)
  199. AX_SUBST(DISTRO)
  200. ARCH=$((@<:@@<:@ $(uname -sm) =~ 64 @:>@@:>@ && echo amd64) || (@<:@@<:@ $(uname -sm) =~ 'i?86' @:>@@:>@ && echo i386 || uname -sm))
  201. AX_SUBST(ARCH)
  202. DISTRIBUTOR=$(lsb_release -si 2>/dev/null || uname -s 2>/dev/null)
  203. case "${DISTRIBUTOR// /-}" in
  204. (Ubuntu) UBUNTU=1; AX_SUBST(UBUNTU);;
  205. (Debian) DEBIAN=1; AX_SUBST(DEBIAN);;
  206. (SUSE-LINUX) SUSE=1; AX_SUBST(SUSE);;
  207. (Fedora) FEDORA=1; AX_SUBST(FEDORA);;
  208. (Centos) CENTOS=1; AX_SUBST(CENTOS);;
  209. esac
  210. AX_SUBST(DISTRIBUTOR)
  211. BUILD_NUMBER=${BUILD_NUMBER:-1}
  212. AX_SUBST(BUILD_NUMBER)
  213. BUILD_DATE=$(LANG= date +"%a, %d %b %Y %H:%M:%S %z")
  214. AX_SUBST(BUILD_DATE)
  215. if test -f "${PACKAGE_NAME}.desktop.in"; then
  216. PACKAGE_DESKTOP="${PACKAGE_NAME}.desktop"
  217. fi
  218. AX_SUBST(PACKAGE_DESKTOP)
  219. if test -f "${PACKAGE_NAME}-logo.png"; then
  220. PACKAGE_LOGO="${PACKAGE_NAME}-logo.png"
  221. fi
  222. AX_SUBST(PACKAGE_LOGO)
  223. if test -f "${PACKAGE_NAME}-icon.svg"; then
  224. PACKAGE_ICON="${PACKAGE_NAME}-icon.svg"
  225. elif test -f "${PACKAGE_NAME}-icon.png"; then
  226. PACKAGE_ICON="${PACKAGE_NAME}-icon.png"
  227. elif test -f "${PACKAGE_NAME}.svg"; then
  228. PACKAGE_ICON="${PACKAGE_NAME}.svg"
  229. elif test -f "${PACKAGE_NAME}.png"; then
  230. PACKAGE_ICON="${PACKAGE_NAME}.png"
  231. fi
  232. AX_SUBST(PACKAGE_ICON)
  233. AC_ARG_ENABLE(pedantic,
  234. [AS_HELP_STRING([--enable-pedantic],
  235. [enable all warnings and checks, abort on warnings])],
  236. [have_pedantic="$enableval"; test "$enableval" = "yes" && \
  237. AM_CXXFLAGS="${AM_CXXFLAGS:-} -pedantic-errors -Wall -W -Wfloat-equal -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wmissing-format-attribute -Wno-multichar -Wpacked -Wredundant-decls -Werror -Wshadow -Wcast-qual -Wno-ctor-dtor-privacy"])
  238. dnl problem in libs: -Wshadow -Wcast-qual
  239. dnl auto.hpp: -Wno-ctor-dtor-privacy (removed)
  240. AM_CONDITIONAL(PEDANTIC, test "$enableval" = "yes")
  241. if test "$have_pedantic" == "yes"; then
  242. AC_MSG_NOTICE([Pedantic compile mode enabled!
  243. - all warnings for GNU g++ are enabled
  244. - all warnings result in an error
  245. - doxygen warnings are treated as error too]); fi
  246. AC_ARG_ENABLE(debug,
  247. [AS_HELP_STRING([--enable-debug],
  248. [compile for debugger])],
  249. [have_debug="$enableval"], [have_debug="no"])
  250. AM_CONDITIONAL(DEBUG, test "$enableval" = "yes")
  251. if test "$have_debug" == "yes"; then
  252. AC_MSG_NOTICE([Debug compile mode enabled]);
  253. AM_CPPFLAGS="${AM_CPPFLAGS} -DDEBUG"
  254. AM_CXXFLAGS="${AM_CXXFLAGS:-} -ggdb3 -O0"
  255. AM_LDFLAGS="${AM_LDFLAGS} -ggdb3 -O0"
  256. else
  257. AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG"
  258. fi
  259. AC_ARG_WITH(gcov,
  260. [AS_HELP_STRING([--with-gcov=FILE],
  261. [enable gcov, set gcov file (defaults to gcov)])],
  262. [GCOV="$enableval"], [GCOV="no"])
  263. AM_CONDITIONAL(COVERAGE, test "$GCOV" != "no")
  264. if test "$GCOV" != "no"; then
  265. if test "$GCOV" == "yes"; then
  266. GCOV=gcov
  267. fi
  268. AC_CHECK_PROG(has_gcov, [$GCOV], [yes], [no])
  269. if test "$has_gcov" != "yes"; then
  270. AC_MSG_ERROR([gcov: program $GCOV not found])
  271. fi
  272. AC_MSG_NOTICE([Coverage tests enabled, using ${GCOV}]);
  273. AM_CXXFLAGS="${AM_CXXFLAGS:-} -O0 --coverage -fprofile-arcs -ftest-coverage"
  274. AM_LDFLAGS="${AM_LDFLAGS} -O0 --coverage -fprofile-arcs"
  275. AX_SUBST(GCOV)
  276. fi
  277. if test -f ${PACKAGE_NAME}.desktop.in; then
  278. AC_CONFIG_FILES([${PACKAGE_NAME}.desktop])
  279. fi
  280. AC_CONFIG_FILES([makefile])
  281. AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-standard-project-targets], [makefile.in])
  282. AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-standard-project-targets], [makefile.in])
  283. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-standard-project-targets], [makefile.in])
  284. test -f makefile.in && cat >> makefile.in <<EOF
  285. #### Begin: Appended by $0
  286. EXTRA_DIST += bootstrap.sh ax_init_standard_project.m4 ax_cxx_compile_stdcxx_11.m4 \
  287. ax_check_qt.m4 resolve-debbuilddeps.sh resolve-rpmbuilddeps.sh \
  288. build-resource-file.sh mac-create-app-bundle.sh
  289. clean-standard-project-targets:
  290. -rm -rf \${PACKAGE_NAME}-\${PACKAGE_VERSION}
  291. -rm \${PACKAGE_TARNAME}-\${PACKAGE_VERSION}.tar.gz
  292. distclean-standard-project-targets:
  293. -rm -r autom4te.cache
  294. -rm aclocal.m4 config.guess config.sub configure depcomp compile install-sh ltmain.sh makefile missing mkinstalldirs test-driver
  295. maintainer-clean-standard-project-targets:
  296. -rm makefile.in
  297. #### End: $0
  298. EOF
  299. ])
  300. # use this in configure.ac to support C++
  301. AC_DEFUN([AX_USE_CXX], [
  302. m4_include(ax_cxx_compile_stdcxx_11.m4)
  303. AC_LANG(C++)
  304. AX_CXX_COMPILE_STDCXX_14(noext, optional)
  305. AC_PROG_CXX
  306. AC_PROG_CPP
  307. AC_CONFIG_FILES([src/makefile])
  308. AM_CPPFLAGS+=' -I ${top_srcdir}/src -I ${top_builddir}/src -I ${srcdir} -I ${builddir}'
  309. AM_LDFLAGS+=' -L ${top_srcdir}/src -L ${top_builddir}/src'
  310. # Get rid of those stupid -g -O2 options!
  311. CXXFLAGS="${CXXFLAGS//-g -O2/}"
  312. CFLAGS="${CFLAGS//-g -O2/}"
  313. # pass compile flags to make distcheck
  314. AM_DISTCHECK_CONFIGURE_FLAGS="CXXFLAGS='${CXXFLAGS}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
  315. AC_SUBST(AM_DISTCHECK_CONFIGURE_FLAGS)
  316. AC_SUBST(AM_CXXFLAGS)
  317. AC_SUBST(AM_CPPFLAGS)
  318. AC_SUBST(AM_LDFLAGS)
  319. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-cxx-targets], [src/makefile.in])
  320. test -f src/makefile.in && cat >> src/makefile.in <<EOF
  321. #### Begin: Appended by $0
  322. %.app: %
  323. -rm -r [\$][@]
  324. \$(MAKE) DESTDIR=[\$][\$](pwd)/[\$][@]/tmp install
  325. QTDIR="\${QTDIR}" \
  326. QT_PLUGINS="\${QT_PLUGINS}" \
  327. QT_PLUGIN_PATH="\${QT_PLUGIN_PATH}" \
  328. \${top_builddir}/mac-create-app-bundle.sh \
  329. [\$][@] [\$][<] [\$][\$](pwd)/[\$][@]/tmp\${prefix}
  330. maintainer-clean-cxx-targets:
  331. -rm makefile.in
  332. #### End: $0
  333. EOF
  334. ])
  335. # use this in configure.ac to support old school C
  336. AC_DEFUN([AX_USE_C], [
  337. AC_LANG(C)
  338. AC_PROG_CC
  339. AC_PROG_CPP
  340. AC_CONFIG_FILES([src/makefile])
  341. AM_CPPFLAGS+=' -I ${top_srcdir}/src -I ${top_builddir}/src -I ${srcdir} -I ${builddir}'
  342. AM_LDFLAGS+=' -L ${top_srcdir}/src -L ${top_builddir}/src'
  343. # Get rid of those stupid -g -O2 options!
  344. CXXFLAGS="${CXXFLAGS//-g -O2/}"
  345. CFLAGS="${CFLAGS//-g -O2/}"
  346. # pass compile flags to make distcheck
  347. AM_DISTCHECK_CONFIGURE_FLAGS="CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
  348. AC_SUBST(AM_DISTCHECK_CONFIGURE_FLAGS)
  349. AC_SUBST(AM_CFLAGS)
  350. AC_SUBST(AM_CPPFLAGS)
  351. AC_SUBST(AM_LDFLAGS)
  352. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-c-targets], [src/makefile.in])
  353. test -f src/makefile.in && cat >> src/makefile.in <<EOF
  354. #### Begin: Appended by $0
  355. %.app: %
  356. -rm -r [\$][@]
  357. \$(MAKE) DESTDIR=[\$][\$](pwd)/[\$][@]/tmp install
  358. \${top_builddir}/mac-create-app-bundle.sh \
  359. [\$][@] [\$][<] [\$][\$](pwd)/[\$][@]/tmp\${prefix}
  360. maintainer-clean-c-targets:
  361. -rm makefile.in
  362. #### End: $0
  363. EOF
  364. ])
  365. # use this in configure.ac to support tests without CppUnit
  366. AC_DEFUN([AX_BUILD_TEST], [
  367. AC_CONFIG_FILES([test/makefile])
  368. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-test-targets], [test/makefile.in])
  369. test -f test/makefile.in && cat >> test/makefile.in <<EOF
  370. #### Begin: Appended by $0
  371. maintainer-clean-test-targets:
  372. -rm makefile.in
  373. #### End: $0
  374. EOF
  375. ])
  376. # use this in configure.ac to support CppUnit for C++ unit tests
  377. AC_DEFUN([AX_USE_CPPUNIT], [
  378. AM_PATH_CPPUNIT([1.0.0], [have_cppunit="yes"], [have_cppunit="no"])
  379. # infos and warnings
  380. if test "$have_cppunit" = "no"; then
  381. AC_MSG_WARN([Missing cppunit development library!
  382. - you cannot check the project using "make check"
  383. - everything else works perfectly]); fi
  384. AX_BUILD_TEST
  385. ])
  386. # use this in configure.ac to support C++ examples
  387. AC_DEFUN([AX_BUILD_EXAMPLES], [
  388. AC_CONFIG_FILES([examples/makefile])
  389. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-example-targets], [examples/makefile.in])
  390. test -f examples/makefile.in && cat >> examples/makefile.in <<EOF
  391. #### Begin: Appended by $0
  392. maintainer-clean-example-targets:
  393. -rm makefile.in
  394. #### End: $0
  395. EOF
  396. ])
  397. # use this in configure.ac to support C++ examples
  398. AC_DEFUN([AX_USE_NODEJS], [
  399. AC_PATH_PROG(ANDROID, [android], [0],
  400. [${PATH}${PATH_SEPARATOR}${ANDROID_HOME}/tools])
  401. AC_PATH_PROG(CORDOVA, [cordova], [0],
  402. [${PATH}${PATH_SEPARATOR}$(pwd)/node_modules/cordova/bin])
  403. if test ${CORDOVA} = 0; then
  404. AC_MSG_WARN([cordova is missing, on ubuntu install cordova-cli from repository ppa:cordova-ubuntu/ppa])
  405. fi
  406. if test ${ANDROID} = 0; then
  407. AC_MSG_WARN([android sdk is missing, set variable ANDROID_HOME after installation])
  408. fi
  409. AM_CONDITIONAL(HAVE_CORDOVA, [test ${CORDOVA} != 0 -a ${ANDROID} != 0])
  410. AX_SUBST(CORDOVA)
  411. AC_CONFIG_FILES([nodejs/package.json])
  412. AC_CONFIG_FILES([nodejs/makefile])
  413. AC_CONFIG_FILES([cordova/makefile])
  414. AC_CONFIG_FILES([cordova/config.xml])
  415. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-example-targets], [examples/makefile.in])
  416. test -f examples/makefile.in && cat >> examples/makefile.in <<EOF
  417. #### Begin: Appended by $0
  418. maintainer-clean-example-targets:
  419. -rm makefile.in
  420. #### End: $0
  421. EOF
  422. ])
  423. # use this in configure.ac to support HTML data for webservers
  424. AC_DEFUN([AX_BUILD_HTML], [
  425. AC_CONFIG_FILES([html/makefile])
  426. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-html-targets], [html/makefile.in])
  427. test -f html/makefile.in && cat >> html/makefile.in <<EOF
  428. #### Begin: Appended by $0
  429. maintainer-clean-html-targets:
  430. -rm makefile.in
  431. #### End: $0
  432. EOF
  433. ])
  434. # use this in configure.ac to support C++ libraries
  435. AC_DEFUN([AX_USE_LIBTOOL], [
  436. # libtool versioning
  437. LIB_MAJOR=m4_eval(x_major+x_minor+x_minor_diff)
  438. LIB_MINOR=x_least
  439. LIB_LEAST=m4_eval(x_minor+x_minor_diff)
  440. LIB_VERSION="${LIB_MAJOR}:${LIB_MINOR}:${LIB_LEAST}"
  441. AM_LDFLAGS="-version-info ${LIB_VERSION}"
  442. AC_SUBST(AM_LDFLAGS)
  443. AC_SUBST(LIB_VERSION)
  444. AC_PROG_LIBTOOL
  445. AC_CONFIG_FILES([src/${PACKAGE_NAME}.pc])
  446. AX_ADD_MAKEFILE_TARGET_DEP([install-data-am], [install-data-libtool-pkg], [src/makefile.in])
  447. AX_ADD_MAKEFILE_TARGET_DEP([uninstall-am], [uninstall-data-am], [src/makefile.in])
  448. AX_ADD_MAKEFILE_TARGET_DEP([uninstall-data-am], [uninstall-data-libtool-pkg], [src/makefile.in])
  449. test -f src/makefile.in && cat >> src/makefile.in <<EOF
  450. #### Begin: Appended by $0
  451. install-data-libtool-pkg:
  452. test -d \$(DESTDIR)\${libdir}/pkgconfig || mkdir -p \$(DESTDIR)\${libdir}/pkgconfig
  453. chmod -R u+w \$(DESTDIR)\${libdir}/pkgconfig
  454. cp \${PACKAGE_NAME}.pc \$(DESTDIR)\${libdir}/pkgconfig/
  455. uninstall-data-libtool-pkg:
  456. -chmod -R u+w \$(DESTDIR)\${libdir}/pkgconfig
  457. -rm -f \$(DESTDIR)\${libdir}/pkgconfig/\${PACKAGE_NAME}.pc
  458. #### End: $0
  459. EOF
  460. ])
  461. # use this in configure.ac to support debian packages
  462. AC_DEFUN([AX_USE_DEBIAN_PACKAGING], [
  463. if test -f README.md; then
  464. README_DEB=$(tail -n +3 README.md | sed -e 's/^ *$/./g' -e 's/^/ /g')
  465. else
  466. README_DEB=$(tail -n +3 README | sed -e 's/^ *$/./g' -e 's/^/ /g')
  467. fi
  468. AC_SUBST(README_DEB)
  469. _AM_SUBST_NOTMAKE([README_DEB])
  470. AC_CONFIG_FILES([debian/changelog debian/control])
  471. AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-debian-targets], [makefile.in])
  472. AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-debian-targets], [makefile.in])
  473. test -f makefile.in && cat >> makefile.in <<EOF
  474. #### Begin: Appended by $0
  475. EXTRA_DIST += debian
  476. clean-debian-targets:
  477. -rm -rf \${PACKAGE_NAME}_\${PACKAGE_VERSION}~\${DISTRO}.\${BUILD_NUMBER}.{dsc,tar.gz} \${PACKAGE_NAME}_\${PACKAGE_VERSION}~\${DISTRO}.\${BUILD_NUMBER}*.changes \$\$(sed -n 's,Package: \(.*\),\1_${PACKAGE_VERSION}~${DISTRO}.${BUILD_NUMBER}*.deb,p;' debian/control)
  478. deb: distdir
  479. cd \${PACKAGE_NAME}-\${PACKAGE_VERSION} && ( export CFLAGS="\${CFLAGS}"; export CPPFLAGS="\${CPPFLAGS}"; export CXXFLAGS="\${CXXFLAGS}"; export LDFLAGS="\${LDFLAGS}"; export DEB_CFLAGS_APPEND="\${CFLAGS}"; export DEB_CPPFLAGS_APPEND="\${CPPFLAGS}"; export DEB_CXXFLAGS_APPEND="\${CXXFLAGS}"; export DEB_LDFLAGS_APPEND="\${LDFLAGS}"; dpkg-buildpackage )
  480. distclean-debian-targets:
  481. -rm debian/changelog debian/control
  482. #### End: $0
  483. EOF
  484. ])
  485. # use this in configure.ac to support RPM packages
  486. AC_DEFUN([AX_USE_RPM_PACKAGING], [
  487. AC_CONFIG_FILES([${PACKAGE_NAME}.spec])
  488. #AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-rpm-targets], [makefile.in])
  489. AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-rpm-targets], [makefile.in])
  490. AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-rpm-targets], [makefile.in])
  491. test -f makefile.in && cat >> makefile.in <<EOF
  492. #### Begin: Appended by $0
  493. EXTRA_DIST += \${PACKAGE_NAME}.spec.in
  494. rpm: dist
  495. rpmbuild -ba --define "_topdir \$\$(pwd)" --define "_sourcedir \$\$(pwd)" \${PACKAGE_NAME}.spec
  496. clean-rpm-targets:
  497. -rm -rf BUILD BUILDROOT RPMS SPECS SRPMS
  498. distclean-rpm-targets:
  499. -rm \${PACKAGE_NAME}.spec
  500. #### End: $0
  501. EOF
  502. ])
  503. # use this in configure.ac to support scripts, e.g. bash scripts
  504. AC_DEFUN([AX_USE_SCRIPTS], [
  505. AC_CONFIG_FILES([scripts/makefile])
  506. ])
  507. # use this in configure.ac to support Doxygen documentation generation
  508. AC_DEFUN([AX_USE_DOXYGEN], [
  509. AC_CHECK_PROG(have_doxygen, doxygen, yes, no)
  510. AC_CHECK_PROG(have_dot, dot, yes, no)
  511. AC_CHECK_PROG(have_mscgen, mscgen, yes, no)
  512. AM_CONDITIONAL(NEED_PLANTUML, test "$have_doxygen" = "yes" -a "1.8.11" != $((echo "1.8.11"; doxygen -v) | sort -V | head -1))
  513. PDF_DOC=${PACKAGE_NAME}-${PACKAGE_VERSION}.pdf
  514. AC_SUBST(PDF_DOC)
  515. if test "$have_doxygen" = "no"; then
  516. AC_MSG_WARN([Missing program doxygen!
  517. - you cannot rebuild the documentation
  518. - there are precompiled derived files in the distribution]); fi
  519. if test "$have_dot" = "no"; then
  520. AC_MSG_WARN([Missing program dot!
  521. - when you rebild documentation, there are no generated images
  522. - there are precompiled derived files in the distribution]); fi
  523. if test "$have_mscgen" = "no"; then
  524. AC_MSG_WARN([Missing program mscgen!
  525. - when you rebild documentation, there are no message state charts
  526. - there are precompiled derived files in the distribution]); fi
  527. AC_CONFIG_FILES([doc/makefile doc/doxyfile doc/header.html doc/footer.html])
  528. AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-documentation], [doc/makefile.in])
  529. AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-documentation], [doc/makefile.in])
  530. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-documentation], [doc/makefile.in])
  531. AX_ADD_MAKEFILE_TARGET_DEP([install-data-am], [install-data-documentation], [doc/makefile.in])
  532. AX_ADD_MAKEFILE_TARGET_DEP([uninstall-am], [uninstall-documentation], [doc/makefile.in])
  533. AX_ADD_MAKEFILE_TARGET_DEP([all], [doc], [doc/makefile.in])
  534. AX_ADD_MAKEFILE_TARGET_DEP([.PHONY], [pdf gen-uml-images], [doc/makefile.in])
  535. test -f doc/makefile.in && cat >> doc/makefile.in <<EOF
  536. #### Begin: Appended by $0
  537. doc: doxyfile @NEED_PLANTUML_TRUE@ gen-uml-images
  538. @NEED_PLANTUML_TRUE@ doxyadd() { grep -q "\$\$[1] += \$\$[2]" doxyfile || sed -i '/^'"\$\$[1]"' *=/a'"\$\$[1]"' += '"\$\$[2]" doxyfile; }; \\
  539. @NEED_PLANTUML_TRUE@ doxyadd ALIASES '"startuml{1}=@image html \\\\1\\\\n@image latex \\\\1\\\\n\\\\if DontIgnorePlantUMLCode"'; \\
  540. @NEED_PLANTUML_TRUE@ doxyadd ALIASES '"enduml=\\\\endif"'; \\
  541. @NEED_PLANTUML_TRUE@ doxyadd IMAGE_PATH '"gen-uml-images"';
  542. doxygen doxyfile
  543. @PEDANTIC_TRUE@ test \! -s doxygen.errors
  544. @NEED_PLANTUML_TRUE@EXTRA_DIST = ${EXTRA_DIST} plantuml.jar
  545. @NEED_PLANTUML_TRUE@
  546. @NEED_PLANTUML_TRUE@gen-uml-images:
  547. @NEED_PLANTUML_TRUE@ test -d gen-uml-images || mkdir gen-uml-images
  548. @NEED_PLANTUML_TRUE@ eval \$\$(sed -n 's, *INPUT *\\(+\\?\\)= *\\(.*\\),INPUT\\1=" \\2",gp' doxyfile); \\
  549. @NEED_PLANTUML_TRUE@ eval \$\$(sed -n 's, *FILE_PATTERNS *\\(+\\?\\)= *\\(.*\\),FILE_PATTERNS\\1=" \\2",gp' doxyfile); \\
  550. @NEED_PLANTUML_TRUE@ SOURCES="**.("\$\$(echo \$\${FILE_PATTERNS} | sed 's,*.,,g;s, ,|,g')")"; \\
  551. @NEED_PLANTUML_TRUE@ for src in \$\$INPUT; do \\
  552. @NEED_PLANTUML_TRUE@ java -Djava.awt.headless=true -jar \${top_srcdir}/doc/plantuml.jar -v -o \$\$(pwd)/gen-uml-images "\$\$src/\$\$SOURCES"; \\
  553. @NEED_PLANTUML_TRUE@ done
  554. clean-documentation:
  555. -rm doxygen.errors @PDF_DOC@
  556. @NEED_PLANTUML_TRUE@ -rm -rf gen-uml-images
  557. distclean-documentation:
  558. -rm -r html
  559. -rm @PACKAGE_NAME@.doxytag
  560. maintainer-clean-documentation:
  561. -rm makefile.in
  562. install-data-documentation:
  563. test -d \$(DESTDIR)\${docdir} || mkdir -p \$(DESTDIR)\${docdir}
  564. chmod -R u+w \$(DESTDIR)\${docdir}
  565. cp -r html \$(DESTDIR)\${docdir}/
  566. uninstall-documentation:
  567. -chmod -R u+w \$(DESTDIR)\${docdir}
  568. -rm -rf \$(DESTDIR)\${docdir}/html
  569. #### End: $0
  570. EOF
  571. ])
  572. # use this in configure.ac to support Doxygen documentation generation
  573. AC_DEFUN([AX_USE_PERLDOC], [
  574. PERL_SOURCES="m4_default([$1], [perl])"
  575. AX_SUBST(PERL_SOURCES)
  576. if test -z "$PERL_SOURCES"; then
  577. AC_MSG_ERROR([You must specify the path to per files
  578. - use [AX]_[USE]_PERLDOC([[pathes to perldoc]])]); fi
  579. AC_CHECK_PROG(have_perldoc, pods2html, yes, no)
  580. if test "$have_doxygen" = "no"; then
  581. AC_MSG_WARN([Missing program pods2html!
  582. - you cannot rebuild the documentation
  583. - there are precompiled derived files in the distribution
  584. - if you need to generate documentation, install libpod-tree-perl]); fi
  585. AC_CONFIG_FILES([doc/makefile])
  586. AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-perldoc], [doc/makefile.in])
  587. AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-perldoc], [doc/makefile.in])
  588. AX_ADD_MAKEFILE_TARGET_DEP([install-data-am], [install-data-perldoc], [doc/makefile.in])
  589. AX_ADD_MAKEFILE_TARGET_DEP([uninstall-am], [uninstall-perldoc], [doc/makefile.in])
  590. AX_ADD_MAKEFILE_TARGET_DEP([all], [doc], [doc/makefile.in])
  591. AX_ADD_MAKEFILE_TARGET_DEP([.PHONY], [doc], [doc/makefile.in])
  592. test -f doc/makefile.in && cat >> doc/makefile.in <<EOF
  593. #### Begin: Appended by $0
  594. doc: perldoc/index.html
  595. perldoc/index.html: \${PERL_SOURCES:%=perldoc/%}
  596. echo "<html><head><title>Perl Documentation</title></head><body><h1>Perl Documentation</h1><ul>" > perldoc/index.html
  597. for p in \${PERL_SOURCES:%=perldoc/%}; do \
  598. echo '<li><a href="'"\$\${p#perldoc/}"'/index.html">'"\$\${p#perldoc/}"'</a></li>' >> perldoc/index.html; \
  599. done
  600. echo "</ul></body></html>" >> perldoc/index.html
  601. perldoc/%:
  602. pods2html --notoc --empty --index index @top_srcdir@/\${@:perldoc/%=%} \$[@]
  603. distclean-perldoc:
  604. -rm -r perldoc
  605. maintainer-clean-perldoc:
  606. -rm makefile.in
  607. install-data-perldoc:
  608. test -d \$(DESTDIR)\${docdir} || mkdir -p \$(DESTDIR)\${docdir}
  609. chmod -R u+w \$(DESTDIR)\${docdir}
  610. cp -r perldoc \$(DESTDIR)\${docdir}/
  611. uninstall-perldoc:
  612. -chmod -R u+w \$(DESTDIR)\${docdir}
  613. -rm -rf \$(DESTDIR)\${docdir}/perldoc
  614. #### End: $0
  615. EOF
  616. ])
  617. # require a specific package, with fallback: test for a header
  618. # - parameter:
  619. # $1 = unique id (no special characters)
  620. # $2 = module name (optional, if different from id)
  621. # $3 = a header file to find (optional)
  622. # $4 = alternative module names (space separated, optional)
  623. # $5 = optional flags:
  624. # manualflags if CXXFLAGS, CPPFLAGS, LIBS should remain unchanged
  625. #
  626. # uses PKG_CHECK_MODULES to test for a module
  627. # then, if given, looks for the header file
  628. # if header file is not found, searches in alternative modules
  629. # sets all flags, so that the module can be used everywhere
  630. # fails if not found
  631. AC_DEFUN([AX_PKG_REQUIRE], [
  632. PKG_PROG_PKG_CONFIG
  633. optional_flags="$5"
  634. $1_found=no
  635. secondpar="m4_default([$2], [$1])"
  636. PKG_CHECK_MODULES([$1], [m4_default([$2], [$1])], [
  637. $1_found=$secondpar
  638. PKG_REQUIREMENTS+=" $secondpar"
  639. ], [
  640. if test -n "$4"; then
  641. AC_MSG_WARN([Recommended package $secondpar for feature $1 not installed, trying $4])
  642. for pkg in $4; do
  643. PKG_CHECK_MODULES([$1], [$pkg], [
  644. PKG_REQUIREMENTS+=" $pkg"
  645. $1_found=$pkg
  646. break;
  647. ], [
  648. AC_MSG_WARN([Recommended package $pkg for feature $1 not installed])
  649. ])
  650. done
  651. fi
  652. ])
  653. AC_SUBST(CPPFLAGS)
  654. AC_SUBST(CXXFLAGS)
  655. AC_SUBST(PKG_REQUIREMENTS)
  656. if test -n "$3"; then
  657. if test "${$1_found}" = "no"; then
  658. tmp_package="yes"
  659. else
  660. tmp_package=${$1_found}
  661. fi
  662. $1_found=no
  663. old_CPPFLAGS=${CPPFLAGS}
  664. CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"
  665. AC_CHECK_HEADER([$3], [
  666. $1_found=${tmp_package}
  667. ], [
  668. for x in ${$1_CFLAGS}; do
  669. AC_MSG_NOTICE([search for $3 in ${x[#]-I}])
  670. for f in $(find ${x[#]-I} -name "$3" 2> /dev/null); do
  671. if test -f "$f"; then
  672. $1_found=${tmp_package}
  673. $1_CFLAGS+=" -I${f%/*}"
  674. AC_MSG_NOTICE([added path ${f%/*}])
  675. break;
  676. fi
  677. done
  678. if test "${$1_found}" != "no"; then
  679. break;
  680. fi
  681. done
  682. if test "${$1_found}" = "no"; then
  683. tmp_includedir=$(${PKG_CONFIG} --variable=includedir $tmp_package)
  684. for x in ${tmp_includedir}; do
  685. AC_MSG_NOTICE([search for $3 in $x])
  686. for f in $(find ${x} -name "$3" 2> /dev/null); do
  687. if test -f "$f"; then
  688. $1_found=${tmp_package}
  689. $1_CFLAGS+=" -I${f%/*}"
  690. AC_MSG_NOTICE([added path ${f%/*}])
  691. break;
  692. fi
  693. done
  694. if test "${$1_found}" != "no"; then
  695. break;
  696. fi
  697. done
  698. fi
  699. ])
  700. CPPFLAGS=${old_CPPFLAGS}
  701. fi
  702. if test "${$1_found}" = "no"; then
  703. if test -n "$3"; then
  704. if test -n "$4"; then
  705. AC_MSG_ERROR([Feature $1 not found, need header $3 in modules $secondpar or $4])
  706. else
  707. AC_MSG_ERROR([Feature $1 not found, need header $3 in module $secondpar])
  708. fi
  709. else
  710. AC_MSG_ERROR([Feature $1 not found please install module $secondpar])
  711. fi
  712. fi
  713. [$1]_CPPFLAGS="${$1_CFLAGS}"
  714. [$1]_CXXFLAGS="${$1_CFLAGS}"
  715. AC_SUBST([$1]_CPPFLAGS)
  716. AC_SUBST([$1]_CXXFLAGS)
  717. if test "${optional_flags/manualflags/}" = "${optional_flags}"; then
  718. CPPFLAGS+=" ${$1_CPPFLAGS}"
  719. CXXFLAGS+=" ${$1_CXXFLAGS}"
  720. LIBS+=" ${$1_LIBS}"
  721. AC_MSG_NOTICE([Adding flags for $1])
  722. else
  723. AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS])
  724. fi
  725. ])
  726. # check if a specific package exists
  727. # - parameter:
  728. # $1 = unique id (no special characters)
  729. # $2 = module name (optional, if different from id)
  730. # $3 = optional flags:
  731. # manualflags if CXXFLAGS, CPPFLAGS, LIBS should remain unchanged
  732. #
  733. # uses PKG_CHECK_MODULES to test for a module
  734. # sets automake conditional HAVE_$1 to 0 (not found) or 1 (found)
  735. # sets all flags, so that the module can be used everywhere
  736. AC_DEFUN([AX_PKG_CHECK], [
  737. optional_flags="$3"
  738. PKG_PROG_PKG_CONFIG
  739. PKG_CHECK_MODULES([$1], [m4_default([$2], [$1])], [
  740. HAVE_$1=1
  741. [$1]_CPPFLAGS="${$1_CFLAGS}"
  742. [$1]_CXXFLAGS="${$1_CFLAGS}"
  743. AC_SUBST([$1]_CPPFLAGS)
  744. AC_SUBST([$1]_CXXFLAGS)
  745. if test "${optional_flags/manualflags/}" = "${optional_flags}"; then
  746. CPPFLAGS+=" ${$1_CPPFLAGS}"
  747. CXXFLAGS+=" ${$1_CXXFLAGS}"
  748. LIBS+=" ${$1_LIBS}"
  749. AC_MSG_NOTICE([Adding flags for $1])
  750. else
  751. AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS])
  752. fi
  753. if test -z "$PKG_REQUIREMENTS"; then
  754. PKG_REQUIREMENTS="m4_default([$2], [$1])"
  755. else
  756. PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, m4_default([$2], [$1])"
  757. fi
  758. ], [
  759. HAVE_$1=0
  760. ])
  761. AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1)
  762. AC_SUBST(HAVE_$1)
  763. AC_SUBST(CPPFLAGS)
  764. AC_SUBST(CXXFLAGS)
  765. AC_SUBST(PKG_REQUIREMENTS)
  766. ])
  767. # make sure, a specific header exists
  768. # - parameter:
  769. # $1 = header name
  770. # $2 = pathes to search for
  771. AC_DEFUN([AX_REQUIRE_HEADER], [
  772. AC_CHECK_HEADER($1, [], [
  773. if test -n "$2"; then
  774. found=0
  775. for d in $2; do
  776. if test -f "${d}/$1"; then
  777. AC_MSG_NOTICE([found file ${d}/$1])
  778. CPPFLAGS+=" -I${d}"
  779. found=1
  780. break;
  781. else
  782. AC_MSG_NOTICE([not found file ${d}/$1])
  783. fi
  784. done
  785. fi
  786. if test $found -eq 0; then
  787. AC_MSG_ERROR([Header $1 not found])
  788. fi
  789. ], [])
  790. ], [])
  791. ])
  792. # Check within a list of CPP-Flags for the first that is usable and
  793. # configure it
  794. # - parameter:
  795. # $1 = white-space separated list of alternative flags
  796. # $2 = module name (optional, if different from id)
  797. AC_DEFUN([AX_CHECK_VALID_CPP_FLAG], [
  798. AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
  799. save_cppflags="$CPPFLAGS"
  800. newflag="no"
  801. for test_flag in $1; do
  802. CPPFLAGS+=" ${test_flag}"
  803. AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
  804. newflag="$test_flag"
  805. CPPFLAGS="$save_cppflags"
  806. CPPFLAGS+=" ${test_flag}"
  807. break;
  808. ])
  809. CPPFLAGS="$save_cppflags"
  810. done
  811. AC_SUBST(CPPFLAGS)
  812. AC_MSG_RESULT([$newflag in $CPPFLAGS])
  813. ])
  814. # Check within a list of CXX-Flags for the first that is usable and
  815. # configure it
  816. # - parameter:
  817. # $1 = white-space separated list of alternative flags
  818. # $2 = module name (optional, if different from id)
  819. AC_DEFUN([AX_CHECK_VALID_CXX_FLAG], [
  820. AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
  821. save_cxxflags="$CXXFLAGS"
  822. newflag="no"
  823. for test_flag in $1; do
  824. CXXFLAGS+=" ${test_flag}"
  825. AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
  826. newflag="$test_flag"
  827. CXXFLAGS="$save_cxxflags"
  828. CXXFLAGS+=" ${test_flag}"
  829. break;
  830. ])
  831. CXXFLAGS="$save_cxxflags"
  832. done
  833. AC_SUBST(CXXFLAGS)
  834. AC_MSG_RESULT([$newflag in $CXXFLAGS])
  835. ])
  836. # Check within a list of C-Flags for the first that is usable and
  837. # configure it
  838. # - parameter:
  839. # $1 = white-space separated list of alternative flags
  840. # $2 = module name (optional, if different from id)
  841. AC_DEFUN([AX_CHECK_VALID_C_FLAG], [
  842. AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
  843. save_cflags="$CFLAGS"
  844. newflag="no"
  845. for test_flag in $1; do
  846. CFLAGS+=" ${test_flag}"
  847. AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
  848. newflag="$test_flag"
  849. CFLAGS="$save_cflags"
  850. CFLAGS+=" ${test_flag}"
  851. break;
  852. ])
  853. CFLAGS="$save_cflags"
  854. done
  855. AC_SUBST(CFLAGS)
  856. AC_MSG_RESULT([$newflag in $CFLAGS])
  857. ])
  858. # Check within a list of LD-Flags for the first that is usable and
  859. # configure it
  860. # - parameter:
  861. # $1 = white-space separated list of alternative flags
  862. # $2 = module name (optional, if different from id)
  863. AC_DEFUN([AX_CHECK_VALID_LD_FLAG], [
  864. AC_MSG_CHECKING([m4_default([$2], [for valid flag in "$1"])])
  865. save_ldflags="$LDFLAGS"
  866. newflag="no"
  867. for test_flag in $1; do
  868. LDFLAGS+=" ${test_flag}"
  869. AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
  870. newflag="$test_flag"
  871. LDFLAGS="$save_ldflags"
  872. LDFLAGS+=" ${test_flag}"
  873. break;
  874. ])
  875. LDFLAGS="$save_ldflags"
  876. done
  877. AC_SUBST(LDFLAGS)
  878. AC_MSG_RESULT([$newflag in $LDFLAGS])
  879. ])
  880. # Check if a package exists in the current distribution, if yes, require it
  881. # in debian/control.in append @DEB_DEPEND_IFEXISTS@ to Build-Depends
  882. # - parameter:
  883. # $1 = package name
  884. AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [
  885. pkg=$1
  886. if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then
  887. DEB_DEPEND_IFEXISTS+=", ${pkg}"
  888. fi
  889. AC_SUBST(DEB_DEPEND_IFEXISTS)
  890. ])