Signed-off-by: Juergen Borleis <j...@pengutronix.de>
---
 rules/templates/src-autoconf-lib/Makefile.am  |   2 +-
 rules/templates/src-autoconf-lib/configure.ac |  35 +--
 rules/templates/src-autoconf-prog/Makefile.am |   3 +-
 .../templates/src-autoconf-prog/configure.ac  | 110 +++++++-
 .../src-autoconf-proglib/Makefile.am          |   2 +-
 .../src-autoconf-proglib/configure.ac         | 100 ++++++-
 .../template-m4-macros/attributes.m4          |   2 +-
 .../template-m4-macros/ax_armv7_detection.m4  |   8 +-
 ...mv4_detection.m4 => ax_armv8_detection.m4} |  60 ++--
 rules/templates/template-m4-macros/pkg.m4     | 256 +++++++++++++-----
 rules/templates/template-src-autoconf-make    |  37 +--
 11 files changed, 448 insertions(+), 167 deletions(-)
 rename rules/templates/template-m4-macros/{ax_armv4_detection.m4 => 
ax_armv8_detection.m4} (62%)

diff --git a/rules/templates/src-autoconf-lib/Makefile.am 
b/rules/templates/src-autoconf-lib/Makefile.am
index ae223891a..771b45454 100644
--- a/rules/templates/src-autoconf-lib/Makefile.am
+++ b/rules/templates/src-autoconf-lib/Makefile.am
@@ -28,10 +28,10 @@ EXTRA_DIST = \
        autogen.sh \
        m4/attributes.m4 \
        m4/ptx.m4 \
-       m4/ax_armv4_detection.m4 \
        m4/ax_armv5_detection.m4 \
        m4/ax_armv6_detection.m4 \
        m4/ax_armv7_detection.m4 \
+       m4/ax_armv8_detection.m4 \
        m4/ax_floating_point.m4 \
        m4/ax_code_coverage.m4 \
        m4/pkg.m4 \
diff --git a/rules/templates/src-autoconf-lib/configure.ac 
b/rules/templates/src-autoconf-lib/configure.ac
index 24d0cb189..f062e6be5 100644
--- a/rules/templates/src-autoconf-lib/configure.ac
+++ b/rules/templates/src-autoconf-lib/configure.ac
@@ -14,9 +14,15 @@ AM_SILENT_RULES([yes])
 # TODO If you don't want the default installation path to be '/usr/local' 
change it here
 # AC_PREFIX_DEFAULT(<new prefix>)
 
-# TODO If possible, enable extensions to Posix
+# If possible, enable extensions to Posix
 AC_USE_SYSTEM_EXTENSIONS
 
+# support LFS
+AC_SYS_LARGEFILE
+
+AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE([foreign no-exeext dist-xz silent-rules subdir-objects])
+
 #
 # libtool library versioning stuff
 #
@@ -31,13 +37,10 @@ AC_SUBST(LT_CURRENT)
 AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)
 
-AM_MAINTAINER_MODE
-AM_INIT_AUTOMAKE([foreign no-exeext dist-xz silent-rules subdir-objects])
-
 #
 # Checks for programs.
 #
-AC_PROG_CC
+AC_PROG_CC_C99
 
 #
 # TODO to only build the static library uncomment the following line
@@ -120,15 +123,16 @@ PTX_LIBRARY_CHECKS
 # specific architectures.
 
 #AS_IF([test x${host_cpu} = "xarm"],
-#      [AX_DETECT_ARMV4([enable_arm4=yes], [enable_arm4=no])
-#      AX_DETECT_ARMV5([enable_arm5=yes], [enable_arm5=no])
+#      [AX_DETECT_ARMV5([enable_arm5=yes], [enable_arm5=no])
 #      AX_DETECT_ARMV6([enable_arm6=yes], [enable_arm6=no])
 #      AX_DETECT_ARMV7([enable_arm7=yes], [enable_arm7=no])
+#      AX_DETECT_ARMV8([enable_arm8=yes], [enable_arm8=no])
 #
 #      AS_IF([test x${enable_arm4} = "xyes"], [AC_MSG_NOTICE([ARMv4 target])])
 #      AS_IF([test x${enable_arm5} = "xyes"], [AC_MSG_NOTICE([ARMv5 target])])
 #      AS_IF([test x${enable_arm6} = "xyes"], [AC_MSG_NOTICE([ARMv6 target])])
