Changeset: 1d1bbf8d9d45 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1d1bbf8d9d45
Modified Files:
        
Branch: Apr2011
Log Message:

merge


diffs (truncated from 684 to 300 lines):

diff --git a/NT/winconfig.py b/NT/winconfig.py
--- a/NT/winconfig.py
+++ b/NT/winconfig.py
@@ -41,7 +41,6 @@
         ("@pkgincludedir@", r'%prefix%\include\@PACKAGE@'),
         ("@DIRSEP@", '\\'),
         ("@CROSS_COMPILING_FALSE@", ''),
-        ("@LINK_STATIC_FALSE@", ''),
         ("@HAVE_CLIENTS_FALSE@", '#'),
         ("@HAVE_MONETDB_FALSE@", '#'),
         ("@NATIVE_WIN32_FALSE@", '#'),
diff --git a/common/utils/mutils.c b/common/utils/mutils.c
--- a/common/utils/mutils.c
+++ b/common/utils/mutils.c
@@ -278,3 +278,39 @@
 }
 
 #endif
+
+static char _bin_path[1024];
+char *
+get_bin_path(void)
+{
+       /* getting the path to the executable's binary, isn't all that
+        * simple, unfortunately */
+#if defined(_MSC_VER)          /* Windows */
+       if (GetModuleFileName(NULL, _bin_path,
+                             (DWORD) sizeof(_bin_path)) != 0)
+               return _bin_path;
+#elif defined(HAVE__NSGETEXECUTABLEPATH)  /* Darwin/OSX */
+       uint32_t size = sizeof(_bin_path);
+       if (_NSGetExecutablePath(_bin_path, &size) == 0)
+               return _bin_path;
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(KERN_PROC_PATHNAME)  /* BSD */
+       int mib[4];
+       size_t cb = sizeof(_bin_path);
+       mib[0] = CTL_KERN;
+       mib[1] = KERN_PROC;
+       mib[2] = KERN_PROC_PATHNAME;
+       mib[3] = -1;
+       if (sysctl(mib, 4, _bin_path, &cb, NULL, 0) == 0)
+               return _bin_path;
+#elif defined(HAVE_GETEXECNAME)  /* Solaris */
+       const char *execn = getexecname();
+       /* copy, such that the caller can actually modify this string */
+       snprintf(_bin_path, sizeof(_bin_path), "%s", execn);
+#else  /* try Linux approach */
+       if (readlink("/proc/self/exe",
+                               _bin_path, sizeof(_bin_path)) != -1)
+                       return _bin_path;
+#endif
+       /* could use argv[0] (passed) to deduce location based on PATH */
+       return NULL;
+}
diff --git a/common/utils/mutils.h b/common/utils/mutils.h
--- a/common/utils/mutils.h
+++ b/common/utils/mutils.h
@@ -72,4 +72,6 @@
 
 mutils_export int MT_lockf(char *filename, int mode, off_t off, off_t len);
 
+mutils_export char *get_bin_path(void);
+
 #endif /* _MUTILS_H_ */
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -865,33 +865,119 @@
        AC_MSG_RESULT([$noexpand])
 fi
 
