Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30688
Modified Files: Tag: branch-v0-40-extended config.h.in configure.in x_arithmetic.c Added Files: Tag: branch-v0-40-extended acinclude.m4 Log Message: This commit adds configure script checking for a number of functions in libm: - sinf, cosf, atanf, atan2f, ...
Previously, in x_arithmetic.c, these functions were redefined for MSW / Apple. Now, they will only be redefined if the configure script does not find them. The results of the checks for these functions are placed in the config.h header file. The config.h.in file was generated using autoheader.
This commit also introduces a library of m4 macros that I use in another project to make adding these checks easier, as well as other things in the future. I left the macro prefixes as AST_ to make it easier to keep this file in sync with the original version.
Important Note: - With the introduction of acinclude.m4, you have to run aclocal before running autoconf. It wouldn't hurt to make running autoheader a habit as well. We should probably just add a bootstrap/autogen script that does all of this for you.
Index: x_arithmetic.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/x_arithmetic.c,v retrieving revision 1.4 retrieving revision 1.4.6.1 diff -C2 -d -r1.4 -r1.4.6.1 *** x_arithmetic.c 15 Aug 2006 04:54:15 -0000 1.4 --- x_arithmetic.c 2 Jan 2008 17:20:38 -0000 1.4.6.1 *************** *** 7,24 **** inputs to int and their outputs back to float. */
#include "m_pd.h" #include <math.h>
! ! /* MSW and OSX don't appear to have single-precision ANSI math */ ! #if defined(MSW) || defined(__APPLE__) #define sinf sin #define cosf cos #define atanf atan #define atan2f atan2 #define sqrtf sqrt #define logf log #define expf exp #define fabsf fabs #define powf pow #endif --- 7,48 ---- inputs to int and their outputs back to float. */
+ #include "config.h" + #include "m_pd.h" #include <math.h>
! #if !defined(HAVE_SINF) #define sinf sin + #endif + + #if !defined(HAVE_COSF) #define cosf cos + #endif + + #if !defined(HAVE_ATANF) #define atanf atan + #endif + + #if !defined(HAVE_ATAN2F) #define atan2f atan2 + #endif + + #if !defined(HAVE_SQRTF) #define sqrtf sqrt + #endif + + #if !defined(HAVE_LOGF) #define logf log + #endif + + #if !defined(HAVE_EXPF) #define expf exp + #endif + + #if !defined(HAVE_FABSF) #define fabsf fabs + #endif + + #if !defined(HAVE_POWF) #define powf pow #endif
--- NEW FILE: acinclude.m4 --- # Various support functions for configure.ac in asterisk #
# Helper function to check for gcc attributes. # AST_GCC_ATTRIBUTE([attribute name])
AC_DEFUN([AST_GCC_ATTRIBUTE], [ AC_MSG_CHECKING(for compiler 'attribute $1' support) AC_COMPILE_IFELSE( AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}], []), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), AC_MSG_RESULT(no)) ])
# Helper function to setup variables for a package. # $1 -> the package name. Used in configure.ac and also as a prefix [...1011 lines suppressed...] PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi
AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD
Index: config.h.in =================================================================== RCS file: /cvsroot/pure-data/pd/src/config.h.in,v retrieving revision 1.1 retrieving revision 1.1.8.1 diff -C2 -d -r1.1 -r1.1.8.1 *** config.h.in 31 Dec 2005 00:59:49 -0000 1.1 --- config.h.in 2 Jan 2008 17:20:38 -0000 1.1.8.1 *************** *** 1,5 **** --- 1,222 ---- + /* config.h.in. Generated from configure.in by autoheader. */ + + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ + #undef CRAY_STACKSEG_END + + /* Define to 1 if using `alloca.c'. */ + #undef C_ALLOCA
+ /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA
+ /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ #undef HAVE_ALLOCA_H
+ /* Define this to indicate the ${ATAN2F_DESCRIP} library */ + #undef HAVE_ATAN2F + + /* Define to indicate the ${ATAN2F_DESCRIP} library version */ + #undef HAVE_ATAN2F_VERSION + + /* Define this to indicate the ${ATANF_DESCRIP} library */ + #undef HAVE_ATANF + + /* Define to indicate the ${ATANF_DESCRIP} library version */ + #undef HAVE_ATANF_VERSION + + /* Define to 1 if you have the <bstring.h> header file. */ + #undef HAVE_BSTRING_H + + /* Define this to indicate the ${COSF_DESCRIP} library */ + #undef HAVE_COSF + + /* Define to indicate the ${COSF_DESCRIP} library version */ + #undef HAVE_COSF_VERSION + + /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ + #undef HAVE_DOPRNT + + /* Define this to indicate the ${EXPF_DESCRIP} library */ + #undef HAVE_EXPF + + /* Define to indicate the ${EXPF_DESCRIP} library version */ + #undef HAVE_EXPF_VERSION + + /* Define this to indicate the ${FABSF_DESCRIP} library */ + #undef HAVE_FABSF + + /* Define to indicate the ${FABSF_DESCRIP} library version */ + #undef HAVE_FABSF_VERSION + + /* Define to 1 if you have the <fcntl.h> header file. */ + #undef HAVE_FCNTL_H + + /* Define to 1 if you have the `gettimeofday' function. */ + #undef HAVE_GETTIMEOFDAY + + /* Define to 1 if you have the <inttypes.h> header file. */ + #undef HAVE_INTTYPES_H + + /* Define to 1 if you have the `tcl84' library (-ltcl84). */ + #undef HAVE_LIBTCL84 + + /* Define to 1 if you have the `tcl85' library (-ltcl85). */ + #undef HAVE_LIBTCL85 + + /* Define to 1 if you have the `tcl8.0' library (-ltcl8.0). */ + #undef HAVE_LIBTCL8_0 + + /* Define to 1 if you have the `tcl8.2' library (-ltcl8.2). */ + #undef HAVE_LIBTCL8_2 + + /* Define to 1 if you have the `tcl8.3' library (-ltcl8.3). */ + #undef HAVE_LIBTCL8_3 + + /* Define to 1 if you have the `tcl8.4' library (-ltcl8.4). */ + #undef HAVE_LIBTCL8_4 + + /* Define to 1 if you have the `tcl8.5' library (-ltcl8.5). */ + #undef HAVE_LIBTCL8_5 + + /* Define to 1 if you have the `tk84' library (-ltk84). */ + #undef HAVE_LIBTK84 + + /* Define to 1 if you have the `tk85' library (-ltk85). */ + #undef HAVE_LIBTK85 + + /* Define to 1 if you have the `tk8.0' library (-ltk8.0). */ + #undef HAVE_LIBTK8_0 + + /* Define to 1 if you have the `tk8.2' library (-ltk8.2). */ + #undef HAVE_LIBTK8_2 + + /* Define to 1 if you have the `tk8.3' library (-ltk8.3). */ + #undef HAVE_LIBTK8_3 + + /* Define to 1 if you have the `tk8.4' library (-ltk8.4). */ + #undef HAVE_LIBTK8_4 + + /* Define to 1 if you have the `tk8.5' library (-ltk8.5). */ + #undef HAVE_LIBTK8_5 + + /* Define to 1 if you have the <limits.h> header file. */ + #undef HAVE_LIMITS_H + + /* Define this to indicate the ${LOGF_DESCRIP} library */ + #undef HAVE_LOGF + + /* Define to indicate the ${LOGF_DESCRIP} library version */ + #undef HAVE_LOGF_VERSION + + /* Define to 1 if you have the <malloc.h> header file. */ + #undef HAVE_MALLOC_H + + /* Define to 1 if you have the <memory.h> header file. */ + #undef HAVE_MEMORY_H + + /* Define this to indicate the ${POWF_DESCRIP} library */ + #undef HAVE_POWF + + /* Define to indicate the ${POWF_DESCRIP} library version */ + #undef HAVE_POWF_VERSION + + /* Define to 1 if you have the `select' function. */ + #undef HAVE_SELECT + + /* Define this to indicate the ${SINF_DESCRIP} library */ + #undef HAVE_SINF + + /* Define to indicate the ${SINF_DESCRIP} library version */ + #undef HAVE_SINF_VERSION + + /* Define to 1 if you have the `socket' function. */ + #undef HAVE_SOCKET + + /* Define this to indicate the ${SQRTF_DESCRIP} library */ + #undef HAVE_SQRTF + + /* Define to indicate the ${SQRTF_DESCRIP} library version */ + #undef HAVE_SQRTF_VERSION + + /* Define to 1 if you have the <stdint.h> header file. */ + #undef HAVE_STDINT_H + + /* Define to 1 if you have the <stdlib.h> header file. */ + #undef HAVE_STDLIB_H + + /* Define to 1 if you have the `strerror' function. */ + #undef HAVE_STRERROR + + /* Define to 1 if you have the <strings.h> header file. */ + #undef HAVE_STRINGS_H + + /* Define to 1 if you have the <string.h> header file. */ + #undef HAVE_STRING_H + + /* Define to 1 if you have the <sys/ioctl.h> header file. */ + #undef HAVE_SYS_IOCTL_H + + /* Define to 1 if you have the <sys/stat.h> header file. */ + #undef HAVE_SYS_STAT_H + + /* Define to 1 if you have the <sys/time.h> header file. */ + #undef HAVE_SYS_TIME_H + + /* Define to 1 if you have the <sys/types.h> header file. */ + #undef HAVE_SYS_TYPES_H + + /* Define to 1 if you have the <unistd.h> header file. */ + #undef HAVE_UNISTD_H + + /* Define to 1 if you have the `vprintf' function. */ + #undef HAVE_VPRINTF + + /* Define to the address where bug reports for this package should be sent. */ + #undef PACKAGE_BUGREPORT + + /* Define to the full name of this package. */ + #undef PACKAGE_NAME + + /* Define to the full name and version of this package. */ + #undef PACKAGE_STRING + + /* Define to the one symbol short name of this package. */ + #undef PACKAGE_TARNAME + + /* Define to the version of this package. */ + #undef PACKAGE_VERSION + + /* Define as the return type of signal handlers (`int' or `void'). */ + #undef RETSIGTYPE + + /* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ + #undef STACK_DIRECTION + + /* Define to 1 if you have the ANSI C header files. */ + #undef STDC_HEADERS + + /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ + #undef TIME_WITH_SYS_TIME + + /* Number of bits in a file offset, on hosts where this is settable. */ + #undef _FILE_OFFSET_BITS + + /* Define for large files, on AIX-style hosts. */ + #undef _LARGE_FILES + + /* Define to empty if `const' does not conform to ANSI C. */ + #undef const + + /* Define to `int' if <sys/types.h> does not define. */ + #undef pid_t + + /* Define to `unsigned int' if <sys/types.h> does not define. */ + #undef size_t
Index: configure.in =================================================================== RCS file: /cvsroot/pure-data/pd/src/configure.in,v retrieving revision 1.21.2.1.4.1 retrieving revision 1.21.2.1.4.2 diff -C2 -d -r1.21.2.1.4.1 -r1.21.2.1.4.2 *** configure.in 4 Nov 2007 18:00:19 -0000 1.21.2.1.4.1 --- configure.in 2 Jan 2008 17:20:38 -0000 1.21.2.1.4.2 *************** *** 2,5 **** --- 2,7 ---- AC_INIT(d_arithmetic.c)
+ AC_CONFIG_HEADER(config.h) + AC_SUBST(alsa, yes) AC_SUBST(jack, no) *************** *** 427,430 **** --- 429,442 ---- ## }JMZ: end of large-file support section
+ AST_EXT_LIB_CHECK([SINF], [m], [sinf]) + AST_EXT_LIB_CHECK([COSF], [m], [cosf]) + AST_EXT_LIB_CHECK([ATANF], [m], [atanf]) + AST_EXT_LIB_CHECK([ATAN2F], [m], [atan2f]) + AST_EXT_LIB_CHECK([SQRTF], [m], [sqrtf]) + AST_EXT_LIB_CHECK([LOGF], [m], [logf]) + AST_EXT_LIB_CHECK([EXPF], [m], [expf]) + AST_EXT_LIB_CHECK([FABSF], [m], [fabsf]) + AST_EXT_LIB_CHECK([POWF], [m], [powf]) + AC_OUTPUT(makefile)