autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: issue with AC_CHECK_LIB...


From: Bob Friesenhahn
Subject: Re: issue with AC_CHECK_LIB...
Date: Wed, 30 Jun 2004 17:52:49 -0500 (CDT)

On Wed, 30 Jun 2004, Chris Bowlby wrote:

Hi Bob,

That would explain why that was not working, though I do see other application that are using that method with success, which is where I got the idea from. Would you be able to provide me with an example on how I could link in the function into the configure.ac file (I can write the function, but I'm not certain how to link that into the test system). Where would I need to store that function in order for it to be called?

I was going to suggest using AC_TRY_LINK but for some reason I can't find it in the Autoconf documentation anymore. Instead I see a AC_LINK_IFELSE macro which must be used in conjunction with AC_LANG_PROGRAM. Maybe AC_TRY_LINK has been retired.

Unfortunately, I do not have time to write an example. I think that almost any compilable code fragment which lacks a main routine will serve as a test. You would temporarily add the library to be tested to LIBS. If you have a successful link, then a main() routine was found somewhere.

This special case seems to occur often so perhaps Autoconf should provide a macro to support it, or substitute different code if the function name tested is 'main'.

Bob



At 06:10 PM 6/30/2004, Bob Friesenhahn wrote:
Sorry, you can not test for the function "main" in a library using AC_CHECK_LIB. That is probably the only function you can not test for. The reason is that AC_CHECK_LIB writes a test program which provides its own main.

You could write your own test program which is missing a main() function and try compiling/linking it instead.

Bob

On Wed, 30 Jun 2004, Chris Bowlby wrote:

Hi All,

I've been pegging away with a configure script for the last month or so and feel that I'm getting a good understanding of how things are working, however I've got one issue that I've been trying to figure out for the last few hours and I've tried every suggestion I could find on the net. My issue is that I'm trying to use:

AC_CHECK_LIB([stlport_gcc], [main])
AC_CHECK_LIB([pqxx], [main])

within the configure script, defining:

SRCH_INC="/usr/local/include /usr/include"
SRCH_LIB="/usr/local/lib /usr/lib"

#
# Include directories
#
ac_save_IFS=$IFS
IFS="${IFS}:"
# SRCH_INC comes from the template file
for dir in $with_includes $SRCH_INC; do
 if test -d "$dir"; then
   INCLUDES="$INCLUDES -I$dir"
 else
   AC_MSG_WARN([*** Include directory $dir does not exist.])
 fi
done
IFS=$ac_save_IFS
AC_SUBST(INCLUDES)


#
# Library directories
#
ac_save_IFS=$IFS
IFS="${IFS}:"
# LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
for dir in $LIBRARY_DIRS $SRCH_LIB; do
 if test -d "$dir"; then
   LIBDIRS="$LIBDIRS -L$dir"
 else
   AC_MSG_WARN([*** Library directory $dir does not exist.])
 fi
done
IFS=$ac_save_IFS

CPPFLAGS="$CPPFLAGS $INCLUDES"
LDFLAGS="$LDFLAGS $LIBDIRS"

AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])

before I even process the check lib macro's. No matter what I do I always get:

checking for main in -lstlport_gcc... no
checking for main in -lpqxx... no

And I know the files are located within the path stucture defined by the library search path before I call AC_CHECK_LIB.

ls -al /usr/local/lib/libpqxx*
-rwxr-xr-x 1 root wheel 7265864 Jun 30 11:36 /usr/local/lib/libpqxx-2.2.3.so -rw-r--r-- 1 root wheel 15174818 Jun 30 11:36 /usr/local/lib/libpqxx.a -rwxr-xr-x 1 root wheel 865 Jun 30 11:36 /usr/local/lib/libpqxx.la lrwxr-xr-x 1 root wheel 16 Jun 30 11:36 /usr/local/lib/libpqxx.so -> libpqxx-2.2.3.so


ls -al /usr/local/lib/libstlport*
-rwxr-xr-x 1 root wheel 1586106 Jun 30 11:02 /usr/local/lib/libstlport_gcc.a lrwxr-xr-x 1 root wheel 21 Jun 30 11:02 /usr/local/lib/libstlport_gcc.so -> libstlport_gcc.so_4_5 -rwxr-xr-x 1 root wheel 684045 Jun 30 11:02 /usr/local/lib/libstlport_gcc.so_4_5 -rwxr-xr-x 1 root wheel 15271126 Jun 30 11:02 /usr/local/lib/libstlport_gcc_stldebug.a lrwxr-xr-x 1 root wheel 30 Jun 30 11:02 /usr/local/lib/libstlport_gcc_stldebug.so -> libstlport_gcc_stldebug.so_4_5 -rwxr-xr-x 1 root wheel 7392400 Jun 30 11:02 /usr/local/lib/libstlport_gcc_stldebug.so_4_5

I am royally stuck as I can not compile my app due to missing references, this worked a few days ago, but today it does not.... Does anyone have any suggestions?




_______________________________________________
Autoconf mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/autoconf

======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen




======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]