Skip to content

Commit

Permalink
Git environment variables and compiler version macro improvements (#103)
Browse files Browse the repository at this point in the history
Closes #101 
Closes #102  

Signed-off-by: Mike Detwiler <mike@detwiler.io>
  • Loading branch information
detwiler authored Jan 7, 2021
1 parent c251dba commit cac829b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
11 changes: 7 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ AM_COND_IF([HAVE_WIN_PY3],

## conan ##

QH_REQUIRE_PROG([CLANG], [clang], [path to clang])
QH_CLANG_VERSION_MAJOR([CONAN_CLANG_VERSIONS], [clang version for conan])
QH_REQUIRE_PROG([GCC], [gcc], [path to gcc])
QH_GCC_VERSION_MAJOR([CONAN_GCC_VERSIONS], [gcc version for conan])
EC_COMPILER_C_VERSION_MAJOR([CONAN_CLANG_VERSIONS],
[clang version for conan],
[clang])
EC_COMPILER_C_VERSION_MAJOR([CONAN_GCC_VERSIONS],
[gcc version for conan],
[gcc])

QH_VAR_ENSURE([CONAN_USERNAME],
[User name required by conan-package-tools],
Expand Down Expand Up @@ -339,6 +341,7 @@ AC_CONFIG_FILES([Makefile
data/bash/common/bashrc.d/vi.sh
data/bash/common/profile.d/Makefile
data/bash/common/profile.d/conan.sh
data/bash/common/profile.d/git.sh
data/bash/common/profile.d/editor.sh
data/dircolors/Makefile
data/git/Makefile
Expand Down
1 change: 1 addition & 0 deletions data/bash/common/profile.d/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# generated data files
conan.sh
editor.sh
git.sh
go.sh
gnulib.sh
gvim.sh
Expand Down
2 changes: 1 addition & 1 deletion data/bash/common/profile.d/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ vim = vim.sh
# static data/scripts (not generated; require explicit distribution)
static_data = $(bash_completion) \
$(bash) \
$(git) \
$(gpg)

if HOST_OS_DARWIN
Expand All @@ -30,6 +29,7 @@ dist_profile_DATA = $(static_data)

# data/scripts generated by configure (source file automatically distributed)
conf_data = $(conan) \
$(git) \
$(editor)

if HAVE_GNULIB_SRCDIR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export GIT_AUTHOR_EMAIL='@GIT_AUTHOR_EMAIL@'
export GIT_AUTHOR_NAME='@GIT_AUTHOR_NAME@'
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
Expand Down
29 changes: 29 additions & 0 deletions m4/envconf.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# envconf.m4

# EC_COMPILER_C_VERSION_MAJOR(VARIABLE, DESCRIPTION, COMPILER)
# ----------------------------------------------------------
# Set VARIABLE to value of C COMPILER's major version number, and make it
# precious by passing to AC_ARG_VAR along with DESCRIPTION.
# Supported compilers: clang, gcc
AC_DEFUN([EC_COMPILER_C_VERSION_MAJOR],
[
AC_ARG_VAR([$1],[$2])
AC_MSG_CHECKING([if $1 is set])
AS_VAR_SET_IF([$1],
[AC_MSG_RESULT([$$1])],
[AC_MSG_RESULT([no])
AC_LANG_PUSH([C])
AS_VAR_COPY([_ec_cc], [CC])
AS_VAR_SET([CC], [$3])
AS_ECHO_N(['setting $1 to computed value... '])
AS_CASE([$3],
[gcc], [AC_COMPUTE_INT([$1], [__GNUC__])],
[clang], [AC_COMPUTE_INT([$1], [__clang_major__])],
[AC_MSG_ERROR([unsupported compiler: $3])])
AS_IF([test "x$$1" = x],
[AC_MSG_RESULT([empty])
AC_MSG_WARN([$1 set to empty value!])],
[AC_MSG_RESULT([$$1])])
AS_VAR_COPY([CC], [_ec_cc])
AC_LANG_POP([C])])
]) # EC_COMPILER_C_VERSION_MAJOR

0 comments on commit cac829b

Please sign in to comment.