-#      AS_IF([test x${enable_arm7} = "xyes"], [AC_MSG_NOTICE([ARMv7 
target])])])
+#      AS_IF([test x${enable_arm7} = "xyes"], [AC_MSG_NOTICE([ARMv7 target])])
+#      AS_IF([test x${enable_arm8} = "xyes"], [AC_MSG_NOTICE([ARMv8 
target])])])
 
 # -------------------------- use all the settings ----------------------------
 
@@ -177,14 +181,17 @@ AC_MSG_RESULT([
         Target CPU:            ${host_cpu}
         Target OS:             ${host_os}
 
-       Detected options:
+       User options:
        ------------------------------------------------------
-        CPPFLAGS:              ${CPPFLAGS}
         CFLAGS:                ${CFLAGS}
+        CPPFLAGS:              ${CPPFLAGS}
         LDFLAGS:               ${LDFLAGS}
+
+       Detected options:
+       ------------------------------------------------------
         Debug:                 ${enable_debug}
         Hidden symbols         ${enable_hide}
-        Coverage:              ${enable_coverage}
+        Coverage:              ${enable_code_coverage}
                CPPFLAGS:       ${CODE_COVERAGE_CPPFLAGS}
                CFLAGS:         ${CODE_COVERAGE_CFLAGS}
                LDFLAGS:        ${CODE_COVERAGE_LDFLAGS}
@@ -193,12 +200,6 @@ AC_MSG_RESULT([
         Private libs:          ${LIBS}
         Use abort():           ${enable_abort}
 
-       User options:
-       ------------------------------------------------------
-        CFLAGS:                ${CFLAGS}
-        CPPFLAGS:              ${CPPFLAGS}
-        LDFLAGS:               ${LDFLAGS}
-
        Install options:
        ------------------------------------------------------
         prefix:                ${prefix}
diff --git a/rules/templates/src-autoconf-prog/Makefile.am 
b/rules/templates/src-autoconf-prog/Makefile.am
index 3b0782dac..2a197076b 100644
--- a/rules/templates/src-autoconf-prog/Makefile.am
+++ b/rules/templates/src-autoconf-prog/Makefile.am
@@ -16,12 +16,11 @@ EXTRA_DIST = \
        autogen.sh \
        m4/attributes.m4 \
        m4/ptx.m4 \
-       m4/ax_armv4_detection.m4 \
        m4/ax_armv5_detection.m4 \
        m4/ax_armv6_detection.m4 \
        m4/ax_armv7_detection.m4 \
+       m4/ax_armv8_detection.m4 \
        m4/ax_floating_point.m4 \
-       m4/ax_am_jobserver.m4 \
        m4/ax_code_coverage.m4 \
        m4/pkg.m4 \
        COPYING
diff --git a/rules/templates/src-autoconf-prog/configure.ac 
b/rules/templates/src-autoconf-prog/configure.ac
index 94f855859..8dcb7cf57 100644
--- a/rules/templates/src-autoconf-prog/configure.ac
+++ b/rules/templates/src-autoconf-prog/configure.ac
@@ -1,5 +1,6 @@
 AC_PREREQ(2.69)
 
+# TODO add useful information about this package
 AC_INIT([@name@], 0.0.0, [b...@yourdomain.to], [@name@], 
[http://www.yourdomain.to/])
 AC_CONFIG_SRCDIR([@name@.c])
 AC_CONFIG_HEADERS([config.h])
@@ -25,18 +26,110 @@ AM_INIT_AUTOMAKE([foreign no-exeext dist-xz silent-rules 
subdir-objects])
 #
 # Checks for programs.
 #
-AC_PROG_CC
+AC_PROG_CC_C99
+
+#
+# Using additional preprocessor, compiler or linker flags:
+# - add them to AM_CPPFLAGS, AM_CFLAGS or AM_LDFLAGS if they should be used
+#   by all source files
+# - give the user a chance to setup her/his own flags with the CPPFLAGS, CFLAGS
+#   and LDFLAGS
+# - if some flags are specific to a file add the flags via the substitute macro
+#   into the Makefile
+#
+# Don't add the "-g" to the CFLAGS variable. It will be done automatically if
+# autoconf detects a GNU compiler.
+#
+
+#
+# Please note: 'configure' defaults the CFLAGS to "-O2 -g" if it detects a
+# GCC. If the user overwrites the CFLAGS externallly, there will be no default!
+# Keep the user informed about this behaviour.
+
+#
+# TODO Check here for mandadory external libraries
+#
+# Rule of thumb: when your library needs an external library, add it
+# to the 'LIBS' variable. Do _not_ add it manually into the Makefile.am files.
+# These libraries _must_ be listed in the *.pc file.
+#
+# Don't add libraries without a check. Even if you know the 'sqrt()' requires
+# 'libm' on most systems, check for its real need with 'AC_SEARCH_LIBS(sqrt, 
m)'.
+# Doing it in this way will ensure an embedded developer knows exactly what
+# dependencies your library has (because it gets listed in the *.pc file).
+#
+# Another way for checking libraries is the PKG_CHECK_MODULES macro. But please
+# honor if a user switches off a feature you also switch of the test for a
+# external component via PKG_CHECK_MODULES when it is no longer required!
+# PKG_CHECK_MODULES returns *_CFLAGS and *_LIBS. Again, add the *_LIBS to the
+# global 'LIBS', but for the CFLAGS you can decide if you add them to the
+# CFLAGS, AM_CFLAGS or as substitution variables in the Makefile.am.
 
-##
-# libsomething
-##
 #REQUIRES_LIBSOMETHING="libsomething >= 20090402-1"
 #AC_SUBST(REQUIRES_LIBSOMETHING)
 #PKG_CHECK_MODULES(libsomething, $REQUIRES_LIBSOMETHING)
 
+#
+# TODO Check for functions and header files. First write your code and then run
+# the 'autoscan' tool to get an idea what is still missing in your 
'configure.ac'
+#
+
 PTX_COMMON_CHECKS
 PTX_APPLICATION_CHECKS
 
+# ---------------------------------------------------------------------------
+
+# TODO Checking if this CPU has a hardware floating point unit
+
+#AX_HARDWARE_FP([target_hardware_fp=yes], [target_hardware_fp=no])
+
+# When a hardware floating point unit seems available, then use it.
+# This will end in bad code on badly configured compilers which generates
+# floating point instructions even if the CPU has not hardware FP unit
+#
+#AS_IF([test x${target_hardware_fp} = "xyes"],
+#      [AC_MSG_NOTICE([FPU available])],
+#      [AC_MSG_NOTICE([FPU not available])])
+
+# ---------------------------------------------------------------------------
+
+# TODO discover on demand the special architecture this compiler builds code
+# for. This can be useful if the package provides some optimized code for
+# specific architectures.
+
+#AS_IF([test x${host_cpu} = "xarm"],
+#      [AX_DETECT_ARMV5([enable_arm5=yes], [enable_arm5=no])
+#      AX_DETECT_ARMV6([enable_arm6=yes], [enable_arm6=no])
+#      AX_DETECT_ARMV7([enable_arm7=yes], [enable_arm7=no])
+#      AX_DETECT_ARMV8([enable_arm8=yes], [enable_arm8=no])
+#
+#      AS_IF([test x${enable_arm4} = "xyes"], [AC_MSG_NOTICE([ARMv4 target])])
+#      AS_IF([test x${enable_arm5} = "xyes"], [AC_MSG_NOTICE([ARMv5 target])])
+#      AS_IF([test x${enable_arm6} = "xyes"], [AC_MSG_NOTICE([ARMv6 target])])
+#      AS_IF([test x${enable_arm7} = "xyes"], [AC_MSG_NOTICE([ARMv7 target])])
+#      AS_IF([test x${enable_arm8} = "xyes"], [AC_MSG_NOTICE([ARMv8 
target])])])
+
+# -------------------------- use all the settings ----------------------------
+
+# substitute the settings valid for all source files
+AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_CPPFLAGS)
+AC_SUBST(AM_LDFLAGS)
+
+# add private libs to the pkg-config file
+# 'private libs' are those required to link this library
+# its used later on if someone wants to link this library statically
+AC_SUBST(LIBS)
+
+# add required lib information to the pkg-config file (on demand)
+AC_SUBST(REQUIRES)
+
+# add lib information which may conflicts with this libarry
+AC_SUBST(CONFLICTS)
+
+# add special compile flags on demand
+AC_SUBST(PRIVATE_CFLAGS)
+
 # be very silent on request
 AM_CONDITIONAL(BUILD_SILENTLY, test "x$AM_DEFAULT_VERBOSITY" = x0)
 
