#!/bin/sh # # Copyright (c) 2002-2020 # The Xfce development team. All rights reserved. # # Written for Xfce by Benedikt Meurer . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # xdt-autogen - Part of the Xfce developer tools. # VERSION="@VERSION@" XDT_AUTOGEN_VERSION_MAJOR="@VERSION_MAJOR@" XDT_AUTOGEN_VERSION_MINOR="@VERSION_MINOR@" XDT_AUTOGEN_VERSION_MICRO="@VERSION_MICRO@" XDT_AUTOGEN_VERSION_REVISION="@VERSION_REVISION@" prefix="@prefix@" datarootdir="@datarootdir@" m4macrodir="${datarootdir}/aclocal" ## ## to properly handle whitespaces in filenames, ## and more generally special characters different from '\1' ## default_IFS=$IFS special_IFS=$(printf '\1') ## ## a few portability tests ## if test -z "$EGREP"; then if type egrep >/dev/null 2>&1; then EGREP=egrep else EGREP="grep -E" fi fi ## ## figures out any subdirs that should be configured as a part ## of recursive configure. ## parse_configure_subdirs() { test -f "$1" && sed -n -e 's|\\[\\nt]| |g' \ -e 's|.*AC_CONFIG_SUBDIRS(\[\{0,1\}\([[:alnum:]_ @/-]\{1,\}\).*|\1|p' \ "$1" } ## ## Helper function to look up configure.{in,ac} files recursively. ## lookup_configure_ac_files() { configure_ac_file="" if test -f "$1/configure.ac"; then configure_ac_file="$1/configure.ac"; elif test -f "$1/configure.in"; then configure_ac_file="$1/configure.in"; else cat >&2 <&2 <"$configure_ac_file" <> "$configure_ac_file" done ## ## Search for the configure.{ac,in} files ## CONFIGURE_AC_FILES=$(lookup_configure_ac_files "$MASTER_DIR") ## ## Check for a suitable make ## if test -z "${MAKE}"; then if type gmake >/dev/null 2>/dev/null; then MAKE="gmake" elif type make >/dev/null 2>/dev/null; then MAKE="make" else cat >&2 </dev/null 2>&1 echo "Cleaning generated files in ${directory}..." # determine the output files used in this package directory output_files=$( sed -n -e 's|\\[\\nt]| |g' \ -e 's|.*AC_OUTPUT(\[\{0,1\}\([[:alnum:]_@/\. -]\{1,\}\).*|\1|p' \ "${configure_ac_file}" ) # we are in the repository here: these filenames don't contain whitespaces # nor special characters: no need to change the IFS for output_file in $output_files; do if test "$(basename "$output_file")" = "Makefile"; then rm -f "${directory}/${output_file}.in" rm -f "${directory}/${output_file}.in.in" fi rm -f "${directory}/${output_file}" done ( cd "${directory}" && { rm -f config.* configure configure.lineno aclocal.m4 rm -f compile depcomp ltmain.sh missing install-sh rm -f po/Makefile.in.in po/stamp-it rm -f stamp-h1 ./*.spec rm -f mkinstalldirs libtool rm -rf autom4te.cache m4 gtk-doc.m4 rm -f intltool-* gtk-doc.make rm -f test-driver if test -f po/POTFILES.in; then rm -f po/POTFILES fi if test -f configure.ac.in -a -f configure.ac; then rm -f configure.ac elif test -f configure.in.in -a -f configure.in; then rm -f configure.in fi } ) # determine translations used in this package directory # translations=$( # sed -n -e 's|\\[\\nt]| |g' \ # -e 's|.*XDT_I18N(\[\{0,1\}\([a-zA-Z_@ ]\{1,\}\).*|\1|p') \ # "${configure_ac_file}" # ) # for translation in $translations; do # rm -f "${directory}/po/${translation}.gmo" # done rm -f "${directory}"/po/*.gmo; done exit 0 fi ## ## Check for autoconf ## if test -z "${XDT_PROG_AUTOCONF}"; then test -z "${AUTOCONF_VERSION}" && i=autoconf || i=autoconf-${AUTOCONF_VERSION} ${i} --version /dev/null 2>&1 && XDT_PROG_AUTOCONF=${i} fi test -z "${XDT_PROG_AUTOCONF}" && { cat >&2 </dev/null 2>&1 || { cat >&2 <&2 </dev/null 2>&1; then XDT_PROG_LIBTOOLIZE="glibtoolize" elif type libtoolize >/dev/null 2>&1; then XDT_PROG_LIBTOOLIZE="libtoolize" fi fi IFS=$special_IFS for configure_ac_file in $CONFIGURE_AC_FILES; do IFS=$default_IFS runlibtoolize=0 if grep -q "^AC_PROG_LIBTOOL" "${configure_ac_file}"; then cat >&2 </dev/null 2>&1 || { cat >&2 </dev/null 2>&1 || { cat >&2 </dev/null 2>&1 || { cat >&2 </dev/null 2>&1 && XDT_PROG_ACLOCAL=${i} fi test -z "${XDT_PROG_ACLOCAL}" && { cat >&2 </dev/null 2>&1 && XDT_PROG_AUTOHEADER=${i} test -z "${XDT_PROG_AUTOHEADER}" && { cat >&2 </dev/null 2>&1 && XDT_PROG_AUTOMAKE=${i} fi test -z "${XDT_PROG_AUTOMAKE}" && { cat >&2 < "${source_dir}/aclocal.m4" \ || exit 1 fi echo "Running ${XDT_PROG_GLIB_GETTEXTIZE} --force --copy..." \ && ${XDT_PROG_GLIB_GETTEXTIZE} --force --copy \ || exit 1 if test -f "${source_dir}/aclocal.m4" -a ! -w "${source_dir}/aclocal.m4"; then echo "Making ${source_dir}/aclocal.m4 writable..." \ && chmod u+w "${source_dir}/aclocal.m4" \ || exit 1 fi fi if $EGREP -q "^(AC|IT)_PROG_INTLTOOL" "${configure_ac_file}"; then ( echo "Running ${XDT_PROG_INTLTOOLIZE} --automake --copy --force" \ && cd "${source_dir}" \ && ${XDT_PROG_INTLTOOLIZE} --automake --copy --force ) || exit 1 fi # patch the po/Makefile.in.in to take into account the setting of # XGETTEXT_ARGS properly if test -f "${source_dir}/po/Makefile.in.in"; then if ! grep -q '^XGETTEXT_ARGS[ ]*=[ ]*@XGETTEXT_ARGS@$' \ "${source_dir}/po/Makefile.in.in" then echo "Patching file 'po/Makefile.in.in'" if sed \ -e 's/^\(XGETTEXT[ ]*=[ ]*@XGETTEXT@\)[ ]*$/\1 $(XGETTEXT_ARGS)/' \ -e 's/^\(MSGMERGE[ ]*=\)[ ]*\(INTLTOOL_EXTRACT=\)/\1 XGETTEXT_ARGS="$(XGETTEXT_ARGS)" \2/' \ -e 's/^\(GENPOT[ ]*=\)[ ]*\(INTLTOOL_EXTRACT=\)/\1 XGETTEXT_ARGS="$(XGETTEXT_ARGS)" \2/' \ -e "/^XGETTEXT = @XGETTEXT@/{ i\\ XGETTEXT_ARGS = @XGETTEXT_ARGS@ }" "${source_dir}/po/Makefile.in.in" > "${source_dir}/po/Makefile.in.in.tmp" then mv -f "${source_dir}/po/Makefile.in.in.tmp" \ "${source_dir}/po/Makefile.in.in" || exit 1 fi fi fi if grep -q -e "^AC_PROG_LIBTOOL" -e "^LT_PREREQ" "${configure_ac_file}"; then ( echo "Running ${XDT_PROG_LIBTOOLIZE} --force --copy..." \ && cd "${source_dir}" \ && ${XDT_PROG_LIBTOOLIZE} --force --copy ) || exit 1 fi if grep -q "^GTK_DOC_CHECK" "${configure_ac_file}"; then ( echo "Running ${XDT_PROG_GTKDOCIZE} --copy..." \ && cd "${source_dir}" \ && ${XDT_PROG_GTKDOCIZE} --copy ) || exit 1 fi ( echo -n "Running ${XDT_PROG_ACLOCAL}" ${ACLOCAL_FLAGS} \ ${ACLOCAL_DIR_1:+-I "${ACLOCAL_DIR_1}"} \ ${ACLOCAL_DIR_2:+-I "${ACLOCAL_DIR_2}"} \ && echo '...' \ && cd "${source_dir}" \ && ${XDT_PROG_ACLOCAL} ${ACLOCAL_FLAGS} \ ${ACLOCAL_DIR_1:+-I "${ACLOCAL_DIR_1}"} \ ${ACLOCAL_DIR_2:+-I "${ACLOCAL_DIR_2}"} ) || exit 1 if $EGREP -q "^A(M|C)_CONFIG_HEADER" "${configure_ac_file}"; then ( echo "Running ${XDT_PROG_AUTOHEADER}..." \ && cd "${source_dir}" \ && ${XDT_PROG_AUTOHEADER} ) || exit 1 fi ( echo "Running ${XDT_PROG_AUTOMAKE} --force-missing --add-missing --copy --gnu..." \ && cd "${source_dir}" \ && ${XDT_PROG_AUTOMAKE} --force-missing --add-missing --copy --gnu ) || exit 1 ( echo "Running ${XDT_PROG_AUTOCONF}..." \ && cd "${source_dir}" \ && ${XDT_PROG_AUTOCONF} ) || exit 1 echo done ## ## Run configure ## if test -z "${NOCONFIGURE}"; then ( echo "Running ${MASTER_DIR}/configure ${CONFIGURE_FLAGS}..." \ && cd "${MASTER_DIR}" \ && ./configure ${CONFIGURE_FLAGS} \ && echo "Now type \"make\" to compile." ) || exit 1 else echo "Skipping configure process." fi # vi:set ts=2 sw=2 et ai: