From 184ba1b3d571e2402b509bfe806af71ecc6113c0 Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Thu, 11 Apr 2019 18:33:08 -0500 Subject: [PATCH] GNU-like handling of installation prefix et al. Details: - Changed the default installation prefix from $HOME/lib to /usr/local. - Modified the way configure internally handles the prefix, libdir, includedir, and sharedir (and also added an --exec-prefix option). The defaults to these variables are set as follows: prefix: /usr/local exec_prefix: ${prefix} libdir: ${exec_prefix}/lib includedir: ${prefix}/include sharedir: ${prefix}/share The key change, aside from the addition of exec_prefix and its use to define the default to libdir, is that the variables are substituted into config.mk with quoting that delays evaluation, meaning the substituted values may contain unevaluated references to other variables (namely, ${prefix} and ${exec_prefix}). This more closely follows GNU conventions, including those used by GNU autoconf, and also allows make to override any one of the variables *after* configure has already been run (e.g. during 'make install'). - Updates to build/config.mk.in pursuant to above changes. - Updates to output of 'configure --help' pursuant to above changes. - Updated docs/BuildSystem.md to reflect the new default installation prefix, as well as mention EXECPREFIX and SHAREDIR. - Changed the definitions of the UNINSTALL_OLD_* variables in the top-level Makefile to use $(wildcard ...) instead of 'find'. This was motivated by the new way of handling prefix and friends, which leads to the 'find' command being run on /usr/local (by default), which can take a while almost never yielding any benefit (since the user will very rarely use the uninstall-old targets). - Removed periods from the end of descriptive output statements (i.e., non-verbose output) since those statements often end with file or directory paths, which get confusing to read when puctuated by a period. - Trival change to 'make showconfig' output. - Removed my name from 'configure --help'. (Many have contributed to it over the years.) - In configure script, changed the default state of threading_model variable from 'no' to 'off' to match that of debug_type, where there are similarly more than two valid states. ('no' is still accepted if given via the --enable-debug= option, though it will be standardized to 'off' prior to config.mk being written out.) - Minor variable name change in flatten-headers.py that was intended for 32812ff. - CREDITS file update. --- CREDITS | 1 + Makefile | 110 +++++++++++++-------------- build/config.mk.in | 34 +++++++-- configure | 180 ++++++++++++++++++++++++-------------------- docs/BuildSystem.md | 12 +-- 5 files changed, 186 insertions(+), 151 deletions(-) diff --git a/CREDITS b/CREDITS index 634aced15..1b076816e 100644 --- a/CREDITS +++ b/CREDITS @@ -24,6 +24,7 @@ but many others have contributed code and feedback, including Krzysztof Drewniak @krzysz00 Marat Dukhan @Maratyszcza (Google) Victor Eijkhout @VictorEijkhout (Texas Advanced Computing Center) + Evgeny Epifanovsky @epifanovsky (Q-Chem) Isuru Fernando @isuruf Roman Gareev @gareevroman Richard Goldschmidt @SuperFluffy diff --git a/Makefile b/Makefile index 2d31feeb0..9cc81c9d1 100644 --- a/Makefile +++ b/Makefile @@ -385,23 +385,22 @@ ifeq ($(IS_CONFIGURED),yes) # named with three .so version numbers. UNINSTALL_OLD_LIBS := -UNINSTALL_OLD_LIBS += $(shell $(FIND) $(INSTALL_LIBDIR)/ -name "$(LIBBLIS_SO).?.?.?" 2> /dev/null | $(GREP) -v "$(LIBBLIS).$(LIBBLIS_SO_MMB_EXT)") +UNINSTALL_OLD_LIBS += $(filter-out $(INSTALL_LIBDIR)/$(LIBBLIS).$(LIBBLIS_SO_MMB_EXT),$(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS_SO).?.?.?)) # These shell commands gather the filepaths to any library symlink in the # current LIBDIR that might be left over from an old installation. We start # with symlinks named using the .so major version number. -UNINSTALL_OLD_SYML := $(shell $(FIND) $(INSTALL_LIBDIR)/ -name "$(LIBBLIS_SO).?" 2> /dev/null | $(GREP) -v "$(LIBBLIS_SO).$(SO_MAJOR)") +UNINSTALL_OLD_SYML := $(filter-out $(INSTALL_LIBDIR)/$(LIBBLIS_SO).$(SO_MAJOR),$(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS_SO).?)) # We also prepare to uninstall older-style symlinks whose names contain the # BLIS version number and configuration family. -UNINSTALL_OLD_SYML += $(shell $(FIND) $(INSTALL_LIBDIR)/ -name "$(LIBBLIS)-*.a" 2> /dev/null | $(GREP) -v "$(LIBBLIS)-$(VERS_CONF).a") - -UNINSTALL_OLD_SYML += $(shell $(FIND) $(INSTALL_LIBDIR)/ -name "$(LIBBLIS)-*.$(SHLIB_EXT)" 2> /dev/null | $(GREP) -v "$(LIBBLIS)-$(VERS_CONF).$(SHLIB_EXT)") +UNINSTALL_OLD_SYML += $(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS)-*.a) +UNINSTALL_OLD_SYML += $(wildcard $(INSTALL_LIBDIR)/$(LIBBLIS)-*.$(SHLIB_EXT)) # This shell command grabs all files named "*.h" that are not blis.h or cblas.h # in the installation directory. We consider this set of headers to be "old" and # eligible for removal upon running of the uninstall-old-headers target. -UNINSTALL_OLD_HEADERS := $(shell $(FIND) $(INSTALL_INCDIR)/blis/ -name "*.h" 2> /dev/null | $(GREP) -v "$(BLIS_H)" | $(GREP) -v "$(CBLAS_H)") +UNINSTALL_OLD_HEADERS := $(filter-out $(BLIS_H),$(filter-out $(CBLAS_H),$(wildcard $(INSTALL_INCDIR)/blis/*.h))) endif # IS_CONFIGURED @@ -1020,23 +1019,24 @@ endif # ifeq ($(IS_WIN),no) # --- Query current configuration --- showconfig: check-env - @echo "configuration family: $(CONFIG_NAME)" - @echo "sub-configurations: $(CONFIG_LIST)" - @echo "requisite kernels: $(KERNEL_LIST)" - @echo "kernel-to-config map: $(KCONFIG_MAP)" - @echo "-----------------------" - @echo "BLIS version string: $(VERSION)" - @echo ".so major version: $(SO_MAJOR)" - @echo ".so minor.build vers: $(SO_MINORB)" - @echo "install libdir: $(INSTALL_LIBDIR)" - @echo "install includedir: $(INSTALL_INCDIR)" - @echo "debugging status: $(DEBUG_TYPE)" - @echo "multithreading status: $(THREADING_MODEL)" - @echo "enable BLAS API? $(MK_ENABLE_BLAS)" - @echo "enable CBLAS API? $(MK_ENABLE_CBLAS)" - @echo "build static library? $(MK_ENABLE_STATIC)" - @echo "build shared library? $(MK_ENABLE_SHARED)" - @echo "ARG_MAX hack enabled? $(ARG_MAX_HACK)" + @echo "configuration family: $(CONFIG_NAME)" + @echo "sub-configurations: $(CONFIG_LIST)" + @echo "requisite kernels sets: $(KERNEL_LIST)" + @echo "kernel-to-config map: $(KCONFIG_MAP)" + @echo "-------------------------" + @echo "BLIS version string: $(VERSION)" + @echo ".so major version: $(SO_MAJOR)" + @echo ".so minor.build vers: $(SO_MINORB)" + @echo "install libdir: $(INSTALL_LIBDIR)" + @echo "install includedir: $(INSTALL_INCDIR)" + @echo "install sharedir: $(INSTALL_SHAREDIR)" + @echo "debugging status: $(DEBUG_TYPE)" + @echo "multithreading status: $(THREADING_MODEL)" + @echo "enable BLAS API? $(MK_ENABLE_BLAS)" + @echo "enable CBLAS API? $(MK_ENABLE_CBLAS)" + @echo "build static library? $(MK_ENABLE_STATIC)" + @echo "build shared library? $(MK_ENABLE_SHARED)" + @echo "ARG_MAX hack enabled? $(ARG_MAX_HACK)" # --- Clean rules --- @@ -1052,16 +1052,16 @@ ifneq ($(SANDBOX),) - $(FIND) $(SANDBOX_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F) endif else - @echo "Removing makefile fragments from $(CONFIG_FRAG_PATH)." + @echo "Removing makefile fragments from $(CONFIG_FRAG_PATH)" @- $(FIND) $(CONFIG_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F) - @echo "Removing makefile fragments from $(FRAME_FRAG_PATH)." + @echo "Removing makefile fragments from $(FRAME_FRAG_PATH)" @- $(FIND) $(FRAME_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F) - @echo "Removing makefile fragments from $(REFKERN_FRAG_PATH)." + @echo "Removing makefile fragments from $(REFKERN_FRAG_PATH)" @- $(FIND) $(REFKERN_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F) - @echo "Removing makefile fragments from $(KERNELS_FRAG_PATH)." + @echo "Removing makefile fragments from $(KERNELS_FRAG_PATH)" @- $(FIND) $(KERNELS_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F) ifneq ($(SANDBOX),) - @echo "Removing makefile fragments from $(SANDBOX_FRAG_PATH)." + @echo "Removing makefile fragments from $(SANDBOX_FRAG_PATH)" @- $(FIND) $(SANDBOX_FRAG_PATH) -name "$(FRAGMENT_MK)" | $(XARGS) $(RM_F) endif endif @@ -1073,7 +1073,7 @@ ifeq ($(ENABLE_VERBOSE),yes) $(RM_F) $(BLIS_H_FLAT) $(RM_F) $(CBLAS_H_FLAT) else - @echo "Removing flattened header files from $(BASE_INC_PATH)." + @echo "Removing flattened header files from $(BASE_INC_PATH)" @$(RM_F) $(BLIS_H_FLAT) @$(RM_F) $(CBLAS_H_FLAT) endif @@ -1086,9 +1086,9 @@ ifeq ($(ENABLE_VERBOSE),yes) - $(RM_F) $(LIBBLIS_A_PATH) - $(RM_F) $(LIBBLIS_SO_PATH) else - @echo "Removing object files from $(BASE_OBJ_PATH)." + @echo "Removing object files from $(BASE_OBJ_PATH)" @- $(FIND) $(BASE_OBJ_PATH) -name "*.o" | $(XARGS) $(RM_F) - @echo "Removing libraries from $(BASE_LIB_PATH)." + @echo "Removing libraries from $(BASE_LIB_PATH)" @- $(RM_F) $(LIBBLIS_A_PATH) @- $(RM_F) $(LIBBLIS_SO_PATH) endif @@ -1110,13 +1110,13 @@ ifeq ($(ENABLE_VERBOSE),yes) - $(RM_F) $(BLASTEST_DRV_BIN_PATHS) - $(RM_F) $(addprefix out.,$(BLASTEST_DRV_BASES)) else - @echo "Removing object files from $(BASE_OBJ_BLASTEST_PATH)." + @echo "Removing object files from $(BASE_OBJ_BLASTEST_PATH)" @- $(RM_F) $(BLASTEST_F2C_OBJS) $(BLASTEST_DRV_OBJS) - @echo "Removing libf2c.a from $(BASE_OBJ_BLASTEST_PATH)." + @echo "Removing libf2c.a from $(BASE_OBJ_BLASTEST_PATH)" @- $(RM_F) $(BLASTEST_F2C_LIB) - @echo "Removing binaries from $(BASE_OBJ_BLASTEST_PATH)." + @echo "Removing binaries from $(BASE_OBJ_BLASTEST_PATH)" @- $(RM_F) $(BLASTEST_DRV_BIN_PATHS) - @echo "Removing driver output files 'out.*'." + @echo "Removing driver output files 'out.*'" @- $(RM_F) $(addprefix out.,$(BLASTEST_DRV_BASES)) endif # ENABLE_VERBOSE endif # IS_CONFIGURED @@ -1129,13 +1129,13 @@ ifeq ($(ENABLE_VERBOSE),yes) - $(RM_F) $(BLASTEST_DIR)/$(BLASTEST_F2C_LIB_NAME) - $(RM_F) $(addprefix $(BLASTEST_DIR)/out.,$(BLASTEST_DRV_BASES)) else - @echo "Removing object files from ./$(BLASTEST_DIR)/$(OBJ_DIR)." + @echo "Removing object files from ./$(BLASTEST_DIR)/$(OBJ_DIR)" @- $(FIND) $(BLASTEST_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F) - @echo "Removing libf2c.a from ./$(BLASTEST_DIR)." + @echo "Removing libf2c.a from ./$(BLASTEST_DIR)" @- $(RM_F) $(BLASTEST_DIR)/$(BLASTEST_F2C_LIB_NAME) - @echo "Removing binaries from ./$(BLASTEST_DIR)." + @echo "Removing binaries from ./$(BLASTEST_DIR)" @- $(FIND) $(BLASTEST_DIR) -name "*.x" | $(XARGS) $(RM_F) - @echo "Removing driver output files 'out.*' from ./$(BLASTEST_DIR)." + @echo "Removing driver output files 'out.*' from ./$(BLASTEST_DIR)" @- $(RM_F) $(addprefix $(BLASTEST_DIR)/out.,$(BLASTEST_DRV_BASES)) endif # ENABLE_VERBOSE endif # IS_CONFIGURED @@ -1153,11 +1153,11 @@ ifeq ($(ENABLE_VERBOSE),yes) - $(RM_F) $(TESTSUITE_BIN) - $(RM_F) $(TESTSUITE_OUT_FILE) else - @echo "Removing object files from $(BASE_OBJ_TESTSUITE_PATH)." + @echo "Removing object files from $(BASE_OBJ_TESTSUITE_PATH)" @- $(RM_F) $(MK_TESTSUITE_OBJS) - @echo "Removing binary $(TESTSUITE_BIN)." + @echo "Removing binary $(TESTSUITE_BIN)" @- $(RM_F) $(TESTSUITE_BIN) - @echo "Removing $(TESTSUITE_OUT_FILE)." + @echo "Removing $(TESTSUITE_OUT_FILE)" @- $(RM_F) $(TESTSUITE_OUT_FILE) endif # ENABLE_VERBOSE endif # IS_CONFIGURED @@ -1168,9 +1168,9 @@ ifeq ($(ENABLE_VERBOSE),yes) - $(FIND) $(TESTSUITE_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F) - $(RM_F) $(TESTSUITE_DIR)/$(TESTSUITE_BIN) else - @echo "Removing object files from $(TESTSUITE_DIR)/$(OBJ_DIR)." + @echo "Removing object files from $(TESTSUITE_DIR)/$(OBJ_DIR)" @- $(FIND) $(TESTSUITE_DIR)/$(OBJ_DIR) -name "*.o" | $(XARGS) $(RM_F) - @echo "Removing binary $(TESTSUITE_DIR)/$(TESTSUITE_BIN)." + @echo "Removing binary $(TESTSUITE_DIR)/$(TESTSUITE_BIN)" @- $(RM_F) $(TESTSUITE_DIR)/$(TESTSUITE_BIN) endif # ENABLE_VERBOSE endif # IS_CONFIGURED @@ -1184,15 +1184,15 @@ ifeq ($(ENABLE_VERBOSE),yes) - $(RM_RF) $(LIB_DIR) - $(RM_RF) $(INCLUDE_DIR) else - @echo "Removing $(BLIS_CONFIG_H)." + @echo "Removing $(BLIS_CONFIG_H)" @$(RM_F) $(BLIS_CONFIG_H) - @echo "Removing $(CONFIG_MK_FILE)." + @echo "Removing $(CONFIG_MK_FILE)" @- $(RM_F) $(CONFIG_MK_FILE) - @echo "Removing $(OBJ_DIR)." + @echo "Removing $(OBJ_DIR)" @- $(RM_RF) $(OBJ_DIR) - @echo "Removing $(LIB_DIR)." + @echo "Removing $(LIB_DIR)" @- $(RM_RF) $(LIB_DIR) - @echo "Removing $(INCLUDE_DIR)." + @echo "Removing $(INCLUDE_DIR)" @- $(RM_RF) $(INCLUDE_DIR) endif endif @@ -1201,7 +1201,7 @@ endif # --- CHANGELOG rules --- changelog: - @echo "Updating '$(DIST_PATH)/$(CHANGELOG)' via '$(GIT_LOG)'." + @echo "Updating '$(DIST_PATH)/$(CHANGELOG)' via '$(GIT_LOG)'" @$(GIT_LOG) > $(DIST_PATH)/$(CHANGELOG) @@ -1216,7 +1216,7 @@ uninstall-libs: check-env ifeq ($(ENABLE_VERBOSE),yes) - $(RM_F) $(MK_LIBS_INST) else - @echo "Uninstalling libraries $(notdir $(MK_LIBS_INST)) from $(dir $(firstword $(MK_LIBS_INST)))." + @echo "Uninstalling libraries $(notdir $(MK_LIBS_INST)) from $(dir $(firstword $(MK_LIBS_INST)))" @- $(RM_F) $(MK_LIBS_INST) endif @@ -1224,7 +1224,7 @@ uninstall-lib-symlinks: check-env ifeq ($(ENABLE_VERBOSE),yes) - $(RM_F) $(MK_LIBS_SYML) else - @echo "Uninstalling symlinks $(notdir $(MK_LIBS_SYML)) from $(dir $(firstword $(MK_LIBS_SYML)))." + @echo "Uninstalling symlinks $(notdir $(MK_LIBS_SYML)) from $(dir $(firstword $(MK_LIBS_SYML)))" @- $(RM_F) $(MK_LIBS_SYML) endif @@ -1232,7 +1232,7 @@ uninstall-headers: check-env ifeq ($(ENABLE_VERBOSE),yes) - $(RM_RF) $(MK_INCL_DIR_INST) else - @echo "Uninstalling directory '$(notdir $(MK_INCL_DIR_INST))' from $(dir $(MK_INCL_DIR_INST))." + @echo "Uninstalling directory '$(notdir $(MK_INCL_DIR_INST))' from $(dir $(MK_INCL_DIR_INST))" @- $(RM_RF) $(MK_INCL_DIR_INST) endif @@ -1240,7 +1240,7 @@ uninstall-share: check-env ifeq ($(ENABLE_VERBOSE),yes) - $(RM_RF) $(MK_SHARE_DIR_INST) else - @echo "Uninstalling directory '$(notdir $(MK_SHARE_DIR_INST))' from $(dir $(MK_SHARE_DIR_INST))." + @echo "Uninstalling directory '$(notdir $(MK_SHARE_DIR_INST))' from $(dir $(MK_SHARE_DIR_INST))" @- $(RM_RF) $(MK_SHARE_DIR_INST) endif @@ -1256,7 +1256,7 @@ $(UNINSTALL_OLD_LIBS) $(UNINSTALL_OLD_SYML) $(UNINSTALL_OLD_HEADERS): check-env ifeq ($(ENABLE_VERBOSE),yes) - $(RM_F) $@ else - @echo "Uninstalling $(@F) from $(@D)/." + @echo "Uninstalling $(@F) from $(@D)/" @- $(RM_F) $@ endif diff --git a/build/config.mk.in b/build/config.mk.in index 15704422d..0516ec97b 100644 --- a/build/config.mk.in +++ b/build/config.mk.in @@ -115,13 +115,33 @@ THREADING_MODEL := @threading_model@ # Whether the compiler supports "#pragma omp simd" via the -fopenmp-simd option. PRAGMA_OMP_SIMD := @pragma_omp_simd@ -# The install libdir, includedir, and shareddir values from configure tell -# us where to install the libraries, header files, and public makefile -# fragments, respectively. Notice that we support the use of DESTDIR so that -# advanced users may install to a temporary location. -INSTALL_LIBDIR := $(DESTDIR)@install_libdir@ -INSTALL_INCDIR := $(DESTDIR)@install_incdir@ -INSTALL_SHAREDIR := $(DESTDIR)@install_sharedir@ +# The installation prefix, exec_prefix, libdir, includedir, and shareddir +# values from configure tell us where to install the libraries, header files, +# and public makefile fragments. We must first assign each substituted +# @anchor@ to its own variable. Why? Because the subsitutions may contain +# unevaluated variable expressions. For example, '@libdir@' may be replaced +# with '${exec_prefix}/lib'. By assigning the anchors to variables first, and +# then assigning them to their final INSTALL_* variables, we allow prefix and +# exec_prefix to be used in the definitions of exec_prefix, libdir, +# includedir, and sharedir. +prefix := @prefix@ +exec_prefix := @exec_prefix@ +libdir := @libdir@ +includedir := @includedir@ +sharedir := @sharedir@ + +# Notice that we support the use of DESTDIR so that advanced users may install +# to a temporary location. +INSTALL_LIBDIR := $(DESTDIR)$(libdir) +INSTALL_INCDIR := $(DESTDIR)$(includedir) +INSTALL_SHAREDIR := $(DESTDIR)$(sharedir) + +#$(info prefix = $(prefix) ) +#$(info exec_prefix = $(exec_prefix) ) +#$(info libdir = $(libdir) ) +#$(info includedir = $(includedir) ) +#$(info sharedir = $(sharedir) ) +#$(error .) # Whether to output verbose command-line feedback as the Makefile is # processed. diff --git a/configure b/configure index dfdb7975c..778679aec 100755 --- a/configure +++ b/configure @@ -51,8 +51,6 @@ print_usage() #echo " " #echo " BLIS ${version}" echo " " - echo " Field G. Van Zee" - echo " " echo " Configure BLIS's build system for compilation using a specified" echo " configuration directory." echo " " @@ -72,30 +70,37 @@ print_usage() echo " " echo " -p PREFIX, --prefix=PREFIX" echo " " - echo " The path to which make will install all build products." - echo " If given, this option implies the following options:" - echo " --libdir=PREFIX/lib" - echo " --incdir=PREFIX/include" + echo " The common installation prefix for all files. If given," + echo " this option effectively implies:" + echo " --libdir=EXECPREFIX/lib" + echo " --includedir=PREFIX/include" echo " --sharedir=PREFIX/share" - echo " If not given, PREFIX defaults to \$(HOME)/blis. If PREFIX" + echo " where EXECPREFIX defaults to PREFIX. If this option is" + echo " not given, PREFIX defaults to '${prefix_def}'. If PREFIX" echo " refers to a directory that does not exist, it will be" echo " created." echo " " + echo " --exec-prefix=EXECPREFIX" + echo " " + echo " The installation prefix for libraries. Specifically, if" + echo " given, this option effectively implies:" + echo " --libdir=EXECPREFIX/lib" + echo " If not given, EXECPREFIX defaults to PREFIX, which may be" + echo " modified by the --prefix option. If EXECPREFIX refers to" + echo " a directory that does not exist, it will be created." + echo " " echo " --libdir=LIBDIR" echo " " - echo " The path to which make will install libraries. If given," - echo " LIBDIR will override the corresponding directory implied" - echo " by --prefix; if not not given, LIBDIR defaults to" - echo " PREFIX/lib. If LIBDIR refers to a directory that does" - echo " not exist, it will be created." + echo " The path to which make will install libraries. If not" + echo " given, LIBDIR defaults to PREFIX/lib. If LIBDIR refers to" + echo " a directory that does not exist, it will be created." echo " " echo " --includedir=INCDIR" echo " " echo " The path to which make will install development header" - echo " files. If given, INCDIR will override the corresponding" - echo " directory implied by --prefix; if not given, INCDIR" - echo " defaults to PREFIX/include. If INCDIR refers to a" - echo " directory that does not exist, it will be created." + echo " files. If not given, INCDIR defaults to PREFIX/include." + echo " If INCDIR refers to a directory that does not exist, it" + echo " will be created." echo " " echo " --sharedir=SHAREDIR" echo " " @@ -104,11 +109,9 @@ print_usage() echo " and LDFLAGS). These files allow certain BLIS makefiles," echo " such as those in the examples or testsuite directories, to" echo " operate on an installed copy of BLIS rather than a local" - echo " (and possibly uninstalled) copy. If given, SHAREDIR will" - echo " override the corresponding directory implied by --prefix;" - echo " if not given, SHAREDIR defaults to PREFIX/share. If" - echo " SHAREDIR refers to a directory that does not exist, it" - echo " will be created." + echo " (and possibly uninstalled) copy. If not given, SHAREDIR" + echo " defaults to PREFIX/share. If SHAREDIR refers to a" + echo " directory that does not exist, it will be created." echo " " echo " --enable-verbose-make, --disable-verbose-make" echo " " @@ -1762,21 +1765,33 @@ main() # -- configure options -- - # The user-given install prefix and a flag indicating it was given. - #install_prefix_def="${HOME}/blis" - install_prefix_user=${HOME}/blis # default to this directory. + # Define the default prefix so that the print_usage() function can + # output it in the --help text. + prefix_def='/usr/local' + + # The installation prefix, assigned its default value, and a flag to + # track whether or not it was given by the user. + prefix=${prefix_def} prefix_flag='' - # The user-given install libdir and a flag indicating it was given. - install_libdir_user='' + # The installation exec_prefix, assigned its default value, and a flag to + # track whether or not it was given by the user. + exec_prefix='${prefix}' + exec_prefix_flag='' + + # The installation libdir, assigned its default value, and a flag to + # track whether or not it was given by the user. + libdir='${exec_prefix}/lib' libdir_flag='' - # The user-given install includedir and a flag indicating it was given. - install_incdir_user='' - incdir_flag='' + # The installation includedir, assigned its default value, and a flag to + # track whether or not it was given by the user. + includedir='${prefix}/include' + includedir_flag='' - # The user-given install sharedir and a flag indicating it was given. - install_sharedir_user='' + # The installation sharedir, assigned its default value, and a flag to + # track whether or not it was given by the user. + sharedir='${prefix}/share' sharedir_flag='' # The preset value of CFLAGS and LDFLAGS (ie: compiler and linker flags @@ -1789,7 +1804,7 @@ main() debug_flag='' # The threading flag. - threading_model='no' + threading_model='off' # The method of assigning micropanels to threads in the JR and JR loops. thread_part_jrir='slab' @@ -1865,19 +1880,23 @@ main() ;; prefix=*) prefix_flag=1 - install_prefix_user=${OPTARG#*=} + prefix=${OPTARG#*=} + ;; + exec-prefix=*) + exec_prefix_flag=1 + exec_prefix=${OPTARG#*=} ;; libdir=*) libdir_flag=1 - install_libdir_user=${OPTARG#*=} + libdir=${OPTARG#*=} ;; includedir=*) - incdir_flag=1 - install_incdir_user=${OPTARG#*=} + includedir_flag=1 + includedir=${OPTARG#*=} ;; sharedir=*) sharedir_flag=1 - install_sharedir_user=${OPTARG#*=} + sharedir=${OPTARG#*=} ;; enable-debug) debug_flag=1 @@ -1920,12 +1939,12 @@ main() enable-threading=*) threading_model=${OPTARG#*=} ;; + disable-threading) + threading_model='off' + ;; thread-part-jrir=*) thread_part_jrir=${OPTARG#*=} ;; - disable-threading) - threading_model='no' - ;; enable-pba-pools) enable_pba_pools='yes' ;; @@ -2002,7 +2021,7 @@ main() ;; p) prefix_flag=1 - install_prefix_user=$OPTARG + prefix=$OPTARG ;; d) debug_flag=1 @@ -2497,54 +2516,49 @@ main() # -- Prepare variables for subsitution into template files ----------------- - # Parse the status of the install prefix and echo feedback. + # Parse the status of the prefix option and echo feedback. if [ -n "${prefix_flag}" ]; then - echo "${script_name}: detected --prefix='${install_prefix_user}'." + echo "${script_name}: detected --prefix='${prefix}'." else - echo "${script_name}: no install prefix option given; defaulting to '${install_prefix_user}'." + echo "${script_name}: no install prefix option given; defaulting to '${prefix}'." fi - # Set initial (candidate) values for the libdir and includedir using the - # install prefix that was determined above. - install_libdir=${install_prefix_user}/lib - install_incdir=${install_prefix_user}/include - install_sharedir=${install_prefix_user}/share + # Parse the status of the exec_prefix option and echo feedback. + if [ -n "${exec_prefix_flag}" ]; then + echo "${script_name}: detected --exec-prefix='${exec_prefix}'." + else + echo "${script_name}: no install exec_prefix option given; defaulting to PREFIX." + fi - # Set the install libdir, if it was specified. Note that this will override - # the default libdir implied by the install prefix, even if both options - # were given. + # Parse the status of the libdir option and echo feedback. if [ -n "${libdir_flag}" ]; then - echo "${script_name}: detected --libdir='${install_libdir_user}'." - install_libdir=${install_libdir_user} + echo "${script_name}: detected --libdir='${libdir}'." else - echo "${script_name}: no install libdir option given; defaulting to PREFIX/lib." + echo "${script_name}: no install libdir option given; defaulting to EXECPREFIX/lib." fi - # Set the install includedir, if it was specified. Note that this will - # override the default includedir implied by the install prefix, even if - # both options were given. - if [ -n "${incdir_flag}" ]; then - echo "${script_name}: detected --includedir='${install_incdir_user}'." - install_incdir=${install_incdir_user} + # Parse the status of the includedir option and echo feedback. + if [ -n "${includedir_flag}" ]; then + echo "${script_name}: detected --includedir='${includedir}'." else echo "${script_name}: no install includedir option given; defaulting to PREFIX/include." fi - # Set the install sharedir, if it was specified. Note that this will - # override the default sharedir implied by the install prefix, even if - # both options were given. + # Parse the status of the sharedir option and echo feedback. if [ -n "${sharedir_flag}" ]; then - echo "${script_name}: detected --sharedir='${install_sharedir_user}'." - install_sharedir=${install_sharedir_user} + echo "${script_name}: detected --sharedir='${sharedir}'." else echo "${script_name}: no install sharedir option given; defaulting to PREFIX/share." fi # Echo the installation directories that we settled on. echo "${script_name}: final installation directories:" - echo "${script_name}: libdir: ${install_libdir}" - echo "${script_name}: includedir: ${install_incdir}" - echo "${script_name}: sharedir: ${install_sharedir}" + echo "${script_name}: prefix: "${prefix} + echo "${script_name}: exec_prefix: "${exec_prefix} + echo "${script_name}: libdir: "${libdir} + echo "${script_name}: includedir: "${includedir} + echo "${script_name}: sharedir: "${sharedir} + echo "${script_name}: NOTE: the variables above can be overridden when running make." # Check if CFLAGS is non-empty. if [ -n "${CFLAGS}" ]; then @@ -2649,9 +2663,11 @@ main() enable_pthreads='yes' enable_pthreads_01=1 threading_model="pthreads" # Standardize the value. - elif [ "x${threading_model}" = "xno" ] || + elif [ "x${threading_model}" = "xoff" ] || + [ "x${threading_model}" = "xno" ] || [ "x${threading_model}" = "xnone" ]; then echo "${script_name}: threading is disabled." + threading_model="off" else echo "${script_name}: *** Unsupported threading model: ${threading_model}." exit 1 @@ -2813,13 +2829,15 @@ main() # Variables that may contain forward slashes, such as paths, need extra # escaping when used in sed commands. We insert those extra escape # characters here so that the sed commands below do the right thing. - os_name_esc=$(echo "${os_name}" | sed 's/\//\\\//g') - install_libdir_esc=$(echo "${install_libdir}" | sed 's/\//\\\//g') - install_incdir_esc=$(echo "${install_incdir}" | sed 's/\//\\\//g') - install_sharedir_esc=$(echo "${install_sharedir}" | sed 's/\//\\\//g') - dist_path_esc=$(echo "${dist_path}" | sed 's/\//\\\//g') - cc_esc=$(echo "${found_cc}" | sed 's/\//\\\//g') - cxx_esc=$(echo "${found_cxx}" | sed 's/\//\\\//g') + os_name_esc=$(echo "${os_name}" | sed 's/\//\\\//g') + prefix_esc=$(echo "${prefix}" | sed 's/\//\\\//g') + exec_prefix_esc=$(echo "${exec_prefix}" | sed 's/\//\\\//g') + libdir_esc=$(echo "${libdir}" | sed 's/\//\\\//g') + includedir_esc=$(echo "${includedir}" | sed 's/\//\\\//g') + sharedir_esc=$(echo "${sharedir}" | sed 's/\//\\\//g') + dist_path_esc=$(echo "${dist_path}" | sed 's/\//\\\//g') + cc_esc=$(echo "${found_cc}" | sed 's/\//\\\//g') + cxx_esc=$(echo "${found_cxx}" | sed 's/\//\\\//g') #sandbox_relpath_esc=$(echo "${sandbox_relpath}" | sed 's/\//\\\//g') # For RANLIB, if the variable is not set, we use a default value of @@ -2926,9 +2944,11 @@ main() | sed -e "s/@ldflags_preset@/${ldflags_preset_esc}/g" \ | sed -e "s/@debug_type@/${debug_type}/g" \ | sed -e "s/@threading_model@/${threading_model}/g" \ - | sed -e "s/@install_libdir@/${install_libdir_esc}/g" \ - | sed -e "s/@install_incdir@/${install_incdir_esc}/g" \ - | sed -e "s/@install_sharedir@/${install_sharedir_esc}/g" \ + | sed -e "s/@prefix@/${prefix_esc}/g" \ + | sed -e "s/@exec_prefix@/${exec_prefix_esc}/g" \ + | sed -e "s/@libdir@/${libdir_esc}/g" \ + | sed -e "s/@includedir@/${includedir_esc}/g" \ + | sed -e "s/@sharedir@/${sharedir_esc}/g" \ | sed -e "s/@enable_verbose@/${enable_verbose}/g" \ | sed -e "s/@configured_oot@/${configured_oot}/g" \ | sed -e "s/@enable_arg_max_hack@/${enable_arg_max_hack}/g" \ diff --git a/docs/BuildSystem.md b/docs/BuildSystem.md index 9d1730bf4..28137d8b3 100644 --- a/docs/BuildSystem.md +++ b/docs/BuildSystem.md @@ -90,7 +90,7 @@ However, as of this writing, only a limited number of architectures are detected Upon running configure, you will get output similar to the following. The exact output will depend on whether you cloned BLIS from a `git` repository or whether you obtained BLIS via a downloadable tarball from the [releases](https://github.com/flame/blis/releases) page. ``` -$ ./configure haswell +$ ./configure --prefix=$HOME/blis haswell configure: using 'gcc' compiler. configure: found gcc version 5.4.0 (maj: 5, min: 4, rev: 0). configure: checking for blacklisted configurations due to gcc 5.4.0. @@ -169,17 +169,11 @@ The installation prefix can be specified via the `--prefix=PREFIX` option: ``` $ ./configure --prefix=/usr ``` -This will cause libraries to eventually be installed (via `make install`) to `PREFIX/lib` and development headers to be installed to `PREFIX/include`. (The default value of `PREFIX` is `$(HOME)/blis`.) You can also specify the library install directory separately from the development header install directory with the `--libdir=LIBDIR` and `--includedir=INCDIR` options, respectively: +This will cause libraries to eventually be installed (via `make install`) to `PREFIX/lib` and development headers to be installed to `PREFIX/include`. (The default value of `PREFIX` is `/usr/local`.) You can also specify the library install directory separately from the development header install directory with the `--libdir=LIBDIR` and `--includedir=INCDIR` options, respectively: ``` $ ./configure --libdir=/usr/lib --includedir=/usr/include ``` -The `--libdir=LIBDIR` and `--includedir=INCDIR` options will override any `PREFIX` path, whether it was specified explicitly via `--prefix` or implicitly (via the default). That is, `LIBDIR` defaults to `PREFIX/lib` and `INCDIR` defaults to `PREFIX/include`, but each will be overriden by their respective `--libdir`/`--includedir` options. So, -``` -$ ./configure --libdir=/usr/lib - -``` -will configure BLIS to install libraries to `/usr/lib` and header files to the default location (`$HOME/blis/include`). -Also, note that `configure` will create any installation directories that do not already exist. +The `--libdir=LIBDIR` and `--includedir=INCDIR` options will override any path implied by `PREFIX`, whether it was specified explicitly via `--prefix` or implicitly (via the default). That is, `LIBDIR` defaults to `EXECPREFIX/lib` (where `EXECPREFIX`, set via `--exec-prefix=EXECPREFIX`, defaults to `PREFIX`) and `INCDIR` defaults to `PREFIX/include`, but `LIBDIR` and `INCDIR` will each be overriden by their respective `--libdir`/`--includedir` options. There is a third related option, `--sharedir=SHAREDIR`, where `SHAREDIR` defaults to `PREFIX/share`. This option specifies the installation directory for certain makefile fragments that contain variables determined by `configure` (e.g. `CC`, `CFLAGS`, `LDFLAGS`, etc.). These files allow certain BLIS makefiles, such as those in the `examples` or `testsuite` directories, to operate on an installed copy of BLIS rather than a local (and possibly uninstalled) copy. For a complete list of supported `configure` options and arguments, run `configure` with the `-h` option: ```