From: Michal H. <ms...@gm...> - 2008-08-23 00:09:07
|
It is rather long time since I have started Unified makefiles patchset and there were several things I was lazy work on those days. Most of them were marked as "TODO from autoconf" and the main motivation was to make almost everything configurable from configure script rather than having them hard-coded. This patch sets all those variable (in Makefile.flags.in) from configure. In the result it means that we can modify them during configuration when necessary (e.g. ./configure COPY="something else than cp" will use given "something else than cp" instead of default "cp -f". The second important thing which is done here, is the consolidation of all these variables with those coming out of qmake when it generates makefile. Qmake has its own idea about COPY, MKDIR, ... variables and we have to force it to use our configured values. I have used the same trick which is already used for unification of compiler - make all configurable variables used by qmake 2 layered: CONFIG_NAME is set by configured and used in pro file and NAME used in our makefiles is initialized from CONFIG_NAME. * config/env.m4 - CHK_OR_DEFINE_VAR(PARAM1, PARAM2) macro added - PARAM1 stands for variable we want to check and set - PARAM2 default value if PARAM1 isn't defined yet - it should be used for all configurable variables because we can push such a variable by ./configure NAME=value or from configure itself when needed (just define such variable) -TODO - maybe we could include also AC_SUBST into this macro. Any idea how Martin? (I have tried AC_SUBS($[]$1 but it didn't work) * configure.in - all hard-coded variables from Makefile.flags.in defined by CHK_OR_DEFINE_VAR * Makefile.flags.in - all hard-coded variables are set from configure now (except for C*FLAGS and our headers and libraries paths * gui/pdfedit.pro, kpdf-kde-3.3.2/qoutputdevices.pro - All variables which might affect installation replaced initialized from CONFIG_* equivalents - TODO I wasn't able to force SYMLINK initialization QMAKE_SYMLINK = $(CONFIG_SYMLINK) doesn't seem to work - I have tried even SYMLINK = $(CONFIG_SYMLINK) withou success Index: pdfedit-patches/Makefile.flags.in =================================================================== --- pdfedit-patches.orig/Makefile.flags.in 2008-08-22 16:35:30.000000000 -0600 +++ pdfedit-patches/Makefile.flags.in 2008-08-22 16:58:15.000000000 -0600 @@ -12,31 +12,37 @@ CONFIG_LINK = $(CONFIG_CXX) CC = $(CONFIG_CC) CXX = $(CONFIG_CXX) LINK = $(CONFIG_LINK) -# TODO from autoconf -AR = ar cqs +CONFIG_AR = @AR@ +AR = $(CONFIG_AR) CONFIG_RANLIB = @RANLIB@ RANLIB = $(CONFIG_RANLIB) -# TODO from autoconf -COPY = cp -f -COPY_FILE= $(COPY) -COPY_DIR = $(COPY) -r -INSTALL_FILE= $(COPY_FILE) -INSTALL_DIR = $(COPY_DIR) -# TODO from autoconf -DEL_FILE = rm -f -# TODO from autoconf -SYMLINK = ln -sf -# TODO from autoconf -DEL_DIR = rmdir -DEL_FORCE_DIR = rm -rf -MOVE = mv -f -# TODO from autoconf -CHK_DIR_EXISTS= test -d -MKDIR = mkdir -p -SHELL = @SHELL@ +CONFIG_COPY = @COPY@ +COPY = $(CONFIG_COPY) +CONFIG_COPY_FILE = $(COPY) +COPY_FILE= $(CONFIG_COPY_FILE) +CONFIG_COPY_DIR = $(COPY) -r +COPY_DIR = $(CONFIG_COPY_DIR) +CONFIG_INSTALL_FILE = $(COPY_FILE) +INSTALL_FILE= $(CONFIG_INSTALL_FILE) +CONFIG_INSTALL_DIR = $(COPY_DIR) +INSTALL_DIR = $(CONFIG_INSTALL_DIR) +CONFIG_DEL_FILE= @DEL_FILE@ +DEL_FILE = $(CONFIG_DEL_FILE) +CONFIG_SYMLINK = @SYMLINK@ +SYMLINK = $(CONFIG_SYMLINK) +CONFIG_DEL_DIR = @DEL_DIR@ +DEL_DIR = $(CONFIG_DEL_DIR) +CONFIG_DEL_FORCE_DIR = @DEL_FORCE_DIR@ +DEL_FORCE_DIR = $(CONFIG_DEL_FORCE_DIR) +CONFIG_MOVE = @MOVE@ +MOVE = $(MOVE) +CONFIG_CHK_DIR_EXISTS = @CHK_DIR_EXISTS@ +CHK_DIR_EXISTS = $(CONFIG_CHK_DIR_EXISTS) +CONFIG_MKDIR = @MKDIR@ +MKDIR = $(CONFIG_MKDIR) +SHELL = @SHELL@ DOXYGEN_BIN = @DOXYGEN_BIN@ -# TODO from autoconf ? -LIBPREFIX = lib +LIBPREFIX = @LIBPREFIX@ ########################################### # Installation directories Index: pdfedit-patches/config/env.m4 =================================================================== --- pdfedit-patches.orig/config/env.m4 2008-08-22 16:35:30.000000000 -0600 +++ pdfedit-patches/config/env.m4 2008-08-22 16:42:20.000000000 -0600 @@ -14,3 +14,12 @@ AC_DEFUN(CHK_ENV_VAR_NOTICE,[ fi ]) +AC_DEFUN(CHK_OR_DEFINE_VAR, [ + if test -z "$[]$1" + then + $1=$2 + AC_MSG_NOTICE(Using default $1=$2) + else + AC_MSG_NOTICE(Using provided $1=$[]$1) + fi + ]) Index: pdfedit-patches/configure.in =================================================================== --- pdfedit-patches.orig/configure.in 2008-08-22 16:35:30.000000000 -0600 +++ pdfedit-patches/configure.in 2008-08-22 16:49:41.000000000 -0600 @@ -54,6 +54,33 @@ then AC_MSG_ERROR(Boost IOStreams is required by PDFedit) fi +dnl Default (and configurable) values for files/directories manipulation +dnl programs (you can overwrite them by ./configure NAME=value) +CHK_OR_DEFINE_VAR(COPY, "cp -f") +CHK_OR_DEFINE_VAR(DEL_FILE, "rm -f") +CHK_OR_DEFINE_VAR(DEL_DIR, "rmdir") +CHK_OR_DEFINE_VAR(DEL_FORCE_DIR, "rm -rf") +CHK_OR_DEFINE_VAR(SYMLINK, "ln -s") +CHK_OR_DEFINE_VAR(MOVE, "mv -f") +CHK_OR_DEFINE_VAR(CHK_DIR_EXISTS, "tets -d") +CHK_OR_DEFINE_VAR(MKDIR, "mkdir -p") +AC_SUBST(COPY) +AC_SUBST(DEL_FILE) +AC_SUBST(DEL_DIR) +AC_SUBST(DEL_FORCE_DIR) +AC_SUBST(SYMLINK) +AC_SUBST(MOVE) +AC_SUBST(CHK_DIR_EXISTS) +AC_SUBST(MKDIR) + + +dnl Default (and configurable) values for libraries +CHK_OR_DEFINE_VAR(AR, "ar cqs") +CHK_OR_DEFINE_VAR(LIBPREFIX, "lib") +AC_SUBST(AR) +AC_SUBST(LIBPREFIX) + + AC_ARG_ENABLE(stack-protector, [AS_HELP_STRING([--enable-stack-protector], [Turn on stack protector (disabled by default)])], Index: pdfedit-patches/src/gui/pdfedit.pro =================================================================== --- pdfedit-patches.orig/src/gui/pdfedit.pro 2008-08-22 16:59:32.000000000 -0600 +++ pdfedit-patches/src/gui/pdfedit.pro 2008-08-22 17:09:58.000000000 -0600 @@ -229,12 +229,23 @@ exists( .menu-trans.h ) { HEADERS += .menu-trans.h } -# Force configure compiler +# Force configure compiler and all other programs used for installation QMAKE_CC = $(CONFIG_CC) QMAKE_CXX = $(CONFIG_CXX) QMAKE_LINK = $(CONFIG_LINK) QMAKE_LINK_SHLIB = $(CONFIG_LINK) QMAKE_RANLIB = $(CONFIG_RANLIB) +QMAKE_AR = $(CONFIG_AR) +QMAKE_COPY = $(CONFIG_COPY) +QMAKE_COPY_FILE = $(CONFIG_COPY_FILE) +QMAKE_COPY_DIR = $(CONFIG_COPY_DIR) +QMAKE_DEL_FILE = $(CONFIG_DEL_FILE) +# qmake doesn't like QMAKE_SYMLINK and ignores it +QMAKE_SYMLINK = $(CONFIG_SYMLINK) +QMAKE_DEL_DIR = $(CONFIG_DEL_DIR) +QMAKE_MOVE = $(CONFIG_MOVE) +QMAKE_CHK_DIR_EXISTS = $(CONFIG_CHK_DIR_EXISTS) +QMAKE_MKDIR = $(CONFIG_MKDIR) # QSA include INCPATH += $(QSAPATH) Index: pdfedit-patches/src/kpdf-kde-3.3.2/qoutputdevices.pro =================================================================== --- pdfedit-patches.orig/src/kpdf-kde-3.3.2/qoutputdevices.pro 2008-08-22 16:59:32.000000000 -0600 +++ pdfedit-patches/src/kpdf-kde-3.3.2/qoutputdevices.pro 2008-08-22 17:10:09.000000000 -0600 @@ -40,11 +40,23 @@ INCPATH += $(MANDATORY_PATHS) # Flags from configuration QMAKE_CXXFLAGS += $(CONFIG_CXXFLAGS) -# Force configure compiler +# Force configure compiler and all other programs used for installation QMAKE_CC = $(CONFIG_CC) -QMAKE_CPP = $(CONFIG_CXX) +QMAKE_CXX = $(CONFIG_CXX) QMAKE_LINK = $(CONFIG_LINK) QMAKE_LINK_SHLIB = $(CONFIG_LINK) +QMAKE_RANLIB = $(CONFIG_RANLIB) +QMAKE_AR = $(CONFIG_AR) +QMAKE_COPY = $(CONFIG_COPY) +QMAKE_COPY_FILE = $(CONFIG_COPY_FILE) +QMAKE_COPY_DIR = $(CONFIG_COPY_DIR) +QMAKE_DEL_FILE = $(CONFIG_DEL_FILE) +# qmake doesn't like QMAKE_SYMLINK and ignores it +QMAKE_SYMLINK = $(CONFIG_SYMLINK) +QMAKE_DEL_DIR = $(CONFIG_DEL_DIR) +QMAKE_MOVE = $(CONFIG_MOVE) +QMAKE_CHK_DIR_EXISTS = $(CONFIG_CHK_DIR_EXISTS) +QMAKE_MKDIR = $(CONFIG_MKDIR) #QOutputDevices source files HEADERS += QOutputDevPixmap.h -- Michal Hocko |