Skip to content

Commit f05ca25

Browse files
committed
Updated build scripts
1 parent bd6a94f commit f05ca25

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

autogen.sh

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,41 @@ while [ $# -gt 0 ] ; do
7373
shift
7474
break
7575
else
76-
echo >&2 "Usage: autogen.sh [--use-clang|--use-clang-scan-build|--use-gcc|--use-gcc-analyzer] [--debug|--release|--release-with-debinfo] [--cores N] [--verbose] -- (further CMake options)"
76+
echo >&2 "Usage: autogen.sh [--use-clang|--use-clang-scan-build|--use-gcc|--use-gcc-analyzer] [--debug|--release|--release-with-debinfo] [--cores N] [--verbose] -- (further CMake/Configure options)"
7777
exit 1
7878
fi
7979
shift
8080
done
8181

82-
# ====== Configure with CMake ===============================================
83-
rm -f CMakeCache.txt
8482
if [ "$(uname)" != "FreeBSD" ] ; then
8583
installPrefix="/usr"
8684
else
8785
installPrefix="/usr/local"
8886
fi
89-
if [ "$*" != "" ] ; then
90-
CMAKE_OPTIONS="${CMAKE_OPTIONS} $*"
87+
88+
89+
# ====== Configure with CMake ===============================================
90+
if [ -e CMakeLists.txt ] ; then
91+
rm -f CMakeCache.txt
92+
if [ "$*" != "" ] ; then
93+
CMAKE_OPTIONS="${CMAKE_OPTIONS} $*"
94+
fi
95+
echo "CMake options:${CMAKE_OPTIONS} . -DCMAKE_INSTALL_PREFIX=\"${installPrefix}\""
96+
# shellcheck disable=SC2048,SC2086
97+
${COMMAND} cmake ${CMAKE_OPTIONS} . -DCMAKE_INSTALL_PREFIX="${installPrefix}"
98+
99+
# ====== Configure with AutoConf/AutoMake ===================================
100+
elif [ -e bootstrap ] ; then
101+
./bootstrap
102+
./configure $*
103+
104+
else
105+
echo >&2 "ERROR: Failed to configure with CMake or AutoMake/AutoConf!"
106+
exit 1
91107
fi
92-
echo "CMake options:${CMAKE_OPTIONS} . -DCMAKE_INSTALL_PREFIX=\"${installPrefix}\""
93-
# shellcheck disable=SC2048,SC2086
94-
${COMMAND} cmake ${CMAKE_OPTIONS} . -DCMAKE_INSTALL_PREFIX="${installPrefix}"
95108

96-
# ------ Obtain number of cores ---------------------------------------------
109+
110+
# ====== Obtain number of cores =============================================
97111
# Try Linux
98112
if [ "${CORES}" == "" ] ; then
99113
CORES=$(getconf _NPROCESSORS_ONLN 2>/dev/null || true)
@@ -107,5 +121,6 @@ if [ "${CORES}" == "" ] ; then
107121
echo "This system has ${CORES} cores!"
108122
fi
109123

124+
110125
# ====== Build ==============================================================
111126
${COMMAND} make -j"${CORES}"

0 commit comments

Comments
 (0)