1AC_INIT(configure.in)
2
3AM_CONFIG_HEADER(config.h)
4AM_INIT_AUTOMAKE(brikx, 0.1)
5
6AC_LANG_CPLUSPLUS
7AC_PROG_CXX
8AM_PROG_LIBTOOL
9
10dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
11dnl     if-not-found, test-parameter)
12AC_DEFUN(KDE_FIND_PATH,
13[
14   AC_MSG_CHECKING([for $1])
15   if test -n "$$2"; then
16        kde_cv_path="$$2";
17   else
18        kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
19
20        AC_CACHE_VAL(kde_cv_path_$kde_cache,
21        [
22        kde_cv_path="NONE"
23        dirs="$3"
24        kde_save_IFS=$IFS
25        IFS=':'
26        for dir in $PATH; do
27          dirs="$dirs $dir"
28        done
29        IFS=$kde_save_IFS
30
31        for dir in $dirs; do
32          if test -x "$dir/$1"; then
33            if test -n "$5"
34            then
35              evalstr="$dir/$1 $5 2>&1 "
36              if eval $evalstr; then
37                kde_cv_path="$dir/$1"
38                break
39              fi
40            else
41                kde_cv_path="$dir/$1"
42                break
43            fi
44          fi
45        done
46
47        eval "kde_cv_path_$kde_cache=$kde_cv_path"
48
49        ])
50
51      eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
52
53   fi
54
55   if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
56      AC_MSG_RESULT(not found)
57      $4
58   else
59      AC_MSG_RESULT($kde_cv_path)
60      $2=$kde_cv_path
61
62   fi
63])
64
65KDE_FIND_PATH(sdl-config, LIBSDL_CONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [
66  AC_MSG_WARN([Could not find libsdl anywhere, check http://www.sdl.org])
67])
68
69if test -n "$LIBSDL_CONFIG"; then
70     LIBSDL_LIBS="`$LIBSDL_CONFIG --libs`"
71     LIBSDL_RPATH=
72     for args in $LIBSDL_LIBS; do
73          case $args in
74            -L*)
75               LIBSDL_RPATH="$LIBSDL_RPATH $args"
76               ;;
77          esac
78     done
79     LIBSDL_RPATH=`echo $LIBSDL_RPATH | sed -e "s/-L/-R/g"`
80     LIBSDL_CFLAGS="`$LIBSDL_CONFIG --cflags`"
81
82     AC_DEFINE_UNQUOTED(HAVE_LIBSDL, 1, [Defines if your system has the LIBSDL library])
83fi
84
85
86AC_SUBST(LIBSDL_LIBS)
87AC_SUBST(LIBSDL_CFLAGS)
88AC_SUBST(LIBSDL_RPATH)
89
90AC_OUTPUT(Makefile src/Makefile)
91