Skip to content

Commit

Permalink
(build) bug fix with -DHAVE_CONFIG_H causing build failure on Mac OS
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljprice committed Nov 29, 2024
1 parent d8c319f commit 10a01fd
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 170 deletions.
3 changes: 0 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ distcleancheck_listfiles = \
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
Expand Down Expand Up @@ -272,9 +271,7 @@ ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FC = @FC@
FCFLAGS = @FCFLAGS@
FCFLAGS_F = @FCFLAGS_F@
FC_CFLAGS = @FC_CFLAGS@
FC_DEFINE = @FC_DEFINE@
FC_LIBS = @FC_LIBS@
FGREP = @FGREP@
FT_CFLAGS = @FT_CFLAGS@
Expand Down
143 changes: 1 addition & 142 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,6 @@ LT_CURRENT
GIZA_VERSION_MICRO
GIZA_VERSION_MINOR
GIZA_VERSION_MAJOR
AM_FCFLAGS
FC_DEFINE
FCFLAGS_F
ac_ct_FC
FCFLAGS
FC
Expand Down Expand Up @@ -4980,145 +4977,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu

ac_config_headers="$ac_config_headers config.h"

#
# following 3 lines are to fix a bug where -DHAVE_CONFIG_H should not be passed to libtool on Mac OS
#

ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_fc_compiler_gnu
ac_fc_pp_define_srcext_save=$ac_fc_srcext
ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_fc_compiler_gnu
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran flag to compile preprocessed .F files" >&5
printf %s "checking for Fortran flag to compile preprocessed .F files... " >&6; }
if test ${ac_cv_fc_pp_srcext_F+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_ext=F
ac_fcflags_pp_srcext_save=$ac_fcflags_srcext
ac_fcflags_srcext=
ac_cv_fc_pp_srcext_F=unknown
case $ac_ext in #(
[fF]77) ac_try=f77-cpp-input;; #(
*) ac_try=f95-cpp-input;;
esac
for ac_flag in none -ftpp -fpp -Tf "-fpp -Tf" -xpp=fpp -Mpreprocess "-e Z" \
-cpp -xpp=cpp -qsuffix=cpp=F "-x $ac_try" +cpp -Cpp; do
test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
cat > conftest.$ac_ext <<_ACEOF
program main

#if 0
#include <ac_nonexistent.h>
choke me
#endif
end
_ACEOF
if ac_fn_fc_try_compile "$LINENO"
then :
cat > conftest.$ac_ext <<_ACEOF
program main

#if 1
#include <ac_nonexistent.h>
choke me
#endif
end
_ACEOF
if ac_fn_fc_try_compile "$LINENO"
then :

else case e in #(
e) ac_cv_fc_pp_srcext_F=$ac_flag; break ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
done
rm -f conftest.$ac_objext conftest.F
ac_fcflags_srcext=$ac_fcflags_pp_srcext_save
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_pp_srcext_F" >&5
printf "%s\n" "$ac_cv_fc_pp_srcext_F" >&6; }
if test "x$ac_cv_fc_pp_srcext_F" = xunknown; then
as_fn_error $? "Fortran could not compile preprocessed .F files" "$LINENO" 5
else
ac_fc_srcext=F
if test "x$ac_cv_fc_pp_srcext_F" = xnone; then
ac_fcflags_srcext=""
FCFLAGS_F=""
else
ac_fcflags_srcext=$ac_cv_fc_pp_srcext_F
FCFLAGS_F=$ac_cv_fc_pp_srcext_F
fi


fi
ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_fc_compiler_gnu

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to define symbols for preprocessed Fortran" >&5
printf %s "checking how to define symbols for preprocessed Fortran... " >&6; }
if test ${ac_cv_fc_pp_define+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_fc_pp_define_srcext_save=$ac_fc_srcext
ac_cv_fc_pp_define=unknown
ac_fc_pp_define_FCFLAGS_save=$FCFLAGS
for ac_flag in -D -WF,-D -Wp,-D -Wc,-D
do
FCFLAGS="$ac_fc_pp_define_FCFLAGS_save ${ac_flag}FOOBAR ${ac_flag}ZORK=42"
cat > conftest.$ac_ext <<_ACEOF
program main

#ifndef FOOBAR
choke me
#endif
#if ZORK != 42
choke me
#endif
end
_ACEOF
if ac_fn_fc_try_compile "$LINENO"
then :
ac_cv_fc_pp_define=$ac_flag
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test x"$ac_cv_fc_pp_define" != xunknown && break
done
FCFLAGS=$ac_fc_pp_define_FCFLAGS_save
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_pp_define" >&5
printf "%s\n" "$ac_cv_fc_pp_define" >&6; }
ac_fc_srcext=$ac_fc_pp_define_srcext_save
if test "x$ac_cv_fc_pp_define" = xunknown; then
FC_DEFINE=
as_fn_error 77 "Fortran does not allow to define preprocessor symbols" "$LINENO" 5
else
FC_DEFINE=$ac_cv_fc_pp_define

fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

AM_FCFLAGS="-cpp"

#
# set giza version
#
Expand Down Expand Up @@ -8924,6 +8782,7 @@ func_stripname_cnf ()




# Set options
# Check whether --enable-shared was given.
if test ${enable_shared+y}
Expand Down
6 changes: 0 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ AC_PROG_CC
AC_PROG_FC
AC_CONFIG_HEADERS([config.h])
#
# following 3 lines are to fix a bug where -DHAVE_CONFIG_H should not be passed to libtool on Mac OS
#
AC_FC_PP_DEFINE
AM_FCFLAGS="-cpp"
AC_SUBST([AM_FCFLAGS])
#
# set giza version
#
AC_SUBST(GIZA_VERSION_MAJOR,giza_version_major)
Expand Down
7 changes: 5 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ libgiza_la_CPPFLAGS = $(X11_CFLAGS) $(CAIRO_CFLAGS) $(FT_CFLAGS) $(FC_CFLAGS)

libcpgplot_la_CPPFLAGS = $(libgiza_la_CPPFLAGS)

libpgplot_la_CPPFLAGS = $(libgiza_la_CPPFLAGS)

libgiza_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-no-undefined $(X11_LIBS) $(CAIRO_LIBS) $(FT_LIBS) $(FC_LIBS)

Expand All @@ -50,6 +48,11 @@ libcpgplot_la_LDFLAGS = $(libgiza_la_LDFLAGS) -lgiza -static

libpgplot_la_SOURCES = giza-fortran.F90 giza-pgplot.f90

# fix issue with -DHAVE_CONFIG_H being passed incorrectly to libtool
libpgplot_la_FCFLAGS = $(AM_FCFLAGS)
libpgplot_la_FFLAGS = $(AM_FFLAGS)
libpgplot_la_CPPFLAGS = $(AM_CPPFLAGS)

libpgplot_la_LDFLAGS = $(libcpgplot_la_LDFLAGS) -static

