[PATCH v2 3/8] configure: move gettext detection to meson.build

Alex Bennée posted 8 patches 5 years, 2 months ago
[PATCH v2 3/8] configure: move gettext detection to meson.build
Posted by Alex Bennée 5 years, 2 months ago
This will allow meson to honour -Dauto_features=disabled later.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure         | 19 +++----------------
 meson_options.txt |  2 +-
 po/meson.build    |  2 +-
 3 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index 8f2095a2db..46fdea88c7 100755
--- a/configure
+++ b/configure
@@ -448,7 +448,7 @@ libdaxctl=""
 meson=""
 ninja=""
 skip_meson=no
-gettext=""
+gettext="auto"
 
 bogus_os="no"
 malloc_trim="auto"
@@ -1014,9 +1014,9 @@ for opt do
   ;;
   --enable-vnc) vnc="enabled"
   ;;
-  --disable-gettext) gettext="false"
+  --disable-gettext) gettext="disabled"
   ;;
-  --enable-gettext) gettext="true"
+  --enable-gettext) gettext="enabled"
   ;;
   --oss-lib=*) oss_lib="$optarg"
   ;;
@@ -2839,19 +2839,6 @@ if test "$xen_pci_passthrough" != "disabled"; then
   fi
 fi
 
-##########################################
-# gettext probe
-if test "$gettext" != "false" ; then
-  if has xgettext; then
-    gettext=true
-  else
-    if test "$gettext" = "true" ; then
-      feature_not_found "gettext" "Install xgettext binary"
-    fi
-    gettext=false
-  fi
-fi
-
 ##########################################
 # X11 probe
 if $pkg_config --exists "x11"; then
