[cfg] Rename configure macros FORK -> OWNTONE

This commit is contained in:
ejurgensen 2021-04-09 20:39:49 +02:00
parent 90ae602bd5
commit a93455b5a9
3 changed files with 87 additions and 87 deletions

View File

@ -105,33 +105,33 @@ dnl Checks for libraries.
AC_SUBST([COMMON_LIBS]) AC_SUBST([COMMON_LIBS])
AC_SUBST([COMMON_CPPFLAGS]) AC_SUBST([COMMON_CPPFLAGS])
AC_SUBST([FORKED_LIBS]) AC_SUBST([OWNTONE_LIBS])
AC_SUBST([FORKED_CPPFLAGS]) AC_SUBST([OWNTONE_CPPFLAGS])
AC_SUBST([FORKED_OPTS_LIBS]) AC_SUBST([OWNTONE_OPTS_LIBS])
AC_SUBST([FORKED_OPTS_CPPFLAGS]) AC_SUBST([OWNTONE_OPTS_CPPFLAGS])
AM_ICONV AM_ICONV
dnl All FORK_ macros defined in m4/fork_checks.m4 dnl All OWNTONE_ macros defined in m4/owntone_checks.m4
FORK_FUNC_REQUIRE([COMMON], [GNU libunistring], [LIBUNISTRING], [unistring], OWNTONE_FUNC_REQUIRE([COMMON], [GNU libunistring], [LIBUNISTRING], [unistring],
[u8_strconv_from_locale], [uniconv.h], [], [u8_strconv_from_locale], [uniconv.h], [],
[dnl Retry test with iconv library [dnl Retry test with iconv library
FORK_VARS_PREPEND([COMMON], [LIBICONV], [INCICONV]) OWNTONE_VARS_PREPEND([COMMON], [LIBICONV], [INCICONV])
FORK_FUNC_REQUIRE([COMMON], [GNU libunistring], [LIBUNISTRING], OWNTONE_FUNC_REQUIRE([COMMON], [GNU libunistring], [LIBUNISTRING],
[unistring], [u8_strconv_from_locale], [uniconv.h])]) [unistring], [u8_strconv_from_locale], [uniconv.h])])
FORK_MODULES_CHECK([FORKED], [ZLIB], [zlib], [deflate], [zlib.h]) OWNTONE_MODULES_CHECK([OWNTONE], [ZLIB], [zlib], [deflate], [zlib.h])
FORK_MODULES_CHECK([FORKED], [CONFUSE], [libconfuse >= 3.0], [cfg_init], [confuse.h]) OWNTONE_MODULES_CHECK([OWNTONE], [CONFUSE], [libconfuse >= 3.0], [cfg_init], [confuse.h])
FORK_MODULES_CHECK([FORKED], [LIBCURL], [libcurl], [curl_global_init], [curl/curl.h]) OWNTONE_MODULES_CHECK([OWNTONE], [LIBCURL], [libcurl], [curl_global_init], [curl/curl.h])
FORK_MODULES_CHECK([FORKED], [LIBSODIUM], [libsodium], [sodium_init], [sodium.h]) OWNTONE_MODULES_CHECK([OWNTONE], [LIBSODIUM], [libsodium], [sodium_init], [sodium.h])
FORK_MODULES_CHECK([FORKED], [MINIXML], [mxml], OWNTONE_MODULES_CHECK([OWNTONE], [MINIXML], [mxml],
[mxmlNewElement], [mxml.h], [mxmlNewElement], [mxml.h],
[ [
dnl See mxml-compat.h dnl See mxml-compat.h
AC_CHECK_FUNCS([mxmlGetOpaque] [mxmlGetText] [mxmlGetType] [mxmlGetFirstChild]) AC_CHECK_FUNCS([mxmlGetOpaque] [mxmlGetText] [mxmlGetType] [mxmlGetFirstChild])
]) ])
FORK_MODULES_CHECK([COMMON], [SQLITE3], [sqlite3 >= 3.5.0], OWNTONE_MODULES_CHECK([COMMON], [SQLITE3], [sqlite3 >= 3.5.0],
[sqlite3_initialize], [sqlite3.h], [sqlite3_initialize], [sqlite3.h],
[dnl Check that SQLite3 has the unlock notify API built-in [dnl Check that SQLite3 has the unlock notify API built-in
AC_CHECK_FUNC([[sqlite3_unlock_notify]], [], AC_CHECK_FUNC([[sqlite3_unlock_notify]], [],
@ -151,7 +151,7 @@ FORK_MODULES_CHECK([COMMON], [SQLITE3], [sqlite3 >= 3.5.0],
[AC_MSG_RESULT([[runtime will tell]])]) [AC_MSG_RESULT([[runtime will tell]])])
]) ])
FORK_MODULES_CHECK([FORKED], [LIBEVENT], [libevent >= 2], OWNTONE_MODULES_CHECK([OWNTONE], [LIBEVENT], [libevent >= 2],
[event_base_new], [event2/event.h], [event_base_new], [event2/event.h],
[dnl check for old version [dnl check for old version
PKG_CHECK_EXISTS([libevent >= 2.1.4], [], PKG_CHECK_EXISTS([libevent >= 2.1.4], [],
@ -159,7 +159,7 @@ FORK_MODULES_CHECK([FORKED], [LIBEVENT], [libevent >= 2],
[Define to 1 if you have libevent 2 (<2.1.4)])]) [Define to 1 if you have libevent 2 (<2.1.4)])])
]) ])
FORK_MODULES_CHECK([FORKED], [JSON_C], [json-c], OWNTONE_MODULES_CHECK([OWNTONE], [JSON_C], [json-c],
[json_tokener_parse], [json.h], [json_tokener_parse], [json.h],
[dnl check for old version [dnl check for old version
PKG_CHECK_EXISTS([json-c >= 0.11], [], PKG_CHECK_EXISTS([json-c >= 0.11], [],
@ -169,13 +169,13 @@ FORK_MODULES_CHECK([FORKED], [JSON_C], [json-c],
dnl Build with libplist (2.2.0 does not ship libplist.pc, only libplist-2.0.pc) dnl Build with libplist (2.2.0 does not ship libplist.pc, only libplist-2.0.pc)
PKG_CHECK_EXISTS([libplist], PKG_CHECK_EXISTS([libplist],
[FORK_MODULES_CHECK([FORKED], [LIBPLIST], [libplist >= 0.16], [OWNTONE_MODULES_CHECK([OWNTONE], [LIBPLIST], [libplist >= 0.16],
[plist_dict_get_item], [plist/plist.h])], [plist_dict_get_item], [plist/plist.h])],
[FORK_MODULES_CHECK([FORKED], [LIBPLIST], [libplist-2.0], [OWNTONE_MODULES_CHECK([OWNTONE], [LIBPLIST], [libplist-2.0],
[plist_dict_get_item], [plist/plist.h])]) [plist_dict_get_item], [plist/plist.h])])
FORK_FUNC_REQUIRE([FORKED], [ANTLR3 C runtime], [ANTLR3C], [antlr3c], OWNTONE_FUNC_REQUIRE([OWNTONE], [ANTLR3 C runtime], [ANTLR3C], [antlr3c],
[antlr3BaseRecognizerNew], [antlr3.h], [antlr3BaseRecognizerNew], [antlr3.h],
[AC_CHECK_FUNC([[antlr3NewAsciiStringInPlaceStream]], [AC_CHECK_FUNC([[antlr3NewAsciiStringInPlaceStream]],
[AC_DEFINE([ANTLR3C_NEW_INPUT], 0, [AC_DEFINE([ANTLR3C_NEW_INPUT], 0,
@ -185,10 +185,10 @@ FORK_FUNC_REQUIRE([FORKED], [ANTLR3 C runtime], [ANTLR3C], [antlr3c],
]) ])
AM_PATH_LIBGCRYPT([1:1.2.0]) AM_PATH_LIBGCRYPT([1:1.2.0])
FORK_FUNC_REQUIRE([FORKED], [GNU Crypt Library], [LIBGCRYPT], [gcrypt], OWNTONE_FUNC_REQUIRE([OWNTONE], [GNU Crypt Library], [LIBGCRYPT], [gcrypt],
[gcry_control], [gcrypt.h]) [gcry_control], [gcrypt.h])
AM_PATH_GPG_ERROR([1.6]) AM_PATH_GPG_ERROR([1.6])
FORK_FUNC_REQUIRE([FORKED], [GNUPG Error Values], [GPG_ERROR_MT], [gpg-error], OWNTONE_FUNC_REQUIRE([OWNTONE], [GNUPG Error Values], [GPG_ERROR_MT], [gpg-error],
[gpg_err_init], [gpg-error.h]) [gpg_err_init], [gpg-error.h])
@ -197,7 +197,7 @@ AC_CHECK_HEADER([sys/eventfd.h], [AC_CHECK_FUNCS([eventfd])])
AC_CHECK_HEADER([sys/timerfd.h], [AC_CHECK_FUNC([timerfd_create], AC_CHECK_HEADER([sys/timerfd.h], [AC_CHECK_FUNC([timerfd_create],
[AC_DEFINE([HAVE_TIMERFD], 1, [Define to 1 if you have timerfd])])]) [AC_DEFINE([HAVE_TIMERFD], 1, [Define to 1 if you have timerfd])])])
FORK_FUNC_REQUIRE([FORKED], [inotify], [INOTIFY], [inotify], OWNTONE_FUNC_REQUIRE([OWNTONE], [inotify], [INOTIFY], [inotify],
[inotify_add_watch], [sys/inotify.h]) [inotify_add_watch], [sys/inotify.h])
have_signal=no have_signal=no
@ -229,7 +229,7 @@ AC_ARG_WITH([libav], [AS_HELP_STRING([--with-libav],
[choose libav even if ffmpeg present (default=no)])], [choose libav even if ffmpeg present (default=no)])],
[[LIBAV=-libav]], [[LIBAV=]]) [[LIBAV=-libav]], [[LIBAV=]])
dnl libav/ffmpeg requires many feature checks dnl libav/ffmpeg requires many feature checks
FORK_MODULES_CHECK([FORKED], [LIBAV], OWNTONE_MODULES_CHECK([OWNTONE], [LIBAV],
[libavformat$LIBAV libavcodec$LIBAV libavutil$LIBAV libavfilter$LIBAV], [libavformat$LIBAV libavcodec$LIBAV libavutil$LIBAV libavfilter$LIBAV],
[av_init_packet], [libavcodec/avcodec.h], [av_init_packet], [libavcodec/avcodec.h],
[dnl Checks for misc libav and ffmpeg API differences [dnl Checks for misc libav and ffmpeg API differences
@ -247,9 +247,9 @@ FORK_MODULES_CHECK([FORKED], [LIBAV],
[Define to 1 if you have ffmpeg (not libav)])], [Define to 1 if you have ffmpeg (not libav)])],
[[is_ffmpeg=no]]) [[is_ffmpeg=no]])
AC_MSG_RESULT([$is_ffmpeg]) AC_MSG_RESULT([$is_ffmpeg])
FORK_CHECK_DECLS([av_version_info], OWNTONE_CHECK_DECLS([av_version_info],
[libavutil/avutil.h]) [libavutil/avutil.h])
FORK_CHECK_DECLS([avformat_network_init], OWNTONE_CHECK_DECLS([avformat_network_init],
[libavformat/avformat.h]) [libavformat/avformat.h])
]) ])
@ -257,61 +257,61 @@ AC_CHECK_SIZEOF([void *])
dnl --- Begin configuring the options --- dnl --- Begin configuring the options ---
dnl ALSA dnl ALSA
FORK_ARG_WITH_CHECK([FORKED_OPTS], [ALSA support], [alsa], [ALSA], OWNTONE_ARG_WITH_CHECK([OWNTONE_OPTS], [ALSA support], [alsa], [ALSA],
[alsa], [snd_mixer_open], [alsa/asoundlib.h]) [alsa], [snd_mixer_open], [alsa/asoundlib.h])
AM_CONDITIONAL([COND_ALSA], [[test "x$with_alsa" = "xyes"]]) AM_CONDITIONAL([COND_ALSA], [[test "x$with_alsa" = "xyes"]])
dnl PULSEAUDIO dnl PULSEAUDIO
FORK_ARG_WITH_CHECK([FORKED_OPTS], [Pulseaudio support], [pulseaudio], [LIBPULSE], OWNTONE_ARG_WITH_CHECK([OWNTONE_OPTS], [Pulseaudio support], [pulseaudio], [LIBPULSE],
[libpulse], [pa_stream_get_state], [pulse/pulseaudio.h], [libpulse], [pa_stream_get_state], [pulse/pulseaudio.h],
[AC_CHECK_FUNCS([pa_threaded_mainloop_set_name])]) [AC_CHECK_FUNCS([pa_threaded_mainloop_set_name])])
AM_CONDITIONAL([COND_PULSEAUDIO], [[test "x$with_pulseaudio" = "xyes"]]) AM_CONDITIONAL([COND_PULSEAUDIO], [[test "x$with_pulseaudio" = "xyes"]])
dnl Build with libwebsockets dnl Build with libwebsockets
FORK_ARG_WITH_CHECK([FORKED_OPTS], [libwebsockets support], [libwebsockets], [LIBWEBSOCKETS], OWNTONE_ARG_WITH_CHECK([OWNTONE_OPTS], [libwebsockets support], [libwebsockets], [LIBWEBSOCKETS],
[libwebsockets >= 2.0.2]) [libwebsockets >= 2.0.2])
AM_CONDITIONAL([COND_LIBWEBSOCKETS], [[test "x$with_libwebsockets" = "xyes"]]) AM_CONDITIONAL([COND_LIBWEBSOCKETS], [[test "x$with_libwebsockets" = "xyes"]])
dnl Build with libevent_pthreads dnl Build with libevent_pthreads
FORK_ARG_WITH_CHECK([FORKED_OPTS], [libevent_pthreads support], OWNTONE_ARG_WITH_CHECK([OWNTONE_OPTS], [libevent_pthreads support],
[libevent_pthreads], [LIBEVENT_PTHREADS], [libevent_pthreads], [libevent_pthreads], [LIBEVENT_PTHREADS], [libevent_pthreads],
[evthread_use_pthreads], [event2/thread.h]) [evthread_use_pthreads], [event2/thread.h])
dnl Build with Avahi (or Bonjour if not) dnl Build with Avahi (or Bonjour if not)
FORK_ARG_WITH_CHECK([FORKED_OPTS], [Avahi mDNS], [avahi], [AVAHI], OWNTONE_ARG_WITH_CHECK([OWNTONE_OPTS], [Avahi mDNS], [avahi], [AVAHI],
[avahi-client >= 0.6.24], [avahi_client_new], [avahi-client/client.h]) [avahi-client >= 0.6.24], [avahi_client_new], [avahi-client/client.h])
AS_IF([[test "x$with_avahi" = "xno"]], AS_IF([[test "x$with_avahi" = "xno"]],
[FORK_FUNC_REQUIRE([FORKED_OPTS], [Bonjour DNS_SD], [DNSSD], [dns_sd], [OWNTONE_FUNC_REQUIRE([OWNTONE_OPTS], [Bonjour DNS_SD], [DNSSD], [dns_sd],
[DNSServiceGetAddrInfo], [dns_sd.h], [], [DNSServiceGetAddrInfo], [dns_sd.h], [],
[AC_MSG_ERROR([[Avahi client or Bonjour DNS_SD required, please install one.]])])]) [AC_MSG_ERROR([[Avahi client or Bonjour DNS_SD required, please install one.]])])])
AM_CONDITIONAL([COND_AVAHI], [[test "x$with_avahi" = "xyes"]]) AM_CONDITIONAL([COND_AVAHI], [[test "x$with_avahi" = "xyes"]])
dnl Spotify with dynamic linking to libspotify dnl Spotify with dynamic linking to libspotify
FORK_ARG_ENABLE([Spotify support], [spotify], [SPOTIFY], OWNTONE_ARG_ENABLE([Spotify support], [spotify], [SPOTIFY],
[AS_IF([[test "x$with_libevent_pthreads" = "xno"]], [AS_IF([[test "x$with_libevent_pthreads" = "xno"]],
[AC_MSG_ERROR([[Spotify support requires libevent_pthreads]])]) [AC_MSG_ERROR([[Spotify support requires libevent_pthreads]])])
FORK_MODULES_CHECK([SPOTIFY], [LIBSPOTIFY], [libspotify], OWNTONE_MODULES_CHECK([SPOTIFY], [LIBSPOTIFY], [libspotify],
[], [libspotify/api.h]) [], [libspotify/api.h])
AC_DEFINE([HAVE_SPOTIFY_H], 1, AC_DEFINE([HAVE_SPOTIFY_H], 1,
[Define to 1 if you have the <libspotify/api.h> header file.]) [Define to 1 if you have the <libspotify/api.h> header file.])
dnl Don't link with libspotify, use dynamic linking dnl Don't link with libspotify, use dynamic linking
AC_SEARCH_LIBS([dlopen], [dl], [], AC_SEARCH_LIBS([dlopen], [dl], [],
[AC_MSG_ERROR([[Spotify support requires dlopen]])]) [AC_MSG_ERROR([[Spotify support requires dlopen]])])
FORK_VAR_PREPEND([FORKED_OPTS_CPPFLAGS], [$SPOTIFY_CPPFLAGS]) OWNTONE_VAR_PREPEND([OWNTONE_OPTS_CPPFLAGS], [$SPOTIFY_CPPFLAGS])
FORK_VAR_PREPEND([FORKED_OPTS_LIBS], [-rdynamic]) OWNTONE_VAR_PREPEND([OWNTONE_OPTS_LIBS], [-rdynamic])
]) ])
AM_CONDITIONAL([COND_SPOTIFY], [[test "x$enable_spotify" = "xyes"]]) AM_CONDITIONAL([COND_SPOTIFY], [[test "x$enable_spotify" = "xyes"]])
dnl LastFM support dnl LastFM support
FORK_ARG_DISABLE([LastFM support], [lastfm], [LASTFM]) OWNTONE_ARG_DISABLE([LastFM support], [lastfm], [LASTFM])
AM_CONDITIONAL([COND_LASTFM], [[test "x$enable_lastfm" = "xyes"]]) AM_CONDITIONAL([COND_LASTFM], [[test "x$enable_lastfm" = "xyes"]])
dnl ChromeCast support with libprotobuf-c dnl ChromeCast support with libprotobuf-c
FORK_ARG_ENABLE([Chromecast support], [chromecast], [CHROMECAST], OWNTONE_ARG_ENABLE([Chromecast support], [chromecast], [CHROMECAST],
[FORK_MODULES_CHECK([FORKED_OPTS], [LIBPROTOBUF_C], [OWNTONE_MODULES_CHECK([OWNTONE_OPTS], [LIBPROTOBUF_C],
[libprotobuf-c >= 1.0.0], [protobuf_c_message_pack], [libprotobuf-c >= 1.0.0], [protobuf_c_message_pack],
[protobuf-c/protobuf-c.h], [], [protobuf-c/protobuf-c.h], [],
[FORK_FUNC_REQUIRE([FORKED_OPTS], [v0 libprotobuf-c], [OWNTONE_FUNC_REQUIRE([OWNTONE_OPTS], [v0 libprotobuf-c],
[LIBPROTOBUF_OLD], [protobuf-c], [LIBPROTOBUF_OLD], [protobuf-c],
[protobuf_c_message_pack], [protobuf_c_message_pack],
[google/protobuf-c/protobuf-c.h], [google/protobuf-c/protobuf-c.h],
@ -320,24 +320,24 @@ FORK_ARG_ENABLE([Chromecast support], [chromecast], [CHROMECAST],
[protobuf_old=yes]], [protobuf_old=yes]],
[AC_MSG_ERROR([[Chromecast support requires protobuf-c]])]) [AC_MSG_ERROR([[Chromecast support requires protobuf-c]])])
]) ])
FORK_MODULES_CHECK([FORKED_OPTS], [GNUTLS], [gnutls], [gnutls_init], OWNTONE_MODULES_CHECK([OWNTONE_OPTS], [GNUTLS], [gnutls], [gnutls_init],
[gnutls/gnutls.h]) [gnutls/gnutls.h])
]) ])
AM_CONDITIONAL([COND_CHROMECAST], [[test "x$enable_chromecast" = "xyes"]]) AM_CONDITIONAL([COND_CHROMECAST], [[test "x$enable_chromecast" = "xyes"]])
AM_CONDITIONAL([COND_PROTOBUF_OLD], [[test "x$protobuf_old" = "xyes"]]) AM_CONDITIONAL([COND_PROTOBUF_OLD], [[test "x$protobuf_old" = "xyes"]])
dnl Prefer AirPlay 2 dnl Prefer AirPlay 2
FORK_ARG_ENABLE([preference for AirPlay 2 for devices that support both 1 and 2], [preferairplay2], [PREFER_AIRPLAY2]) OWNTONE_ARG_ENABLE([preference for AirPlay 2 for devices that support both 1 and 2], [preferairplay2], [PREFER_AIRPLAY2])
dnl DB profiling support dnl DB profiling support
FORK_ARG_ENABLE([DB profiling support], [dbprofile], [DB_PROFILE]) OWNTONE_ARG_ENABLE([DB profiling support], [dbprofile], [DB_PROFILE])
dnl MPD support dnl MPD support
FORK_ARG_DISABLE([MPD client protocol support], [mpd], [MPD]) OWNTONE_ARG_DISABLE([MPD client protocol support], [mpd], [MPD])
AM_CONDITIONAL([COND_MPD], [[test "x$enable_mpd" = "xyes"]]) AM_CONDITIONAL([COND_MPD], [[test "x$enable_mpd" = "xyes"]])
dnl Include default webinterface dnl Include default webinterface
FORK_ARG_DISABLE([Include default web interface], [webinterface], [WEBINTERFACE], OWNTONE_ARG_DISABLE([Include default web interface], [webinterface], [WEBINTERFACE],
[AS_IF([[test "x$with_libwebsockets" = "xno"]], [AS_IF([[test "x$with_libwebsockets" = "xno"]],
[AC_MSG_ERROR([[Web interface requires libwebsockets >= 2.0.2 (or use --disable-webinterface)]])]) [AC_MSG_ERROR([[Web interface requires libwebsockets >= 2.0.2 (or use --disable-webinterface)]])])
]) ])

View File

@ -1,4 +1,4 @@
# fork_checks.m4 serial 2 # owntone_checks.m4 serial 2
dnl Copyright (c) Scott Shambarger <devel@shambarger.net> dnl Copyright (c) Scott Shambarger <devel@shambarger.net>
dnl dnl
dnl Copying and distribution of this file, with or without modification, are dnl Copying and distribution of this file, with or without modification, are
@ -6,10 +6,10 @@ dnl permitted in any medium without royalty provided the copyright notice
dnl and this notice are preserved. This file is offered as-is, without any dnl and this notice are preserved. This file is offered as-is, without any
dnl warranty. dnl warranty.
dnl _FORK_FUNC_MERGE dnl _OWNTONE_FUNC_MERGE
dnl ---------------- dnl ----------------
dnl Internal only. Defines function used by FORK_VAR_PREPEND dnl Internal only. Defines function used by OWNTONE_VAR_PREPEND
AC_DEFUN([_FORK_FUNC_MERGE], [[ AC_DEFUN([_OWNTONE_FUNC_MERGE], [[
# fork_fn_merge(before, after) # fork_fn_merge(before, after)
# create wordlist removing duplicates # create wordlist removing duplicates
fork_fn_merge() { fork_fn_merge() {
@ -31,55 +31,55 @@ fork_fn_merge() {
unset fork_fn_var_result unset fork_fn_var_result
}]]) }]])
dnl FORK_VAR_PREPEND(VARNAME, BEFORE) dnl OWNTONE_VAR_PREPEND(VARNAME, BEFORE)
dnl --------------------------------- dnl ---------------------------------
dnl Prepends words in BEFORE to the contents of VARNAME, skipping any dnl Prepends words in BEFORE to the contents of VARNAME, skipping any
dnl duplicate words. dnl duplicate words.
AC_DEFUN([FORK_VAR_PREPEND], AC_DEFUN([OWNTONE_VAR_PREPEND],
[AC_REQUIRE([_FORK_FUNC_MERGE])dnl [AC_REQUIRE([_OWNTONE_FUNC_MERGE])dnl
[ $1=$(fork_fn_merge "$2" "$$1")]]) [ $1=$(fork_fn_merge "$2" "$$1")]])
dnl FORK_VARS_PREPEND(TARGET, LIBS_ENV, CFLAGS_ENV) dnl OWNTONE_VARS_PREPEND(TARGET, LIBS_ENV, CFLAGS_ENV)
dnl ----------------------------------------------- dnl -----------------------------------------------
dnl Prepend LIBS_ENV to LIBS and TARGET_LIBS dnl Prepend LIBS_ENV to LIBS and TARGET_LIBS
dnl Append CFLAGS_ENV to CPPFLAGS and TARGET_CPPFLAGS. dnl Append CFLAGS_ENV to CPPFLAGS and TARGET_CPPFLAGS.
AC_DEFUN([FORK_VARS_PREPEND], AC_DEFUN([OWNTONE_VARS_PREPEND],
[[ [[
LIBS="$$2 $LIBS" LIBS="$$2 $LIBS"
$1_LIBS="$$2 $$1_LIBS"] $1_LIBS="$$2 $$1_LIBS"]
FORK_VAR_PREPEND([CPPFLAGS], [$$3]) OWNTONE_VAR_PREPEND([CPPFLAGS], [$$3])
FORK_VAR_PREPEND([$1_CPPFLAGS], [$$3]) OWNTONE_VAR_PREPEND([$1_CPPFLAGS], [$$3])
]) ])
dnl _FORK_VARS_ADD_PREFIX(TARGET) dnl _OWNTONE_VARS_ADD_PREFIX(TARGET)
dnl ----------------------------- dnl -----------------------------
dnl Internal use only. Add libdir prefix to {TARGET_}LIBS and dnl Internal use only. Add libdir prefix to {TARGET_}LIBS and
dnl includedir prefix to {TARGET_}CPPFLAGS as fallback search paths dnl includedir prefix to {TARGET_}CPPFLAGS as fallback search paths
dnl expanding all variables. dnl expanding all variables.
AC_DEFUN([_FORK_VARS_ADD_PREFIX], AC_DEFUN([_OWNTONE_VARS_ADD_PREFIX],
[AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) [AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_LIB_WITH_FINAL_PREFIX([[ AC_LIB_WITH_FINAL_PREFIX([[
eval LIBS=\"-L$libdir $LIBS\" eval LIBS=\"-L$libdir $LIBS\"
eval $1_LIBS=\"-L$libdir $$1_LIBS\" eval $1_LIBS=\"-L$libdir $$1_LIBS\"
eval fork_tmp_cppflags=\"-I$includedir\"] eval fork_tmp_cppflags=\"-I$includedir\"]
FORK_VAR_PREPEND([CPPFLAGS], [$fork_tmp_cppflags]) OWNTONE_VAR_PREPEND([CPPFLAGS], [$fork_tmp_cppflags])
FORK_VAR_PREPEND([$1_CPPFLAGS], [$fork_tmp_cppflags]) OWNTONE_VAR_PREPEND([$1_CPPFLAGS], [$fork_tmp_cppflags])
]) ])
]) ])
dnl FORK_CHECK_DECLS(SYMBOLS, INCLUDE, [ACTION-IF-FOUND], dnl OWNTONE_CHECK_DECLS(SYMBOLS, INCLUDE, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND]) dnl [ACTION-IF-NOT-FOUND])
dnl ----------------------------------------------------- dnl -----------------------------------------------------
dnl Expands AC_CHECK_DECLS with SYMBOLS and INCLUDE appended to dnl Expands AC_CHECK_DECLS with SYMBOLS and INCLUDE appended to
dnl AC_INCLUDES_DEFAULT. dnl AC_INCLUDES_DEFAULT.
dnl NOTE: Remember that AC_CHECK_DECLS defines HAVE_* to 1 or 0 dnl NOTE: Remember that AC_CHECK_DECLS defines HAVE_* to 1 or 0
dnl (not 1 or undefined!) dnl (not 1 or undefined!)
AC_DEFUN([FORK_CHECK_DECLS], AC_DEFUN([OWNTONE_CHECK_DECLS],
[AC_CHECK_DECLS([$1], [$3], [$4], [AC_INCLUDES_DEFAULT [AC_CHECK_DECLS([$1], [$3], [$4], [AC_INCLUDES_DEFAULT
[@%:@include <$2>]]) [@%:@include <$2>]])
]) ])
dnl FORK_FUNC_REQUIRE(TARGET, DESCRIPTION, ENV, LIBRARY, FUNCTION, [HEADER], dnl OWNTONE_FUNC_REQUIRE(TARGET, DESCRIPTION, ENV, LIBRARY, FUNCTION, [HEADER],
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
dnl Check for software which lacks pkg-config support, setting TARGET_CPPFLAGS dnl Check for software which lacks pkg-config support, setting TARGET_CPPFLAGS
@ -95,22 +95,22 @@ dnl identify software to install. If FUNCTION not found, either displays
dnl error suggested use of ENV_* overrides, or if ENV_* were not set dnl error suggested use of ENV_* overrides, or if ENV_* were not set
dnl expands optional ACTION-IF-NOT-FOUND in place of error. dnl expands optional ACTION-IF-NOT-FOUND in place of error.
dnl Restores original CPPFLAGS and LIBS when done. dnl Restores original CPPFLAGS and LIBS when done.
AC_DEFUN([FORK_FUNC_REQUIRE], AC_DEFUN([OWNTONE_FUNC_REQUIRE],
[AS_VAR_PUSHDEF([FORK_MSG], [fork_msg_$3]) [AS_VAR_PUSHDEF([OWNTONE_MSG], [fork_msg_$3])
AC_ARG_VAR([$3_CFLAGS], [C compiler flags for $2, overriding search]) AC_ARG_VAR([$3_CFLAGS], [C compiler flags for $2, overriding search])
AC_ARG_VAR([$3_LIBS], [linker flags for $2, overriding search]) AC_ARG_VAR([$3_LIBS], [linker flags for $2, overriding search])
[fork_save_$3_LIBS=$LIBS; fork_save_$3_CPPFLAGS=$CPPFLAGS [fork_save_$3_LIBS=$LIBS; fork_save_$3_CPPFLAGS=$CPPFLAGS
fork_found_$3=yes] fork_found_$3=yes]
AS_IF([[test -n "$$3_CFLAGS" && test -n "$$3_LIBS"]], AS_IF([[test -n "$$3_CFLAGS" && test -n "$$3_LIBS"]],
[dnl ENV variables provided, just verify they work [dnl ENV variables provided, just verify they work
AS_VAR_SET([FORK_MSG], [[" AS_VAR_SET([OWNTONE_MSG], [["
Library specific environment variables $3_LIBS and Library specific environment variables $3_LIBS and
$3_CFLAGS were used, verify they are correct..."]]) $3_CFLAGS were used, verify they are correct..."]])
FORK_VARS_PREPEND([$1], [$3_LIBS], [$3_CFLAGS]) OWNTONE_VARS_PREPEND([$1], [$3_LIBS], [$3_CFLAGS])
AC_CHECK_FUNC([[$5]], [], AC_CHECK_FUNC([[$5]], [],
[AC_MSG_FAILURE([[Unable to link function $5 with $2.$]FORK_MSG])])], [AC_MSG_FAILURE([[Unable to link function $5 with $2.$]OWNTONE_MSG])])],
[dnl Search w/o LIBRARY, w/ LIBRARY, and finally adding $prefix path [dnl Search w/o LIBRARY, w/ LIBRARY, and finally adding $prefix path
AS_VAR_SET([FORK_MSG], [[" AS_VAR_SET([OWNTONE_MSG], [["
Install $2 in the default include path, or alternatively set Install $2 in the default include path, or alternatively set
library specific environment variables $3_CFLAGS library specific environment variables $3_CFLAGS
and $3_LIBS."]]) and $3_LIBS."]])
@ -119,7 +119,7 @@ and $3_LIBS."]])
[[LIBS="-l$4 $LIBS" [[LIBS="-l$4 $LIBS"
$1_LIBS="-l$4 $$1_LIBS"] $1_LIBS="-l$4 $$1_LIBS"]
AC_TRY_LINK_FUNC([[$5]], [AC_MSG_RESULT([[-l$4]])], AC_TRY_LINK_FUNC([[$5]], [AC_MSG_RESULT([[-l$4]])],
[_FORK_VARS_ADD_PREFIX([$1]) [_OWNTONE_VARS_ADD_PREFIX([$1])
AC_TRY_LINK_FUNC([[$5]], [AC_MSG_RESULT([[-l$4]])], AC_TRY_LINK_FUNC([[$5]], [AC_MSG_RESULT([[-l$4]])],
[AC_MSG_RESULT([[no]]) [AC_MSG_RESULT([[no]])
fork_found_$3=no])]) fork_found_$3=no])])
@ -128,17 +128,17 @@ and $3_LIBS."]])
AS_IF([[test "$fork_found_$3" != "no"]], AS_IF([[test "$fork_found_$3" != "no"]],
[dnl check HEADER, then expand FOUND [dnl check HEADER, then expand FOUND
m4_ifval([$6], [AC_CHECK_HEADER([[$6]], [], m4_ifval([$6], [AC_CHECK_HEADER([[$6]], [],
[AC_MSG_FAILURE([[Unable to find header $6 for $2.$]FORK_MSG])])]) [AC_MSG_FAILURE([[Unable to find header $6 for $2.$]OWNTONE_MSG])])])
$7]) $7])
[LIBS=$fork_save_$3_LIBS; CPPFLAGS=$fork_save_$3_CPPFLAGS] [LIBS=$fork_save_$3_LIBS; CPPFLAGS=$fork_save_$3_CPPFLAGS]
dnl Expand NOT-FOUND after restoring saved flags to allow recursive expansion dnl Expand NOT-FOUND after restoring saved flags to allow recursive expansion
AS_IF([[test "$fork_found_$3" = "no"]], AS_IF([[test "$fork_found_$3" = "no"]],
[m4_default_nblank([$8], [m4_default_nblank([$8],
[AC_MSG_FAILURE([[Function $5 in lib$4 not found.$]FORK_MSG])])]) [AC_MSG_FAILURE([[Function $5 in lib$4 not found.$]OWNTONE_MSG])])])
AS_VAR_POPDEF([FORK_MSG]) AS_VAR_POPDEF([OWNTONE_MSG])
]) ])
dnl FORK_MODULES_CHECK(TARGET, ENV, MODULES, [FUNCTION], [HEADER], dnl OWNTONE_MODULES_CHECK(TARGET, ENV, MODULES, [FUNCTION], [HEADER],
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
dnl Expands PKG_CHECK_MODULES, but when found also attempt to link dnl Expands PKG_CHECK_MODULES, but when found also attempt to link
@ -147,10 +147,10 @@ dnl TARGET_CPPFLAGS and TARGET_LIBS. Expands optional ACTION-IF-FOUND with
dnl working CPPFLAGS/LIBS for additional checks. Expands dnl working CPPFLAGS/LIBS for additional checks. Expands
dnl ACTION-IF-NOT-FOUND only if package not found (not link/include failures) dnl ACTION-IF-NOT-FOUND only if package not found (not link/include failures)
dnl overriding default error. Restores original CPPFLAGS and LIBS when done. dnl overriding default error. Restores original CPPFLAGS and LIBS when done.
AC_DEFUN([FORK_MODULES_CHECK], AC_DEFUN([OWNTONE_MODULES_CHECK],
[PKG_CHECK_MODULES([$2], [[$3]], [PKG_CHECK_MODULES([$2], [[$3]],
[[fork_save_$2_LIBS=$LIBS; fork_save_$2_CPPFLAGS=$CPPFLAGS] [[fork_save_$2_LIBS=$LIBS; fork_save_$2_CPPFLAGS=$CPPFLAGS]
FORK_VARS_PREPEND([$1], [$2_LIBS], [$2_CFLAGS]) OWNTONE_VARS_PREPEND([$1], [$2_LIBS], [$2_CFLAGS])
m4_ifval([$4], [AC_CHECK_FUNC([[$4]], [], m4_ifval([$4], [AC_CHECK_FUNC([[$4]], [],
[AC_MSG_ERROR([[Unable to link function $4]])])]) [AC_MSG_ERROR([[Unable to link function $4]])])])
m4_ifval([$5], [AC_CHECK_HEADER([[$5]], [], m4_ifval([$5], [AC_CHECK_HEADER([[$5]], [],
@ -160,23 +160,23 @@ AC_DEFUN([FORK_MODULES_CHECK],
m4_default_nblank_quoted([$7])) m4_default_nblank_quoted([$7]))
]) ])
dnl FORK_ARG_WITH_CHECK(TARGET, DESCRIPTION, OPTION, ENV, MODULES, [FUNCTION], dnl OWNTONE_ARG_WITH_CHECK(TARGET, DESCRIPTION, OPTION, ENV, MODULES, [FUNCTION],
dnl [HEADER], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl [HEADER], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------------------- dnl --------------------------------------------------------------------------
dnl Create an --with-OPTION with a default of "check" (include MODULES dnl Create an --with-OPTION with a default of "check" (include MODULES
dnl if they are available). Expands FORK_MODULES_CHECK with remaining dnl if they are available). Expands OWNTONE_MODULES_CHECK with remaining
dnl arguments. Defines HAVE_ENV to 1 if package found. DESCRIPTION is used dnl arguments. Defines HAVE_ENV to 1 if package found. DESCRIPTION is used
dnl in option help. Shell variable with_OPTION set to yes before dnl in option help. Shell variable with_OPTION set to yes before
dnl ACTION-IF-FOUND. Default ACTION-IF-NOT-FOUND will fail dnl ACTION-IF-FOUND. Default ACTION-IF-NOT-FOUND will fail
dnl if --with-OPTION given and MODULES not found, or sets shell var dnl if --with-OPTION given and MODULES not found, or sets shell var
dnl with_OPTION to no if option was check. A non-empty ACTION-IF-NOT-FOUND dnl with_OPTION to no if option was check. A non-empty ACTION-IF-NOT-FOUND
dnl overrides this behavior to allow alternate checks. dnl overrides this behavior to allow alternate checks.
AC_DEFUN([FORK_ARG_WITH_CHECK], AC_DEFUN([OWNTONE_ARG_WITH_CHECK],
[AC_ARG_WITH([[$3]], [AS_HELP_STRING([--with-$3], [AC_ARG_WITH([[$3]], [AS_HELP_STRING([--with-$3],
[with $2 (default=check)])], [], [with $2 (default=check)])], [],
[[with_$3=check]]) [[with_$3=check]])
AS_IF([[test "x$with_$3" != "xno"]], AS_IF([[test "x$with_$3" != "xno"]],
[FORK_MODULES_CHECK([$1], [$4], [$5], [$6], [$7], [OWNTONE_MODULES_CHECK([$1], [$4], [$5], [$6], [$7],
[[with_$3=yes] [[with_$3=yes]
AC_DEFINE([HAVE_$4], 1, [Define to 1 to build with $2]) AC_DEFINE([HAVE_$4], 1, [Define to 1 to build with $2])
$8], $8],
@ -188,12 +188,12 @@ AC_DEFUN([FORK_ARG_WITH_CHECK],
]) ])
]) ])
dnl FORK_ARG_ENABLE(DESCRIPTION, OPTION, DEFINE, [ACTION-IF-ENABLE]) dnl OWNTONE_ARG_ENABLE(DESCRIPTION, OPTION, DEFINE, [ACTION-IF-ENABLE])
dnl ---------------------------------------------------------------- dnl ----------------------------------------------------------------
dnl Create an --enable-OPTION, setting shell variable enable_OPTION dnl Create an --enable-OPTION, setting shell variable enable_OPTION
dnl to no by default. If feature is enabled, defines DEFINE to 1 dnl to no by default. If feature is enabled, defines DEFINE to 1
dnl and expand ACTION-IF_ENABLE. DESCRIPTION is used in option help. dnl and expand ACTION-IF_ENABLE. DESCRIPTION is used in option help.
AC_DEFUN([FORK_ARG_ENABLE], AC_DEFUN([OWNTONE_ARG_ENABLE],
[AC_ARG_ENABLE([[$2]], [AS_HELP_STRING([--enable-$2], [AC_ARG_ENABLE([[$2]], [AS_HELP_STRING([--enable-$2],
[enable $1 (default=no)])]) [enable $1 (default=no)])])
AS_IF([[test "x$enable_$2" = "xyes"]], AS_IF([[test "x$enable_$2" = "xyes"]],
@ -202,12 +202,12 @@ AC_DEFUN([FORK_ARG_ENABLE],
[[enable_$2=no]]) [[enable_$2=no]])
]) ])
dnl FORK_ARG_DISABLE(DESCRIPTION, OPTION, DEFINE, [ACTION-IF-ENABLE]) dnl OWNTONE_ARG_DISABLE(DESCRIPTION, OPTION, DEFINE, [ACTION-IF-ENABLE])
dnl ---------------------------------------------------------------- dnl ----------------------------------------------------------------
dnl Create an --disable-OPTION, setting shell variable enable_OPTION dnl Create an --disable-OPTION, setting shell variable enable_OPTION
dnl to yes by default. If feature is enabled, defines DEFINE to 1 dnl to yes by default. If feature is enabled, defines DEFINE to 1
dnl and expand ACTION-IF_ENABLE. DESCRIPTION is used in option help. dnl and expand ACTION-IF_ENABLE. DESCRIPTION is used in option help.
AC_DEFUN([FORK_ARG_DISABLE], AC_DEFUN([OWNTONE_ARG_DISABLE],
[AC_ARG_ENABLE([[$2]], [AS_HELP_STRING([--disable-$2], [AC_ARG_ENABLE([[$2]], [AS_HELP_STRING([--disable-$2],
[disable $1 (default=no)])]) [disable $1 (default=no)])])
AS_IF([[test "x$enable_$2" = "x" || test "x$enable_$2" = "xyes"]], AS_IF([[test "x$enable_$2" = "x" || test "x$enable_$2" = "xyes"]],

View File

@ -75,8 +75,8 @@ ANTLR_OBJECTS = \
SMARTPLLexer.$(OBJEXT) SMARTPLParser.$(OBJEXT) SMARTPL2SQL.$(OBJEXT) SMARTPLLexer.$(OBJEXT) SMARTPLParser.$(OBJEXT) SMARTPL2SQL.$(OBJEXT)
AM_CPPFLAGS += \ AM_CPPFLAGS += \
$(FORKED_CPPFLAGS) \ $(OWNTONE_CPPFLAGS) \
$(FORKED_OPTS_CPPFLAGS) \ $(OWNTONE_OPTS_CPPFLAGS) \
$(COMMON_CPPFLAGS) \ $(COMMON_CPPFLAGS) \
\ \
-D_GNU_SOURCE \ -D_GNU_SOURCE \
@ -86,8 +86,8 @@ AM_CPPFLAGS += \
-DPKGLIBDIR=\"$(pkglibdir)\" -DPKGLIBDIR=\"$(pkglibdir)\"
owntone_LDADD = \ owntone_LDADD = \
$(FORKED_LIBS) \ $(OWNTONE_LIBS) \
$(FORKED_OPTS_LIBS) \ $(OWNTONE_OPTS_LIBS) \
$(COMMON_LIBS) $(COMMON_LIBS)
owntone_SOURCES = main.c \ owntone_SOURCES = main.c \