@@ -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
8080done
8181
82- # ====== Configure with CMake ===============================================
83- rm -f CMakeCache.txt
8482if [ " $( uname) " != " FreeBSD" ] ; then
8583 installPrefix=" /usr"
8684else
8785 installPrefix=" /usr/local"
8886fi
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
91107fi
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
98112if [ " ${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!"
108122fi
109123
124+
110125# ====== Build ==============================================================
111126${COMMAND} make -j" ${CORES} "
0 commit comments