libtool
[Top][All Lists]
Advanced

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

Plus characters ("++") in library name


From: code
Subject: Plus characters ("++") in library name
Date: Sun, 01 Jan 2017 17:46:59 -0500
User-agent: Roundcube Webmail/1.2.2

Hello,

I am trying to get my first open source project distribution set up to build with autotools (incl. libtool). It is a fairly simple C++ wrapper library around the Gnu "argp" options parser program. I would like to configure the build so as to produce a shared library which is installed in "/usr/local/lib" and the header "argpp.hpp" in "/usr/local/include".

Problem: I would like to name my library "libargp++" but not having much success. Not sure if the problem lies more with automake than with libtool, but I suspect it could be libtool. When I use the name "libargpp", everything works. All I have to do is run "autoreconf -i" from the project directory, then "./configure", "make" and "sudo make install". Of course, I know that it can work by writing the Makefile by hand, but I want to use autotools, and the "++" in the name seems to cause trouble.

The project directory structure looks like this ... for now, I am leaving out README, ChangeLog, etc. until I can get the "bare bones" to work:

(project root:)
  ---/include: argpp.hpp argppbaseimpl.hpp
  ---/src:     argpp.cpp argppbaseimpl.cpp Makefile.am
  ---/m4:      (empty)
  configure.ac
  Makefile.am

Makefile.am in the root directory looks like this:

  ACLOCAL_AMFLAGS = -I m4
  SUBDIRS = src

(not much can go wrong there). Here is the Makefile.am in the src subdirectory:

  lib_LTLIBRARIES = libargpp.la
  libargpp_la_SOURCES = argpp.cpp argppbaseimpl.cpp argppbaseimpl.hpp
  libargpp_la_CXXFLAGS = $(CXXFLAGS) -I$(top_srcdir)/include
  libargpp_la_LDFLAGS = -version-info 1:0:0
  libargpp_includedir = $(includedir)
  include_HEADERS = $(top_srcdir)/include/argpp.hpp

I tried this instead:

  lib_LTLIBRARIES = libargp++.la
  libargp++_la_SOURCES = argpp.cpp argppbaseimpl.cpp argppbaseimpl.hpp
  libargp++_la_CXXFLAGS = $(CXXFLAGS) -I$(top_srcdir)/include
  <etc.>

and got several errors at "make" time.

Here is configure.ac (I took the check for std::unique_ptr<T> from another project; it works quite well):

  AC_PREREQ([2.69])
AC_INIT([Argpp], [1.0.0], address@hidden, [libargpp], [https://github.com/<etc.>])

  LT_INIT

  AC_PROG_CXX
  AC_LANG([C++])

  AC_CONFIG_SRCDIR([src/argpp.cpp])
  AC_CONFIG_FILES([Makefile src/Makefile])
  AC_CONFIG_MACRO_DIR([m4])

  AM_INIT_AUTOMAKE([foreign])

  AC_CHECK_HEADERS([argp.h])

  dnl############################
  dnl Check for C++ unique_ptr or auto_ptr classes
  AC_MSG_CHECKING([for std::unique_ptr<T> or std::auto_ptr<T>])
  std_smart_ptr=no

  SAVED_CXXFLAGS="${CXXFLAGS}"
  CXXFLAGS="${CXXFLAGS} -std=c++11"

  AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[#include <memory>]]
                     [[#include <vector>]],
[[const std::unique_ptr< std::vector<int> > up;]])], [AC_DEFINE([HAVE_STD_UNIQUE_PTR], [1], [Define to 1 if std::unique_ptr<T> exists in <memory>]) std_smart_ptr='found.std::unique_ptr<T>'])
  CXXFLAGS="${SAVED_CXXFLAGS}"

  AC_MSG_RESULT([$std_smart_ptr])

  if test $std_smart_ptr = 'found.std::unique_ptr<T>'; then
    AC_SUBST(ARGPP_CXXFLAGS, [-std=c++11])
  else
    AC_SUBST(ARGPP_CXXFLAGS, [''])
  fi
  dnl############################

  CXXFLAGS="${CXXFLAGS} ${ARGPP_CXXFLAGS}"
  AC_OUTPUT

Is there a way?
Thanks!




reply via email to

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