diff --git a/meson_options.txt b/meson_options.txt
index f6f64785fe..191e848600 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,7 +9,7 @@ option('sphinx_build', type : 'string', value : '',
 
 option('docs', type : 'feature', value : 'auto',
        description: 'Documentations build support')
-option('gettext', type : 'boolean', value : true,
+option('gettext', type : 'feature', value : 'auto',
        description: 'Localization of the GTK+ user interface')
 option('install_blobs', type : 'boolean', value : true,
        description: 'install provided firmware blobs')
diff --git a/po/meson.build b/po/meson.build
index 1387fd979a..a863f0575f 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,6 +1,6 @@
 i18n = import('i18n')
 
-if get_option('gettext')
+if find_program('xgettext', required: get_option('gettext')).found()
   i18n.gettext(meson.project_name(),
                args: '--msgid-bugs-address=qemu-devel@nongnu.org',
                preset: 'glib')
-- 
2.20.1


Re: [PATCH v2 3/8] configure: move gettext detection to meson.build
Posted by Alex Bennée 5 years, 1 month ago
Alex Bennée <alex.bennee@linaro.org> writes:

> This will allow meson to honour -Dauto_features=disabled later.
>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

ping Paolo, are you happy with this bit?

> ---
>  configure         | 19 +++----------------
>  meson_options.txt |  2 +-
>  po/meson.build    |  2 +-
>  3 files changed, 5 insertions(+), 18 deletions(-)
>
> diff --git a/configure b/configure
> index 8f2095a2db..46fdea88c7 100755
> --- a/configure
> +++ b/configure
> @@ -448,7 +448,7 @@ libdaxctl=""
>  meson=""
>  ninja=""
>  skip_meson=no
> -gettext=""
> +gettext="auto"
>  
>  bogus_os="no"
>  malloc_trim="auto"
> @@ -1014,9 +1014,9 @@ for opt do
>    ;;
>    --enable-vnc) vnc="enabled"
>    ;;
> -  --disable-gettext) gettext="false"
> +  --disable-gettext) gettext="disabled"
>    ;;
> -  --enable-gettext) gettext="true"
> +  --enable-gettext) gettext="enabled"
>    ;;
>    --oss-lib=*) oss_lib="$optarg"
>    ;;
> @@ -2839,19 +2839,6 @@ if test "$xen_pci_passthrough" != "disabled"; then
>    fi
>  fi
>  
> -##########################################
> -# gettext probe
> -if test "$gettext" != "false" ; then
> -  if has xgettext; then
> -    gettext=true
> -  else
> -    if test "$gettext" = "true" ; then
> -      feature_not_found "gettext" "Install xgettext binary"
> -    fi
> -    gettext=false
> -  fi
> -fi
> -
>  ##########################################
>  # X11 probe
>  if $pkg_config --exists "x11"; then
> diff --git a/meson_options.txt b/meson_options.txt
> index f6f64785fe..191e848600 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -9,7 +9,7 @@ option('sphinx_build', type : 'string', value : '',
>  
>  option('docs', type : 'feature', value : 'auto',
>         description: 'Documentations build support')
> -option('gettext', type : 'boolean', value : true,
> +option('gettext', type : 'feature', value : 'auto',
>         description: 'Localization of the GTK+ user interface')
>  option('install_blobs', type : 'boolean', value : true,
>         description: 'install provided firmware blobs')
> diff --git a/po/meson.build b/po/meson.build
> index 1387fd979a..a863f0575f 100644
> --- a/po/meson.build
> +++ b/po/meson.build
> @@ -1,6 +1,6 @@
>  i18n = import('i18n')
>  
> -if get_option('gettext')
> +if find_program('xgettext', required: get_option('gettext')).found()
>    i18n.gettext(meson.project_name(),
>                 args: '--msgid-bugs-address=qemu-devel@nongnu.org',
>                 preset: 'glib')


-- 
Alex Bennée

Re: [PATCH v2 3/8] configure: move gettext detection to meson.build
Posted by Paolo Bonzini 5 years, 1 month ago
On 16/12/20 15:19, Alex Bennée wrote:
> 
> Alex Bennée <alex.bennee@linaro.org> writes:
> 
>> This will allow meson to honour -Dauto_features=disabled later.
>>
>> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> 
> ping Paolo, are you happy with this bit?

Yes, I'm so happy with this and the --with-default-features parts that I 
was going to include it in my next pull request. :)

Series

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

>> ---
>>   configure         | 19 +++----------------
>>   meson_options.txt |  2 +-
>>   po/meson.build    |  2 +-
>>   3 files changed, 5 insertions(+), 18 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 8f2095a2db..46fdea88c7 100755
>> --- a/configure
>> +++ b/configure
>> @@ -448,7 +448,7 @@ libdaxctl=""
>>   meson=""
>>   ninja=""
>>   skip_meson=no
>> -gettext=""
>> +gettext="auto"
>>   
>>   bogus_os="no"
>>   malloc_trim="auto"
>> @@ -1014,9 +1014,9 @@ for opt do
>>     ;;
>>     --enable-vnc) vnc="enabled"
>>     ;;
>> -  --disable-gettext) gettext="false"
>> +  --disable-gettext) gettext="disabled"
>>     ;;
>> -  --enable-gettext) gettext="true"
>> +  --enable-gettext) gettext="enabled"
>>     ;;
>>     --oss-lib=*) oss_lib="$optarg"
>>     ;;
>> @@ -2839,19 +2839,6 @@ if test "$xen_pci_passthrough" != "disabled"; then
>>     fi
>>   fi
>>   
>> -##########################################
>> -# gettext probe
>> -if test "$gettext" != "false" ; then
>> -  if has xgettext; then
>> -    gettext=true
>> -  else
>> -    if test "$gettext" = "true" ; then
>> -      feature_not_found "gettext" "Install xgettext binary"
>> -    fi
>> -    gettext=false
>> -  fi
>> -fi
>> -
>>   ##########################################
>>   # X11 probe
>>   if $pkg_config --exists "x11"; then
>> diff --git a/meson_options.txt b/meson_options.txt
>> index f6f64785fe..191e848600 100644
>> --- a/meson_options.txt
>> +++ b/meson_options.txt
>> @@ -9,7 +9,7 @@ option('sphinx_build', type : 'string', value : '',
>>   
>>   option('docs', type : 'feature', value : 'auto',
>>          description: 'Documentations build support')
>> -option('gettext', type : 'boolean', value : true,
>> +option('gettext', type : 'feature', value : 'auto',
>>          description: 'Localization of the GTK+ user interface')
>>   option('install_blobs', type : 'boolean', value : true,
>>          description: 'install provided firmware blobs')
>> diff --git a/po/meson.build b/po/meson.build
>> index 1387fd979a..a863f0575f 100644
>> --- a/po/meson.build
>> +++ b/po/meson.build
>> @@ -1,6 +1,6 @@
>>   i18n = import('i18n')
>>   
>> -if get_option('gettext')
>> +if find_program('xgettext', required: get_option('gettext')).found()
>>     i18n.gettext(meson.project_name(),
>>                  args: '--msgid-bugs-address=qemu-devel@nongnu.org',
>>                  preset: 'glib')
> 
> 


Re: [PATCH v2 3/8] configure: move gettext detection to meson.build
Posted by Alex Bennée 5 years, 1 month ago
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 16/12/20 15:19, Alex Bennée wrote:
>> 
>> Alex Bennée <alex.bennee@linaro.org> writes:
>> 
>>> This will allow meson to honour -Dauto_features=disabled later.
>>>
>>> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> 
>> ping Paolo, are you happy with this bit?
>
> Yes, I'm so happy with this and the --with-default-features parts that I 
> was going to include it in my next pull request. :)

I'm putting together an testing one now (as there is a testing update as
well).

