Search code examples
linuxcross-compilingautotoolsyoctorecipe

How to give options for "configure" using yocto recipes?


I want write a recipe in yocto to build my custom component. In that i would like to enable some flags according to machine.

eg:

if machine is x86

my configure command should be like :

./configure --enable-x86

if it is x64

./configure --enable-x64

i am using auto tools for building. please help me in writing recipe as well as "configure.ac" for achieving this.

ps: I am very new to yocto.


Solution

  • You can provide the configure options using EXTRA_OECONF. Here, you can also append values to it based on your architecture.

    EXTRA_OECONF_append_x86="--enable-x86"
    EXTRA_OECONF_append_x64="--enable-x64"
    

    You can do this only if your architecture (x86/x64) is defined as aprt of OVERRIDE value. Let us see what OVERRIDE value is:

    The Yocto bitbake configuration values are defined in poky/meta/conf/bitbake.conf. In that file, there is a variable called OVERRIDE. The sample value for OVERRIDE in bitbake configuration is shown below:

    OVERRIDES = "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:build-${BUILD_OS}:pn-${PN}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}:forcevariable"
    

    When you run bitbake -e and gather the output, the value for OVERRIDE translates into based on your configuration.

    OVERRIDES="linux:i586:build-linux:pn-defaultpkgname:x86:qemuall:qemux86:poky:class-target:forcevariable:libc-glibc"
    

    In your setup, if you can see x86/x64 as part of OVERRIDE value then you can define configure options as described earlier.