Modified:
trunk/MYODBC_CONF.h
trunk/configure.in
trunk/samples/my_utility.h
trunk/test/include/mytest3.h
Log:
- Added configure test to handle compiler defined __FUNCTION__
or C99 __func__, or none.
- When adding flags from "mysql_config --cflags", put before user
supplied ones, else user can't reduce optimization level.
- Undefine HAVE_CONFIG_H when "myconf.h" is included, to work around
a problem to compile against the iODBC bundled with Mac OS X 10.3.
Modified: trunk/MYODBC_CONF.h
===================================================================
--- trunk/MYODBC_CONF.h 2006-09-10 17:08:47 UTC (rev 84)
+++ trunk/MYODBC_CONF.h 2006-09-10 19:53:30 UTC (rev 85)
@@ -4,7 +4,8 @@
#ifdef HAVE_CONFIG_H
#include "myodbc3/myconf.h"
#define SETUP_VERSION VERSION
-#else
+ /* Work around iODBC header bug on Mac OS X 10.3 */
+ #undef HAVE_CONFIG_H
#endif
#endif
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2006-09-10 17:08:47 UTC (rev 84)
+++ trunk/configure.in 2006-09-10 19:53:30 UTC (rev 85)
@@ -91,10 +91,6 @@
ldflags_is_set=yes
fi
-# The following hack should ensure that configure doesn't add optimizing
-# or debugging flags to CFLAGS or CXXFLAGS
-CFLAGS="$CFLAGS "
-
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
@@ -538,7 +534,7 @@
fi
# We have to remove any ' around paths as this confuses configure
OPT=`echo $OPT | sed -e "s;';;g"`
-CFLAGS="$CFLAGS $OPT"
+CFLAGS="$OPT $CFLAGS"
MYSQL_LIB=`$mysql_config --libs | sed -e "s;';;g"`
OPT=`$mysql_config --libs_r`
@@ -879,6 +875,27 @@
###################################################################
# #
+# Find out if compiler defines __func__ or __FUNCTION__ macro #
+# #
+###################################################################
+
+# Use expression that will result in syntax error if undefined
+AC_MSG_CHECKING([if compiler defines the __FUNCTION__ macro])
+AC_TRY_COMPILE([],[const char *cp = __FUNCTION__;],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE(USE_GNU_FUNC_MACRO, 1,
+ [Define if compiler defines __FUNCTION__])],
+ [AC_MSG_RESULT([no])])
+
+AC_MSG_CHECKING([if compiler defines the C99 __func__ macro])
+AC_TRY_COMPILE([], [const char *cp = __func__;],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE(USE_C99_FUNC_MACRO, 1,
+ [Define if compiler defines C99 __func__ macro])],
+ [AC_MSG_RESULT([no])])
+
+###################################################################
+# #
# Should be done adding to LIBS, check if functions are there #
# #
###################################################################
Modified: trunk/samples/my_utility.h
===================================================================
--- trunk/samples/my_utility.h 2006-09-10 17:08:47 UTC (rev 84)
+++ trunk/samples/my_utility.h 2006-09-10 19:53:30 UTC (rev 85)
@@ -34,6 +34,8 @@
#ifdef HAVE_CONFIG_H
#include <myconf.h>
#endif
+/* Work around iODBC header bug on Mac OS X 10.3 */
+#undef HAVE_CONFIG_H
#ifdef WIN32
#include <windows.h>
Modified: trunk/test/include/mytest3.h
===================================================================
--- trunk/test/include/mytest3.h 2006-09-10 17:08:47 UTC (rev 84)
+++ trunk/test/include/mytest3.h 2006-09-10 19:53:30 UTC (rev 85)
@@ -21,6 +21,8 @@
#ifdef HAVE_CONFIG_H
#include <myconf.h>
#endif
+/* Work around iODBC header bug on Mac OS X 10.3 */
+#undef HAVE_CONFIG_H
#ifdef WIN32
#include <windows.h>
@@ -151,11 +153,25 @@
myerror( rc, 3, hstmt, __FILE__, __LINE__ ); \
my_assert( r )
+#if defined(USE_C99_FUNC_MACRO)
#define printMessageHeader()\
{\
+ g_nCursor = sprintf( g_szHeader, "[%s][%s][%d]\n", __FILE__, __func__, __LINE__
);\
+ fprintf( stdout, g_szHeader );\
+ }
+#elif defined(USE_GNU_FUNC_MACRO)
+#define printMessageHeader()\
+ {\
g_nCursor = sprintf( g_szHeader, "[%s][%s][%d]\n", __FILE__, __FUNCTION__,
__LINE__ );\
fprintf( stdout, g_szHeader );\
}
+#else
+#define printMessageHeader()\
+ {\
+ g_nCursor = sprintf( g_szHeader, "[%s][%d]\n", __FILE__, __LINE__ );\
+ fprintf( stdout, g_szHeader );\
+ }
+#endif
#define printMessageFooter( A )\
{\
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r85 - in trunk: . samples test/include | mysqldev | 10 Sep |