Christian Hesse <l...@eworm.de> on Tue, 2016/11/29 12:07:
> From: Christian Hesse <m...@eworm.de>
> 
> Drop --with-plugindir, instead use an environment variable PLUGINDIR
> to specify the plugin directory.
> 
> This always defines PLUGIN_LIBDIR and enables plugin search path.
> 
> Signed-off-by: Christian Hesse <m...@eworm.de>
> ---
>  configure.ac            | 14 ++++++--------
>  src/openvpn/Makefile.am |  3 ++-
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index f4073d0..5fe652e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -301,13 +301,12 @@ AC_ARG_WITH(
>       [with_crypto_library="openssl"]
>  )
>  
> -AC_ARG_WITH(
> -     [plugindir],
> -     [AS_HELP_STRING([--with-plugindir], [plugin directory
> @<:@default=LIBDIR/openvpn@:>@])],
> -     ,
> -     [with_plugindir="\$(libdir)/openvpn/plugins"]
> -)
> -
> +AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory
> @<:@default=LIBDIR/openvpn/plugins@:>@]) +if test -n "${PLUGINDIR}"; then
> +     plugindir="${PLUGINDIR}"
> +else
> +     plugindir="\${libdir}/openvpn/plugins"
> +fi
>  
>  AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our
> host]) case "$host" in
> @@ -1245,7 +1244,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test
> "${enable_plugin_auth_pam}" = "ye AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT],
> [test "${enable_plugin_down_root}" = "yes"])
> AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"]) 
> -plugindir="${with_plugindir}"
>  sampledir="\$(docdir)/sample"
>  AC_SUBST([plugindir])
>  AC_SUBST([sampledir])
> diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
> index 4c18449..188834a 100644
> --- a/src/openvpn/Makefile.am
> +++ b/src/openvpn/Makefile.am
> @@ -27,7 +27,8 @@ AM_CFLAGS = \
>       $(OPTIONAL_CRYPTO_CFLAGS) \
>       $(OPTIONAL_LZO_CFLAGS) \
>       $(OPTIONAL_LZ4_CFLAGS) \
> -     $(OPTIONAL_PKCS11_HELPER_CFLAGS)
> +     $(OPTIONAL_PKCS11_HELPER_CFLAGS) \
> +     -DPLUGIN_LIBDIR=\"${plugindir}\"
>  if WIN32
>  # we want unicode entry point but not the macro
>  AM_CFLAGS += -municode -UUNICODE

The alternative would look something like this:

--- a/configure.ac
+++ b/configure.ac
@@ -301,13 +301,13 @@ AC_ARG_WITH(
        [with_crypto_library="openssl"]
 )
 
-AC_ARG_WITH(
-       [plugindir],
-       [AS_HELP_STRING([--with-plugindir], [plugin directory 
@<:@default=LIBDIR/openvpn@:>@])],
-       ,
-       [with_plugindir="\$(libdir)/openvpn/plugins"]
-)
-
+AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory 
@<:@default=LIBDIR/openvpn/plugins@:>@])
+if test -n "${PLUGINDIR}"; then
+       plugindir="${PLUGINDIR}"
+       AC_DEFINE_UNQUOTED([PLUGIN_LIBDIR], ["${PLUGINDIR}"], [Path of plug-in 
search directory])
+else
+       plugindir="\${libdir}/openvpn/plugins"
+fi
 
 AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our 
host])
 case "$host" in
@@ -1245,7 +1245,6 @@ AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test 
"${enable_plugin_auth_pam}" = "ye
 AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = 
"yes"])
 AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
 
-plugindir="${with_plugindir}"
 sampledir="\$(docdir)/sample"
 AC_SUBST([plugindir])
 AC_SUBST([sampledir])

However you *have* to give PLUGINDIR this way to enable the search path. I
would like to avoid that. And I did not find a way to move
AC_DEFINE_UNQUOTED() below the condition due to the nested variables in
$libdir.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

Attachment: pgp65zxVT78KU.pgp
Description: OpenPGP digital signature

------------------------------------------------------------------------------
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to