Mac OS X -module (was Re: Confusion about use of G2)

Peter O'Gorman peter at pogma.com
Tue Oct 4 12:21:41 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter O'Gorman wrote:
| If you look at configure.in, you'll see a god awful hack to change the
| value
| of archive_cmds on darwin after libtool is generated. I put the hack in
| there in preference to changing lots and lots of Makefile.am's. If you want
| to change the Makefiles so that the loadable module only contains the file
| which has the gnc_module_init functions and it links to all shared
| library's
| needed so that there are no undefined symbols anywhere (I believe this
| would
| also greatly improve the chances of a working windows build), that will
| solve the problem.
|
| I suggest the short term hack of adding to the ugly sed hack in
| configure to
| set libtool's "module_cmds" var to nothing. eg. -e
| 's,^module_cmds=.*,module_cmds=,g' or something, this will make the build
| better on OS X. I don't understand how you aremanaging to build on OS X at
| the moment though.

Love replying to myself, do it all the time :)

I see that this mail is rather hard to follow (i.e. it makes no sense), so I
hope to make some sense of it, while attaching a patch. I don't post the
patch to -patches because a) I don't think I am subsribed to patches anymore
and b) these patches need discussion, one of them is a simple reversion of
one of Neil's.

First to libtool's warning about linking the loadable module foo crap. If,
for example. we have libgncmod-bar and it consists of file gncmodbar.c
reallycoolcode.c greatsharedcode.c and barstuff.c and we currently make just
one library that is both runtime loaded and linked then it needs, at some
point, to be changed to libgncmod-bar and libgncshared-bar with the code
that is only needed by the loadable module in the former, with the cool
shared code in the latter. The former can have the -module flag and the
latter not. This will then allow the ugly configure time libtool hack on
darwin to go away.

Now for the inline commented patch...
? bin
Index: configure.in
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/configure.in,v
retrieving revision 1.359.2.64
diff -u -3 -p -u -r1.359.2.64 configure.in
- --- configure.in	1 Oct 2005 17:54:25 -0000	1.359.2.64
+++ configure.in	4 Oct 2005 15:48:09 -0000
@@ -159,9 +159,8 @@ AC_SUBST(DL_LIB)

~ # Some systems (MacOS) require -lintl
~ # not true for darwin 10.3 - halts the build.
- -#AC_SEARCH_LIBS(gettext, intl, ,[
- -#	AC_MSG_ERROR([Cannot find gettext -- do you need to build -lintl?])], )
- -
+AC_SEARCH_LIBS(gettext, intl, ,[
+       AC_MSG_ERROR([Cannot find gettext -- do you need to build -lintl?])], )

I don't understand why you removed this, it causes no problems for me, and
once it fixed something...

~ AC_MSG_CHECKING(for darwin)
~ case $host_os in
~ 	rhapsody* | darwin1*)
@@ -170,28 +169,19 @@ case $host_os in
~ update to latest  darwin])
~ 		;;
~ 	darwin*)
- -     dnl Use fink under MacOS X to find popt
- -     AC_MSG_CHECKING(for fink support)
- -     if test -d "/sw/lib" -a -d "/sw/include"; then
- -        AM_CFLAGS="$AM_CFLAGS -I/sw/include"
- -        LDFLAGS="$LDFLAGS -L/sw/lib"
- -        AC_MSG_RESULT(yes)
- -    else
- -        AC_MSG_RESULT(no)
- -    fi
- -    AC_CHECK_HEADERS(popt.h)


I have major issues with this. One is that /sw is simply the defauslt
install prefix for fink, it is not necessarily the one the user chose.
Another is that AC_CHECK_HEADERS takes no notice whatever of AM_CFLAGS, so
the whole thing is pointless. The user is expected to specify the location
of headers and libraries when they are installed in non-standard places with
CPPFLAGS and LDFLAGS.

~ 		AC_MSG_RESULT([yes, patching libtool to always build dylibs])
~ 		mv libtool libtool.old
~ 		sed -e 's/^deplibs_check_method.*/deplibs_check_method=pass_all/g' \
~ 			-e 's|^archive_cmds.*|archive_cmds="$CC -dynamiclib
\\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs\\$linker_flags
- -install_name \\$rpath/\\$soname \\$verstring"|g' \
~ 			-e
's|^library_names_spec.*|library_names_spec="\\$libname\\$release\\$versuffix.dylib
\\$libname\\$release\\${major}.dylib \\$libname.dylib"|g' \
~ 			-e 's|^soname_spec.*|soname_spec="\\$libname\\$release\\$major.dylib"|g' \
+                       -e 's|^module_cmds=.*|module_cmds=|g' \

I don't understand how you've been building on Mac OS X, hampton kindly
removed some dupliacte symbol definitions for me yesterday which allowed my
build to finish. Resetting module_cmds to the empty string makes libtool use
the archive_cmds that we set above...

