From aa7256a8125a19dfb21914559175446da405cb1e Mon Sep 17 00:00:00 2001 From: Carsten Schoenert Date: Wed, 27 Jul 2016 20:11:05 +0200 Subject: [PATCH] configure.ac: splitting ctags check into freebsd specific detection On FreeBSD the default ctags binary isn't usable for getting the tags from the header files, we need to take the binary exctags explicitly. Also before the check can be done we need to know on which platform we running. --- Makefile.am | 6 +++--- configure.ac | 43 +++++++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index d6892cdb..7763ce70 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am for libcoap # # Copyright (C) 2010-2015 Olaf Bergmann -# (C) 2015 Carsten Schoenert +# (C) 2015-2016 Carsten Schoenert # # This file is part of the CoAP C library libcoap. Please see README and # COPYING for terms of use. @@ -132,14 +132,14 @@ update-map-file: libcoap-$(LIBCOAP_API_VERSION).map libcoap-$(LIBCOAP_API_VERSIO libcoap-$(LIBCOAP_API_VERSION).map: check_ctags $(libcoap_include_HEADERS) ( echo "VER_$(LIBCOAP_API_VERSION) {" ; \ echo "global:" ; \ - ctags $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print " " $$1 ";" }' | sort ; \ + $(CTAGS_PROG) $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print " " $$1 ";" }' | sort ; \ echo "local:" ; \ echo " *;" ; \ echo "};" ) > $@.new mv $@.new $@ libcoap-$(LIBCOAP_API_VERSION).sym: check_ctags $(libcoap_include_HEADERS) - ( ctags $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print $$1 }' | sort ) \ + ( $(CTAGS_PROG) $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print $$1 }' | sort ) \ > $@.new mv $@.new $@ diff --git a/configure.ac b/configure.ac index e3f6dcb8..1253c26f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # configure.ac for the libcoap package # # Copyright (C) 2010-2015 Olaf Bergmann -# (C) 2015 Carsten Schoenert +# (C) 2015-2016 Carsten Schoenert # # Please run 'autogen.sh' to let autoconf produce a configure script. @@ -251,19 +251,38 @@ AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$build_examples" = "xyes"]) # end configure options ####################### -# Check for ctags -AC_ARG_VAR([CTAGS_PROG],[the 'ctag' program to use for make target 'update-map-file']) -AC_PATH_PROG([CTAGS_PROG],[ctags],[]) -if test "x$CTAGS_PROG" = "x"; then - AC_MSG_NOTICE([==> Note: 'ctags' command not found!]) +########################################## +# from configure options independed checks + +# Check for (ex)ctags binary +# The needed ctags binary name differs on FreeBSD and Linux, on Linux +# systems we search for 'ctags', on FreeBSD for 'exctags' +case $host in + # FreeBSD has exctags from the ctags port + *-freebsd1*) + AC_ARG_VAR([CTAGS_PROG],[the 'exctags' program to use for make target 'update-map-file']) + AC_PATH_PROG([CTAGS_PROG],[exctags],[HAVE_CTAGS=no]) + ;; + + *) + # Linux distributions have exuberant-ctags + AC_ARG_VAR([CTAGS_PROG],[the 'ctags' program to use for make target 'update-map-file']) + AC_PATH_PROG([CTAGS_PROG],[ctags],[HAVE_CTAGS=no]) + ;; + +esac + +if test "x$HAVE_CTAGS" = "xno"; then + AC_MSG_NOTICE([==> Note: '(ex)ctags' command not found!]) AC_MSG_WARN([==> Without ctags you will be unable to run the target 'update-map-file'!]) AC_MSG_WARN([==> This is no problem if you just want to build the library libcoap.]) -fi -if ! "$CTAGS_PROG" --c-kinds=f /dev/null &>/dev/null; then - AC_MSG_NOTICE([==> Note: your ctags does not support '--c-kinds'!]) - AC_MSG_NOTICE([==> Most likely, you are using the GNU Emacs ctag and not exuberant ctag]) - AC_MSG_WARN([==> This option is required for target 'update-map-file']) - AC_MSG_WARN([==> which is not a problem if you just want to build the library libcoap.]) +else + if test "`$CTAGS_PROG --help | grep '\---kinds'`" = ""; then + AC_MSG_NOTICE([==> Note: Your ctags binary does not support '--c-kinds'!]) + AC_MSG_NOTICE([==> Most likely, you are using the GNU Emacs ctag and not exuberant ctag.]) + AC_MSG_WARN([==> This option is required for the target 'update-map-file'.]) + AC_MSG_WARN([==> which is not a problem if you just want to build the library libcoap.]) + fi fi # Checks for header files.