summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2007-06-20 15:50:54 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2007-06-20 15:50:54 (GMT)
commit276a7abba4e7d6b5d5f2b0255bd53a3d0bcbde1a (patch)
tree0b8c5b650ab42a78e579ea09387d27ef9c6f74b8 /c++
parenta3d3090bd0fef91fd442e2daef4d48a5bf6bbd90 (diff)
downloadhdf5-276a7abba4e7d6b5d5f2b0255bd53a3d0bcbde1a.zip
hdf5-276a7abba4e7d6b5d5f2b0255bd53a3d0bcbde1a.tar.gz
hdf5-276a7abba4e7d6b5d5f2b0255bd53a3d0bcbde1a.tar.bz2
[svn-r13890] Purpose: intermediate checkin for offsetof fix for PGI compiler.
Description: added new configuration to generate a pubconf file in the c++/src directory, H5cxx_pubconf.h. When C++ compiler recognizes 'offsetof', the macro H5_CXX_HAVE_OFFSETOF is defined in the new pubconf file. Tested: on kagiso
Diffstat (limited to 'c++')
-rw-r--r--c++/Makefile.in4
-rwxr-xr-xc++/configure257
-rw-r--r--c++/configure.in34
-rw-r--r--c++/src/H5cxx_config.h.in5
4 files changed, 260 insertions, 40 deletions
diff --git a/c++/Makefile.in b/c++/Makefile.in
index 645fdf4..485c240 100644
--- a/c++/Makefile.in
+++ b/c++/Makefile.in
@@ -126,7 +126,7 @@ distclean:
-$(RM) config/commence config/conclude
-$(RM) config/stamp1 config/stamp2 config/depend?
-$(RM) config.cache config.log config.status configure.lineno
- -$(RM) src/H5config.h src/H5pubconf.h
+ -$(RM) src/H5cxx_config.h src/H5cxx_pubconf.h
-$(RM) libtool Makefile so_locations
maintainer-clean:
@@ -135,6 +135,6 @@ maintainer-clean:
@@SETX@; for d in $(SUBDIRS) examples; do \
(cd $$d && $(MAKE) $@); \
done
- -$(RM) config.cache config.log config.status src/H5config.h
+ -$(RM) config.cache config.log config.status src/H5cxx_config.h
-$(RM) configure src/H5config.h.in
diff --git a/c++/configure b/c++/configure
index 5c4089b..bdf9bfa 100755
--- a/c++/configure
+++ b/c++/configure
@@ -1914,6 +1914,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_config_headers="$ac_config_headers src/H5cxx_config.h"
+
+
ac_aux_dir=
for ac_dir in ../bin "$srcdir"/../bin; do
if test -f "$ac_dir/install-sh"; then
@@ -1946,6 +1949,9 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+ac_config_commands="$ac_config_commands default-1"
+
+
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
{ { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
@@ -5499,7 +5505,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5502 "configure"' > conftest.$ac_ext
+ echo '#line 5508 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -6056,7 +6062,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
-if { (eval echo configure:6059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:6065: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
@@ -7931,7 +7937,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 7934 "configure"
+#line 7940 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8029,7 +8035,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8032 "configure"
+#line 8038 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9260,9 +9266,70 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ echo "$as_me:$LINENO: checking for offsetof extension" >&5
+echo $ECHO_N "checking for offsetof extension... $ECHO_C" >&6; }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdio.h>
+ #include <stddef.h>
+int
+main ()
+{
+struct index_st
+ {
+ unsigned char type;
+ unsigned char num;
+ unsigned int len;
+ };
+ typedef struct index_st index_t;
+ int x,y;
+ x = offsetof(struct index_st, len);
+ y = offsetof(index_t, num)
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_OFFSETOF 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
{ echo "$as_me:$LINENO: checking if $CXX needs old style header files in includes" >&5
echo $ECHO_N "checking if $CXX needs old style header files in includes... $ECHO_C" >&6; }
-
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \`config.log' for more details." >&5
@@ -11274,37 +11341,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section. Otherwise,
-# look for a macro that doesn't take arguments.
-ac_script='
-t clear
-:clear
-s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-b any
-:quote
-s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
- g
- s/^\n//
- s/\n/ /g
- p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
-
+DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
@@ -11639,6 +11676,8 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
_ACEOF
@@ -11656,10 +11695,18 @@ Usage: $0 [OPTIONS] [FILE]...
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
Configuration files:
$config_files
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
@@ -11709,7 +11756,16 @@ do
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
- --he | --h | --help | --hel | -h )
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
@@ -11756,6 +11812,11 @@ _ASBOX
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+
+
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
@@ -11764,6 +11825,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
+ "src/H5cxx_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/H5cxx_config.h" ;;
+ "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
"config/depend1") CONFIG_FILES="$CONFIG_FILES config/depend1" ;;
"config/depend2") CONFIG_FILES="$CONFIG_FILES config/depend2" ;;
"config/depend3") CONFIG_FILES="$CONFIG_FILES config/depend3" ;;
@@ -11791,6 +11854,8 @@ done
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
@@ -11995,7 +12060,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF
fi # test -n "$CONFIG_FILES"
-for ac_tag in :F $CONFIG_FILES
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
@@ -12235,11 +12300,127 @@ which seems to be undefined. Please make sure it is defined." >&2;}
*) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
esac
;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+_ACEOF
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+ if test x"$ac_file" != x-; then
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f $ac_file
+ mv "$tmp/config.h" $ac_file
+ fi
+ else
+ echo "/* $configure_input */"
+ cat "$ac_result"
+ fi
+ rm -f "$tmp/out12"
+ ;;
+ :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
esac
+
+ case $ac_file$ac_mode in
+ "default-1":C)
+ echo "creating c++/src/H5cxx_pubconf.h"
+ sed 's/#define /#define H5_CXX_/' <src/H5cxx_config.h |\
+ sed 's/#undef /#undef H5_CXX_/' >pubconf
+ if test ! -f src/H5cxx_pubconf.h; then
+ /bin/mv -f pubconf src/H5cxx_pubconf.h
+ elif (diff pubconf src/H5cxx_pubconf.h >/dev/null); then
+ /bin/rm -f pubconf
+ echo "src/H5cxx_pubconf.h is unchanged"
+ else
+ /bin/mv -f pubconf src/H5cxx_pubconf.h
+ fi
+ ;;
+
+ esac
done # for ac_tag
diff --git a/c++/configure.in b/c++/configure.in
index e31adec..4f079a3 100644
--- a/c++/configure.in
+++ b/c++/configure.in
@@ -30,8 +30,24 @@ dnl release!!!
dnl
AC_INIT([HDF5 C++], [1.6.6-snap21], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5Library.cpp])
+AC_CONFIG_HEADER([src/H5cxx_config.h])
+
AC_CONFIG_AUX_DIR([../bin])
+AC_OUTPUT_COMMANDS([
+ echo "creating c++/src/H5cxx_pubconf.h"
+ sed 's/#define /#define H5_CXX_/' <src/H5cxx_config.h |\
+ sed 's/#undef /#undef H5_CXX_/' >pubconf
+ if test ! -f src/H5cxx_pubconf.h; then
+ /bin/mv -f pubconf src/H5cxx_pubconf.h
+ elif (diff pubconf src/H5cxx_pubconf.h >/dev/null); then
+ /bin/rm -f pubconf
+ echo "src/H5cxx_pubconf.h is unchanged"
+ else
+ /bin/mv -f pubconf src/H5cxx_pubconf.h
+ fi
+])
+
AC_CANONICAL_HOST
AC_SUBST(CPPFLAGS)
@@ -395,6 +411,24 @@ dnl Checks for compiler characteristics.
dnl
AC_LANG_CPLUSPLUS
+AC_MSG_CHECKING([for offsetof extension])
+AC_TRY_COMPILE([#include <stdio.h>
+ #include <stddef.h>],
+ [struct index_st
+ {
+ unsigned char type;
+ unsigned char num;
+ unsigned int len;
+ };
+ typedef struct index_st index_t;
+ int x,y;
+ x = offsetof(struct index_st, len);
+ y = offsetof(index_t, num)],
+ AC_DEFINE([HAVE_OFFSETOF], [1],
+ [Define if the offsetof extension is present])
+ AC_MSG_RESULT([yes]),
+ AC_MSG_RESULT([no]))
+
AC_MSG_CHECKING(if $CXX needs old style header files in includes)
AC_TRY_RUN([
#include <iostream>
diff --git a/c++/src/H5cxx_config.h.in b/c++/src/H5cxx_config.h.in
new file mode 100644
index 0000000..38d38f1
--- /dev/null
+++ b/c++/src/H5cxx_config.h.in
@@ -0,0 +1,5 @@
+/* src/H5cxx_config.h.in Created manually. */
+
+/* Define if offsetof extension is present */
+#undef HAVE_OFFSETOF
+