@@ -61,18 +154,21 @@ AC_MSG_RESULT([
         Target CPU:            ${host_cpu}
         Target OS:             ${host_os}
 
-       Detected options:
+       User options:
        ------------------------------------------------------
-        CPPFLAGS:              ${CPPFLAGS}
         CFLAGS:                ${CFLAGS}
+        CPPFLAGS:              ${CPPFLAGS}
         LDFLAGS:               ${LDFLAGS}
+
+       Detected options:
+       ------------------------------------------------------
         Debug:                 ${enable_debug}
         Coverage:              ${enable_code_coverage}
                CPPFLAGS:       ${CODE_COVERAGE_CPPFLAGS}
                CFLAGS:         ${CODE_COVERAGE_CFLAGS}
                LDFLAGS:        ${CODE_COVERAGE_LDFLAGS}
         Profiling:             ${enable_profile}
-        optimisation goal:     ${with_goal}
+        Optimisation goal:     ${with_goal}
         Private libs:          ${LIBS}
         Use abort():           ${enable_abort}
 
diff --git a/rules/templates/src-autoconf-proglib/Makefile.am 
b/rules/templates/src-autoconf-proglib/Makefile.am
index c5c27b0af..2f666eae2 100644
--- a/rules/templates/src-autoconf-proglib/Makefile.am
+++ b/rules/templates/src-autoconf-proglib/Makefile.am
@@ -27,10 +27,10 @@ EXTRA_DIST = \
        autogen.sh \
        m4/attributes.m4 \
        m4/ptx.m4 \
-       m4/ax_armv4_detection.m4 \
        m4/ax_armv5_detection.m4 \
        m4/ax_armv6_detection.m4 \
        m4/ax_armv7_detection.m4 \
+       m4/ax_armv8_detection.m4 \
        m4/ax_floating_point.m4 \
        m4/ax_code_coverage.m4 \
        m4/pkg.m4 \
diff --git a/rules/templates/src-autoconf-proglib/configure.ac 
b/rules/templates/src-autoconf-proglib/configure.ac
index cdbc182f1..ad873c9ca 100644
--- a/rules/templates/src-autoconf-proglib/configure.ac
+++ b/rules/templates/src-autoconf-proglib/configure.ac
@@ -17,6 +17,12 @@ AM_SILENT_RULES([yes])
 # If possible, enable extensions to Posix
 AC_USE_SYSTEM_EXTENSIONS
 
+# support LFS
+AC_SYS_LARGEFILE
+
+AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE([foreign no-exeext dist-xz silent-rules subdir-objects])
+
 #
 # libtool library versioning stuff
 #
@@ -31,17 +37,37 @@ AC_SUBST(LT_CURRENT)
 AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)
 
-AM_MAINTAINER_MODE
-AM_INIT_AUTOMAKE([foreign no-exeext dist-xz silent-rules subdir-objects])
-
 #
 # Checks for programs.
 #
-AC_PROG_CC
-AC_PROG_LIBTOOL
+AC_PROG_CC_C99
+
+#
+# TODO to only build the static library uncomment the following line
+# AC_DISABLE_SHARED([])
+# TODO to only build the shared library uncomment the following line
+# AC_DISABLE_STATIC([])
 
 LT_INIT
 
+#
+# Using additional preprocessor, compiler or linker flags:
+# - add them to AM_CPPFLAGS, AM_CFLAGS or AM_LDFLAGS if they should be used
+#   by all source files
+# - give the user a chance to setup her/his own flags with the CPPFLAGS, CFLAGS
+#   and LDFLAGS
+# - if some flags are specific to a file add the flags via the substitute macro
+#   into the Makefile
+#
+# Don't add the "-g" to the CFLAGS variable. It will be done automatically if
+# autoconf detects a GNU compiler.
+#
+
+#
+# Please note: 'configure' defaults the CFLAGS to "-O2 -g" if it detects a
+# GCC. If the user overwrites the CFLAGS externallly, there will be no default!
+# Keep the user informed about this behaviour.
+
 #
 # TODO Check here for mandadory external libraries
 #
@@ -60,7 +86,6 @@ LT_INIT
 # PKG_CHECK_MODULES returns *_CFLAGS and *_LIBS. Again, add the *_LIBS to the
 # global 'LIBS', but for the CFLAGS you can decide if you add them to the
 # CFLAGS, AM_CFLAGS or as substitution variables in the Makefile.am.
-#
 
 #REQUIRES_LIBSOMETHING="libsomething >= 20090402-1"
 #AC_SUBST(REQUIRES_LIBSOMETHING)
@@ -78,15 +103,65 @@ PTX_COMMON_CHECKS
 PTX_LIBRARY_CHECKS
 PTX_APPLICATION_CHECKS
 
-# be very silent on request
-AM_CONDITIONAL(BUILD_SILENTLY, test "x$AM_DEFAULT_VERBOSITY" = x0)
+# ---------------------------------------------------------------------------
+
+# TODO Checking if this CPU has a hardware floating point unit
+
+#AX_HARDWARE_FP([target_hardware_fp=yes], [target_hardware_fp=no])
+
+# When a hardware floating point unit seems available, then use it.
+# This will end in bad code on badly configured compilers which generates
+# floating point instructions even if the CPU has not hardware FP unit
+#
+#AS_IF([test x${target_hardware_fp} = "xyes"],
+#      [AC_MSG_NOTICE([FPU available])],
+#      [AC_MSG_NOTICE([FPU not available])])
+
+# ---------------------------------------------------------------------------
+
+# TODO discover on demand the special architecture this compiler builds code
+# for. This can be useful if the package provides some optimized code for
+# specific architectures.
+
+#AS_IF([test x${host_cpu} = "xarm"],
+#      [AX_DETECT_ARMV5([enable_arm5=yes], [enable_arm5=no])
+#      AX_DETECT_ARMV6([enable_arm6=yes], [enable_arm6=no])
+#      AX_DETECT_ARMV7([enable_arm7=yes], [enable_arm7=no])
+#      AX_DETECT_ARMV8([enable_arm8=yes], [enable_arm8=no])
+#
+#      AS_IF([test x${enable_arm4} = "xyes"], [AC_MSG_NOTICE([ARMv4 target])])
+#      AS_IF([test x${enable_arm5} = "xyes"], [AC_MSG_NOTICE([ARMv5 target])])
+#      AS_IF([test x${enable_arm6} = "xyes"], [AC_MSG_NOTICE([ARMv6 target])])
+#      AS_IF([test x${enable_arm7} = "xyes"], [AC_MSG_NOTICE([ARMv7 target])])
+#      AS_IF([test x${enable_arm8} = "xyes"], [AC_MSG_NOTICE([ARMv8 
target])])])
+
+# -------------------------- use all the settings ----------------------------
+
+# substitute the settings valid for all source files
+AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_CPPFLAGS)
+AC_SUBST(AM_LDFLAGS)
+
+# add private libs to the pkg-config file
+# 'private libs' are those required to link this library
+# its used later on if someone wants to link this library statically
+AC_SUBST(LIBS)
 
 # add required lib information to the pkg-config file (on demand)
 AC_SUBST(REQUIRES)
 