-dnl --enable-debug
 AC_ARG_ENABLE(debug,
        AS_HELP_STRING([--enable-debug],
                [enable full debugging (default=yes for development sources)]),
        enable_debug=$enableval,
-       enable_debug=$dft_debug)
+       enable_debug=def_$dft_debug)
+
+AC_ARG_ENABLE(assert,
+       AS_HELP_STRING([--enable-assert],
+               [enable assertions in the code (default=yes for development 
sources)]),
+       enable_assert=$enableval,
+       enable_assert=def_$dft_assert)
+
+AC_ARG_ENABLE(optimize,
+       AS_HELP_STRING([--enable-optimize],
+               [enable extra optimization (default=no)]),
+       enable_optim=$enableval,
+       enable_optim=def_$dft_optimi)
+
+AC_ARG_ENABLE(warning,
+       AS_HELP_STRING([--enable-warning],
+               [enable extended compiler warnings (default=$dft_warning)]),
+       enable_warning=$enableval,
+       enable_warning=def_$dft_warning)
+
+need_profiling=no
+AC_ARG_ENABLE(profile,
+       AS_HELP_STRING([--enable-profile], [enable profiling (default=no)]),
+       enable_prof=$enableval,
+       enable_prof=no)
+
+need_instrument=no
+AC_ARG_ENABLE(instrument,
+       AS_HELP_STRING([--enable-instrument],
+               [enable instrument (default=no)]),
+       enable_instrument=$enableval,
+       enable_instrument=no)
+
+dnl check whether no (explictly chosen) mutual exclusive combinations
+dnl were made, compatability matrix:
+dnl                 deb  ass  opt  war  pro  ins
+dnl   debug          \    C    X    C    C    C
+dnl   assert         C    \    C    C    C    C
+dnl   optimize       X    C    \    C    X    X
+dnl   warnings       C    C    C    \    C    C
+dnl   profile        C    C    X    C    \    C
+dnl   instrument     C    C    X    C    C    \
+
+case "x$enable_debug.$enable_optim.$enable_prof.$enable_instrument" in
+       # find conflicts
+       xyes.yes.*.*)
+               AC_MSG_ERROR([combining --enable-optimize and --enable-debug is 
not possible])
+               ;;
+       x*.yes.yes.*)
+               AC_MSG_ERROR([combining --enable-optimize and --enable-profile 
is not possible])
+               ;;
+       x*.yes.*.yes)
+               AC_MSG_ERROR([combining --enable-optimize and 
--enable-instrument is not possible])
+               ;;
+       # handle defaults after user requests
+       xyes.*.*.*)
+               enable_debug=yes
+               enable_optim=no
+               enable_prof="`echo $enable_prof | sed 's:^def_::'`"
+               enable_instrument="`echo $enable_instrument | sed 's:^def_::'`"
+               ;;
+       x*.*.yes.*)
+               enable_debug="`echo $enable_debug | sed 's:^def_::'`"
+               enable_optim=no
+               enable_prof=yes
+               enable_instrument="`echo $enable_instrument | sed 's:^def_::'`"
+               ;;
+       x*.*.*.yes)
+               enable_debug="`echo $enable_debug | sed 's:^def_::'`"
+               enable_optim=no
+               enable_prof="`echo $enable_prof | sed 's:^def_::'`"
+               enable_instrument=yes
+               ;;
+       x*.*no.*.*)
+               enable_debug="`echo $enable_debug | sed 's:^def_::'`"
+               enable_optim=no
+               enable_prof="`echo $enable_prof | sed 's:^def_::'`"
+               enable_instrument="`echo $enable_instrument | sed 's:^def_::'`"
+               ;;
+       x*.*yes.*.*) # enable-optimize overrules other defaults
+               enable_optim=yes
+               enable_debug=no
+               enable_prof=no
+               enable_instrument=no
+               ;;
+       x*)
+               AC_MSG_WARN([unhandled configuration 
$enable_debug.$enable_optim.$enable_prof.$enable_instrument, please file a bug 
on bugs.monetdb.org])
+               ;;
+esac
+# make defaults real for flags which don't conflict with anything
+enable_assert="`echo $enable_assert | sed 's:^def_::'`"
+enable_warning="`echo $enable_warning | sed 's:^def_::'`"
 
 AC_MSG_CHECKING([for --enable-debug])
-origCFLAGS=$CFLAGS
 if test "x$enable_debug" = xyes; then
