You are not logged in.

#1 2022-08-03 20:02:39

PhotonX
Member
From: Munich
Registered: 2008-08-10
Posts: 591

[Solved] Need some help with autoconf

Hi guys,

after I got so much support in https://bbs.archlinux.org/viewtopic.php?id=272687 where I was struggling to port a GTK+ app to GTK2, I am asking for help again. It is still the same project, Lightspeed, but now I am stuck with the configure.ac file. The problem is that it only finds gtkgl correctly if configure is run with the --with_gtkgl_prefix=/usr flag. However, the original GTK+ version didn't need this flag and has found gtkgl (the old 1.x version though) without this flag. I already had a helpful discussion with the maintainer of the gtkglarea package ( https://aur.archlinux.org/packages/gtkg … ent-845180 and above) which pointed me into the right direction (before that I didn't know about this flag, it built successfully without it but only if the ancient gtkglarea1 package was installed...). So now I wonder, if it is possible to adjust the configure.ac such that it works with the generic --prefix flag only and doesn't rely on the --with_gtkgl_prefix flag.

Here is how configure.ac looks like right now: https://github.com/Photon89/lightspeed/ … nfigure.ac As you can see, in lines 61 to 76 it deals with this flag.

Here are my changes from the original GTK+ version of this file to the current version linked above: https://pastebin.com/09V7d8f8 As you can see, I didn't change that much stuff related to gtkgl, so I am puzzled why it doesn't work without the additional flag as it used to work in the GTK+ version... Sorry for the probably quite stupid question, I have almost no experience with autoconf and therefore don't even know where to start searching!

Thanks for any input!
PhotonX

Last edited by PhotonX (2022-08-10 12:40:53)


Desktop: http://www.sysprofile.de/id15562, Arch Linux    |    Notebook: Thinkpad L13 Yoga Gen2, Manjaro

The very worst thing you can do with free software is to download it, see that it doesn't work for some reason, leave it, and tell your friends that it doesn't work.  -  Tuomas Lukka

Offline

#2 2022-08-03 20:36:46

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: [Solved] Need some help with autoconf

The problem is gonna be

GTKGL_CFLAGS="-I$with_gtkgl_prefix/include/gtkgl-2.0"

and if with_gtkgl_prefix is set you want to use that else you want to use a different path, right?

Sidebar, the code probably should™ rather "#include gtkgl-2.0/foo.h", not just "#include foo.h" - at least you need to be careful w/ lumping in random include paths into the overall project because it can easily cause ambiguities/occlusions.

Last edited by seth (2022-08-03 20:37:01)

Offline

#3 2022-08-03 20:45:47

PhotonX
Member
From: Munich
Registered: 2008-08-10
Posts: 591

Re: [Solved] Need some help with autoconf

and if with_gtkgl_prefix is set you want to use that else you want to use a different path, right?

Yes, I think it should be something like $prefix/include/gtkgl-2.0 if $prefix is available at this point. Sooo, is it? smile

Sidebar, the code probably should™ rather "#include gtkgl-2.0/foo.h", not just "#include foo.h" - at least you need to be careful w/ lumping in random include paths into the overall project because it can easily cause ambiguities/occlusions.

I had it in some similar way but looks like it was wrong: https://aur.archlinux.org/packages/gtkg … ent-848134

As you can guess, that's basically me right now: https://miro.medium.com/max/455/1*snTXF … ZKJ6IA.png


Desktop: http://www.sysprofile.de/id15562, Arch Linux    |    Notebook: Thinkpad L13 Yoga Gen2, Manjaro

The very worst thing you can do with free software is to download it, see that it doesn't work for some reason, leave it, and tell your friends that it doesn't work.  -  Tuomas Lukka

Offline

#4 2022-08-03 21:10:21

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: [Solved] Need some help with autoconf

Sooo, is it?

You could test for it and AC_MSG_WARN yourself about the result of the test.

I had it in some similar way but looks like it was wrong

I don't know anything about the substructure of gtkgl-2.0 but since there's apparently gtkgl-2.0/gtkgl/gtkglarea.h it makes sense to #include gtkgl/gtkglarea.h and handle the gtkgl-2.0 at the include path, yes.

Offline

#5 2022-08-04 05:09:15

PhotonX
Member
From: Munich
Registered: 2008-08-10
Posts: 591

Re: [Solved] Need some help with autoconf

Ok, so I tried it. The problem is, $prefix is probably not a good way to define the location of the header files. Say, I want to install Lightspeed in /usr/local, so I run "./configure --prefix=/usr/local" but my libs are in /usr, it will then fail to find them. I am really wondering why it finds all other libraries but complains about the gtkglarea one...


Desktop: http://www.sysprofile.de/id15562, Arch Linux    |    Notebook: Thinkpad L13 Yoga Gen2, Manjaro

The very worst thing you can do with free software is to download it, see that it doesn't work for some reason, leave it, and tell your friends that it doesn't work.  -  Tuomas Lukka

Offline

#6 2022-08-04 05:39:55

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: [Solved] Need some help with autoconf

Libraries? I thought this was about the header?

You could add the default include paths (/usr/{,local}/include/gtkgl-2.0) unconditioanlly and $prefix/include/gtkgl-2.0 if $prefix isn't /usr or /usr/local.
You could also manually test each path for existence and warn/error the user if gtkgl-2.0 cannot be found in any given path.

Offline

#7 2022-08-04 08:45:49

PhotonX
Member
From: Munich
Registered: 2008-08-10
Posts: 591