+# add lib information which may conflicts with this libarry
+AC_SUBST(CONFLICTS)
+
+# add special compile flags on demand
+AC_SUBST(PRIVATE_CFLAGS)
+
+# be very silent on request
+AM_CONDITIONAL(BUILD_SILENTLY, test "x$AM_DEFAULT_VERBOSITY" = x0)
+
 AC_CONFIG_FILES([
-       lib@name@.pc
        Makefile
+       lib@name@.pc
 ])
 AC_OUTPUT
 
@@ -107,11 +182,14 @@ AC_MSG_RESULT([
         Target CPU:            ${host_cpu}
         Target OS:             ${host_os}
 
-       Detected options:
+       User options:
        ------------------------------------------------------
-        CPPFLAGS:              ${CPPFLAGS}
         CFLAGS:                ${CFLAGS}
+        CPPFLAGS:              ${CPPFLAGS}
         LDFLAGS:               ${LDFLAGS}
+
+       Detected options:
+       ------------------------------------------------------
         Debug:                 ${enable_debug}
         Hidden symbols         ${enable_hide}
         Coverage:              ${enable_code_coverage}
diff --git a/rules/templates/template-m4-macros/attributes.m4 
b/rules/templates/template-m4-macros/attributes.m4
index 494584e7c..5ea0fd5e0 100644
--- a/rules/templates/template-m4-macros/attributes.m4
+++ b/rules/templates/template-m4-macros/attributes.m4
@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
     AS_TR_SH([cc_cv_ldflags_$1]),
     [ac_save_LDFLAGS="$LDFLAGS"
      LDFLAGS="$LDFLAGS $1"
-     AC_LINK_IFELSE(AC_LANG_SOURCE([int main(void); int main() { return 1; }]),
+     AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void); int main() { return 1; 
}])],
        [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
        [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
      LDFLAGS="$ac_save_LDFLAGS"
diff --git a/rules/templates/template-m4-macros/ax_armv7_detection.m4 
b/rules/templates/template-m4-macros/ax_armv7_detection.m4
index 70050ec2b..b598bf887 100644
--- a/rules/templates/template-m4-macros/ax_armv7_detection.m4
+++ b/rules/templates/template-m4-macros/ax_armv7_detection.m4
@@ -12,7 +12,7 @@
 #   --disable-armv7core.
 #   It works by detecting the compiler's macros __ARM_ARCH_7A__, 
__ARM_ARCH_7M__.
 #   These are set in  gcc compilers when they are configured to create code for
-#   ARMv6 cores.
+#   ARMv7 cores.
 #   This macro cannot detect the correct target's features if the compiler is
 #   not correctly configured to reflect the target's features.
 #
@@ -58,7 +58,7 @@ dnl
                [ax_armv7core=auto])
 
        AC_CACHE_CHECK([for ARMv7 target core], [ax_cv_armv7core],
-               [ax_cv_armv7core=${ax_armv6core}])
+               [ax_cv_armv7core=${ax_armv7core}])
 dnl    AC_MSG_RESULT([${ax_cv_armv7core}])
 
        if test "x${ax_cv_armv7core}" = "xauto"; then