< libtool.old > libtool
~ 		rm libtool.old
- -		;;
+               ;;
~ 	*)
~ 		AC_MSG_RESULT(no)
- -		;;	
+               ;;
~ esac


@@ -1001,14 +991,6 @@ then
~         fi
~     fi
~     AS_SCRUB_INCLUDE(GTKHTML_CFLAGS)
- -dnl if Mac OSX, also scrub /sw/include
- -dnl GIVEN_CFLAGS=$(echo $GIVEN_CFLAGS | sed -e "s;-I/sw/include ;;" | sed
- -e "s;-I/sw/include$;;")
- -case $host_os in
- -	darwin*)
- -		GTKHTML_CFLAGS=$(echo $GTKHTML_CFLAGS | sed -e "s;-I/sw/include ;;" | sed
- -e "s;-I/sw/include$;;")
- -		GTKHTML_CFLAGS=$(echo $GTKHTML_CFLAGS | sed -e "s;-I/sw/include/gtkhtml
;;" | sed -e "s;-I/sw/includ/gtkhtmle$;;")
- -		;;
- -esac

Why are you scrubbing these, did you see an actual problem?


~     AC_SUBST(GTKHTML_CFLAGS)
~     AC_SUBST(GTKHTML_LIBS)

Index: lib/goffice/graph/plugins/plot_radar/gog-radar.c
===================================================================
RCS file:
/home/cvs/cvsroot/gnucash/lib/goffice/graph/plugins/plot_radar/Attic/gog-radar.c,v
retrieving revision 1.1.4.1
diff -u -3 -p -u -r1.1.4.1 gog-radar.c
- --- lib/goffice/graph/plugins/plot_radar/gog-radar.c	24 Apr 2005 00:34:53
- -0000	1.1.4.1
+++ lib/goffice/graph/plugins/plot_radar/gog-radar.c	4 Oct 2005 15:48:09 -0000
@@ -295,7 +295,7 @@ typedef GogPlotView		GogRadarView;
~ typedef GogPlotViewClass	GogRadarViewClass;

~ static double
- -fmin (double a, double b)
+gog_fmin (double a, double b)

I built using gcc-4.0 and --disable-error-on-warning and this was the only
place I saw an actual error. I've got a system fmin and gcc-4.0 complains
about static declaration after non-static. Since this is an actual error,
and even though I know this is an imported source, I'd appreciate this minor
change being made so that gcc-4.0 compilation is possible without patching.


~ {
~ 	return (a < b) ? a : b;
~ }
@@ -312,7 +312,7 @@ gog_radar_view_render (GogView *view, Go

~ 	map = gog_axis_map_new (GOG_PLOT (model)->axis[GOG_AXIS_RADIAL],
~ 				0.,
- -				fmin (view->allocation.h, view->allocation.w) / 2.0);
+				gog_fmin (view->allocation.h, view->allocation.w) / 2.0);

~ 	if (!gog_axis_map_is_valid (map)) {
~ 		gog_axis_map_free (map);
@@ -388,7 +388,7 @@ gog_radar_view_info_at_point (GogView *v
~ 			      GogObject const *cur_selection,
~ 			      GogObject **obj, char **name)
~ {
- -	double radius = fmin (view->allocation.h, view->allocation.w)/2.0;
+	double radius = gog_fmin (view->allocation.h, view->allocation.w)/2.0;

~ 	x -= view->allocation.x + view->allocation.w/2.;
~ 	y -= view->allocation.y + view->allocation.h/2.;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)

iQCVAwUBQ0KsFbiDAg3OZTLPAQKzvgP8ConS44DXi3f0BgvM/NFj0AaJ6ClpIfld
Z3uH2yR6EAkSkC0FeZbs/j8SPy5orpEr0omwliTW7oVxbFtpP0iAPE8NI54w8Aek
HLlW7KYDTkguQFeU/4OET736UmxN2dHRGzaglNr/cUTEXt16+iL2jiz8Xf7zqKjW
ZWfdkA2AsPs=
=WiQi
-----END PGP SIGNATURE-----
-------------- next part --------------
? bin
Index: configure.in
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/configure.in,v
retrieving revision 1.359.2.64
diff -u -3 -p -u -r1.359.2.64 configure.in
--- configure.in	1 Oct 2005 17:54:25 -0000	1.359.2.64
+++ configure.in	4 Oct 2005 15:48:09 -0000
@@ -159,9 +159,8 @@ AC_SUBST(DL_LIB)
 
 # Some systems (MacOS) require -lintl
 # not true for darwin 10.3 - halts the build.
-#AC_SEARCH_LIBS(gettext, intl, ,[
-#	AC_MSG_ERROR([Cannot find gettext -- do you need to build -lintl?])], )
-
+AC_SEARCH_LIBS(gettext, intl, ,[
+       AC_MSG_ERROR([Cannot find gettext -- do you need to build -lintl?])], )
 AC_MSG_CHECKING(for darwin)
 case $host_os in
 	rhapsody* | darwin1*)
@@ -170,28 +169,19 @@ case $host_os in
 update to latest  darwin])
 		;;
 	darwin*)
-     dnl Use fink under MacOS X to find popt
-     AC_MSG_CHECKING(for fink support)
-     if test -d "/sw/lib" -a -d "/sw/include"; then
-        AM_CFLAGS="$AM_CFLAGS -I/sw/include"
-        LDFLAGS="$LDFLAGS -L/sw/lib"
-        AC_MSG_RESULT(yes)
-    else
-        AC_MSG_RESULT(no)
-    fi
-    AC_CHECK_HEADERS(popt.h)
 		AC_MSG_RESULT([yes, patching libtool to always build dylibs])
 		mv libtool libtool.old
 		sed -e 's/^deplibs_check_method.*/deplibs_check_method=pass_all/g' \
 			-e 's|^archive_cmds.*|archive_cmds="$CC -dynamiclib \\$allow_undefined_flag -o \\$lib \\$libobjs \\$deplibs\\$linker_flags -install_name \\$rpath/\\$soname \\$verstring"|g' \
 			-e 's|^library_names_spec.*|library_names_spec="\\$libname\\$release\\$versuffix.dylib \\$libname\\$release\\${major}.dylib \\$libname.dylib"|g' \
 			-e 's|^soname_spec.*|soname_spec="\\$libname\\$release\\$major.dylib"|g' \
+                       -e 's|^module_cmds=.*|module_cmds=|g' \
 			< libtool.old > libtool
 		rm libtool.old
-		;;
+               ;;
 	*)
 		AC_MSG_RESULT(no)
-		;;	
+               ;;
 esac
 
 
@@ -1001,14 +991,6 @@ then
         fi
     fi
     AS_SCRUB_INCLUDE(GTKHTML_CFLAGS)
-dnl if Mac OSX, also scrub /sw/include
-dnl GIVEN_CFLAGS=$(echo $GIVEN_CFLAGS | sed -e "s;-I/sw/include ;;" | sed -e "s;-I/sw/include$;;")
-case $host_os in
-	darwin*)
-		GTKHTML_CFLAGS=$(echo $GTKHTML_CFLAGS | sed -e "s;-I/sw/include ;;" | sed -e "s;-I/sw/include$;;")
-		GTKHTML_CFLAGS=$(echo $GTKHTML_CFLAGS | sed -e "s;-I/sw/include/gtkhtml ;;" | sed -e "s;-I/sw/includ/gtkhtmle$;;")
-		;;
-esac
     AC_SUBST(GTKHTML_CFLAGS)
     AC_SUBST(GTKHTML_LIBS)
 
Index: lib/goffice/graph/plugins/plot_radar/gog-radar.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/lib/goffice/graph/plugins/plot_radar/Attic/gog-radar.c,v
retrieving revision 1.1.4.1
diff -u -3 -p -u -r1.1.4.1 gog-radar.c
--- lib/goffice/graph/plugins/plot_radar/gog-radar.c	24 Apr 2005 00:34:53 -0000	1.1.4.1
+++ lib/goffice/graph/plugins/plot_radar/gog-radar.c	4 Oct 2005 15:48:09 -0000
@@ -295,7 +295,7 @@ typedef GogPlotView		GogRadarView;
 typedef GogPlotViewClass	GogRadarViewClass;
 
 static double
-fmin (double a, double b)
+gog_fmin (double a, double b)
 {
 	return (a < b) ? a : b;
 }
@@ -312,7 +312,7 @@ gog_radar_view_render (GogView *view, Go
 
 	map = gog_axis_map_new (GOG_PLOT (model)->axis[GOG_AXIS_RADIAL], 
 				0.,
-				fmin (view->allocation.h, view->allocation.w) / 2.0);
+				gog_fmin (view->allocation.h, view->allocation.w) / 2.0);
 	
 	if (!gog_axis_map_is_valid (map)) {
 		gog_axis_map_free (map);
@@ -388,7 +388,7 @@ gog_radar_view_info_at_point (GogView *v
 			      GogObject const *cur_selection,
 			      GogObject **obj, char **name)
 {
-	double radius = fmin (view->allocation.h, view->allocation.w)/2.0;
+	double radius = gog_fmin (view->allocation.h, view->allocation.w)/2.0;
 
 	x -= view->allocation.x + view->allocation.w/2.;
 	y -= view->allocation.y + view->allocation.h/2.;


More information about the gnucash-devel mailing list