diff --git a/.gitignore b/.gitignore index 2a842a5..a9f14b7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,9 @@ stamp-h1 # Ignore output files libpipecolors.o libpipecolors.so +.libs/ +libpipecolors.la +libpipecolors.lo # Ignore backup files *~ \ No newline at end of file diff --git a/Makefile.am b/Makefile.am old mode 100755 new mode 100644 index fc6b7b9..55fe1b0 --- a/Makefile.am +++ b/Makefile.am @@ -1,19 +1,17 @@ pkgconfig_DATA = pipecolors.pc +VERSION = 0.1.0 +AM_CXXFLAGS = -std=c++11 +ACLOCAL_AMFLAGS = -I m4 -I config +LIBTOOL_DEPS = @LIBTOOL_DEPS@ -AM_CXXFLAGS += -std=c++11 -fPIC -pipe -ACLOCAL_AMFLAGS = -I m4 -LIBTOOL_DEPS += @LIBTOOL_DEPS@ libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status libtool -pkginclude_HEADERS = pipecolors.h -soinclude_HEADERS = pipecolors.h -soincludedir = $(prefix)/include -sodir=$(libdir) -so_PROGRAMS = libpipecolors.so -libpipecolors_so_SOURCES = libpipecolors.cpp -libpipecolors_so_LDFLAGS = \ - -shared \ - -fPIC \ - -Wl,-soname,libpipecolors.so.0.1 \ - -ltermcap +lib_LTLIBRARIES = libpipecolors.la +libpipecolors_la_SOURCES = libpipecolors.cpp +libpipecolors_la_LIBADD = -ltermcap +libpipecolors_la_CFLAGS = -fPIC -DPIC -pthread +libpipecolors_la_LDFLAGS = -module \ + -release ${PIPECOLORS_VERSION} + +include_HEADERS = pipecolors.h diff --git a/autogen.sh b/autogen.sh index 9e5b8bb..5e46be5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,7 +3,7 @@ set -x test -d autom4te.cache && rm -rf autom4te.cache -test -d config && rm -rf config || exit 1 +test -d config && rm -rf config mkdir config || exit 1 libtoolize --install --copy || exit 1 aclocal -I config || exit 1 diff --git a/configure.ac b/configure.ac old mode 100755 new mode 100644 index 36e4688..bc75db5 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_PREREQ([2.69]) m4_define([pipecolors_version_major],[0]) m4_define([pipecolors_version_minor],[1]) m4_define([pipecolors_version_micro],[0]) -m4_define([pipecolors_version_beta], [b]) +m4_define([pipecolors_version_beta], []) m4_define([pipecolors_version_base], [pipecolors_version_major.pipecolors_version_minor.pipecolors_version_micro]) m4_define([pipecolors_version], @@ -36,12 +36,12 @@ AC_CANONICAL_HOST AC_PROG_CXX AC_PROG_CXX_C_O AC_PROG_CXXCPP +AM_PROG_AR AC_PROG_LIBTOOL -LT_INIT -AC_DISABLE_SHARED -AC_ENABLE_STATIC -AC_LANG_CPLUSPLUS +LT_INIT +AC_LANG_CPLUSPLUS +AC_PREFIX_DEFAULT([/usr]) #AC_CHECK_LIB([pipecolors], [cprintf]) #PKG_CHECK_MODULES([LIBPIPECOLORS], [pipecolors]) # Checks for programs. @@ -57,8 +57,6 @@ gcc_micro_vers=`echo ${gcc_full_vers} | cut -f3 -d.` # Checks for functions AC_CHECK_CXX_ARGUMENT([-std=c++11], [], [AC_MSG_ERROR([C++11 support is required.])]) -AC_SUBST([ACLOCAL_AMFLAGS]) -AC_SUBST([AM_CXXFLAGS]) AC_MSG_CHECKING([if ${CXX-c++} supports nullptr]) AC_LINK_IFELSE( @@ -95,38 +93,11 @@ AC_CHECK_TYPES([std::string], [], [], [[ #include ]]) -AC_ARG_WITH(arch, - AS_HELP_STRING([--with-arch=ARCH], - [On x86_64 systems, compile with -fno-omit-frame-pointer (see INSTALL)])) - -if test z${with_arch} = "z"; then - AC_CHECK_PROG(ARCH_PROG, arch, "found", "no") - if test $ARCH_PROG = "no"; then - AC_CHECK_PROG(UNAME_PROG, uname, "found", "no") - if test $UNAME_PROG = "no"; then - AC_MSG_ERROR([Could not detect your architecture, please set --with-arch=ARCH.]) - else - with_arch=`uname -i` - fi - else - with_arch=`arch` - fi -fi -AC_MSG_NOTICE([building for ${with_arch} platform]) - -# Checks for header files. - - - -# Checks for typedefs, structures, and compiler characteristics. - -# Checks for library functions. - AC_ARG_ENABLE([the-force], [AC_HELP_STRING([--enable-the-force], [use the force [default=no]])], [], [enable_the_force=no]) AM_CONDITIONAL([ENABLE_THE_FORCE], [test "x$enable_the_force" = "xyes"]) -AC_CONFIG_FILES([Makefile pipecolors.pc:pipecolors.pc.in],[],[API_VERSION='0.1']) +AC_CONFIG_FILES([Makefile pipecolors.pc:pipecolors.pc.in],[],[APIVERSION=PIPECOLORS_VERSION]) AC_CONFIG_COMMANDS([default],[[]],[[]]) AC_OUTPUT diff --git a/examples/test b/examples/test new file mode 100755 index 0000000..cb04fff Binary files /dev/null and b/examples/test differ diff --git a/tests/test.cpp b/examples/test.cpp similarity index 64% rename from tests/test.cpp rename to examples/test.cpp index 860c5aa..a670062 100644 --- a/tests/test.cpp +++ b/examples/test.cpp @@ -1,12 +1,15 @@ #include -#include +#include +#include int main(void) { - const char* str = "|0101|0202|0303|0404|0505|0606|0707|0808|0909|1010|1111|1212|1313|1414|1515"; + const char* str = "|0101|0202|0303|0404|0505|0606|0707|0808|0909|1010|1111|1212|1313|1414|1515|07"; const char* name = "|01P|02i|03p|04e|05c|06ol|07o|08r|09s |10l|11i|12b|13r|14a|15r|14y |130|12.|111|07"; cprintf("\n%s\n\n", name); cprintf("%s\n", str); - + if( isatty(fileno(stdout)) ) { + cprintf("Awesome!"); + } } diff --git a/libpipecolors.cpp b/libpipecolors.cpp old mode 100755 new mode 100644 index 11957d7..b43fa53 --- a/libpipecolors.cpp +++ b/libpipecolors.cpp @@ -18,16 +18,15 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include +//#include +//#include #include #include #include - +#include #include #include #include -#include #include "pipecolors.h" #define C_DEFAULT 0 @@ -98,13 +97,8 @@ } bool has_colors(void) { - char buffer[1024]; - int c; - tgetent(buffer, getenv("TERM")); - c = tgetnum("Co"); - - if(c > 0 || c == -1) { + if( isatty(fileno(stdout)) ) { return true; } else { return false; @@ -138,8 +132,3 @@ void cprintf( const char * format, ... ) { std::cout << s; } - -int main(void) { - cprintf("\n%s\n\n", "|01P|02i|03p|04e|05c|06ol|07o|08r|09s |10l|11i|12b|13r|14a|15r|14y |130|12.|111|07"); - return 0; -} diff --git a/pipecolors.h b/pipecolors.h index 6c6a0c1..e7ef575 100644 --- a/pipecolors.h +++ b/pipecolors.h @@ -1,5 +1,8 @@ -#ifndef __PIPECOLORS_H -#define __PIPECOLORS_H +#ifdef _PIPECOLORS_H +#undef _PIPECOLORS_H +#endif +#ifndef _PIPECOLORS_H +#define _PIPECOLORS_H #endif #ifdef __cplusplus @@ -7,6 +10,7 @@ extern "C" { #endif void cprintf(const char* format, ...); +void csprintf(void); #ifdef __cplusplus } diff --git a/pipecolors.pc.in b/pipecolors.pc.in old mode 100755 new mode 100644 diff --git a/releases/pipecolors-0.1.0.tar.bz2 b/releases/pipecolors-0.1.0.tar.bz2 new file mode 100644 index 0000000..1b590e0 Binary files /dev/null and b/releases/pipecolors-0.1.0.tar.bz2 differ diff --git a/releases/pipecolors-0.1.0.tar.gz b/releases/pipecolors-0.1.0.tar.gz new file mode 100644 index 0000000..205074d Binary files /dev/null and b/releases/pipecolors-0.1.0.tar.gz differ diff --git a/releases/pipecolors-0.1.0.zip b/releases/pipecolors-0.1.0.zip new file mode 100644 index 0000000..3b0dc36 Binary files /dev/null and b/releases/pipecolors-0.1.0.zip differ