@@ -71,7 +71,7 @@ dnl only for GCC we know it works in this way
                                [AC_LANG_PROGRAM([[]],
                                        [[
 #undef THIS_IS_V7
-#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7M__)
+#if __ARM_ARCH==7 || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7M__)
 # define THIS_IS_V7 1
 #endif
 int foo = THIS_IS_V7;
@@ -79,7 +79,7 @@ int foo = THIS_IS_V7;
                                ],
                                [ax_cv_armv7core=yes],
                                [ax_cv_armv7core=no],
-                               [ARMv6 core]); dnl AC_COMPILE_IFELSE
+                               [ARMv7 core]); dnl AC_COMPILE_IFELSE
                        AC_MSG_RESULT([${ax_cv_armv7core}]);
                fi
        fi
diff --git a/rules/templates/template-m4-macros/ax_armv4_detection.m4 
b/rules/templates/template-m4-macros/ax_armv8_detection.m4
similarity index 62%
rename from rules/templates/template-m4-macros/ax_armv4_detection.m4
rename to rules/templates/template-m4-macros/ax_armv8_detection.m4
index 05b6ae0de..2afb0ddb3 100644
--- a/rules/templates/template-m4-macros/ax_armv4_detection.m4
+++ b/rules/templates/template-m4-macros/ax_armv8_detection.m4
@@ -1,24 +1,24 @@
 #
 # SYNOPSIS
 #
-#   AX_DETECT_ARMV4([ACTION-IF-ARMv4],[ACTION-IF-NO-ARMv4])
+#   AX_DETECT_ARMV8([ACTION-IF-ARMv8],[ACTION-IF-NO-ARMv8])
 #
 # DESCRIPTION
 #
-#   AX_DETECT_ARMV4 detects from the compiler settings if the target is of
-#   type ARMv4. It is intended mostly for cross compiling to be able to collect
+#   AX_DETECT_ARMV8 detects from the compiler settings if the target is of
+#   type ARMv8. It is intended mostly for cross compiling to be able to collect
 #   more information about the target architecture and features. The user can
-#   overwrite the detection by using the option --enable-armv4core or
-#   --disable-armv4core.
-#   It works by detecting the compiler's macros __ARM_ARCH_4__ and
-#   __ARM_ARCH_4T__. These are set in gcc compilers when they are configured
-#   to create code for ARMv4 cores.
+#   overwrite the detection by using the option --enable-armv8core or
+#   --disable-armv8core.
+#   It works by detecting the compiler's macro __ARM_ARCH=8 and __ARM_ARCH_8A.
+#   These are set in gcc compilers when they are configured to create code for
+#   ARMv8 cores.
 #   This macro cannot detect the correct target's features if the compiler is
 #   not correctly configured to reflect the target's features.
 #
 # LICENSE
 #
-#   Copyright (c) 2012 Juergen Borleis <j...@pengutronix.de>
+#   Copyright (c) 2019 Juergen Borleis <j...@pengutronix.de>
 #
 #   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
@@ -46,45 +46,45 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-AC_DEFUN([AX_DETECT_ARMV4],
+AC_DEFUN([AX_DETECT_ARMV8],
        [AC_REQUIRE([AC_PROG_CC])
 dnl
 dnl Give the user the possibility to overwrite the auto detection
 dnl
-       AC_ARG_ENABLE([armv4core],
-               [AS_HELP_STRING([--enable-armv4core],
-                       [Enable optimizations for ARMv4 cores 
@<:@default=auto@:>@])],
-               [ax_armv4core="${enableval}"],
-               [ax_armv4core=auto])
+       AC_ARG_ENABLE([armv8core],
+               [AS_HELP_STRING([--enable-armv8core],
+                       [Enable optimizations for ARMv8 cores 
@<:@default=auto@:>@])],
+               [ax_armv8core="${enableval}"],
+               [ax_armv8core=auto])
 
-       AC_CACHE_CHECK([for ARMv4 target core], [ax_cv_armv4core],
-               [ax_cv_armv4core=${ax_armv4core}])
-dnl    AC_MSG_RESULT([${ax_cv_armv4core}])
+       AC_CACHE_CHECK([for ARMv8 target core], [ax_cv_armv8core],
+               [ax_cv_armv8core=${ax_armv8core}])
+dnl    AC_MSG_RESULT([${ax_cv_armv8core}])
 
-       if test "x${ax_cv_armv4core}" = "xauto"; then
+       if test "x${ax_cv_armv8core}" = "xauto"; then
                if test "x$GCC" != "xyes"; then
 dnl only for GCC we know it works in this way
                        AC_MSG_ERROR([Cannot autodetect the architecture for 
non GCC compilers])
                else
-                       AC_MSG_CHECKING(if target's core is of type ARMv4)
+                       AC_MSG_CHECKING(if target's core is of type ARMv8)
                        AC_COMPILE_IFELSE(
                                [AC_LANG_PROGRAM([[]],
                                        [[
-#undef THIS_IS_V4
-#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
-# define THIS_IS_V4 1
+#undef THIS_IS_V8
+#if __ARM_ARCH==8  || defined(__ARM_ARCH_8A__)
+# define THIS_IS_V8 1
 #endif
-int foo = THIS_IS_V4;
+int foo = THIS_IS_V8;
                                        ]]) dnl AC_LANG_PROGRAM
                                ],
-                               [ax_cv_armv4core=yes],
-                               [ax_cv_armv4core=no],
-                               [ARMv4 core]); dnl AC_COMPILE_IFELSE
-                       AC_MSG_RESULT([${ax_cv_armv4core}]);
+                               [ax_cv_armv8core=yes],
+                               [ax_cv_armv8core=no],
+                               [ARMv8 core]); dnl AC_COMPILE_IFELSE
+                       AC_MSG_RESULT([${ax_cv_armv8core}]);
                fi
        fi
 
-       case "x${ax_cv_armv4core}" in
+       case "x${ax_cv_armv8core}" in
        "xyes")
                $1
                ;;
@@ -92,7 +92,7 @@ int foo = THIS_IS_V4;
                $2
                ;;
        *)
-               AC_MSG_ERROR([Unknown setting for ARMv4 architecture: 
'${ax_cv_armv4core}'.])
+               AC_MSG_ERROR([Unknown setting for ARMv8 architecture: 
'${ax_cv_armv8core}'.])
                ;;
        esac
 ]) dnl AC_DEFUN
diff --git a/rules/templates/template-m4-macros/pkg.m4 
b/rules/templates/template-m4-macros/pkg.m4
index 4d42fdd58..13a889017 100644
--- a/rules/templates/template-m4-macros/pkg.m4
+++ b/rules/templates/template-m4-macros/pkg.m4
@@ -1,32 +1,64 @@
-# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-# serial 1 (pkg-config-0.24)
-#
-# Copyright © 2004 Scott James Remnant <sc...@netsplit.com>.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
+
+dnl Copyright © 2004 Scott James Remnant <sc...@netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.li...@gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running 
autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but 
]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
 AC_DEFUN([PKG_PROG_PKG_CONFIG],
 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search 
path])
@@ -44,18 +76,19 @@ if test -n "$PKG_CONFIG"; then
                PKG_CONFIG=""
        fi
 fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists.  Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-# only at the first occurence in configure.ac, so if the first place