>
> Series
>
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Paolo
>
>>> ---
>>>   configure         | 19 +++----------------
>>>   meson_options.txt |  2 +-
>>>   po/meson.build    |  2 +-
>>>   3 files changed, 5 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index 8f2095a2db..46fdea88c7 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -448,7 +448,7 @@ libdaxctl=""
>>>   meson=""
>>>   ninja=""
>>>   skip_meson=no
>>> -gettext=""
>>> +gettext="auto"
>>>   
>>>   bogus_os="no"
>>>   malloc_trim="auto"
>>> @@ -1014,9 +1014,9 @@ for opt do
>>>     ;;
>>>     --enable-vnc) vnc="enabled"
>>>     ;;
>>> -  --disable-gettext) gettext="false"
>>> +  --disable-gettext) gettext="disabled"
>>>     ;;
>>> -  --enable-gettext) gettext="true"
>>> +  --enable-gettext) gettext="enabled"
>>>     ;;
>>>     --oss-lib=*) oss_lib="$optarg"
>>>     ;;
>>> @@ -2839,19 +2839,6 @@ if test "$xen_pci_passthrough" != "disabled"; then
>>>     fi
>>>   fi
>>>   
>>> -##########################################
>>> -# gettext probe
>>> -if test "$gettext" != "false" ; then
>>> -  if has xgettext; then
>>> -    gettext=true
>>> -  else
>>> -    if test "$gettext" = "true" ; then
>>> -      feature_not_found "gettext" "Install xgettext binary"
>>> -    fi
>>> -    gettext=false
>>> -  fi
>>> -fi
>>> -
>>>   ##########################################
>>>   # X11 probe
>>>   if $pkg_config --exists "x11"; then
>>> diff --git a/meson_options.txt b/meson_options.txt
>>> index f6f64785fe..191e848600 100644
>>> --- a/meson_options.txt
>>> +++ b/meson_options.txt
>>> @@ -9,7 +9,7 @@ option('sphinx_build', type : 'string', value : '',
>>>   
>>>   option('docs', type : 'feature', value : 'auto',
>>>          description: 'Documentations build support')
>>> -option('gettext', type : 'boolean', value : true,
>>> +option('gettext', type : 'feature', value : 'auto',
>>>          description: 'Localization of the GTK+ user interface')
>>>   option('install_blobs', type : 'boolean', value : true,
>>>          description: 'install provided firmware blobs')
>>> diff --git a/po/meson.build b/po/meson.build
>>> index 1387fd979a..a863f0575f 100644
>>> --- a/po/meson.build
>>> +++ b/po/meson.build
>>> @@ -1,6 +1,6 @@
>>>   i18n = import('i18n')
>>>   
>>> -if get_option('gettext')
>>> +if find_program('xgettext', required: get_option('gettext')).found()
>>>     i18n.gettext(meson.project_name(),
>>>                  args: '--msgid-bugs-address=qemu-devel@nongnu.org',
>>>                  preset: 'glib')
>> 
>> 


-- 
Alex Bennée

Re: [PATCH v2 3/8] configure: move gettext detection to meson.build
Posted by Paolo Bonzini 5 years, 1 month ago
On 16/12/20 16:27, Alex Bennée wrote:
> 
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> On 16/12/20 15:19, Alex Bennée wrote:
>>>
>>> Alex Bennée <alex.bennee@linaro.org> writes:
>>>
>>>> This will allow meson to honour -Dauto_features=disabled later.
>>>>
>>>> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>>
>>> ping Paolo, are you happy with this bit?
>>
>> Yes, I'm so happy with this and the --with-default-features parts that I
>> was going to include it in my next pull request. :)
> 
> I'm putting together an testing one now (as there is a testing update as
> well).