Re: [Solved] Need some help with autoconf

Sorry, of course I meant the headers (of the libraries).

I would like to better understand how the autoconf stuff works. I mean, for all the other libraries, say, GTK2 or GL, the correct path is being found, but for gtkgl it's not for some reason, though the code in configure.ac looks the same for all of them. What exactly is happening there? Why does gtkgl need default include paths while other libraries don't? And why did it use to work previously with gtkglarea1 but is not broken with gtkglarea?


Desktop: http://www.sysprofile.de/id15562, Arch Linux    |    Notebook: Thinkpad L13 Yoga Gen2, Manjaro

The very worst thing you can do with free software is to download it, see that it doesn't work for some reason, leave it, and tell your friends that it doesn't work.  -  Tuomas Lukka

Offline

#8 2022-08-04 11:59:36

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: [Solved] Need some help with autoconf

/usr/include/gtk-2.0  is found by this macro:

grep -r AM_PATH_GTK_2_0 /usr/share/aclocal

glx.h is fully referenced relative to the global include path (/usr/include)

#include <GL/gl.h>
#include <GL/glx.h>

Unless gtkgl-2.0 provides a similar autoconf macro, you'd have to derive one from the gtk-2.0 one.

Offline

#9 2022-08-04 18:55:08

PhotonX
Member
From: Munich
Registered: 2008-08-10
Posts: 591

Re: [Solved] Need some help with autoconf

Ok, so as there seems to be no suiting autoconf macro for gtkgl-2.0, it should work similarly to glx.h. So I should use the path relative to /usr/include, as I tried originally: https://github.com/Photon89/lightspeed/ … 1c7444fe11 But this way, it failed to find the include

#include <gtkgl/gdkgl.h>

from inside /usr/include/gtkgl-2.0/gtkgl/gtkglarea.h which is part of the gtkglarea package. When I pointed this out on the AUR, I have been told that the error is on my side (see https://aur.archlinux.org/packages/gtkg … ent-845180). So now I am confused again...

Last edited by PhotonX (2022-08-04 18:57:29)


Desktop: http://www.sysprofile.de/id15562, Arch Linux    |    Notebook: Thinkpad L13 Yoga Gen2, Manjaro

The very worst thing you can do with free software is to download it, see that it doesn't work for some reason, leave it, and tell your friends that it doesn't work.  -  Tuomas Lukka

Offline

#10 2022-08-04 19:26:13

seth
Member
Registered: 2012-09-03
Posts: 50,012

Re: [Solved] Need some help with autoconf

Just that  gtkgl-2.0 doesnt't provide an autoconf macro for its detection doesn't mean it's similar to glx.h at all - in particular not if gtkgl/gtkglarea.h itself tries to include files and only references them by "gtkgl/gdkgl.h"
It means that you'll have to implement that detection yourself.

In the most simple case you test for the existence of $prefix/include/gtkgl-2.0/gtkgl/gdkgl.h and if that exists you add $prefix/include/gtkgl-2.0 to the include path.
Else you test for /usr/local/include/gtkgl-2.0/gtkgl/gdkgl.h and if that also doesn't exist for /usr/include/gtkgl-2.0/gtkgl/gdkgl.h and if that also doesn't exist, error out and inform the user about the missing dependency

You could also file a bug against gtkgl-2.0 to have it ship such macro.

Offline

#11 2022-08-05 17:50:22

lambdarch
Member
Registered: 2021-01-10
Posts: 67

Re: [Solved] Need some help with autoconf

You should not set these variables yourself, they should be set from the pkg-config file.
With `PKG_CHECK_MODULES([GTKGL], [gtkgl-2.0])` it builds fine.
If an additional path for the gtkgl (or other) pkg-config file is to be added, it would be better to do `PKG_CONFIG_PATH=$prefix/lib/pkgconfig ./configure`.
But if you want to keep the `--with-gtkgl-prefix` option, you can always put `PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}$with_gtkgl_prefix/lib/pkgconfig"` before `PKG_CHECK_MODULES`, it should work.

Offline

#12 2022-08-09 16:44:06

PhotonX
Member
From: Munich
Registered: 2008-08-10
Posts: 591

Re: [Solved] Need some help with autoconf

@lambdarch That works great, thanks a lot! So, is it correct that now pkgconfig is a makedepend (which doesn't have to be listed explicitly in an AUR package as it is in base-devel, but possibly in other distros' packages or when building by hand)?


Desktop: http://www.sysprofile.de/id15562, Arch Linux    |    Notebook: Thinkpad L13 Yoga Gen2, Manjaro

The very worst thing you can do with free software is to download it, see that it doesn't work for some reason, leave it, and tell your friends that it doesn't work.  -  Tuomas Lukka

Offline

#13 2022-08-09 17:16:51

lambdarch
Member
Registered: 2021-01-10
Posts: 67

Re: [Solved] Need some help with autoconf

In theory I guess so, in practice I never see it specified, I think it's implied.

Offline

#14 2022-08-10 12:40:37

PhotonX
Member
From: Munich
Registered: 2008-08-10
Posts: 591

Re: [Solved] Need some help with autoconf

I see! So, the problem is solved, I guess, thanks again!


Desktop: http://www.sysprofile.de/id15562, Arch Linux    |    Notebook: Thinkpad L13 Yoga Gen2, Manjaro

The very worst thing you can do with free software is to download it, see that it doesn't work for some reason, leave it, and tell your friends that it doesn't work.  -  Tuomas Lukka

Offline

Board footer

Powered by FluxBB