<HTML>
<HEAD>
<TITLE>Re: [CMake] Autotools conversion: case statement</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>For this particular use, doesn’t the FindThreads package do this for you?<BR>
<BR>
-Ken<BR>
<BR>
<BR>
On 12/17/09 7:43 AM, "Nicola Brisotto" <<a href="nicolabrisotto@gmail.com">nicolabrisotto@gmail.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hello,<BR>
I've an autotools script to convert to cmake. It has a lot of long case statement. Any tips to easily convert this statement?<BR>
<BR>
Here an example:<BR>
<BR>
case "$THREADS" in<BR>
no | none | single)<BR>
THREADS=none<BR>
;;<BR>
posix | pthreads)<BR>
THREADS=posix<BR>
THREADDLLIBS=-lpthread<BR>
case "$host" in<BR>
x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux* | sparc*-*-linux*)<BR>
AC_DEFINE(GC_LINUX_THREADS)<BR>
AC_DEFINE(_REENTRANT)<BR>
if test "${enable_parallel_mark}" = yes; then<BR>
AC_DEFINE(PARALLEL_MARK)<BR>
fi<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
AC_MSG_WARN("Explicit GC_INIT() calls may be required.");<BR>
;;<BR>
*-*-linux*)<BR>
AC_DEFINE(GC_LINUX_THREADS)<BR>
AC_DEFINE(_REENTRANT)<BR>
;;<BR>
*-*-aix*)<BR>
AC_DEFINE(GC_AIX_THREADS)<BR>
AC_DEFINE(_REENTRANT)<BR>
;;<BR>
*-*-hpux11*)<BR>
AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.")<BR>
AC_DEFINE(GC_HPUX_THREADS)<BR>
AC_DEFINE(_POSIX_C_SOURCE,199506L)<BR>
if test "${enable_parallel_mark}" = yes; then<BR>
AC_DEFINE(PARALLEL_MARK)<BR>
fi<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
AC_MSG_WARN("Explicit GC_INIT() calls may be required.");<BR>
THREADDLLIBS="-lpthread -lrt"<BR>
# HPUX needs REENTRANT for the _r calls.<BR>
AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads.])<BR>
;;<BR>
*-*-hpux10*)<BR>
AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")<BR>
;;<BR>
*-*-openbsd*)<BR>
AC_DEFINE(GC_OPENBSD_THREADS)<BR>
THREADDLLIBS=-pthread<BR>
INCLUDES="$INCLUDES -pthread"<BR>
openbsd_threads=true<BR>
;;<BR>
*-*-freebsd*)<BR>
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")<BR>
AC_DEFINE(GC_FREEBSD_THREADS)<BR>
INCLUDES="$INCLUDES -pthread"<BR>
;;<BR>
*-*-kfreebsd*-gnu)<BR>
AC_DEFINE(GC_FREEBSD_THREADS)<BR>
INCLUDES="$INCLUDES -pthread"<BR>
THREADDLLIBS=-pthread<BR>
AC_DEFINE(_REENTRANT)<BR>
if test "${enable_parallel_mark}" = yes; then<BR>
AC_DEFINE(PARALLEL_MARK)<BR>
fi<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
AC_DEFINE(USE_COMPILER_TLS)<BR>
;;<BR>
*-*-gnu*)<BR>
AC_DEFINE(GC_GNU_THREADS)<BR>
AC_DEFINE(_REENTRANT)<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
;;<BR>
*-*-netbsd*)<BR>
AC_MSG_WARN("Only on NetBSD 2.0 or later.")<BR>
AC_DEFINE(GC_NETBSD_THREADS)<BR>
AC_DEFINE(_REENTRANT)<BR>
AC_DEFINE(_PTHREADS)<BR>
THREADDLLIBS="-lpthread -lrt"<BR>
;;<BR>
*-*-solaris*)<BR>
AC_DEFINE(GC_SOLARIS_THREADS)<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
THREADDLLIBS="-lpthread -lrt"<BR>
if test "$GCC" != yes; then<BR>
CFLAGS="$CFLAGS -O"<BR>
need_atomic_ops_asm=true<BR>
fi<BR>
;;<BR>
*-*-irix*)<BR>
AC_DEFINE(GC_IRIX_THREADS)<BR>
;;<BR>
*-*-cygwin*)<BR>
AC_DEFINE(GC_THREADS)<BR>
if test "${enable_parallel_mark}" = yes; then<BR>
AC_DEFINE(PARALLEL_MARK)<BR>
fi<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
# Cygwin doesn't have a real libpthread, so Libtool can't link<BR>
# against it.<BR>
THREADDLLIBS=""<BR>
win32_threads=true<BR>
;;<BR>
*-*-darwin*)<BR>
AC_DEFINE(GC_DARWIN_THREADS)<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
AC_MSG_WARN("Explicit GC_INIT() calls may be required.");<BR>
# Parallel-mark is currently unreliable on Darwin; ignore request<BR>
# if test "${enable_parallel_mark}" = yes; then<BR>
# AC_DEFINE(PARALLEL_MARK)<BR>
# fi<BR>
darwin_threads=true<BR>
;;<BR>
*-*-osf*)<BR>
AC_DEFINE(GC_OSF1_THREADS)<BR>
if test "${enable_parallel_mark}" = yes; then<BR>
AC_DEFINE(PARALLEL_MARK)<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
AC_MSG_WARN("Explicit GC_INIT() calls may be required.");<BR>
# May want to enable it in other cases, too.<BR>
# Measurements havent yet been done.<BR>
fi<BR>
INCLUDES="$INCLUDES -pthread"<BR>
THREADDLLIBS="-lpthread -lrt"<BR>
;;<BR>
*)<BR>
AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")<BR>
;;<BR>
esac<BR>
;;<BR>
win32)<BR>
AC_DEFINE(GC_THREADS)<BR>
if test "${enable_parallel_mark}" = yes; then<BR>
AC_DEFINE(PARALLEL_MARK)<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
fi<BR>
win32_threads=true<BR>
AC_DEFINE([EMPTY_GETENV_RESULTS], [1],<BR>
[Wine getenv may not return NULL for missing entry.])<BR>
;;<BR>
dgux386)<BR>
THREADS=dgux386<BR>
AC_MSG_RESULT($THREADDLLIBS)<BR>
# Use pthread GCC switch<BR>
THREADDLLIBS=-pthread<BR>
if test "${enable_parallel_mark}" = yes; then<BR>
AC_DEFINE(PARALLEL_MARK)<BR>
fi<BR>
AC_DEFINE(THREAD_LOCAL_ALLOC)<BR>
AC_MSG_WARN("Explicit GC_INIT() calls may be required.");<BR>
AC_DEFINE([GC_DGUX386_THREADS], 1,<BR>
[Define to enable support for DB/UX threads on i386.])<BR>
AC_DEFINE([DGUX_THREADS], 1,<BR>
[Define to enable support for DB/UX threads.])<BR>
# Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread<BR>
INCLUDES="-pthread $INCLUDES"<BR>
;;<BR>
aix)<BR>
THREADS=posix<BR>
THREADDLLIBS=-lpthread<BR>
AC_DEFINE(GC_AIX_THREADS)<BR>
AC_DEFINE(_REENTRANT)<BR>
;;<BR>
decosf1 | irix | mach | os2 | solaris | dce | vxworks)<BR>
AC_MSG_ERROR(thread package $THREADS not yet supported)<BR>
;;<BR>
*)<BR>
AC_MSG_ERROR($THREADS is an unknown thread package)<BR>
;;<BR>
esac<BR>
<BR>
<BR>
</SPAN></FONT><FONT FACE="Helvetica, Verdana, Arial"><SPAN STYLE='font-size:12pt'>Nicola Brisotto<BR>
vcard <<a href="http://www.breezit.net/vcards/NicolaBrisotto.vcf">http://www.breezit.net/vcards/NicolaBrisotto.vcf</a>> <BR>
<BR>
<BR>
<BR>
</SPAN></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
<BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
**** Kenneth Moreland<BR>
*** Sandia National Laboratories<BR>
*********** <BR>
*** *** *** email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
** *** ** phone: (505) 844-8919<BR>
*** web: <a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a><BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>