From 060ba6a9cd5c8bf3fab0e72ac6213e4452fe8302 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 29 Sep 2010 16:12:33 -0400 Subject: [PATCH] Fix path substitutions Autoconf uses multiple levels of variables when defining paths. For example, ${datadir} by default is ${datarootdir}, which by default is ${prefix}/share, which by default is /usr/local. Substituting from ./configure, as is done by AC_DEFINE or AC_DEFINE_UNQUOTED, does not expand all these variables. This was causing some of our defines to have garbage like "${prefix}/share/pixmaps" rather than the intended "/usr/local/share/pixmaps". The solution is to generate the files needing these paths from the Makefile rather than from ./configure, because make does fully expand all those levels. Signed-off-by: Brad Jorsch --- INSTALL-WMAKER | 2 +- INSTALL-WMAKER.cs | 2 +- INSTALL-WMAKER.es | 2 +- INSTALL-WMAKER.fr | 2 +- INSTALL-WMAKER.pt | 2 +- INSTALL-WMAKER.sk | 2 +- Makefile.am | 29 +++++++ WINGs/Makefile.am | 30 ++++++- WINGs/get-wings-flags.in | 31 +++++++ WINGs/get-wutil-flags.in | 31 +++++++ WINGs/wconfig.h | 2 +- configure.ac | 163 ++++--------------------------------- util/directjpeg.c | 2 +- util/wmsetbg.c | 2 +- util/wxpaste.c | 2 +- wrlib/Makefile.am | 21 ++++- wrlib/get-wraster-flags.in | 31 +++++++ 17 files changed, 193 insertions(+), 163 deletions(-) create mode 100644 WINGs/get-wings-flags.in create mode 100644 WINGs/get-wutil-flags.in create mode 100644 wrlib/get-wraster-flags.in diff --git a/INSTALL-WMAKER b/INSTALL-WMAKER index 901ed2a4..1c3f8e0d 100644 --- a/INSTALL-WMAKER +++ b/INSTALL-WMAKER @@ -369,7 +369,7 @@ If you're not sure, try renaming ~/GNUstep to ~/GNUtmp and then run wmaker.inst == The root menu contains only 2 entries. ("XTerm" and "Exit...") * Window Maker is not finding cpp (the C preprocessor). If your cpp is -not located in /lib/cpp, edit src/config.h and correct the path in +not located in /lib/cpp, edit config.h and correct the path in CPP_PATH. == checking lex output file root... configure: error: cannot find output from true; giving up diff --git a/INSTALL-WMAKER.cs b/INSTALL-WMAKER.cs index 2e84c856..915a8102 100644 --- a/INSTALL-WMAKER.cs +++ b/INSTALL-WMAKER.cs @@ -506,7 +506,7 @@ mezerou. == The root menu contains only 2 entries. ("XTerm" and "Exit...") * Window Maker nemůže nalézt cpp (preprocesor jazyka C). Pokud se váš cpp - nenachází v /lib/cpp, tak otevřte soubor src/config.h a nastavte správně + nenachází v /lib/cpp, tak otevřte soubor config.h a nastavte správně cestu CPP_PATH. == checking lex output file root... configure: error: cannot find output from true; giving up diff --git a/INSTALL-WMAKER.es b/INSTALL-WMAKER.es index 2c9325de..127e1281 100644 --- a/INSTALL-WMAKER.es +++ b/INSTALL-WMAKER.es @@ -498,7 +498,7 @@ Si no est == El menú raíz contiene solo 2 entradas. ("XTerm" y "Exit...") * Window Maker no está encontrando cpp (el preprocesador de C). Si su -cpp no está ubicado en /lib/cpp, edite src/config.h y corrija la ruta en +cpp no está ubicado en /lib/cpp, edite config.h y corrija la ruta en CPP_PATH. == checking lex output file root... configure: error: cannot find output from true; giving up diff --git a/INSTALL-WMAKER.fr b/INSTALL-WMAKER.fr index a5c79517..c2c1e4e8 100644 --- a/INSTALL-WMAKER.fr +++ b/INSTALL-WMAKER.fr @@ -535,7 +535,7 @@ Si vous n'en == Le menu des applications ne contient que 2 entrées ("XTerm" et "Exit...") * Window Maker ne trouve pas cpp (le preprocesseur de C). Si votre cpp n'est pas situé -dans /lib/cpp, editez src/config.h et modifiez le chemin d'accčs dans CPP_PATH en conséquent. +dans /lib/cpp, editez config.h et modifiez le chemin d'accčs dans CPP_PATH en conséquent. == checking lex output file root... configure: error: cannot find output from true; giving up diff --git a/INSTALL-WMAKER.pt b/INSTALL-WMAKER.pt index c91b2a3f..d74ed867 100644 --- a/INSTALL-WMAKER.pt +++ b/INSTALL-WMAKER.pt @@ -456,7 +456,7 @@ para obter informa == O menu do root possui só 2 entradas. ("XTerm" e "Exit...") * O Window Maker năo está achando o cpp (o pré-processador C). Se o seu cpp -năo está localizado em /lib/cpp, edite src/config.h e corrija o caminho +năo está localizado em /lib/cpp, edite config.h e corrija o caminho no CPP_PATH. == checking lex output file root... configure: error: cannot find output from diff --git a/INSTALL-WMAKER.sk b/INSTALL-WMAKER.sk index 035af8ee..7b8e35ae 100644 --- a/INSTALL-WMAKER.sk +++ b/INSTALL-WMAKER.sk @@ -505,7 +505,7 @@ wmaker.inst == The root menu contains only 2 entries. ("XTerm" and "Exit...") * Window Maker nevie nájsť cpp (C preprocesor). Ak sa váš cpp nenachádza -v /lib/cpp, upravte src/config.h a vložte správnu cestu do CPP_PATH. +v /lib/cpp, upravte config.h a vložte správnu cestu do CPP_PATH. == checking lex output file root... configure: error: cannot find output from true; giving up diff --git a/Makefile.am b/Makefile.am index a48ad44d..c75cb24a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,34 @@ ## Process this file with automake to produce Makefile.in +AUTOMAKE_OPTIONS = + +BUILT_SOURCES = config-paths.h + +DISTCLEANFILES = config-paths.h + +config.h: config-paths.h + +config-paths.h: Makefile + @echo "Generating $@" + @echo '/* define to the path to cpp */' > $@ + @echo '#define CPP_PATH "$(CPP_PATH)"' >> $@ + @echo '' >> $@ + @echo '/* gettext domain used for menu translations */' >> $@ + @if test -z "$(menutextdomain)"; then \ + echo '/* #undef MENU_TEXTDOMAIN "$(menutextdomain)" */' >> $@; \ + else \ + echo '#define MENU_TEXTDOMAIN "$(menutextdomain)"' >> $@; \ + fi + @echo '' >> $@ + @echo '/* define an extra path for pixmaps */' >> $@ + @echo '#define PIXMAPDIR "$(pixmapdir)"' >> $@ + @echo '' >> $@ + @echo '/* where shared data is stored */' >> $@ + @echo '#define PKGDATADIR "$(pkgdatadir)/WindowMaker"' >> $@ + @echo '' >> $@ + @echo '/* where the configuration is stored */' >> $@ + @echo '#define SYSCONFDIR "$(sysconfdir)"' >> $@ + ACLOCAL_AMFLAGS = -I m4 SUBDIRS = wrlib WINGs src util po WindowMaker WPrefs.app doc diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am index 0e2198c2..0f4db4a0 100644 --- a/WINGs/Makefile.am +++ b/WINGs/Makefile.am @@ -16,7 +16,7 @@ LDADD= libWUtil.la libWINGs.la $(top_builddir)/wrlib/libwraster.la @INTLIBS@ libWINGs_la_LIBADD = libWUtil.la $(top_builddir)/wrlib/libwraster.la @XLIBS@ @XFTLIBS@ @FCLIBS@ @LIBM@ libWUtil_la_LIBADD = @LIBBSD@ -EXTRA_DIST = BUGS make-rgb Examples Extras Tests +EXTRA_DIST = BUGS make-rgb Examples Extras Tests get-wings-flags.in get-wutil-flags.in # wbutton.c @@ -85,7 +85,33 @@ AM_CFLAGS = INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \ @XFTFLAGS@ @HEADER_SEARCH_PATH@ -DISTCLEANFILES = WINGs.pc +DISTCLEANFILES = WINGs.pc get-wings-flags get-wutil-flags + +WINGs.pc: Makefile + @echo "Generating $@" + @echo 'Name: WINGs' > $@ + @echo 'Description: Small widget set with the NeXTStep(TM) look and feel' >> $@ + @echo 'Version: $(VERSION)' >> $@ + @echo 'Requires: wrlib' >> $@ + @echo 'Libs: $(lib_search_path) -lWINGs $(XFTLIBS) $(XLIBS) -lm $(INTLIBS)' >> $@ + @echo 'Cflags: $(inc_search_path)' >> $@ + +get-wings-flags: get-wings-flags.in Makefile + @echo "Generating $@" + @$(SED) -e 's#$${inc_search_path}#$(inc_search_path)#;' \ + -e 's#$${lib_search_path}#$(lib_search_path)#;' \ + -e 's#$${GFXLIBS}#$(GFXLIBS)#;' \ + -e 's#$${XFTLIBS}#$(XFTLIBS)#;' \ + -e 's#$${INTLIBS}#$(INTLIBS)#;' \ + -e 's#$${XLIBS}#$(XLIBS)#;' < $< > $@ + @chmod 755 $@ + +get-wutil-flags: get-wutil-flags.in Makefile + @echo "Generating $@" + @$(SED) -e 's#$${includedir}#$(includedir)#;' \ + -e 's#$${libdir}#$(libdir)#;' \ + -e 's#$${INTLIBS}#$(INTLIBS)#;' < $< > $@ + @chmod 755 $@ install-exec-local: @$(NORMAL_INSTALL) diff --git a/WINGs/get-wings-flags.in b/WINGs/get-wings-flags.in new file mode 100644 index 00000000..a32569ee --- /dev/null +++ b/WINGs/get-wings-flags.in @@ -0,0 +1,31 @@ +#!/bin/sh + +WCFLAGS="${inc_search_path}" +WLFLAGS="${lib_search_path}" +WLIBS="-lWINGs -lWUtil -lwraster ${GFXLIBS} ${XFTLIBS} ${XLIBS} -lm ${INTLIBS}" + +usage="Usage: get-wings-flags [--cflags] [--ldflags] [--libs]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case $1 in + --cflags) + echo $WCFLAGS + ;; + --ldflags|--lflags) + echo $WLFLAGS + ;; + --libs) + echo $WLIBS + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done diff --git a/WINGs/get-wutil-flags.in b/WINGs/get-wutil-flags.in new file mode 100644 index 00000000..026cf597 --- /dev/null +++ b/WINGs/get-wutil-flags.in @@ -0,0 +1,31 @@ +#!/bin/sh + +WCFLAGS="-I${includedir}" +WLFLAGS="-L${libdir}" +WLIBS="-lWUtil ${INTLIBS}" + +usage="Usage: get-wutil-flags [--cflags] [--ldflags] [--libs]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case $1 in + --cflags) + echo $WCFLAGS + ;; + --ldflags|--lflags) + echo $WLFLAGS + ;; + --libs) + echo $WLIBS + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done diff --git a/WINGs/wconfig.h b/WINGs/wconfig.h index b4495600..5cf10e2f 100644 --- a/WINGs/wconfig.h +++ b/WINGs/wconfig.h @@ -3,7 +3,7 @@ #ifndef WINGS_CONFIG_H_ #define WINGS_CONFIG_H_ -#include "../src/config.h" +#include "../config.h" #if defined(HAVE_LIBINTL_H) && defined(I18N) # include diff --git a/configure.ac b/configure.ac index 36054967..15145fd9 100644 --- a/configure.ac +++ b/configure.ac @@ -14,9 +14,11 @@ dnl AC_INIT(WindowMaker, 0.94.0-crm, , WindowMaker, http://www.windowmaker.info/) AC_CONFIG_SRCDIR(src/WindowMaker.h) AC_CONFIG_MACRO_DIR([m4]) -AM_CONFIG_HEADER(src/config.h) +AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE([1.11 silent-rules]) +AH_BOTTOM([#include "config-paths.h"]) + dnl libtool library versioning dnl ======================= dnl @@ -124,12 +126,9 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' _bindir=`eval echo $bindir` _bindir=`eval echo $_bindir` -_libdir=`eval echo $libdir` -_libdir=`eval echo $_libdir` -lib_search_path="-L$_libdir" +lib_search_path='-L${libdir}' -inc_search_path=`eval echo $includedir` -inc_search_path="-I`eval echo $inc_search_path`" +inc_search_path='-I${includedir}' dnl =============================================== dnl Specify paths to look for libraries and headers @@ -240,7 +239,6 @@ if test "$CPP_PATH" = "/usr/ccs/lib/cpp" -o "$CPP_PATH" = "notfound" ; then fi fi fi -AC_DEFINE_UNQUOTED(CPP_PATH, "$CPP_PATH", [define to the path to cpp]) @@ -373,10 +371,12 @@ if test "x$NLSDIR" = "x"; then fi fi +menutextdomain= AC_ARG_WITH(menu-textdomain, AS_HELP_STRING([--with-menu-textdomain=DOMAIN], [specify gettext domain used for menu translations]), [if test "x$withval" != "xno"; then - AC_DEFINE_UNQUOTED([MENU_TEXTDOMAIN], ["$withval"], [gettext domain used for menu translations]) + menutextdomain=$withval fi]) +AC_SUBST(menutextdomain) AC_SUBST(INTLIBS) AC_SUBST(NLSDIR) @@ -816,16 +816,12 @@ AC_ARG_WITH(pixmapdir, AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pi if test "x$with_pixmapdir" != "x"; then pixmapdir=$with_pixmapdir else - pixmapdir=`eval echo ${datadir}/pixmaps` + pixmapdir='${datadir}/pixmaps' fi +AC_SUBST(pixmapdir) -AC_DEFINE_UNQUOTED(PIXMAPDIR, "$pixmapdir", [define an extra path for pixmaps (set by configure)]) - -pkgdatadir=`eval echo $datadir` -AC_DEFINE_UNQUOTED(PKGDATADIR, "$pkgdatadir/WindowMaker", [where shared data is stored (defined by configure)]) - -_sysconfdir=`eval echo $sysconfdir` -AC_DEFINE_UNQUOTED(SYSCONFDIR, "$_sysconfdir", [where the configuration is stored (defined by configure)]) +pkgdatadir='${datadir}' +AC_SUBST(pkgdatadir) dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app @@ -894,139 +890,8 @@ dnl | sed -e 's|\$(prefix)|'"$prefix|" >> WINGs-flags dnl The #lp# and #rp# stuff below is a hack because [ and ] get lost when dnl parsed by m4 -cat <get-wraster-flags -#!/bin/sh - -WCFLAGS="$inc_search_path" -WLFLAGS="$lib_search_path" -WLIBS="-lwraster $GFXLIBS $XLIBS -lm" - -usage="Usage: get-wraster-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#" - -if test \$# -eq 0; then - echo "\${usage}" 1>&2 - exit 1 -fi - -while test \$# -gt 0; do - case \$1 in - --cflags) - echo \$WCFLAGS - ;; - --ldflags|--lflags) - echo \$WLFLAGS - ;; - --libs) - echo \$WLIBS - ;; - *) - echo "\${usage}" 1>&2 - exit 1 - ;; - esac - shift -done - - -EOF - -cat < wrlib/wrlib.pc -Name: wrlib -Description: Image manipulation and conversion library -Version: $VERSION -Libs: $lib_search_path -lwraster $GFXLIBS $XLIBS -lm -Cflags: $inc_search_path -EOF - -cat <get-wings-flags -#!/bin/sh - -WCFLAGS="$inc_search_path" -WLFLAGS="$lib_search_path" -WLIBS="-lWINGs -lWUtil -lwraster $GFXLIBS $XFTLIBS $XLIBS -lm $INTLIBS" - -usage="Usage: get-wings-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#" - -if test \$# -eq 0; then - echo "\${usage}" 1>&2 - exit 1 -fi - -while test \$# -gt 0; do - case \$1 in - --cflags) - echo \$WCFLAGS - ;; - --ldflags|--lflags) - echo \$WLFLAGS - ;; - --libs) - echo \$WLIBS - ;; - *) - echo "\${usage}" 1>&2 - exit 1 - ;; - esac - shift -done - - -EOF - -cat < WINGs/WINGs.pc -Name: WINGs -Description: Small widget set with the NeXTStep(TM) look and feel -Version: $VERSION -Requires: wrlib -Libs: $lib_search_path -lWINGs $XFTLIBS $XLIBS -lm $INTLIBS -Cflags: $inc_search_path -EOF - -cat <get-wutil-flags -#!/bin/sh - -WCFLAGS="-I`eval echo ${includedir}`" -WLFLAGS="-L${_libdir}" -WLIBS="-lWUtil $INTLIBS" - -usage="Usage: get-wutil-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#" - -if test \$# -eq 0; then - echo "\${usage}" 1>&2 - exit 1 -fi - -while test \$# -gt 0; do - case \$1 in - --cflags) - echo \$WCFLAGS - ;; - --ldflags|--lflags) - echo \$WLFLAGS - ;; - --libs) - echo \$WLIBS - ;; - *) - echo "\${usage}" 1>&2 - exit 1 - ;; - esac - shift -done - - -EOF - -sed 's/#lp#/[/g' get-wraster-flags | sed 's/#rp#/]/g' > wrlib/get-wraster-flags -sed 's/#lp#/[/g' get-wings-flags | sed 's/#rp#/]/g' > WINGs/get-wings-flags -sed 's/#lp#/[/g' get-wutil-flags | sed 's/#rp#/]/g' > WINGs/get-wutil-flags - -chmod 755 wrlib/get-wraster-flags WINGs/get-wings-flags WINGs/get-wutil-flags - -rm -f get-wraster-flags get-wings-flags get-wutil-flags - +AC_SUBST(lib_search_path) +AC_SUBST(inc_search_path) dnl dnl Spit out the configuration diff --git a/util/directjpeg.c b/util/directjpeg.c index c242c4a8..d698febe 100644 --- a/util/directjpeg.c +++ b/util/directjpeg.c @@ -20,7 +20,7 @@ * USA. */ -#include "../src/config.h" +#include "../config.h" #ifdef USE_JPEG diff --git a/util/wmsetbg.c b/util/wmsetbg.c index 33ea4479..e9698366 100644 --- a/util/wmsetbg.c +++ b/util/wmsetbg.c @@ -37,7 +37,7 @@ #include #include -#include "../src/config.h" +#include "../config.h" #ifdef XINERAMA # ifdef SOLARIS_XINERAMA /* sucks */ diff --git a/util/wxpaste.c b/util/wxpaste.c index 72c3d272..87fc8920 100644 --- a/util/wxpaste.c +++ b/util/wxpaste.c @@ -17,7 +17,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "../src/config.h" +#include "../config.h" #include #include diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am index 7a8c73ef..4f6062b9 100644 --- a/wrlib/Makefile.am +++ b/wrlib/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = . AUTOMAKE_OPTIONS = -EXTRA_DIST = tests libwraster.map +EXTRA_DIST = tests libwraster.map get-wraster-flags.in lib_LTLIBRARIES = libwraster.la @@ -49,7 +49,24 @@ INCLUDES = $(DFLAGS) @HEADER_SEARCH_PATH@ libwraster_la_LIBADD = @LIBRARY_SEARCH_PATH@ @GFXLIBS@ @XLIBS@ @LIBXMU@ -lm -DISTCLEANFILES = wrlib.pc +DISTCLEANFILES = wrlib.pc get-wraster-flags + +wrlib.pc: Makefile + @echo "Generating $@" + @echo 'Name: wrlib' > $@ + @echo 'Description: Image manipulation and conversion library' >> $@ + @echo 'Version: $(VERSION)' >> $@ + @echo 'Libs: $(lib_search_path) -lwraster $(GFXLIBS) $(XLIBS) -lm' >> $@ + @echo 'Cflags: $(inc_search_path)' >> $@ + +get-wraster-flags: get-wraster-flags.in Makefile + @echo "Generating $@" + @$(SED) -e 's#$${inc_search_path}#$(inc_search_path)#;' \ + -e 's#$${lib_search_path}#$(lib_search_path)#;' \ + -e 's#$${GFXLIBS}#$(GFXLIBS)#;' \ + -e 's#$${XLIBS}#$(XLIBS)#;' < $< > $@ + @chmod 755 $@ + install-exec-local: @$(NORMAL_INSTALL) diff --git a/wrlib/get-wraster-flags.in b/wrlib/get-wraster-flags.in new file mode 100644 index 00000000..a8cdd1ae --- /dev/null +++ b/wrlib/get-wraster-flags.in @@ -0,0 +1,31 @@ +#!/bin/sh + +WCFLAGS="${inc_search_path}" +WLFLAGS="${lib_search_path}" +WLIBS="-lwraster ${GFXLIBS} ${XLIBS} -lm" + +usage="Usage: get-wraster-flags [--cflags] [--ldflags] [--libs]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case $1 in + --cflags) + echo $WCFLAGS + ;; + --ldflags|--lflags) + echo $WLFLAGS + ;; + --libs) + echo $WLIBS + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done