summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-06-03 15:54:40 -0700
committerGarrett D'Amore <garrett@damore.org>2016-06-03 15:57:32 -0700
commit1ebe8db86c152e0f75320b406cf5cee6852cff2d (patch)
tree12455ef9eb0e4c6648bf3e8b29e34432a145249a
parentc8b55a6837dca17a5b49d6b43248cc99bea1a41f (diff)
downloadnanomsg-1ebe8db86c152e0f75320b406cf5cee6852cff2d.tar.gz
fixes #752 configure script could be more robust
-rw-r--r--CMakeLists.txt13
-rwxr-xr-xconfigure24
2 files changed, 22 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad835d6..8f10ba8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,13 +163,14 @@ if (WIN32)
set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} ws2_32)
set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} mswsock)
set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} advapi32)
- nn_check_func (InitializeConditionVariable NN_HAVE_CONDVAR)
+ nn_check_sym (InitializeConditionVariable windows.h NN_HAVE_CONDVAR)
if (NOT NN_HAVE_CONDVAR)
- message (ERROR "Modern Windows API support is missing.")
- message (ERROR "Versions of Windows prior to Vista are not supported.")
- message (ERROR "Further, the 32-bit MinGW environment is not supported.")
- message (ERROR "Ensure you have at least Windows Vista or newer, and are")
- message (ERROR "using either Visual Studio 2010 or newer or MinGW-W64.")
+ message (FATAL_ERROR
+ "Modern Windows API support is missing. "
+ "Versions of Windows prior to Vista are not supported. "
+ "Further, the 32-bit MinGW environment is not supported. "
+ "Ensure you have at least Windows Vista or newer, and are "
+ "using either Visual Studio 2010 or newer or MinGW-W64.")
endif()
else ()
# Unconditionally declare the following feature test macros. These are
diff --git a/configure b/configure
index 5c36372..bcbf7dc 100755
--- a/configure
+++ b/configure
@@ -29,21 +29,26 @@ CURDIR=`pwd`
strip_arg()
{
- echo "$1" | sed "s/[^=]*=//"
+ x=`echo "$1" | sed "s/[^=]*=//"`
+ eval $2=\"$x\"
}
warn() {
- echo "$*" 2>&1
+ echo "$*" 1>&2
}
find_prog() {
- for p in `echo "$PATH" | sed 's/:/ /'`; do
+ SIFS="${IFS= }"
+ IFS=:
+ for p in $PATH; do
if [ -x ${p}/$1 ]
then
+ IFS="${SIFS}"
echo "${p}/${1}"
return 0
fi
done
+ IFS="${SIFS}"
return 1
}
@@ -68,8 +73,8 @@ help() {
exit 1
}
+CMAKE_ARGS=()
# Argument parsing
-#
while [ -n "$1" ]; do
case "$1" in
--with-cmake)
@@ -77,15 +82,16 @@ while [ -n "$1" ]; do
shift 2
;;
--with-cmake=*)
- CMAKE=`strip_arg "$1"`
+ strip_arg "$1" CMAKE
shift
;;
--prefix)
- PREFIX="-DCMAKE_INSTALL_PREFIX=$2"
+ CMAKE_ARGS+=( "-DCMAKE_INSTALL_PREFIX=$2" )
shift 2
;;
--prefix=*)
- PREFIX=-DCMAKE_INSTALL_PREFIX=`strip_arg "$1"`
+ strip_arg "$1" PFX
+ CMAKE_ARGS+=( "-DCMAKE_INSTALL_PREFIX=$PFX" )
shift
;;
*)
@@ -100,9 +106,9 @@ fi
if [ -f src/nn.h ]
then
- warn "NB: In-tree building is not recommended."
+ warn "NOTE: Building in the source directory is not recommended."
fi
GENERATOR="Unix Makefiles"
-$CMAKE $PREFIX -G "$GENERATOR" $SRCDIR
+"$CMAKE" "${CMAKE_ARGS[@]}" -G "$GENERATOR" $SRCDIR