include_HEADERS = cpgplot.h giza.h giza-shared.h giza-version.h giza-fortran.F90
Expand Down
21 changes: 13 additions & 8 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ libgiza_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libgiza_la_LDFLAGS) $(LDFLAGS) -o $@
libpgplot_la_LIBADD =
am_libpgplot_la_OBJECTS = libpgplot_la-giza-fortran.lo giza-pgplot.lo
am_libpgplot_la_OBJECTS = libpgplot_la-giza-fortran.lo \
libpgplot_la-giza-pgplot.lo
libpgplot_la_OBJECTS = $(am_libpgplot_la_OBJECTS)
libpgplot_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \
$(libpgplot_la_LDFLAGS) $(LDFLAGS) -o $@
$(LIBTOOLFLAGS) --mode=link $(FCLD) $(libpgplot_la_FCFLAGS) \
$(FCFLAGS) $(libpgplot_la_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
Expand Down Expand Up @@ -362,7 +363,6 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
Expand Down Expand Up @@ -390,9 +390,7 @@ ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FC = @FC@
FCFLAGS = @FCFLAGS@
FCFLAGS_F = @FCFLAGS_F@
FC_CFLAGS = @FC_CFLAGS@
FC_DEFINE = @FC_DEFINE@
FC_LIBS = @FC_LIBS@
FGREP = @FGREP@
FT_CFLAGS = @FT_CFLAGS@
Expand Down Expand Up @@ -538,13 +536,17 @@ libgiza_la_SOURCES = giza-annotate.c giza-arrow-style.c giza-arrow.c giza-axis.c

libgiza_la_CPPFLAGS = $(X11_CFLAGS) $(CAIRO_CFLAGS) $(FT_CFLAGS) $(FC_CFLAGS)
libcpgplot_la_CPPFLAGS = $(libgiza_la_CPPFLAGS)
libpgplot_la_CPPFLAGS = $(libgiza_la_CPPFLAGS)
libgiza_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-no-undefined $(X11_LIBS) $(CAIRO_LIBS) $(FT_LIBS) $(FC_LIBS)

libcpgplot_la_SOURCES = giza-cpgplot.c
libcpgplot_la_LDFLAGS = $(libgiza_la_LDFLAGS) -lgiza -static
libpgplot_la_SOURCES = giza-fortran.F90 giza-pgplot.f90

# fix issue with -DHAVE_CONFIG_H being passed incorrectly to libtool
libpgplot_la_FCFLAGS = $(AM_FCFLAGS)
libpgplot_la_FFLAGS = $(AM_FFLAGS)
libpgplot_la_CPPFLAGS = $(AM_CPPFLAGS)
libpgplot_la_LDFLAGS = $(libcpgplot_la_LDFLAGS) -static
include_HEADERS = cpgplot.h giza.h giza-shared.h giza-version.h giza-fortran.F90
pkgconfigdir = $(libdir)/pkgconfig
Expand Down Expand Up @@ -731,7 +733,7 @@ am--depfiles: $(am__depfiles_remade)
$(AM_V_PPFC)$(LTPPFCCOMPILE) -c -o $@ $<

libpgplot_la-giza-fortran.lo: giza-fortran.F90
$(AM_V_PPFC)$(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpgplot_la_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o libpgplot_la-giza-fortran.lo `test -f 'giza-fortran.F90' || echo '$(srcdir)/'`giza-fortran.F90
$(AM_V_PPFC)$(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpgplot_la_CPPFLAGS) $(CPPFLAGS) $(libpgplot_la_FCFLAGS) $(FCFLAGS) -c -o libpgplot_la-giza-fortran.lo `test -f 'giza-fortran.F90' || echo '$(srcdir)/'`giza-fortran.F90

.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
Expand Down Expand Up @@ -1274,6 +1276,9 @@ libgiza_la-giza-itf.lo: giza-itf.c
.f90.lo:
$(AM_V_FC)$(LTFCCOMPILE) -c -o $@ $<

libpgplot_la-giza-pgplot.lo: giza-pgplot.f90
$(AM_V_FC)$(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(FC) $(libpgplot_la_FCFLAGS) $(FCFLAGS) -c -o libpgplot_la-giza-pgplot.lo `test -f 'giza-pgplot.f90' || echo '$(srcdir)/'`giza-pgplot.f90

mostlyclean-libtool:
-rm -f *.lo

Expand Down
3 changes: 0 additions & 3 deletions test/C/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
Expand Down Expand Up @@ -331,9 +330,7 @@ ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FC = @FC@
FCFLAGS = @FCFLAGS@
FCFLAGS_F = @FCFLAGS_F@
FC_CFLAGS = @FC_CFLAGS@
FC_DEFINE = @FC_DEFINE@
FC_LIBS = @FC_LIBS@
FGREP = @FGREP@
FT_CFLAGS = @FT_CFLAGS@
Expand Down
4 changes: 1 addition & 3 deletions test/F90/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) -I../../src
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
Expand Down Expand Up @@ -211,9 +210,7 @@ ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FC = @FC@
FCFLAGS = @FCFLAGS@
FCFLAGS_F = @FCFLAGS_F@
FC_CFLAGS = @FC_CFLAGS@
FC_DEFINE = @FC_DEFINE@
FC_LIBS = @FC_LIBS@
FGREP = @FGREP@
FT_CFLAGS = @FT_CFLAGS@
Expand Down Expand Up @@ -324,6 +321,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_FCFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) -I../../src
AM_LDFLAGS = -no-install
LDADD = ../../src/libpgplot.la
CLEANFILES = *.png
Expand Down
3 changes: 0 additions & 3 deletions test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ am__relativize = \
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
Expand Down Expand Up @@ -213,9 +212,7 @@ ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FC = @FC@
FCFLAGS = @FCFLAGS@
FCFLAGS_F = @FCFLAGS_F@
FC_CFLAGS = @FC_CFLAGS@
FC_DEFINE = @FC_DEFINE@
FC_LIBS = @FC_LIBS@
FGREP = @FGREP@
FT_CFLAGS = @FT_CFLAGS@
Expand Down

0 comments on commit 10a01fd

Please sign in to comment.