fixed dependencies in pkg-config

master
Marc Wäckerlin 10 years ago
parent 091cddf3b6
commit c4768b4f0c
  1. 33
      ax_check_qt.m4
  2. 17
      ax_init_standard_project.m4
  3. 60
      bootstrap.sh

@ -104,12 +104,24 @@ AC_DEFUN([AX_CHECK_QT], [
MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}"
AM_CXXFLAGS+=" ${[$1]5_CFLAGS}" AM_CXXFLAGS+=" ${[$1]5_CFLAGS}"
LIBS+=" ${[$1]5_LIBS}" LIBS+=" ${[$1]5_LIBS}"
modules=${qt_modules//Qt/Qt5}
if test -z "$PKG_REQUIREMENTS"; then
PKG_REQUIREMENTS="${modules// /, }"
else
PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, ${modules// /, }"
fi
if test -n "${qt_modules_optional}"; then if test -n "${qt_modules_optional}"; then
PKG_CHECK_MODULES([$1]5_OPTIONAL, [${qt_modules_optional//Qt/Qt5}], [ PKG_CHECK_MODULES([$1]5_OPTIONAL, [${qt_modules_optional//Qt/Qt5}], [
AM_CPPFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}" AM_CPPFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
MOC_FLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}" MOC_FLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
AM_CXXFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}" AM_CXXFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
LIBS+=" ${[$1]5_OPTIONAL_LIBS}" LIBS+=" ${[$1]5_OPTIONAL_LIBS}"
modules=${qt_modules_optional//Qt/Qt5}
if test -z "$PKG_REQUIREMENTS"; then
PKG_REQUIREMENTS="${modules// /, }"
else
PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, ${modules// /, }"
fi
], [ ], [
AC_MSG_NOTICE([Not found: ${qt_modules_optional//Qt/Qt5}]) AC_MSG_NOTICE([Not found: ${qt_modules_optional//Qt/Qt5}])
]) ])
@ -122,12 +134,24 @@ AC_DEFUN([AX_CHECK_QT], [
MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}" MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}" AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}" LIBS+=" ${$1_LIBS}"
modules=${qt_modules}
if test -z "$PKG_REQUIREMENTS"; then
PKG_REQUIREMENTS="${modules// /, }"
else
PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, ${modules// /, }"
fi
if test -n "$3"; then if test -n "$3"; then
PKG_CHECK_MODULES($1_OPTIONAL, [${qt_modules_optional}], [ PKG_CHECK_MODULES($1_OPTIONAL, [${qt_modules_optional}], [
AM_CPPFLAGS+=" ${$1_OPTIONAL_CFLAGS}" AM_CPPFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
MOC_FLAGS+=" ${$1_OPTIONAL_CFLAGS}" MOC_FLAGS+=" ${$1_OPTIONAL_CFLAGS}"
AM_CXXFLAGS+=" ${$1_OPTIONAL_CFLAGS}" AM_CXXFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
LIBS+=" ${$1_OPTIONAL_LIBS}" LIBS+=" ${$1_OPTIONAL_LIBS}"
modules=${qt_modules_optional}
if test -z "$PKG_REQUIREMENTS"; then
PKG_REQUIREMENTS="${modules// /, }"
else
PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, ${modules// /, }"
fi
], [ ], [
AC_MSG_NOTICE([Not found: ${qt_modules_optional}]) AC_MSG_NOTICE([Not found: ${qt_modules_optional}])
]) ])
@ -139,6 +163,7 @@ AC_DEFUN([AX_CHECK_QT], [
AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CPPFLAGS)
AC_SUBST(MOC_FLAGS) AC_SUBST(MOC_FLAGS)
AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS)
AC_SUBST(PKG_REQUIREMENTS)
AX_ADDITIONAL_QT_RULES_HACK=' AX_ADDITIONAL_QT_RULES_HACK='
ui_%.hxx: %.ui ui_%.hxx: %.ui
$(UIC) -o [$][@] $< $(UIC) -o [$][@] $<
@ -191,3 +216,11 @@ AC_DEFUN([AX_REQUIRE_QT], [
AC_MSG_ERROR([Required Qt modules not found: $2]) AC_MSG_ERROR([Required Qt modules not found: $2])
fi fi
]) ])
# Omit Qt Keywords
# AX_QT_NO_KEYWORDS
AC_DEFUN([AX_QT_NO_KEYWORDS], [
AM_CPPFLAGS+=" -DQT_NO_KEYWORDS"
])

@ -399,6 +399,11 @@ AC_DEFUN([AX_PKG_REQUIRE], [
AM_CPPFLAGS+=" ${$1_CFLAGS}" AM_CPPFLAGS+=" ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}" AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}" LIBS+=" ${$1_LIBS}"
if test -z "$PKG_REQUIREMENTS"; then
PKG_REQUIREMENTS="$2"
else
PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, $2"
fi
], [ ], [
AC_MSG_WARN([Recommended package $2 for feature $1 not installed]) AC_MSG_WARN([Recommended package $2 for feature $1 not installed])
if test -n "$4"; then if test -n "$4"; then
@ -430,6 +435,11 @@ AC_DEFUN([AX_PKG_REQUIRE], [
AM_CPPFLAGS+=" ${$1_CFLAGS}" AM_CPPFLAGS+=" ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}" AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}" LIBS+=" ${$1_LIBS}"
if test -z "$PKG_REQUIREMENTS"; then
PKG_REQUIREMENTS="$pkg"
else
PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, $pkg"
fi
], [ ], [
AC_MSG_WARN([Recommended package $pkg for feature $1 not installed]) AC_MSG_WARN([Recommended package $pkg for feature $1 not installed])
]) ])
@ -438,6 +448,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [
]) ])
AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS)
AC_SUBST(PKG_REQUIREMENTS)
if test -n "$3"; then if test -n "$3"; then
old_CPPFLAGS=${CPPFLAGS} old_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}" CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"
@ -464,6 +475,11 @@ AC_DEFUN([AX_PKG_CHECK], [
AM_CPPFLAGS+=" ${$1_CFLAGS}" AM_CPPFLAGS+=" ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}" AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}" LIBS+=" ${$1_LIBS}"
if test -z "$PKG_REQUIREMENTS"; then
PKG_REQUIREMENTS="m4_default([$2], [$1])"
else
PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, m4_default([$2], [$1])"
fi
], [ ], [
HAVE_$1=0 HAVE_$1=0
]) ])
@ -471,4 +487,5 @@ AC_DEFUN([AX_PKG_CHECK], [
AC_SUBST(HAVE_$1) AC_SUBST(HAVE_$1)
AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS)
AC_SUBST(PKG_REQUIREMENTS)
]) ])

