1 def autotools_dep_prepend(d):
2 if d.getVar('INHIBIT_AUTOTOOLS_DEPS', True):
5 pn = d.getVar('PN', True)
8 if pn in ['autoconf-native', 'automake-native', 'help2man-native']:
10 deps += 'autoconf-native automake-native '
12 if not pn in ['libtool', 'libtool-native'] and not pn.endswith("libtool-cross"):
13 deps += 'libtool-native '
14 if not bb.data.inherits_class('native', d) \
15 and not bb.data.inherits_class('nativesdk', d) \
16 and not bb.data.inherits_class('cross', d) \
17 and not d.getVar('INHIBIT_DEFAULT_DEPS', True):
18 deps += 'libtool-cross '
20 return deps + 'gnu-config-native '
24 DEPENDS_prepend = "${@autotools_dep_prepend(d)}"
28 # Space separated list of shell scripts with variables defined to supply test
29 # results for autoconf tests we cannot run at build time.
30 export CONFIG_SITE = "${@siteinfo_get_files(d)}"
33 EXTRA_AUTORECONF = "--exclude=autopoint"
35 export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir}"
37 def autotools_set_crosscompiling(d):
38 if not bb.data.inherits_class('native', d):
39 return " cross_compiling=yes"
42 def append_libtool_sysroot(d):
43 # Only supply libtool sysroot option for non-native packages
44 if not bb.data.inherits_class('native', d):
45 return '--with-libtool-sysroot=${STAGING_DIR_HOST}'
48 # EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}"
50 CONFIGUREOPTS = " --build=${BUILD_SYS} \
52 --target=${TARGET_SYS} \
54 --exec_prefix=${exec_prefix} \
56 --sbindir=${sbindir} \
57 --libexecdir=${libexecdir} \
58 --datadir=${datadir} \
59 --sysconfdir=${sysconfdir} \
60 --sharedstatedir=${sharedstatedir} \
61 --localstatedir=${localstatedir} \
63 --includedir=${includedir} \
64 --oldincludedir=${oldincludedir} \
65 --infodir=${infodir} \
67 --disable-silent-rules \
68 ${CONFIGUREOPT_DEPTRACK} \
69 ${@append_libtool_sysroot(d)}"
70 CONFIGUREOPT_DEPTRACK = "--disable-dependency-tracking"
74 cfgscript="${S}/configure"
75 if [ -x "$cfgscript" ] ; then
76 bbnote "Running $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} $@"
77 ${CACHED_CONFIGUREVARS} $cfgscript ${CONFIGUREOPTS} ${EXTRA_OECONF} "$@" || bbfatal "oe_runconf failed"
79 bbfatal "no configure script found at $cfgscript"
83 AUTOTOOLS_AUXDIR ?= "${S}"
85 autotools_do_configure() {
92 # WARNING: gross hack follows:
93 # An autotools built package generally needs these scripts, however only
94 # automake or libtoolize actually install the current versions of them.
95 # This is a problem in builds that do not use libtool or automake, in the case
96 # where we -need- the latest version of these scripts. e.g. running a build
97 # for a package whose autotools are old, on an x86_64 machine, which the old
98 # config.sub does not support. Work around this by installing them manually
100 ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do
101 rm -f `dirname $ac`/configure
103 if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then
106 # Remove any previous copy of the m4 macros
107 rm -rf ${B}/aclocal-copy/
108 if [ x"${acpaths}" = xdefault ]; then
110 for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
111 grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
112 acpaths="$acpaths -I $i"
117 AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
119 echo "AUTOV is $AUTOV"
120 if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
121 acpaths="$acpaths -I${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
123 # The aclocal directory could get modified by other processes
124 # uninstalling data from the sysroot. See Yocto #861 for details.
125 # We avoid this by taking a copy here and then files cannot disappear.
126 if [ -d ${STAGING_DATADIR}/aclocal ]; then
127 mkdir -p ${B}/aclocal-copy/
128 # for scratch build this directory can be empty
129 # so avoid cp's no files to copy error
130 cp -r ${STAGING_DATADIR}/aclocal/. ${B}/aclocal-copy/
131 acpaths="$acpaths -I ${B}/aclocal-copy/"
133 # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
134 # like it was auto-generated. Work around this by blowing it away
135 # by hand, unless the package specifically asked not to run aclocal.
136 if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then
139 if [ -e configure.in ]; then
140 CONFIGURE_AC=configure.in
142 CONFIGURE_AC=configure.ac
144 if ! echo ${EXTRA_OECONF} | grep -q "\-\-disable-nls"; then
145 if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
146 if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
147 : do nothing -- we still have an old unmodified configure.ac
149 bbnote Executing glib-gettextize --force --copy
150 echo "no" | glib-gettextize --force --copy
152 else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
153 # We'd call gettextize here if it wasn't so broken...
154 cp ${STAGING_DATADIR}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
155 if [ -d ${S}/po/ -a ! -e ${S}/po/Makefile.in.in ]; then
156 cp ${STAGING_DATADIR}/gettext/po/Makefile.in.in ${S}/po/
157 if [ ! -e ${S}/po/remove-potcdate.sin ]; then
158 cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ${S}/po/
165 if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
166 bbnote Executing intltoolize --copy --force --automake
167 intltoolize --copy --force --automake
169 bbnote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths
170 autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || bbfatal "autoreconf execution failed."
175 if [ -e ${S}/configure ]; then
178 bbnote "nothing to configure"
182 autotools_do_install() {
183 oe_runmake 'DESTDIR=${D}' install
184 # Info dir listing isn't interesting at this point so remove it if it exists.
185 if [ -e "${D}${infodir}/dir" ]; then
186 rm -f ${D}${infodir}/dir
192 EXPORT_FUNCTIONS do_configure do_install