-# it's called might be skipped (such as if it is within an "if", you
-# have to call PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
+])dnl PKG_PROG_PKG_CONFIG
+
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
 AC_DEFUN([PKG_CHECK_EXISTS],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 if test -n "$PKG_CONFIG" && \
@@ -65,22 +98,26 @@ m4_ifvaln([$3], [else
   $3])dnl
 fi])
 
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
 m4_define([_PKG_CONFIG],
 [if test -n "$$1"; then
     pkg_cv_[]$1="$$1"
  elif test -n "$PKG_CONFIG"; then
     PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes ],
                     [pkg_failed=yes])
  else
     pkg_failed=untried
 fi[]dnl
-])# _PKG_CONFIG
+])dnl _PKG_CONFIG
 
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -88,26 +125,24 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 else
         _pkg_short_errors_supported=no
 fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
-
-
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
+
+
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 AC_DEFUN([PKG_CHECK_MODULES],
 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
 pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
 
 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -117,13 +152,13 @@ and $1[]_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.])
 
 if test $pkg_failed = yes; then
-       AC_MSG_RESULT([no])
-       _PKG_SHORT_ERRORS_SUPPORTED
-       if test $_pkg_short_errors_supported = yes; then
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 
2>&1`
-       else
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
-       fi
+        AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors 
--cflags --libs "$2" 2>&1`
+        else
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs 
"$2" 2>&1`
+        fi
        # Put the nasty error message in config.log where it belongs
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
@@ -138,7 +173,7 @@ installed software in a non-standard prefix.
 _PKG_TEXT])[]dnl
         ])
 elif test $pkg_failed = untried; then
-       AC_MSG_RESULT([no])
+        AC_MSG_RESULT([no])
        m4_default([$4], [AC_MSG_FAILURE(
 [The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -147,11 +182,94 @@ path to pkg-config.
 _PKG_TEXT
 
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
-       ])
+        ])
 else
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
         AC_MSG_RESULT([yes])
        $3
 fi[]dnl
-])# PKG_CHECK_MODULES
+])dnl PKG_CHECK_MODULES
+
+
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_INSTALLDIR
+
+
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR
diff --git a/rules/templates/template-src-autoconf-make 
b/rules/templates/template-src-autoconf-make
index 034ea2eb3..57b32ce8c 100644
--- a/rules/templates/template-src-autoconf-make
+++ b/rules/templates/template-src-autoconf-make
@@ -79,30 +79,19 @@ $(STATEDIR)/@package@.targetinstall:
        @$(call install_fixup, @package@, PRIORITY, optional)
        @$(call install_fixup, @package@, SECTION, base)
        @$(call install_fixup, @package@, AUTHOR, "@AUTHOR@")
-       @$(call install_fixup, @package@, DESCRIPTION, missing)
-
-#      #
-#      # example code:; copy all libraries, links and binaries
-#      #
-
-       @for i in $(shell cd $(@PACKAGE@_PKGDIR) && find bin sbin usr/bin 
usr/sbin -type f); do \
-               $(call install_copy, @package@, 0, 0, 0755, -, /$$i); \
-       done
-       @for i in $(shell cd $(@PACKAGE@_PKGDIR) && find lib usr/lib -name 
"*.so*"); do \
-               $(call install_copy, @package@, 0, 0, 0644, -, /$$i); \
-       done
-       @links="$(shell cd $(@PACKAGE@_PKGDIR) && find lib usr/lib -type l)"; \
-       if [ -n "$$links" ]; then \
-               for i in $$links; do \
-                       from="`readlink $(@PACKAGE@_PKGDIR)/$$i`"; \
-                       to="/$$i"; \
-                       $(call install_link, @package@, $$from, $$to); \
-               done; \
-       fi
-
-#      #
-#      # FIXME: add all necessary things here
-#      #
+       @$(call install_fixup, @package@, DESCRIPTION, "TODO @package@")
+
+#      # This is an example only. Adapt it to your requirements. Read the
+#      # documentation's section "Make it Work" in chapter "Adding new 
Packages"
+#      # how to prepare this content or/and read chapter
+#      # "Rule File Macro Reference" to get an idea of the available macros
+#      # you can use here and how to use them.
+
+#      # install library (note: may fail, if there is no library)
+       @$(call install_lib, @package@, 0, 0, 0644, lib@package@)
+
+#      # install binary (note: may fail, if there is no binary)
+       @$(call install_copy, @package@, 0, 0, 0755, -, /usr/bin/@package@)
 
        @$(call install_finish, @package@)
 
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to