@ -22,26 +22,29 @@ configure=0
build=0 build=0
overwrite=0 overwrite=0
rebuild=0 rebuild=0
rebuildfiles=()
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
(--configure|-c) configure=1;; (--configure|-c) configure=1;;
(--build|-b) configure=1; build=1;; (--build|-b) configure=1; build=1;;
(--overwrite|-o) overwrite=1;; (--overwrite|-o) overwrite=1;;
(--rebuild|-r) rebuild=1;; (--rebuild|-r) rebuild=1;;
(--rebuild-file|-f) shift; rebuildfiles+=("$1");;
(--version|-v) (--version|-v)
echo "$Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $"; echo "$Id: bootstrap.sh 31 2015-05-05 15:06:08Z marc $";
exit;; exit;;
(--help|-h) less <<EOF (--help|-h) less <<EOF
SYNOPSIS SYNOPSIS
${MY_NAME} [--help|-h] [--configure|-c] ${MY_NAME} [--help|-h] [OPTIOS]
OPTIONS OPTIONS
--configure, -c call ./configure after initialization --configure, -c call ./configure after initialization
--build, -c build, call ./configure && make after initialization --build, -c build, also call ./configure && make
--overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros) --overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros)
--rebuild -r force rebuild of generated files, even if modified --rebuild, -r force rebuild of generated files, even if modified
--rebuild-file, -f <file> rebild specific file (can be added multiple times)
--help, -h show this help --help, -h show this help
--version, -v show version and date of this file --version, -v show version and date of this file
@ -122,9 +125,15 @@ GENERATED FILES
REBUILDING FILES REBUILDING FILES
To rebuild all these files, just run "${MY_NAME} -o". You can also To rebuild all these files, just run "${MY_NAME} -r".
remove and rebuild a single file by removing it from subversion,
just call "svn rm <file>" and "${MY_NAME}" to rebuild file "<file>". To copy only the files provided by this package, that means those
files you must never change, that means to update the build system
to the latest release, run "${MY_NAME} -o"
You can also rebuild a list of singleany list of specific file files
by adding option "${MY_NAME} -f <file>" to rebuild file
"<file>". You can add option "-f" more than once.
FILES TO EDIT FILES TO EDIT
@ -256,6 +265,12 @@ testtag() {
egrep -q '^ *'"$1" configure.ac egrep -q '^ *'"$1" configure.ac
} }
contains() {
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
checkdir() { checkdir() {
if ! test -d "$1"; then # create path if ! test -d "$1"; then # create path
run mkdir -p "$1" run mkdir -p "$1"
@ -285,8 +300,10 @@ to() {
esac esac
shift; shift;
done done
if checkfile "$1" && test $rebuild -eq 0; then # file already exists if checkfile "$1" && test $rebuild -eq 0 \
return && ! contains "$1" "${rebuildfiles[@]}"; then
# file already exists and must not be rebuilt
return 1
fi fi
checkdir "$(dirname ${1})" checkdir "$(dirname ${1})"
echo -en "\e[1m-> generating:\e[0m $1 ..." echo -en "\e[1m-> generating:\e[0m $1 ..."
@ -307,10 +324,13 @@ to() {
run svn add "$1" run svn add "$1"
run svn propset svn:keywords "Id" "$1" run svn propset svn:keywords "Id" "$1"
fi fi
return 0
} }
copy() { copy() {
if checkfile "$1" && test $overwrite -eq 0; then if checkfile "$1" && test $overwrite -eq 0 \
&& ! contains "$1" "${rebuildfiles[@]}"; then
# file already exists and must not be rebuilt
return return
fi fi
run cp "${0%/*}/$1" "$1" run cp "${0%/*}/$1" "$1"
@ -348,8 +368,8 @@ copy ax_init_standard_project.m4
copy ax_cxx_compile_stdcxx_11.m4 copy ax_cxx_compile_stdcxx_11.m4
copy ax_check_qt.m4 copy ax_check_qt.m4
copy AUTHORS copy AUTHORS
if ! test -f configure.ac; then to configure.ac <<EOF && \
to configure.ac <<EOF ( echo "please edit configure.ac, then rerun $0"; exit 0 )
${HEADER}m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name ${HEADER}m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name
m4_define(x_major, 0) # project's major version m4_define(x_major, 0) # project's major version
m4_define(x_minor, 0) # project's minor version m4_define(x_minor, 0) # project's minor version
@ -375,9 +395,6 @@ AX_INIT_STANDARD_PROJECT
# create output # create output
AC_OUTPUT AC_OUTPUT
EOF EOF
echo "please edit configure.ac, then rerun $0"
exit 0
fi
PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac) PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac)
echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | to --condition AX_USE_CXX src/makefile.am echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | to --condition AX_USE_CXX src/makefile.am
to --condition AX_USE_CXX src/version.hxx <<EOF to --condition AX_USE_CXX src/version.hxx <<EOF
@ -473,10 +490,14 @@ LDADD = -l${PACKAGE_NAME}
MAINTAINERCLEANFILES = makefile.in MAINTAINERCLEANFILES = makefile.in
EOF EOF
if testtag AX_USE_DOXYGEN && ! test -f doc/doxyfile.in; then if testtag AX_USE_DOXYGEN && \
( ! checkfile doc/doxyfile.in || \
contains doc/doxyfile.in "${rebuildfiles[@]}" ); then
run doxygen -g doc/doxyfile.in run doxygen -g doc/doxyfile.in
if test $exists -eq 0; then
run svn add doc/doxyfile.in run svn add doc/doxyfile.in
run svn propset svn:keywords "Id" doc/doxyfile.in run svn propset svn:keywords "Id" doc/doxyfile.in
fi
doxyreplace PROJECT_NAME "@PACKAGE_NAME@" doxyreplace PROJECT_NAME "@PACKAGE_NAME@"
doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@" doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@"
doxyreplace PROJECT_BRIEF "@DESCRIPTION@" doxyreplace PROJECT_BRIEF "@DESCRIPTION@"
@ -595,13 +616,15 @@ ${HEADER}%:
EOF EOF
echo 7 | to debian/compat echo 7 | to debian/compat
fi fi
if ! test -f makefile.am; then
SUBDIRS="" SUBDIRS=""
for d in src test scripts doc examples; do for d in src test scripts doc examples; do
test -d $d && SUBDIRS="${SUBDIRS} $d" test -d $d && SUBDIRS="${SUBDIRS} $d"
done done
echo "${HEADER}SUBDIRS =${SUBDIRS}\n\nMAINTAINERCLEANFILES = makefile.in" | to makefile.am to makefile.am<<EOF
fi ${HEADER}SUBDIRS =${SUBDIRS}
MAINTAINERCLEANFILES = makefile.in
EOF
to --condition AX_USE_LIBTOOL src/${PACKAGE_NAME}.pc.in <<EOF to --condition AX_USE_LIBTOOL src/${PACKAGE_NAME}.pc.in <<EOF
${HEADER}prefix=@prefix@ ${HEADER}prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
@ -613,6 +636,7 @@ Description: @DESCRIPTION@
Version: @VERSION@ Version: @VERSION@
Libs: -L\${libdir} -l@PACKAGE_NAME@ @LDFLAGS@ Libs: -L\${libdir} -l@PACKAGE_NAME@ @LDFLAGS@
Cflags: -I\${includedir} @CPPFLAGS@ Cflags: -I\${includedir} @CPPFLAGS@
Requires: @PKG_REQUIREMENTS@
EOF EOF
#### Cleanup If Makefile Exists #### #### Cleanup If Makefile Exists ####

Loading…
Cancel
Save