1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-02 20:04:15 +01:00

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 <anomie@users.sourceforge.net>
This commit is contained in:
Brad Jorsch
2010-09-29 16:12:33 -04:00
committed by Carlos R. Mafra
parent f6080ffd56
commit 060ba6a9cd
17 changed files with 193 additions and 163 deletions

View File

@@ -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...") == The root menu contains only 2 entries. ("XTerm" and "Exit...")
* Window Maker is not finding cpp (the C preprocessor). If your cpp is * 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. CPP_PATH.
== checking lex output file root... configure: error: cannot find output from true; giving up == checking lex output file root... configure: error: cannot find output from true; giving up

View File

@@ -506,7 +506,7 @@ mezerou.
== The root menu contains only 2 entries. ("XTerm" and "Exit...") == The root menu contains only 2 entries. ("XTerm" and "Exit...")
* Window Maker nemůže nalézt cpp (preprocesor jazyka C). Pokud se váš cpp * 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. cestu CPP_PATH.
== checking lex output file root... configure: error: cannot find output from true; giving up == checking lex output file root... configure: error: cannot find output from true; giving up

View File

@@ -498,7 +498,7 @@ Si no est
== El menú raíz contiene solo 2 entradas. ("XTerm" y "Exit...") == El menú raíz contiene solo 2 entradas. ("XTerm" y "Exit...")
* Window Maker no está encontrando cpp (el preprocesador de C). Si su * 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. CPP_PATH.
== checking lex output file root... configure: error: cannot find output from true; giving up == checking lex output file root... configure: error: cannot find output from true; giving up

View File

@@ -535,7 +535,7 @@ Si vous n'en
== Le menu des applications ne contient que 2 entrées ("XTerm" et "Exit...") == 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é * 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 == checking lex output file root... configure: error: cannot find output from true; giving up

View File

@@ -456,7 +456,7 @@ para obter informa
== O menu do root possui só 2 entradas. ("XTerm" e "Exit...") == 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 * 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. no CPP_PATH.
== checking lex output file root... configure: error: cannot find output from == checking lex output file root... configure: error: cannot find output from

View File

@@ -505,7 +505,7 @@ wmaker.inst
== The root menu contains only 2 entries. ("XTerm" and "Exit...") == The root menu contains only 2 entries. ("XTerm" and "Exit...")
* Window Maker nevie nájs» cpp (C preprocesor). Ak sa vá¹ cpp nenachádza * 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 == checking lex output file root... configure: error: cannot find output from true; giving up

View File

@@ -1,5 +1,34 @@
## Process this file with automake to produce Makefile.in ## 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 ACLOCAL_AMFLAGS = -I m4
SUBDIRS = wrlib WINGs src util po WindowMaker WPrefs.app doc SUBDIRS = wrlib WINGs src util po WindowMaker WPrefs.app doc

View File

@@ -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@ libWINGs_la_LIBADD = libWUtil.la $(top_builddir)/wrlib/libwraster.la @XLIBS@ @XFTLIBS@ @FCLIBS@ @LIBM@
libWUtil_la_LIBADD = @LIBBSD@ 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 # wbutton.c
@@ -85,7 +85,33 @@ AM_CFLAGS =
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \ INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
@XFTFLAGS@ @HEADER_SEARCH_PATH@ @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: install-exec-local:
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)

31
WINGs/get-wings-flags.in Normal file
View File

@@ -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

31
WINGs/get-wutil-flags.in Normal file
View File

@@ -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

View File

@@ -3,7 +3,7 @@
#ifndef WINGS_CONFIG_H_ #ifndef WINGS_CONFIG_H_
#define WINGS_CONFIG_H_ #define WINGS_CONFIG_H_
#include "../src/config.h" #include "../config.h"
#if defined(HAVE_LIBINTL_H) && defined(I18N) #if defined(HAVE_LIBINTL_H) && defined(I18N)
# include <libintl.h> # include <libintl.h>

View File

