AC_CHECK_LIB: Library is found on build host but is not on a target host
Hi, I've autoconfiscated an open source project. I don't using still automake, only I am using autoconf. So I've created an confugure.ac as follows: AC_PREREQ([2.65]) AC_INIT([UpTools],[8.4],[bugs-upto...@myuniv.edu]) AM_INIT_AUTOMAKE([foreign -Wall -Werror dist-bzip2]) AC_CONFIG_SRCDIR([UpConf.cc]) AC_CONFIG_HEADERS([config.h]) AC_PROG_CXX AC_PROG_CC AC_LANG([C++]) AC_PROG_RANLIB AC_CHECK_LIB([ssl], [main],[SSL=-lssl],echo "Error: Required library ssl not found. Install openssl development package and try again" && exit 1 ) AC_CHECK_LIB([crypto], [main],[CRYPTO=-lcrypto],echo "Error: Required library crypto not found. Install openssl development package and try again" && exit 1) AC_CHECK_LIB([pq], [main],[PQ=-lpq],echo "Error: Required library pq not found. Install it and try again" && exit 1) AC_CHECK_LIB([pthread], [main],[PTHREAD=-lpthread],echo "Error: Required library pthread not found. Install it and try again" && exit 1) if test -e /usr/lib64/libresolv.a then "echo checking for /usr/lib64/libresolv.a..yes" else if test -e /usr/lib/libresolv.a then echo "checking for /usr/lib/libresolv.a..yes" else echo "It seems libresolv.a is missing. Install the package that provides it" && exit 1 fi fi AC_HEADER_RESOLV AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h]) AC_HEADER_STDBOOL AC_C_INLINE AC_TYPE_SIZE_T AC_FUNC_MKTIME AC_CHECK_FUNCS([gethostbyname localtime_r memmove memset regcomp select socket strcasecmp strerror strncasecmp]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT EOF I've build that on Mandriva 2010.1 and it worked fine. It compiles with no problems. But it's failing to find mysql libraries on a Fedora 9 system even those libraries are installed: ls /usr/lib/mysql/ libdbug.alibmyisammrg.a libmysqlclient_r.so libmysqlclient.so libmystrings.a mysqlbug libheap.alibmysqlclient.alibmysqlclient_r.so.15 libmysqlclient.so.15 libmysys.a mysql_config libmyisam.a libmysqlclient_r.a libmysqlclient_r.so.15.0.0 libmysqlclient.so.15.0.0 libvio.a configure scripts complains: checking for mysql_get_parameters in -lmysqlclient... no Error: Required library mysqlclient not found. Install it and try again Is there somthing wrong with my configure.ac? You can read the config.log on http://pastebin.com/TMk91Rpi Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: AC_CHECK_LIB: Library is found on build host but is not on a target host
2010/8/23 Eric Blake : > On 08/23/2010 02:26 PM, Sergio Belkin wrote: >> >> 2010/8/23 Eric Blake: >>> >>> [please keep the list in the loop] > > [I reiterate - I do NOT want these mails coming only to me, when I have > asked for them to go to the list] Sorry it was not my will send mails to you only :( Either is a fault on gmail or (perhaps?) the mailing list... I *always* have clicked on Reply button... in fact recent now I realize of that, I haven't this problem on other lists > >>> At this point, all I can guess is that you haven't installed the >>> libraries >>> correctly for your system. Can you do a simple command line test (rather >>> than through autoconf) to rule out whether 'gcc ... -lmysqlclient' works >>> in >>> isolation for you? Or maybe you are trying to access a symbol that is >>> exported in newer versions of the library, but not in the version that >>> you >>> have installed? >>> >>> -- >> >> >> Yes I could run: >> >> g++ -o testUpThreadWorkDistributor -ansi -mtune=i686 -march=i686 >> -Iinclude -Wall -Wno-deprecated -g -DDEBUG -ggdb -L/usr/lib/mysql >> testUpThreadWorkDistributor.cc libUpTools.a -lpthread -lmysqlclient >> -lcrypto -lssl /usr/lib/libresolv.a > > Ah - the difference is the presence of -L/usr/lib/mysql in the working > command line. For your configure test to work, you'd also have to provide > that same -L option to LDFLAGS prior to using AC_CHECK_LIB (or the better > AC_SEARCH_LIBS). But I don't understand why... with AC_CHECK_LIB I have no need to use LDFLAGS on Mandriva or Ubuntu... Thanks > > -- > Eric Blake ebl...@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org > -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: AC_CHECK_LIB: Library is found on build host but is not on a target host
2010/8/23 Eric Blake : >>> Ah - the difference is the presence of -L/usr/lib/mysql in the working >>> command line. For your configure test to work, you'd also have to >>> provide >>> that same -L option to LDFLAGS prior to using AC_CHECK_LIB (or the better >>> AC_SEARCH_LIBS). >> >> But I don't understand why... with AC_CHECK_LIB I have no need to use >> LDFLAGS on Mandriva or Ubuntu... > > Most likely, because Mandriva or Ubuntu chooses to install the package > directly into /usr/lib instead of Fedora's choice of installing into > /usr/lib/mysql (I don't use Ubuntu myself to state that with certainty). I > can't say whether the difference in layout between the distros is worthy of > a bug report (or even to which distro you should file such a bug report), > but that's one of the joys you get to encounter when porting software to > multiple platforms. More importantly, you should remember that someone > might not have mysql installed anywhere under /usr/lib at all; perhaps they > installed it in $HOME/lib instead. > > Hence, the autoconf approach is to expose LDFLAGS as the desired way of > letting the user tune where to look for particular libraries, and both the > autoconf-archives and gnulib projects have written wrapper macros that make > it easier to search in several default candidate locations (including the > location relative to ${prefix}) to set the correct LDFLAGS for a given > library. > > -- > Eric Blake ebl...@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org > Hi, I've added LDFLAGS="-L/usr/lib/mysql $LDFLAGS" and it worked. I wonder if the proper way to do it. Thanks in advance!! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: AC_CHECK_LIB: Library is found on build host but is not on a target host
2010/9/27 Sergio Belkin : > 2010/8/23 Eric Blake : > >>>> Ah - the difference is the presence of -L/usr/lib/mysql in the working >>>> command line. For your configure test to work, you'd also have to >>>> provide >>>> that same -L option to LDFLAGS prior to using AC_CHECK_LIB (or the better >>>> AC_SEARCH_LIBS). >>> >>> But I don't understand why... with AC_CHECK_LIB I have no need to use >>> LDFLAGS on Mandriva or Ubuntu... >> >> Most likely, because Mandriva or Ubuntu chooses to install the package >> directly into /usr/lib instead of Fedora's choice of installing into >> /usr/lib/mysql (I don't use Ubuntu myself to state that with certainty). I >> can't say whether the difference in layout between the distros is worthy of >> a bug report (or even to which distro you should file such a bug report), >> but that's one of the joys you get to encounter when porting software to >> multiple platforms. More importantly, you should remember that someone >> might not have mysql installed anywhere under /usr/lib at all; perhaps they >> installed it in $HOME/lib instead. >> >> Hence, the autoconf approach is to expose LDFLAGS as the desired way of >> letting the user tune where to look for particular libraries, and both the >> autoconf-archives and gnulib projects have written wrapper macros that make >> it easier to search in several default candidate locations (including the >> location relative to ${prefix}) to set the correct LDFLAGS for a given >> library. >> >> -- >> Eric Blake ebl...@redhat.com +1-801-349-2682 >> Libvirt virtualization library http://libvirt.org >> > > > Hi, I've added > > LDFLAGS="-L/usr/lib/mysql $LDFLAGS" > > > and it worked. I wonder if the proper way to do it. > > Thanks in advance!! Clarification: I meant added to configure.ac TIA -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
About AC_CHECK_HEADERS and different locations
Hi, I am autoconfiscating a project that has a header file with a line: #include configure.ac has: AC_CHECK_HEADERS(postgresql/libpq-fe.h) The problem is that Ubuntu has such a header file on /usr/include/postgresq but fedora has it on /usr/include. So how can I make that configure script checks for differents paths? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Short Help Macro for configure
Hi! Is there some macro to set ./configure --help=short by default? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
AC_SEARCH_LIBS directories on 32-bit and 64-bit
Hi, Let's say we have the check: AC_SEARCH_LIBS([ns_get16],[resolv]) How can I do to detect library directory path based on host architecture, I mean, I want that if is an x86_64 bit looks on ${prefix}/lib64 and if is 32-bit look on /usr/lib. I'd want to avoid that user has to provide manually LDFLAGS. Is that possible? If I am thinking something wrong, correct me. Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: AC_CHECK_LIB: Library is found on build host but is not on a target host
2010/9/28 Luke Mewburn : > On Mon, Sep 27, 2010 at 10:30:49AM -0300, Sergio Belkin wrote: > | Hi, I've added > | > | LDFLAGS="-L/usr/lib/mysql $LDFLAGS" > | > | and it worked. I wonder if the proper way to do it. > > I've used the following: > > > > # Look for mysql via the presence of 'mysql_config' or 'mysql_config5' > # > AC_PATH_PROGS([TOOL_MYSQL_CONFIG], [mysql_config mysql_config5], [], > [$PATH:/opt/local/bin])AS_IF([test -n "$TOOL_MYSQL_CONFIG"], > [MYSQL_CFLAGS=`$TOOL_MYSQL_CONFIG --cflags` > MYSQL_LIBS=`$TOOL_MYSQL_CONFIG --libs_r`], > [AC_MSG_ERROR([missing program 'mysql_config'; is 'mysql' or > 'MySQL-devel' > installed?])]) > AC_SUBST([MYSQL_CFLAGS]) > AC_SUBST([MYSQL_LIBS]) > AC_PATH_PROGS([TOOL_MYSQL], [mysql mysql5], [], > [$PATH:/opt/local/bin]) > > > > Use @MYSQL_LIBS@ and @MYSQL_CFLAGS@ in Makefile.am as appropriate. > > It works on CentOS and Fedora with the MySQL packages provided by > either the distribution or from mysql.com, and also for Macports > on Mac OS X (mysql5_config in /opt/local/bin). > > > Luke. > The problem with this approach is that it adds linking against libraries that perhaps one doesn't want. mysql_config on CentOS -L/usr/lib64/mysql -lmysqclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: AC_SEARCH_LIBS directories on 32-bit and 64-bit
2010/10/18 Eric Blake : > On 10/18/2010 04:54 PM, Sergio Belkin wrote: >> >> Hi, >> >> Let's say we have the check: >> >> AC_SEARCH_LIBS([ns_get16],[resolv]) >> >> How can I do to detect library directory path based on host >> architecture, I mean, I want that if is an x86_64 bit looks on >> ${prefix}/lib64 and if is 32-bit look on /usr/lib. I'd want to avoid >> that user has to provide manually LDFLAGS. Is that possible? If I am >> thinking something wrong, correct me. > > Why should you want to offload the responsibility for the user setting up > their system correctly in the first place? And you can't blindly assume > that ${prefix}/lib64 is the correct spelling, as there are 64-bit OSs that > install their libraries directly in /usr/lib. And, per the GNU Coding > Standards, a user should feel free to install libraries in ~/lib (if they > don't have write access to /usr) rather than /usr/local/lib (autoconf's > default, good for installing optional packages above what the distro > includes); as it is, libraries installed in /usr/lib64 is already a case of > distros using the GCS-mandated ability to specify an alternate $prefix of > /usr instead of the default /usr/local. > > In my opinion, the solution to the 32- vs. 64-bit library question SHOULD be > answered by the user (and not by the configure author). Obviously, this can > be done by setting LDFLAGS for every configure run of every package, but > that gets tiresome. But more efficiently, this can be done by installing an > appropriate config.site to answer the question up front. And the manual > already mentions how to do that: > > http://www.gnu.org/software/autoconf/manual/autoconf.html#Site-Defaults > > If a distro wants to ship 64-bit libraries in /usr/lib64, then they should > also ship a config.site that automatically uses that directory any time a > configure script targets ${prefix} of /usr, so that users automatically get > this default without having to set LDFLAGS themselves. But that's in the > realm of the distro, not of autoconf. > > As a package author, you shouldn't have to care about the distro's choice of > spelling for preferred library location. > > -- > Eric Blake ebl...@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org > Thanks Eric for your explanation -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: AC_CHECK_LIB: Library is found on build host but is not on a target host
2010/8/23 Eric Blake : > Hence, the autoconf approach is to expose LDFLAGS as the desired way of > letting the user tune where to look for particular libraries, and both the > autoconf-archives and gnulib projects have written wrapper macros that make > it easier to search in several default candidate locations (including the > location relative to ${prefix}) to set the correct LDFLAGS for a given > library. > > -- > Eric Blake ebl...@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org > Sorry for the question: How can I add a macro from autoconf-archives to my project? TIA -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: AC_CHECK_LIB: Library is found on build host but is not on a target host
2010/10/19 Sergio Belkin : > 2010/8/23 Eric Blake : >> Hence, the autoconf approach is to expose LDFLAGS as the desired way of >> letting the user tune where to look for particular libraries, and both the >> autoconf-archives and gnulib projects have written wrapper macros that make >> it easier to search in several default candidate locations (including the >> location relative to ${prefix}) to set the correct LDFLAGS for a given >> library. >> >> -- >> Eric Blake ebl...@redhat.com +1-801-349-2682 >> Libvirt virtualization library http://libvirt.org >> > > Sorry for the question: How can I add a macro from autoconf-archives > to my project? > > TIA > > -- > -- I've found the answer: http://www.gnu.org/software/hello/manual/automake/Local-Macros.html#Local-Macros. Sorry :) -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Problem with LIBS generated by a macro
; else ss="Yes" fi if test x"$mysql" != xtrue then ms="No. You may enable with --with-mysql" else ms="Yes" fi if test x"$postgresql" = xfalse then pq="No. You may enable with --with-postgresql" else pq="Yes" fi AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h]) AC_HEADER_STDBOOL AC_C_INLINE AC_TYPE_SIZE_T AC_FUNC_MKTIME AC_CHECK_FUNCS([gethostbyname localtime_r memmove memset regcomp select socket strcasecmp strerror strncasecmp]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT echo \ "- Congratulations! You have created a Makefile for: ${PACKAGE_NAME} ${PACKAGE_VERSION} Prefix is '${prefix}'. Compiler is '${CXX} LIBS are '${LIBS}' ssl support: '${ss}' Wanted MySQL: ${want_mysql} mysql support: ${found_mysql} postgresql support: '${pq}' UpTools will be Built on: '${build}' UpTools will Built for: '${host}' Now type 'make' in order to compile If you want to test your compiling type 'make check' After compiling, you can install with 'make install' At the end, you can check your installation with 'make installcheck' --" EOF TIA! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: Problem with LIBS generated by a macro
2010/10/31 Ralf Wildenhues : > Hello Sergio, > > * Sergio Belkin wrote on Sat, Oct 30, 2010 at 11:55:17PM CEST: >> I've autoconfiscated a project that link against libresolv and >> libtpthread, and optionally against ssl, mysqlclient and pq. I am >> working on Fedora 13 (i686). >> >> I've found a macro AX_EXT_HAVE_LIB >> (http://www.gnu.org/software/autoconf-archive/ax_ext_have_lib.html) >> that "is identical to AC_SEARCH_LIBS with the exception that will add >> -L when looking, and use a different variable for each >> directory. " It seems great for me! >> >> The problem is that at the end only take the last library found, in my >> case "pq". >> >> It seems that macro override the earlier value of "LIBS" variable. > > This looks like a bug in the AX_EXT_HAVE_LIB macro to me, as it is > documented to only add to LIBS but not remove existing entries. Indeed. > >> I've examined the configure script but it's a bit tricky, you may >> read a snippet about the macro on http://pastebin.com/vHKYp0UR >> >> I've tried modifying macro, replacing the final LIBS="$new_libs" por >> LIBS="$new_libs $LIBS" which you may read on >> http://pastebin.com/DNCCfgnU >> >> But now LIBS ends as: '-lpq -lmysqlclient -lssl -lpthread -lresolv >> -lssl -lpthread -lresolv ' >> >> It seems harmless but it's too ugly, isn't it? > > Not necessarily. Not necessarily what? :) (sorry english is not my native language) Do you say that that cane be harmful or that is not ugly? :) > > I suggest you report this to the autoconf-archive-maintainers list, > or their bug tracker, so that the macro can be fixed. Good point I've done it. > > Cheers, > Ralf > -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Question about AC_TRY_LINK_FUNC
Hi, The question is simple, altough the answer it's no so, what does AC_TRY_LINK_FUNC macro do? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: Question about AC_TRY_LINK_FUNC
2010/12/21 Eric Blake : > On 12/21/2010 08:02 AM, Sergio Belkin wrote: >> Hi, >> >> The question is simple, altough the answer it's no so, what does >> AC_TRY_LINK_FUNC macro do? > > It's a deprecated wrapper around the modern AC_LINK_IFELSE macro. It > basically tests whether a symbol (global variable or function) exists in > the set of libraries passed in $LIBS, even if that symbol is not > declared in any system header files. Based on the compiler results, it > then runs shell code snippets that you can use to affect subsequent > AC_SUBST or AC_DEFINE patterns to propagate that information on to the > rest of your package. Did you have any more specific details about what > you were trying to figure out about the macro? > > -- > Eric Blake ebl...@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org > > Thanks Eric for your answer and interest. I am using the macro AX_EXT_HAVE_LIB I am trying to understand how it works. Because has a problem: only can be used once, otherwise LIBS is overwritten by last library found. I've made a quick and diry workaround: changed, but it's not perfect, I'd be glad if you can help, this the macro as I am using now (I commented out the lines modified): AC_DEFUN([AX_EXT_HAVE_LIB], [ new_ldflags=${LDFLAGS} new_libs=$LIBS AC_CHECK_LIB([$2], $3, new_libs="-l$2"; ext_lib_found="yes", ext_lib_found="no") for dir in $1 do if test $ext_lib_found = no then ext_haslib_cvdir=`echo $dir | $as_tr_sh` AC_CACHE_CHECK([for $2 library with -L$dir], [ext_cv${ext_haslib_cvdir}_haslib_$2], [ext_func_search_save_LIBS=$LIBS ext_func_save_ldflags=${LDFLAGS} LIBS="-l$2 $4 ${ext_func_search_save_LIBS}" LDFLAGS="-L$dir ${ext_func_save_ldflags}" AC_TRY_LINK_FUNC([$3], [eval "ext_cv${ext_haslib_cvdir}_haslib_$2"="yes"], [eval "ext_cv${ext_haslib_cvdir}_haslib_$2"="no"]) LIBS=$ext_func_search_save_LIBS LDFLAGS=$ext_func_save_ldflags ]) if eval `echo 'test x${'ext_cv${ext_haslib_cvdir}_haslib_$2'}' = "xyes"`; then #new_libs="-l$2 ${new_libs}" #That prevents sometimes that librarie are repeated in LIBS library: new_libs="-l$2" new_ldflags="-L${dir} ${new_ldflags}" ext_lib_found="yes" fi fi done #LIBS=$new_libs # The line below is the key for macro it works. LIBS="$new_libs $LIBS}" LDFLAGS=$new_ldflags ]) EOF Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin - ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Override default CXXFLAGS
Hi, Let's say we'd want to compile with CXXFLAGS=-O3. The problem is that is set in some way as -O2. I've overriden CXXFLAGS on configura.ac setting: CXXFLAGS="-O3 ${CXXFLAGS}" But I wonder if that is the proper way of do it! I'm using Fedora 14. Any idea? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: Override default CXXFLAGS
I answer myself: RTMF :) "If using the GNU C compiler, set shell variable GCC to ‘yes’. If output variable CFLAGS was not already set, set it to -g -O2 for the GNU C compiler (-O2 on systems where GCC does not accept -g), or -g for other compilers. If your package does not like this default, then it is acceptable to insert the line ‘: ${CFLAGS=""}’ after AC_INIT and before AC_PROG_CC to select an empty default instead. " http://www.gnu.org/software/hello/manual/autoconf/C-Compiler.html HTH 2011/1/21 Sergio Belkin : > Hi, > > Let's say we'd want to compile with CXXFLAGS=-O3. The problem is that > is set in some way as -O2. I've overriden CXXFLAGS on configura.ac > setting: > > CXXFLAGS="-O3 ${CXXFLAGS}" > > But I wonder if that is the proper way of do it! > > I'm using Fedora 14. > > Any idea? > > Thanks in advance! > > -- > -- > Sergio Belkin http://www.sergiobelkin.com > Watch More TV http://sebelk.blogspot.com > LPIC-2 Certified > -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Check for global symbol
Hi, Is there a way to check is a library function is global? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
Re: Check for global symbol
2011/1/26 tom fogal : > Please keep mailing list topics on.. the mailing list :) > > -tom > > Sergio Belkin writes: >> 2011/1/26 tom fogal : >> > AC_TRY_COMPILE >> >> Thanks, I forgot to say that I'd want to check if the symbol ig global >> and is in the text code. >> >> How can I do that? > Oh Sorry, against the question: Thanks, I forgot to say that I'd want to check if the symbol ig global and is in the text code. -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified ___ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf
static library as fallback
I have the following sentence in a configure.ac: AC_SEARCH_LIBS(ns_initparse,resolv) The problem is ns_initparse is missing on old releases of libresolv.so eg: on Centos 5. So I'd want to make static resolv as a fallback, Can I do it with AC_SEARCH_LIBS? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified - http://www.lpi.org ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Re: static library as fallback
2011/6/14 Eric Blake : > On 06/14/2011 10:20 AM, Sergio Belkin wrote: > > Did you mean to drop the list in your reply? It's better to keep the > conversation on list, so others may learn of your answer. Shame on me, you're right. > >>> AC_SEARCH_LIBS([ns_initparse], [resolv], [], >>> [AC_DEFINE([MISSING_NS_INITPARSE], [1], [Define to 1 if ns_initparse >>> is not available in any library])]) >>> >>> Then in your C code: >>> >>> #if MISSING_NS_INITPARSE >>> // implement your static ns_initparse instead >>> #endif >>> >> >> Hmmm. It was my fault. I didn't explain myself well. I meant: I'd >> want to *use* existing static resolv on the system as a fallback (if >> shared lib lacks of ns_initparse), Can I do it with AC_SEARCH_LIBS? > > My answer is unchanged - you can use the action-if-not-found portion of > AC_SEARCH_LIBS to do whatever else you want to do when ns_initparse is > not found, including setting up AC_DEFINE or other modifications that > will let your code use the static resolv as the fallback. > > -- > Eric Blake ebl...@redhat.com +1-801-349-2682 > Libvirt virtualization library http://libvirt.org > > I thought that there was a way to do it appending static library to LIBS via AC_SEARCH_LIBS... -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified - http://www.lpi.org ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Question about ac_lib and ac_res
Hi folks, I've found in AC_SEARCH_LIBS functions ac_lib and ac_res what do they do? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified - http://www.lpi.org ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Re: Question about ac_lib and ac_res
2012/10/17 Eric Blake : > On 10/17/2012 02:15 PM, Sergio Belkin wrote: >> Hi folks, >> >> I've found in AC_SEARCH_LIBS functions ac_lib and ac_res what do they do? > > They aren't documented in the manual, so you can assume that they are > used internally for implementing the actual search, and that you can > (and should!) safely ignore them. If you're still more curious than > that, then read the source code: ac_lib is the shell variable that loops > over the 2nd argument passed to the AC_SEARCH_LIBS macro, and ac_res is > the shell variable that tracks which -l library, if any, was needed to > make the link succeed. > > AC_DEFUN([AC_SEARCH_LIBS], > [AS_VAR_PUSHDEF([ac_Search], [ac_cv_search_$1])dnl > AC_CACHE_CHECK([for library containing $1], [ac_Search], > [ac_func_search_save_LIBS=$LIBS > AC_LANG_CONFTEST([AC_LANG_CALL([], [$1])]) > for ac_lib in '' $2; do > if test -z "$ac_lib"; then > ac_res="none required" > else > ac_res=-l$ac_lib > LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS" > fi > AC_LINK_IFELSE([], [AS_VAR_SET([ac_Search], [$ac_res])]) > AS_VAR_SET_IF([ac_Search], [break]) > done > > -- > Eric Blake ebl...@redhat.com+1-919-301-3266 > Libvirt virtualization library http://libvirt.org > Thanks for you explanation, I didn''t understand well what does "none required". I've found "The result of this test is cached in the ac_cv_search_function variable as ‘none required’ if function is already available" at http://www.manpagez.com/info/autoconf/autoconf-2.69/autoconf_46.php So I understand that function was found in the library searched on in another in the system, wasn't it? Thanks in advance! -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified - http://www.lpi.org ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Re: Question about ac_lib and ac_res
2012/10/18 Eric Blake : > On 10/18/2012 10:11 AM, Sergio Belkin wrote: >> >> Thanks for you explanation, I didn''t understand well what does "none >> required". >> >> I've found "The result of this test is cached in the >> ac_cv_search_function variable as ‘none required’ if function is >> already available" at >> http://www.manpagez.com/info/autoconf/autoconf-2.69/autoconf_46.php >> >> So I understand that function was found in the library searched on in >> another in the system, wasn't it? > > For an example, on cygwin, sin() is in libc, but on other platforms, you > have to use libm to get sin(). So: > > AC_SEARCH_LIBS([sin], [m]) > > will set ac_cv_search_sin to 'none required' on cygwin, and '-lm' on > other platforms. > > -- > Eric Blake ebl...@redhat.com+1-919-301-3266 > Libvirt virtualization library http://libvirt.org > As always thanks for your clear explanation Eric -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified - http://www.lpi.org ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Check for experimental/unordered_set and experimental/unordered_map
Hi, I'd like to check the presence of experimental/unordered_map and experimental/unordered_set so I have in configure.ac: AC_ARG_ENABLE([experimental], [ --enable-experimentalenable unordered map and unordered set], AC_CXX_HEADER_UNORDERED_SET AC_CXX_HEADER_UNORDERED_MAP , AC_CXX_GNUCXX_HASHMAP AC_CXX_GNUCXX_HASHSET AS_IF([test x"$ax_cv_cxx_gnucxx_hashset" = xyes -a x"$ax_cv_cxx_gnucxx_hashmap" = xyes],[],AC_MSG_FAILURE([hash headers not found])) ) unordered_headers="unordered map and unordered set not found => using hash_map and hash_set headers" AS_IF([test x"$enable_experimental" = xyes], if test x"$ax_cv_cxx_unordered_map" = xyes -o x"$ax_cv_cxx_unordered_set" = xyes;then [unordered_headers=yes];else AC_MSG_WARN([$unordered_headers]);fi,unordered_headers="No. It will be used hash headers") #End of snippet. I've tested deleting /usr/include/c++/10/experimental/unordered_set and /usr/include/c++/10/experimental/unordered_map but it results in unordered_headers="yes" anyway. I'm using ax_cxx_header_unordered_map.m4 and ax_cxx_header_unordered_set.m4 macros. This is my system info: OS: Fedora 32: autoconf-archive-2019.01.06-5.fc32.noarch gcc-10.1.1-1.fc32.x86_64 gcc-c++-10.1.1-1.fc32.x86_64 autoconf-2.69-33.fc32.noarch libstdc++-devel-10.1.1-1.fc32.x86_64 Please could you help me? Am I doing something wrong? Thanks in advance! -- -- Sergio Belkin LPIC-2 Certified - http://www.lpi.org
Re: Check for experimental/unordered_set and experimental/unordered_map
nevermind... I was confusing Standard C++ Library header. with TS C++ Library header ! El dom., 7 jun. 2020 a las 13:00, Sergio Belkin () escribió: > Hi, > > I'd like to check the presence of experimental/unordered_map and > experimental/unordered_set so I have in configure.ac: > > AC_ARG_ENABLE([experimental], > [ --enable-experimentalenable unordered map and unordered set], > AC_CXX_HEADER_UNORDERED_SET > AC_CXX_HEADER_UNORDERED_MAP > , AC_CXX_GNUCXX_HASHMAP > AC_CXX_GNUCXX_HASHSET > AS_IF([test x"$ax_cv_cxx_gnucxx_hashset" = xyes -a > x"$ax_cv_cxx_gnucxx_hashmap" = xyes],[],AC_MSG_FAILURE([hash headers not > found])) > ) > unordered_headers="unordered map and unordered set not found => using > hash_map and hash_set headers" > > AS_IF([test x"$enable_experimental" = xyes], if test > x"$ax_cv_cxx_unordered_map" = xyes -o x"$ax_cv_cxx_unordered_set" = > xyes;then [unordered_headers=yes];else > AC_MSG_WARN([$unordered_headers]);fi,unordered_headers="No. It will be used > hash headers") > > #End of snippet. > > I've tested deleting /usr/include/c++/10/experimental/unordered_set and > /usr/include/c++/10/experimental/unordered_map but it results in > unordered_headers="yes" anyway. > > I'm using ax_cxx_header_unordered_map.m4 and > ax_cxx_header_unordered_set.m4 macros. > > This is my system info: > OS: Fedora 32: > autoconf-archive-2019.01.06-5.fc32.noarch > gcc-10.1.1-1.fc32.x86_64 > gcc-c++-10.1.1-1.fc32.x86_64 > autoconf-2.69-33.fc32.noarch > libstdc++-devel-10.1.1-1.fc32.x86_64 > > Please could you help me? Am I doing something wrong? > > Thanks in advance! > -- > -- > Sergio Belkin > LPIC-2 Certified - http://www.lpi.org > -- -- Sergio Belkin LPIC-2 Certified - http://www.lpi.org