question regarding enabling libpthread in the configure

W. Tasin tasin at fhm.edu
Tue Nov 27 08:23:38 GMT 2001


Ivica Bukvic wrote:

>Hi all, does anyone know what is the Linux configure's flag for enabling
>libpthread, so that my resulting makefile has LIBPTHREAD =
><path-to-lpthread>/libpthread.a? I am using Kdevelop and it has
>configure implemented as a part of the project and the creates
>Makefile.am, .in and eventually Makefile itself, so storing this kind of
>info in those files would only result in a temporary fix.
>
>I've tried ./configure --enable-libpthread  or --enable--lpthread etc.
>and none worked. My line in Makefile still reads LIBPTHREAD =
>@LIBPTHREAD@ and unless I hack it myself after the ./configure has been
>done, it fails to compile the app. Any help would be greatly
>appreciated! Sincerely,
>
>Ivica Bukvic
>

Hi,

first it depends on the project type (is it a KDE/gnome/terminal-app) 
and then on the KDevelop version.

To shorten this reply I assume you have the actual version of KDevelop 
2.0.2 and you have created your project with it, so your project has a 
admin directory in which you find an acinclude.m4.in file.

Now the decision if you want to use QT (and KDE) with threading or 
"plain" pthreading.
On new KDE/QT projects the thread flags are already implemented. Simply 
invoke configure --help and you should find:
...
  --disable-mt             link to non-threaded Qt (deprecated)
  --enable-kernel-threads Enable the use of the LinuxThreads port on 
FreeBSD/i386 only.
  --disable-threading     disables threading even if libpthread found
...
If you didn't you would have an old version of the autoconf stuff in 
your project.


Now the other case: "plain" pthreading on terminal apps:
There you have to modify the configure.in.in (adding 2 lines). The best 
way IMHO to activate threading on it would be to use the 
KDE_CHECK_THREADING macro of acinclude.m4.in:
--- configure.in.in ----
...
dnl activate the next macro call for DLOPEN tests and setting LIBDL
dnl   (n.b. KDE_MISC_TESTS does the same to you, so use either this or 
the next one)
KDE_CHECK_DLOPEN

dnl activate the next macro call for some additional tests
dnl   (compat, crypt, socket, nsl, dlopen, ...)
dnl KDE_MISC_TESTS

KDE_CHECK_THREADING
CPPFLAGS="$USE_THREADS $CPPFLAGS"

KDE_CHECK_EXTRA_LIBS
all_libraries="$all_libraries $USER_LDFLAGS"
...
------------------------------

Invoke Build-->Autoconf/automake after that "configure --help" should 
output:
...
  --enable-kernel-threads Enable the use of the LinuxThreads port on 
FreeBSD/i386 only.
  --disable-threading     disables threading even if libpthread found
...

If you see this on the help screen threading is activated for the 
Makefiles. The last step is to activate the linkage of $(LIBPTHREAD).
There are two ways to do so:
Either add it by "Project->Options->Linker Options->Additional libs" and 
insert the string $(LIBPTHREAD)
[limitation: only the directory of main.cpp links against -lpthread]

Or add it by changing a line inside configure.in.in:
----
...
all_libraries="$all_libraries $LIBPTHREAD $USER_LDFLAGS"
...
----
[limitation: every subdirectory's Makefile.am has to have the string 
$(all_libraries) in either xxxx_LDFLAGS= or xxx_LIBADD= set]


HTH, Ciao

Walter

-- 
The KDevelop project: tasin at kdevelop.de [www.kdevelop.org]
--
oohhh sveglia.... il mondo e' ammalato, ma x colpa di chi.........
(Zucchero)
:-------W. Tasin, FB 04,FHM-------------------PGP-KeyID:0x7961A645----------:
<Key-Fingerprint: 1610 835F 0080 32F4 6140  6CF7 A7D0 44CD 7961A645>





-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list