-       if test "x$enable_optim" = xyes; then
-               AC_MSG_ERROR([combining --enable-optimize and --enable-debug is 
not possible.])
-       else
-               dnl  remove "-Ox" as some compilers don't like "-g -Ox" 
combinations
-               CFLAGS=" $CFLAGS "
-               CFLAGS="`echo "$CFLAGS" | sed -e 's| -O[[0-9]] | |g' -e 's| -g 
| |g' -e 's|^ ||' -e 's| $||'`"
-               JAVACFLAGS=" $JAVACFLAGS "
-               JAVACFLAGS="`echo "$JAVACFLAGS" | sed -e 's| -O | |g' -e 's| -g 
| |g' -e 's| -g:[[a-z]]* | |g' -e 's|^ ||' -e 's| $||'`"
-               dnl  add "-g"
-               CFLAGS="$CFLAGS -g"
-               JAVACFLAGS="$JAVACFLAGS -g"
-               case "$GCC-$host_os" in
-                 yes-aix*)
-                       CFLAGS="$CFLAGS -gxcoff"
-                       ;;
-               esac
-       fi
+       origCFLAGS=$CFLAGS
+       dnl  remove "-Ox" as some compilers don't like "-g -Ox" combinations
+       CFLAGS=" $CFLAGS "
+       CFLAGS="`echo "$CFLAGS" | sed -e 's| -O[[0-9]] | |g' -e 's| -g | |g' -e 
's|^ ||' -e 's| $||'`"
+       JAVACFLAGS=" $JAVACFLAGS "
+       JAVACFLAGS="`echo "$JAVACFLAGS" | sed -e 's| -O | |g' -e 's| -g | |g' 
-e 's| -g:[[a-z]]* | |g' -e 's|^ ||' -e 's| $||'`"
+       dnl  add "-g"
+       CFLAGS="$CFLAGS -g"
+       JAVACFLAGS="$JAVACFLAGS -g"
+       case "$GCC-$host_os" in
+         yes-aix*)
+               CFLAGS="$CFLAGS -gxcoff"
+               ;;
+       esac
 
        changedCFLAGS=
        for flag in $origCFLAGS ; do
@@ -912,13 +998,6 @@
        AC_MSG_RESULT([no])
 fi
 
-dnl --enable-assert
-AC_ARG_ENABLE(assert,
-       AS_HELP_STRING([--enable-assert],
-               [enable assertions in the code (default=yes for development 
sources)]),
-       enable_assert=$enableval,
-       enable_assert=$dft_assert)
-
 AC_MSG_CHECKING([for --enable-assert])
 if test "x$enable_assert" = xno; then
        AC_DEFINE(NDEBUG, 1, [Define if you do not want assertions])
@@ -927,31 +1006,19 @@
        AC_MSG_RESULT([yes])
 fi
 
-dnl --enable-optimize
-AC_ARG_ENABLE(optimize,
-       AS_HELP_STRING([--enable-optimize],
-               [enable extra optimization (default=no)]),
-       enable_optim=$enableval, enable_optim=$dft_optimi)
 
 AC_MSG_CHECKING([for --enable-optimize])
 if test "x$enable_optim" = xyes; then
-  if test "x$enable_debug" = xyes; then
-    AC_MSG_ERROR([combining --enable-optimize and --enable-debug is not 
possible.])
-  elif test "x$enable_prof" = xyes; then
-    AC_MSG_ERROR([combining --enable-optimize and --enable-profile is not 
(yet?) possible.])
-  elif test "x$enable_instrument" = xyes; then
-    AC_MSG_ERROR([combining --enable-optimize and --enable-instrument is not 
(yet?) possible.])
-  else
        origCFLAGS="$CFLAGS"
-    dnl  remove "-g" as some compilers don't like "-g -Ox" combinations
-    dnl  remove "-O2" as we add "-Ox" and some compilers don't like "-Oy -Ox" 
combinations
-    CFLAGS=" $CFLAGS "
-    CFLAGS="`echo "$CFLAGS" | sed -e 's| -g | |g' -e 's| -O2 | |g' -e 's|^ ||' 
-e 's| $||'`"
-    JAVACFLAGS=" $JAVACFLAGS "
-    JAVACFLAGS="`echo "$JAVACFLAGS" | sed -e 's| -g | |g' -e 's| -g:[[a-z]]* | 
|g' -e 's|^ ||' -e 's| $||'`"
-    dnl  Optimization flags
-    JAVACFLAGS="$JAVACFLAGS -g:none -O"
-    case "$GCC-$CC" in
+       dnl  remove "-g" as some compilers don't like "-g -Ox" combinations
+       dnl  remove "-O2" as we add "-Ox" and some compilers don't like "-Oy 
-Ox" combinations
+       CFLAGS=" $CFLAGS "
+       CFLAGS="`echo "$CFLAGS" | sed -e 's| -g | |g' -e 's| -O2 | |g' -e 's|^ 
||' -e 's| $||'`"
+       JAVACFLAGS=" $JAVACFLAGS "
+       JAVACFLAGS="`echo "$JAVACFLAGS" | sed -e 's| -g | |g' -e 's| 
-g:[[a-z]]* | |g' -e 's|^ ||' -e 's| $||'`"
+       dnl  Optimization flags
+       JAVACFLAGS="$JAVACFLAGS -g:none -O"
+       case "$GCC-$CC" in
     yes-*clang*)
                       CFLAGS="$CFLAGS -O3 -fomit-frame-pointer 
-finline-functions"
       ;;
@@ -1103,7 +1170,6 @@
        done
        changedCFLAGS="`echo $changedCFLAGS | sed -e 's|^, ||'`"
        AC_MSG_RESULT([yes: $changedCFLAGS])
-  fi
 else
        AC_MSG_RESULT([no])
 fi
@@ -1114,112 +1180,53 @@
 AC_SUBST(GCC_SWIG_CFLAGS)
 AC_SUBST(ICC_SWIG_CFLAGS)
 
-dnl --enable-warning (only gcc & icc/ecc)
-AC_ARG_ENABLE(warning,
-       AS_HELP_STRING([--enable-warning],
-               [enable extended compiler warnings (default=$dft_warning)]),
-       enable_warning=$enableval,
-       enable_warning=$dft_warning)
-
 AC_MSG_CHECKING([for --enable-warning])
 if test "x$enable_warning" = xyes; then
-  dnl  Basically, we disable/overule X_CFLAGS, i.e., "-Werror" and some 
"-Wno-*".
-  dnl  All warnings should be on by default (see above).
-  case $GCC-$host_os in
-  yes-*)
-       dnl  GNU (gcc/g++)
-       X_CFLAGS="-pedantic -Wno-long-long"
-       ;;
-  -linux*)
-       dnl  Intel ([ie]cc/[ie]cpc on Linux)
-       X_CFLAGS=""
-       ;;
-  esac
-  AC_MSG_RESULT([yes: ${X_CFLAGS}])
+       dnl  Basically, we disable/overule X_CFLAGS, i.e., "-Werror" and some 
"-Wno-*".
+       dnl  All warnings should be on by default (see above).
+       case $GCC-$host_os in
+               yes-*)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to