@@ -14,9 +14,11 @@ dnl
AC_INIT(WindowMaker, 0.94.0-crm, , WindowMaker, http://www.windowmaker.info/) AC_INIT(WindowMaker, 0.94.0-crm, , WindowMaker, http://www.windowmaker.info/)
AC_CONFIG_SRCDIR(src/WindowMaker.h) AC_CONFIG_SRCDIR(src/WindowMaker.h)
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER(src/config.h) AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([1.11 silent-rules]) AM_INIT_AUTOMAKE([1.11 silent-rules])
AH_BOTTOM([#include "config-paths.h"])
dnl libtool library versioning dnl libtool library versioning
dnl ======================= dnl =======================
dnl dnl
@@ -124,12 +126,9 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
_bindir=`eval echo $bindir` _bindir=`eval echo $bindir`
_bindir=`eval echo $_bindir` _bindir=`eval echo $_bindir`
_libdir=`eval echo $libdir` lib_search_path='-L${libdir}'
_libdir=`eval echo $_libdir`
lib_search_path="-L$_libdir"
inc_search_path=`eval echo $includedir` inc_search_path='-I${includedir}'
inc_search_path="-I`eval echo $inc_search_path`"
dnl =============================================== dnl ===============================================
dnl Specify paths to look for libraries and headers 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 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
fi fi
menutextdomain=
AC_ARG_WITH(menu-textdomain, AS_HELP_STRING([--with-menu-textdomain=DOMAIN], [specify gettext domain used for menu translations]), 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 [if test "x$withval" != "xno"; then
AC_DEFINE_UNQUOTED([MENU_TEXTDOMAIN], ["$withval"], [gettext domain used for menu translations]) menutextdomain=$withval
fi]) fi])
AC_SUBST(menutextdomain)
AC_SUBST(INTLIBS) AC_SUBST(INTLIBS)
AC_SUBST(NLSDIR) 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 if test "x$with_pixmapdir" != "x"; then
pixmapdir=$with_pixmapdir pixmapdir=$with_pixmapdir
else else
pixmapdir=`eval echo ${datadir}/pixmaps` pixmapdir='${datadir}/pixmaps'
fi fi
AC_SUBST(pixmapdir)
AC_DEFINE_UNQUOTED(PIXMAPDIR, "$pixmapdir", [define an extra path for pixmaps (set by configure)]) pkgdatadir='${datadir}'
AC_SUBST(pkgdatadir)
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)])
dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app 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 The #lp# and #rp# stuff below is a hack because [ and ] get lost when
dnl parsed by m4 dnl parsed by m4
cat <<EOF >get-wraster-flags AC_SUBST(lib_search_path)
#!/bin/sh AC_SUBST(inc_search_path)
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 <<EOF > 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 <<EOF >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 <<EOF > 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 <<EOF >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
dnl dnl
dnl Spit out the configuration dnl Spit out the configuration

View File

@@ -20,7 +20,7 @@
* USA. * USA.
*/ */
#include "../src/config.h" #include "../config.h"
#ifdef USE_JPEG #ifdef USE_JPEG

View File

@@ -37,7 +37,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h> #include <ctype.h>
#include "../src/config.h" #include "../config.h"
#ifdef XINERAMA #ifdef XINERAMA
# ifdef SOLARIS_XINERAMA /* sucks */ # ifdef SOLARIS_XINERAMA /* sucks */

View File

@@ -17,7 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "../src/config.h" #include "../config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -4,7 +4,7 @@ SUBDIRS = .
AUTOMAKE_OPTIONS = AUTOMAKE_OPTIONS =
EXTRA_DIST = tests libwraster.map EXTRA_DIST = tests libwraster.map get-wraster-flags.in
lib_LTLIBRARIES = libwraster.la lib_LTLIBRARIES = libwraster.la
@@ -49,7 +49,24 @@ INCLUDES = $(DFLAGS) @HEADER_SEARCH_PATH@
libwraster_la_LIBADD = @LIBRARY_SEARCH_PATH@ @GFXLIBS@ @XLIBS@ @LIBXMU@ -lm 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: install-exec-local:
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)

View File

@@ -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