Great, I'll rebase when it hits qemu.git.

Paolo

>>
>> Series
>>
>> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>> Paolo
>>
>>>> ---
>>>>    configure         | 19 +++----------------
>>>>    meson_options.txt |  2 +-
>>>>    po/meson.build    |  2 +-
>>>>    3 files changed, 5 insertions(+), 18 deletions(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index 8f2095a2db..46fdea88c7 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -448,7 +448,7 @@ libdaxctl=""
>>>>    meson=""
>>>>    ninja=""
>>>>    skip_meson=no
>>>> -gettext=""
>>>> +gettext="auto"
>>>>    
>>>>    bogus_os="no"
>>>>    malloc_trim="auto"
>>>> @@ -1014,9 +1014,9 @@ for opt do
>>>>      ;;
>>>>      --enable-vnc) vnc="enabled"
>>>>      ;;
>>>> -  --disable-gettext) gettext="false"
>>>> +  --disable-gettext) gettext="disabled"
>>>>      ;;
>>>> -  --enable-gettext) gettext="true"
>>>> +  --enable-gettext) gettext="enabled"
>>>>      ;;
>>>>      --oss-lib=*) oss_lib="$optarg"
>>>>      ;;
>>>> @@ -2839,19 +2839,6 @@ if test "$xen_pci_passthrough" != "disabled"; then
>>>>      fi
>>>>    fi
>>>>    
>>>> -##########################################
>>>> -# gettext probe
>>>> -if test "$gettext" != "false" ; then
>>>> -  if has xgettext; then
>>>> -    gettext=true
>>>> -  else
>>>> -    if test "$gettext" = "true" ; then
>>>> -      feature_not_found "gettext" "Install xgettext binary"
>>>> -    fi
>>>> -    gettext=false
>>>> -  fi
>>>> -fi
>>>> -
>>>>    ##########################################
>>>>    # X11 probe
>>>>    if $pkg_config --exists "x11"; then
>>>> diff --git a/meson_options.txt b/meson_options.txt
>>>> index f6f64785fe..191e848600 100644
>>>> --- a/meson_options.txt
>>>> +++ b/meson_options.txt
>>>> @@ -9,7 +9,7 @@ option('sphinx_build', type : 'string', value : '',
>>>>    
>>>>    option('docs', type : 'feature', value : 'auto',
>>>>           description: 'Documentations build support')
>>>> -option('gettext', type : 'boolean', value : true,
>>>> +option('gettext', type : 'feature', value : 'auto',
>>>>           description: 'Localization of the GTK+ user interface')
>>>>    option('install_blobs', type : 'boolean', value : true,
>>>>           description: 'install provided firmware blobs')
>>>> diff --git a/po/meson.build b/po/meson.build
>>>> index 1387fd979a..a863f0575f 100644
>>>> --- a/po/meson.build
>>>> +++ b/po/meson.build
>>>> @@ -1,6 +1,6 @@
>>>>    i18n = import('i18n')
>>>>    
>>>> -if get_option('gettext')
>>>> +if find_program('xgettext', required: get_option('gettext')).found()
>>>>      i18n.gettext(meson.project_name(),
>>>>                   args: '--msgid-bugs-address=qemu-devel@nongnu.org',
>>>>                   preset: 'glib')
>>>
>>>
> 
>