📄 acinclude.m4
字号:
## -*- shell-script -*-## This file is part of the KDE libraries/packages## Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)## (C) 1997 Stephan Kulow (coolo@kde.org)## This file is free software; you can redistribute it and/or## modify it under the terms of the GNU Library General Public## License as published by the Free Software Foundation; either## version 2 of the License, or (at your option) any later version.## This library is distributed in the hope that it will be useful,## but WITHOUT ANY WARRANTY; without even the implied warranty of## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU## Library General Public License for more details.## You should have received a copy of the GNU Library General Public License## along with this library; see the file COPYING.LIB. If not, write to## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,## Boston, MA 02111-1307, USA. ## IMPORTANT NOTE:## Please do not modify this file unless you expect your modifications to be## carried into every other module in the repository. If you decide that you## really want to modify it, contact coolo@kde.org mentioning that you have## and that the modified file should be committed to every module.#### Single-module modifications are best placed in configure.in for kdelibs## and kdebase or configure.in.1 if present.## ------------------------------------------------------------------------## Find a file (or one of more files in a list of dirs)## ------------------------------------------------------------------------##AC_DEFUN(AC_FIND_FILE,[$3=NOfor i in $2;do for j in $1; do if test -r "$i/$j"; then $3=$i break 2 fi donedone])## ------------------------------------------------------------------------## Find the meta object compiler in the PATH, in $QTDIR/bin, and some## more usual places## ------------------------------------------------------------------------##AC_DEFUN(AC_PATH_QT_MOC,[AC_PATH_PROG(MOC, moc, $QTDIR/bin/moc, $ac_qt_bindir $QTDIR/bin $PATH /usr/bin /usr/X11R6/bin /usr/lib/qt/bin /usr/local/qt/bin)])AC_DEFUN(KDE_REPLACE_ROOT, $1=`echo "$$1" | sed -e "s#^/#\$\{install_root\}/#"`)AC_DEFUN(AC_CREATE_KFSSTND,[AC_REQUIRE([AC_CHECK_RPATH])AC_REQUIRE([AC_CHECK_BOOL])if test "$1" = "default"; then AC_MSG_CHECKING(for KDE paths) if test -z "$kde_htmldir"; then kde_htmldir="\$(prefix)/share/doc/HTML" fi if test -z "$kde_appsdir"; then kde_appsdir="\$(prefix)/share/applnk" fi if test -z "$kde_icondir"; then kde_icondir="\$(prefix)/share/icons" fi if test -z "$kde_sounddir"; then kde_sounddir="\$(prefix)/share/sounds" fi if test -z "$kde_datadir"; then kde_datadir="\$(prefix)/share/apps" fi if test -z "$kde_locale"; then kde_locale="\$(prefix)/share/locale" fi if test -z "$kde_cgidir"; then kde_cgidir="\$(exec_prefix)/cgi-bin" fi if test -z "$kde_confdir"; then kde_confdir="\$(prefix)/share/config" fi if test -z "$kde_mimedir"; then kde_mimedir="\$(prefix)/share/mimelnk" fi if test -z "$kde_toolbardir"; then kde_toolbardir="\$(prefix)/share/toolbar" fi if test -z "$kde_wallpaperdir"; then kde_wallpaperdir="\$(prefix)/share/wallpapers" fi if test -z "$kde_bindir"; then kde_bindir="\$(exec_prefix)/bin" fi if test -z "$kde_partsdir"; then kde_partsdir="\$(exec_prefix)/parts" fi AC_MSG_RESULT(defaults) else AC_CACHE_VAL(kde_cv_all_paths,[AC_MSG_CHECKING([for kde headers installed])AC_LANG_CPLUSPLUScat > conftest.$ac_ext <<EOF#include <stdio.h>#include "confdefs.h"#include "config.h.bot"#include <kapp.h>int main() {printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data());printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());return 0;}EOFif test -n "$kde_libraries"; then KDE_TEST_RPATH="-rpath $kde_libraries"fiif test -n "$qt_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries"fiif test -n "$x_libraries"; then KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries"fiKDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'if AC_TRY_EVAL(ac_compile); then AC_MSG_RESULT(yes)else AC_MSG_ERROR([your system is not able to compile a small KDE application!Check, if you installed the KDE header files correctly.])fiAC_MSG_CHECKING([for kde libraries installed])ac_link='/bin/sh ./libtool --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore -lqt -lXext -lX11 $LIBSOCKET $KDE_TEST_RPATH 1>&5'if AC_TRY_EVAL(ac_link) && test -s conftest; then AC_MSG_RESULT(yes)else AC_MSG_ERROR([your system fails at linking a small KDE application!Check, if your compiler is installed correctly and if you have used thesame compiler to compile Qt and kdelibs as you did use now])fiAC_MSG_CHECKING([for KDE paths])if eval `./conftest 2>&5`; then AC_MSG_RESULT(done)else AC_MSG_RESULT(problems)fi./conftest 2> /dev/null >&5 # make an echo for config.logkde_have_all_paths=yesAC_LANG_CPLUSPLUSif test "$kde_have_all_paths" = "yes"; thenkde_cv_all_paths="kde_have_all_paths=\"yes\" \ kde_htmldir=\"$kde_htmldir\" \ kde_appsdir=\"$kde_appsdir\" \ kde_icondir=\"$kde_icondir\" \ kde_sounddir=\"$kde_sounddir\" \ kde_datadir=\"$kde_datadir\" \ kde_locale=\"$kde_locale\" \ kde_cgidir=\"$kde_cgidir\" \ kde_confdir=\"$kde_confdir\" \ kde_mimedir=\"$kde_mimedir\" \ kde_toolbardir=\"$kde_toolbardir\" \ kde_wallpaperdir=\"$kde_wallpaperdir\" \ kde_bindir=\"$kde_bindir\" \ kde_partsdir=\"$kde_partsdir\""firm -fr conftest*])eval "$kde_cv_all_paths"if test -z "$kde_htmldir" || test -z "$kde_appsdir" || test -z "$kde_icondir" || test -z "$kde_sounddir" || test -z "$kde_datadir" || test -z "$kde_locale" || test -z "$kde_cgidir" || test -z "$kde_confdir" || test -z "$kde_mimedir" || test -z "$kde_toolbardir" || test -z "$kde_wallpaperdir" || test -z "$kde_bindir" || test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then kde_have_all_paths=no AC_MSG_ERROR([configure could not run a little KDE program to test the environment. Since it had compiled and linked before, it must be a strange problem on your system.Look at config.log for details. If you are not able to fix this, please contact Stephan Kulow <coolo@kde.org>.])fiif test -n "$install_root"; then KDE_REPLACE_ROOT(kde_htmldir) KDE_REPLACE_ROOT(kde_appsdir) KDE_REPLACE_ROOT(kde_icondir) KDE_REPLACE_ROOT(kde_sounddir) KDE_REPLACE_ROOT(kde_datadir) KDE_REPLACE_ROOT(kde_locale) KDE_REPLACE_ROOT(kde_cgidir) KDE_REPLACE_ROOT(kde_confdir) KDE_REPLACE_ROOT(kde_mimedir) KDE_REPLACE_ROOT(kde_toolbardir) KDE_REPLACE_ROOT(kde_wallpaperdir) KDE_REPLACE_ROOT(kde_bindir) KDE_REPLACE_ROOT(kde_partsdir) AC_SUBST(install_root)fifibindir=$kde_bindir])AC_DEFUN(AC_SUBST_KFSSTND,[AC_SUBST(kde_htmldir)AC_SUBST(kde_appsdir)AC_SUBST(kde_icondir)AC_SUBST(kde_sounddir)kde_minidir="$kde_icondir/mini"AC_SUBST(kde_minidir)AC_SUBST(kde_datadir)AC_SUBST(kde_locale)AC_SUBST(kde_cgidir)AC_SUBST(kde_confdir)AC_SUBST(kde_mimedir)AC_SUBST(kde_toolbardir)AC_SUBST(kde_wallpaperdir)AC_SUBST(kde_bindir)AC_SUBST(kde_partsdir)])AC_DEFUN(KDE_MISC_TESTS,[ AC_LANG_C dnl Checks for libraries. AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD AC_SUBST(LIBCOMPAT) AC_CHECK_LIB(crypt, main, [LIBCRYPT="-lcrypt"]) dnl for BSD AC_SUBST(LIBCRYPT) AC_CHECK_KSIZE_T AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) if test $ac_cv_lib_dnet_dnet_ntoa = no; then AC_CHECK_LIB(dnet_stub, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) fi AC_CHECK_FUNC(gethostbyname) if test $ac_cv_func_gethostbyname = no; then AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") fi AC_CHECK_FUNC(connect) if test $ac_cv_func_connect = no; then AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , $X_EXTRA_LIBS) fi AC_CHECK_FUNC(remove) if test $ac_cv_func_remove = no; then AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. AC_CHECK_FUNC(shmat) if test $ac_cv_func_shmat = no; then AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc") fi LIBSOCKET=$X_EXTRA_LIBS AC_SUBST(LIBSOCKET) AC_SUBST(X_EXTRA_LIBS) AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 AC_SUBST(LIBUCB) case $host in dnl this *is* LynxOS specific *-*-lynxos* ) AC_MSG_CHECKING([LynxOS header file wrappers]) [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] AC_MSG_RESULT(disabled) AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS ;; esac])## ------------------------------------------------------------------------## Find the header files and libraries for X-Windows. Extended the ## macro AC_PATH_X## ------------------------------------------------------------------------##AC_DEFUN(K_PATH_X,[AC_MSG_CHECKING(for X)AC_CACHE_VAL(ac_cv_have_x,[# One or both of the vars are not set, and there is no cached value.ac_x_includes=NO ac_x_libraries=NOAC_PATH_X_DIRECTAC_PATH_X_XMKMFif test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"fi])dnleval "$ac_cv_have_x" if test "$have_x" != yes; then AC_MSG_RESULT($have_x) no_x=yeselse # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])fiif test -z "$x_includes" || test "x$x_includes" = xNONE; then X_INCLUDES="" x_includes="."; dnl better than nothing :- else X_INCLUDES="-I$x_includes"fiif test -z "$x_libraries" || test "x$x_libraries" = xNONE; then X_LDFLAGS="" x_libraries="/usr/lib"; dnl better than nothing :- else X_LDFLAGS="-L$x_libraries"fiall_includes="$all_includes $X_INCLUDES" all_libraries="$all_libraries $X_LDFLAGS" AC_SUBST(X_INCLUDES)AC_SUBST(X_LDFLAGS)AC_SUBST(x_libraries)AC_SUBST(x_includes)])AC_DEFUN(KDE_PRINT_QT_PROGRAM,[AC_LANG_CPLUSPLUScat > conftest.$ac_ext <<EOF#include "confdefs.h"#include <qstring.h>#include <qapplication.h>int main() { QChar c; c = 'a'; return 0;}EOF])AC_DEFUN(KDE_CHECK_QT_DIRECT,[AC_MSG_CHECKING([if Qt compiles without flags])AC_CACHE_VAL(kde_cv_qt_direct,[ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATHac_LIBRARY_PATH="$LIBRARY_PATH"ac_cxxflags_safe="$CXXFLAGS"ac_ldflags_safe="$LDFLAGS"ac_libs_safe="$LIBS"CXXFLAGS="$CXXFLAGS -I$qt_includes"LDFLAGS="$X_LDFLAGS"LIBS="-lqt -lXext -lX11 $LIBSOCKET"LD_LIBRARY_PATH=export LD_LIBRARY_PATHLIBRARY_PATH=export LIBRARY_PATHKDE_PRINT_QT_PROGRAMif AC_TRY_EVAL(ac_link) && test -s conftest; then kde_cv_qt_direct="yes"else kde_cv_qt_direct="no" echo "configure: failed program was:" >&AC_FD_CC cat conftest.$ac_ext >&AC_FD_CCfirm -f conftest*CXXFLAGS="$ac_cxxflags_safe"LDFLAGS="$ac_ldflags_safe"LIBS="$ac_libs_safe"LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"export LD_LIBRARY_PATHLIBRARY_PATH="$ac_LIBRARY_PATH"export LIBRARY_PATH])if test "$kde_cv_qt_direct" = "yes"; then AC_MSG_RESULT(yes) $1else AC_MSG_RESULT(no) $2fi])## ------------------------------------------------------------------------## Try to find the Qt headers and libraries.## $(QT_LDFLAGS) will be -Lqtliblocation (if needed)## and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)## ------------------------------------------------------------------------##AC_DEFUN(AC_PATH_QT_2,[AC_REQUIRE([K_PATH_X])AC_MSG_CHECKING([for Qt])ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NOqt_libraries=""qt_includes=""AC_ARG_WITH(qt-dir, [ --with-qt-dir where the root of qt is installed ], [ ac_qt_includes="$withval"/include ac_qt_libraries="$withval"/lib ac_qt_bindir="$withval"/bin ])AC_ARG_WITH(qt-includes, [ --with-qt-includes where the Qt includes are. ], [ ac_qt_includes="$withval" ]) kde_qt_libs_given=noAC_ARG_WITH(qt-libraries, [ --with-qt-libraries where the Qt library is installed.], [ ac_qt_libraries="$withval" kde_qt_libs_given=yes ])if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; thenAC_CACHE_VAL(ac_cv_have_qt,[#try to guess Qt locationsqt_incdirs="$ac_qt_includes /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes $QTINC"test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"AC_FIND_FILE(qnamespace.h, $qt_incdirs, qt_incdir)ac_qt_includes="$qt_incdir"if test ! "$ac_qt_libraries" = "NO"; then qt_libdirs="$ac_qt_libraries"fiqt_libdirs="$qt_libdirs /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt $x_libraries $QTLIB"test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"test=NONEqt_libdir=NONEfor dir in $qt_libdirs; do try="ls -1 $dir/libqt*" if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fidonednl AC_FIND_FILE(libqt.so libqt.so.2.00 libqt.so.2.0 libqt.so.2 libqt.a libqt.sl, $qt_libdirs, qt_libdir)ac_qt_libraries="$qt_libdir"ac_cxxflags_safe="$CXXFLAGS"ac_ldflags_safe="$LDFLAGS"ac_libs_safe="$LIBS"CXXFLAGS="$CXXFLAGS -I$qt_incdir"LDFLAGS="-L$qt_libdir $X_LDFLAGS"LIBS="$LIBS -lpq++ -lqt -lkdb -lXext -lX11 $LIBSOCKET"KDE_PRINT_QT_PROGRAMif AC_TRY_EVAL(ac_link) && test -s conftest; then rm -f conftest*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -