Read/write methods from/to C++ streams
[lttoolbox.git] / configure.ac
blob2b5e8073e82100ec523b4777c07f116303581d4c
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.52)
6 m4_define([required_libxml_version], [2.6.17])
8 AC_INIT([lttoolbox/lttoolbox.h], [3.0.2], [sortiz@users.sourceforge.net])
9 AC_CONFIG_HEADER([lttoolbox/lttools_config.h])
11 GENERIC_LIBRARY_NAME=lttoolbox
13 # Release versioning
14 GENERIC_MAJOR_VERSION=3
15 GENERIC_MINOR_VERSION=0
16 GENERIC_MICRO_VERSION=2
18 # API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
19 GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION
20 AC_SUBST(GENERIC_API_VERSION)
22 # Shared library versioning
23 GENERIC_LIBRARY_VERSION=0:0:0
24 #                       | | |
25 #                +------+ | +---+
26 #                |        |     |
27 #             current:revision:age
28 #                |        |     |
29 #                |        |     +- increment if interfaces have been added
30 #                |        |        set to zero if interfaces have been removed
31 #                                  or changed
32 #                |        +- increment if source code has changed
33 #                |           set to zero if current is incremented
34 #                +- increment if interfaces have been added, removed or changed
36 AC_SUBST(GENERIC_LIBRARY_VERSION)
37 PACKAGE=$GENERIC_LIBRARY_NAME
38 AC_SUBST(GENERIC_LIBRARY_NAME)
40 GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
41 GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
42 AC_SUBST(GENERIC_RELEASE)
43 AC_SUBST(GENERIC_VERSION)
45 VERSION=$GENERIC_VERSION
47 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
49 # Checks for programs.
51 AC_MSG_CHECKING([Compilation architecture: PPC, i686, x86_64, Other])
52 if test x$(which arch) = x
53 then ARCH=$($(which uname) -m)
54 else ARCH=$($(which arch))
57 if test x$ARCH = xppc
58 then
59   AC_MSG_RESULT([PowerPC])
60   CFLAGS="-Wall -ansi -mpowerpc -maltivec -fno-pic -fomit-frame-pointer $CFLAGS"
61   CXXFLAGS="-Wall -ansi -mpowerpc -maltivec -fno-pic -fomit-frame-pointer $CXXFLAGS"
62 else
63   if test x$ARCH = xi686
64   then
65     AC_MSG_RESULT([i686])
66     CFLAGS="-Wall -ansi -march=i686 -O3 -fomit-frame-pointer -funroll-loops $CFLAGS"
67     CXXFLAGS="-Wall -ansi -march=i686 -O3 \
68               -fomit-frame-pointer -funroll-loops $CXXFLAGS"
69   
70   else
71     if test x$ARCH = xx86_64
72     then
73       AC_MSG_RESULT([x86_64])
74       CFLAGS="-Wall -ansi -O3 -mtune=nocona -fomit-frame-pointer -funroll-loops $CFLAGS"
75       CXXFLAGS="-Wall -ansi -O3 -mtune=nocona \
76               -fomit-frame-pointer -funroll-loops $CXXFLAGS"
77     else
78       AC_MSG_RESULT([Other])
79       CFLAGS="-Wall -ansi -O3 $CFLAGS"
80       CXXFLAGS="-Wall -ansi -O3 $CXXFLAGS"
81     fi
82   fi
85 AC_PROG_CXX
86 AM_PROG_LIBTOOL
87 AM_SANITY_CHECK
88 AC_LANG_CPLUSPLUS
90 AC_ARG_ENABLE(debug,
91               [  --enable-debug  Enable "-g -Wall" compiler options],
92               [CXXFLAGS="-g -Wall";CFLAGS="-g -Wall"])
94 AC_ARG_ENABLE(profile,
95               [  --enable-profile  Enable "-pg -g -Wall" compiler options],
96               [CXXFLAGS="-pg -g -Wall"; CFLAGS="-pg -g -Wall"; LDFLAGS="-pg"])
97                             
99 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
100 if test x$ac_cv_path_PKG_CONFIG = x
101 then
102   AC_MSG_ERROR([You don't have pkg-config installed])
104 if test x$ac_cv_path_PKG_CONFIG = xno
105 then
106   AC_MSG_ERROR([You don't have pkg-config installed])
109 PKG_CHECK_MODULES(LTTOOLBOX, [dnl
110   libxml-2.0 >= required_libxml_version])
112 # Checks for libraries.
113 AC_CHECK_LIB(xml2, xmlReaderForFile)
115 # Checks for header files.
116 AC_HEADER_STDC
117 AC_CHECK_HEADERS([stdlib.h string.h unistd.h stddef.h])
119 # Checks for typedefs, structures, and compiler characteristics.
120 AC_HEADER_STDBOOL
121 AC_C_CONST
122 AC_TYPE_SIZE_T
124 # Checks for library functions.
125 AC_FUNC_ERROR_AT_LINE
126 AC_FUNC_MALLOC
127 AC_FUNC_REALLOC
129 AC_CHECK_DECLS([fread_unlocked, fwrite_unlocked, fgetc_unlocked, \ 
130                 fputc_unlocked, fputs_unlocked, \
131                 fgetwc_unlocked, fputwc_unlocked, fputws_unlocked])
132                 
133 AC_CHECK_FUNCS([setlocale strdup getopt_long])
135 AC_OUTPUT([Makefile lttoolbox-3.0.pc lttoolbox/Makefile])