distromatic/configure.ac

247 lines
8.7 KiB
Plaintext
Raw Permalink Normal View History

2011-04-27 21:50:52 +02:00
dnl QiLinux RPM tool for the distribution
dnl
dnl Copyright 2006 (C) Davide Madrisan <davide.madrisan@gmail.com>
dnl Copyright 2007 (C) Silvan Calarco <silvan.calarco@mambasoft.it>
dnl
dnl This program is free software; you can redistribute it and/or modify it under
dnl the terms of version 2 of the GNU General Public License as published by the
dnl Free Software Foundation.
dnl
dnl This program is distributed in the hope that it will be useful, but WITHOUT
dnl ANY WARRANTY, to the extent permitted by law; without even the implied
dnl warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl See the GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along with
dnl this program; if not, write to the Free Software Foundation, Inc.,
dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
dnl Process this file with autoconf to produce a configure script.
dnl Initialization
dnl ------------------------------------------------------------
m4_define(PROG_NAME, [distromatic])
m4_define(PROG_BUGREPORT, [silvan.calarco@mambasoft.it])
m4_define(PROG_VERSION,dnl
regexp(m4_include(VERSION),[.*=[ \t]*\([.0-9A-Za-z]+\)],[\1]))
AC_PREREQ(2.59)
AC_INIT([PROG_NAME],[PROG_VERSION],[PROG_BUGREPORT],[PROG_NAME])
AC_CONFIG_SRCDIR(src/distromatic.c)
AC_CONFIG_HEADERS(src/include/config.h:src/include/config.h.in)
AC_COPYRIGHT(dnl
[Copyright 2006 by Davide Madrisan <davide.madrisan@gmail.com>
])
dnl set `ac_aux_dir' = 'config'
dnl ------------------------------------------------------------
AC_CONFIG_AUX_DIR(config)
AC_SUBST(ac_aux_dir)
dnl Just to display the version number of this program
dnl ------------------------------------------------------------
AC_MSG_CHECKING([for PROG_NAME version])
AC_MSG_RESULT([PROG_VERSION])
dnl Set and display default target architecture
dnl ------------------------------------------------------------
AC_MSG_CHECKING([for the default target architecture])
DEFAULT_ARCH="i586"
AC_SUBST(DEFAULT_ARCH)
AC_MSG_RESULT([$DEFAULT_ARCH])
dnl Compute the canonical build-system type variable, `build' and
dnl its three individual parts `build_cpu', `build_vendor', `build_os'
dnl ------------------------------------------------------------
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.7 foreign dist-bzip2 nostdinc])
AC_REVISION($Revision: 1.4 $)
dnl Determine a C compiler to use. Define `CFLAGS', `EXEEXT', `OBJEXT'
dnl Define `CFLAGS' to `-g -O2' for the GNU C compiler, or `-g' for
dnl other compilers.
dnl If the C compiler is not in ANSI C mode by default, try to add an
dnl option to output variable `CC' to make it so.
dnl ------------------------------------------------------------
AC_PROG_CC
if test "x$ac_cv_prog_cc_stdc" = xno; then
AC_MSG_ERROR([$CC is not an ANSI C compiler.])
fi
AM_PROG_CC_C_O
AC_ISC_POSIX
#AC_PROG_GCC_TRADITIONAL
#CFLAGS+=-O1
SUPPORTED_CFLAGS=
dnl cc_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS])
dnl ------------------------------------------------------------
dnl Checks if $CC supports a given set of CFLAGS.
dnl If supported, the current CFLAGS is appended to SUPPORTED_CFLAGS
AC_DEFUN([cc_TRY_CFLAGS],
[AC_MSG_CHECKING([whether compiler accepts $1])
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE(
[[int x;]],
[ac_cv_try_cflags_ok=yes
SUPPORTED_CFLAGS="$SUPPORTED_CFLAGS $1"],
[ac_cv_try_cflags_ok=no])
CFLAGS="$ac_save_CFLAGS"
AC_MSG_RESULT([$ac_cv_try_cflags_ok])
if test x"$ac_cv_try_cflags_ok" = x"yes"; then
ifelse([$2],[],[:],[$2])
else
ifelse([$3],[],[:],[$3])
fi
])[]dnl @end [cc_TRY_CFLAGS]
cc_TRY_CFLAGS([-Wall])
cc_TRY_CFLAGS([-W])
cc_TRY_CFLAGS([-Wmissing-prototypes])
cc_TRY_CFLAGS([-Wstrict-prototypes])
cc_TRY_CFLAGS([-Wshadow])
#cc_TRY_CFLAGS([-Wunreachable-code])
AC_SUBST([CFLAGS], ["$CFLAGS $SUPPORTED_CFLAGS"])
dnl Check if C the compiler does not fully support the ANSI C qualifier
dnl `const'.
dnl ------------------------------------------------------------
AC_C_CONST
AC_LANG([C])
dnl Define `WORDS_BIGENDIAN' if a big-endian architecture is found
dnl AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
dnl The default for ACTION-IF-TRUE is to define `WORDS_BIGENDIAN'.
dnl The default for ACTION-IF-FALSE is to do nothing.
dnl And finally, the default for ACTION-IF-UNKNOWN is to abort configure and tell
dnl the installer which variable he should preset to bypass this test.
dnl ------------------------------------------------------------
AC_C_BIGENDIAN
dnl Check for standard header files
dnl ------------------------------------------------------------
AC_HEADER_STDC
AC_HEADER_TIME
dnl Check for library functions for portability issues
dnl ------------------------------------------------------------
AC_CHECK_DECLS([getopt])
dnl If the `malloc' works correctly (`malloc (0)' returns a valid pointer),
dnl define `HAVE_MALLOC'
AC_CHECK_FUNCS([memcpy strchr])
AC_FUNC_MALLOC
dnl Check for needed header files, libraries and tools
dnl ------------------------------------------------------------
AC_CHECK_HEADERS(dirent.h ndir.h sys/ndir.h, break)
AC_CHECK_HEADERS(errno.h)
dnl Check for zlib library and header files
AC_CHECK_HEADER([zlib.h],
AC_DEFINE(HAVE_ZLIB_H,1,
[Define to 1 if you have the <zlib.h> header file.]),
[AC_MSG_ERROR([Can't find zlib.h in your system])])
AC_CHECK_LIB(z,gzopen, [ZLIB="-lz"],
[AC_MSG_ERROR([Can't find libz library in your system])])
LIBS="$LIBS $ZLIB"
dnl Check for rpm tool and needed libraries
AC_PATH_PROG(RPM_PATH,rpm,none)
if test "$RPM_PATH" = "none"; then
AC_MSG_ERROR([RPM executable was not found in your system])
else
AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
dnl Check for RPM version
AC_MSG_CHECKING(for RPM version)
RPM_VERSION_RAW=`LANG= LC_ALL= $RPM_PATH --version | sed 's/^.* //'`
RPM_VERSION_MAJOR=`echo $RPM_VERSION_RAW | cut -d. -f1`
RPM_VERSION_MINOR=`echo $RPM_VERSION_RAW | cut -d. -f2`
RPM_VERSION_MICRO=`echo $RPM_VERSION_RAW | cut -d. -f3`
if test -z "$RPM_VERSION_MAJOR" -o -z "$RPM_VERSION_MINOR"; then
AC_MSG_ERROR([can't parse RPM version])
fi
if test -z "$RPM_VERSION_MICRO"; then
RPM_VERSION_MICRO=0
fi
AC_DEFINE_UNQUOTED([RPM_VERSION_MAJOR],$RPM_VERSION_MAJOR,[RPM major version])
AC_DEFINE_UNQUOTED([RPM_VERSION_MINOR],$RPM_VERSION_MINOR,[RPM minor version])
AC_DEFINE_UNQUOTED([RPM_VERSION_MICRO],$RPM_VERSION_MICRO,[RPM micro version])
AC_DEFINE_UNQUOTED([RPM_VERSION],
[((RPM_VERSION_MAJOR<<16)|(RPM_VERSION_MINOR<<8)|RPM_VERSION_MICRO)],
[Define to the RPM version])
AC_DEFINE_UNQUOTED([RPM_VERSION_RAW],"$RPM_VERSION_RAW",[RPM raw version])
AC_MSG_RESULT($RPM_VERSION_RAW)
dnl Check for RPM libraries and headers
AC_CHECK_LIB(bz2,BZ2_bzopen, [],
[AC_MSG_ERROR([Can't find libbz2 library in your system])])
AC_CHECK_LIB(z,gzopen, [],
[AC_MSG_ERROR([Can't find libz library in your system])])
AC_CHECK_HEADERS(db1/db.h)
CPPFLAGS="$CPPFLAGS -I/usr/include/rpm"
AC_CHECK_HEADER(rpm/rpmlib.h, [],
[AC_MSG_ERROR([Can't find rpmlib.h in your system])])
if test $RPM_VERSION_MAJOR -lt 4; then
RPMLIBS="-lrpm -lz -lbz2 -lpopt"
else
AC_CHECK_LIB(rpmdb,rpmdbOpen,
[RPMDBLIBS="-lrpmdb"],
[RPMDBLIBS="-ldb-3.1"],
[-lrpm -lrpmio -lz -lbz2 -lpopt])
RPMLIBS="-lrpm $RPMDBLIBS -lrpmio -lz -lbz2 -lpopt"
fi
AC_MSG_CHECKING(for RPM libraries)
AC_MSG_RESULT($RPMLIBS)
AC_SUBST(RPMLIBS)
fi
LIBS="$LIBS $RPMLIBS"
dnl Check for libiberty' library and header files
AC_CHECK_HEADERS([libiberty.h], [],
[AC_MSG_ERROR([Can't find libiberty.h in your system,]
[check http://www.gnu.org/software/binutils/binutils.html for libiberty])])
AC_CHECK_LIB(iberty, freeargv,
[LIBS="$LIBS -liberty"
2011-04-27 21:50:52 +02:00
AC_DEFINE(HAVE_LIBIBERTY,1,
[Define to 1 if you have the `libiberty' library (-liberty).])],
[AC_MSG_ERROR([Can't find libiberty in your system,]
[check http://www.gnu.org/software/binutils/binutils.html for libiberty])])
dnl Set the default `prefix' variable to `/usr'
dnl ------------------------------------------------------------
#AC_PREFIX_DEFAULT([/usr])
dnl Generate the output files
dnl ------------------------------------------------------------
AC_CONFIG_FILES([Makefile]
[config/Makefile]
[html/Makefile]
[html/index.php]
[html/index.postnuke.php]
[html/index.html]
[src/Makefile]
[src/include/Makefile]
[src/include/globaldefs.h]
[src/missing/Makefile])
AC_OUTPUT
cat <<_EOF
Good - your configure finished. Start make now.
_EOF
dnl configure.ac ends here