1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
 
AC_INIT(msqlmod.cmod) 
AC_CONFIG_HEADER(msql_config.h) 
 
AC_MODULE_INIT() 
 
AC_ARG_WITH(msql,    [  --with(out)-msql      mSQL Database engine support ],[] 
,[with_msql=yes]) 
 
echo "Configuring msql module" 
 
dnl set up "reasonable" search paths 
pike_msql_reasonable_prefixes="$with_root/usr/local $with_root/usr $with_root/opt" 
pike_msql_reasonable_directories="Minerva Hughes minerva hughes msql Msql msql2 Msql2 /" 
pike_msql_extra_include_directories="$HOME/include" 
pike_msql_extra_lib_directories="$HOME/lib" 
 
for a in $pike_msql_reasonable_prefixes 
do 
        for b in $pike_msql_reasonable_directories 
        do 
                pike_msql_reasonable_include_searchpath="$pike_msql_reasonable_include_searchpath $a/$b/include" 
                pike_msql_reasonable_lib_searchpath="$pike_msql_reasonable_lib_searchpath $a/$b/lib" 
        done 
done 
pike_msql_reasonable_include_searchpath="$pike_msql_reasonable_include_searchpath $pike_msql_extra_include_directories" 
pike_msql_reasonable_lib_searchpath="$pike_msql_reasonable_lib_searchpath $pike_msql_extra_lib_directories" 
 
dnl let's start the actual tests 
if test x$with_msql = xyes; then 
        OLD_CPPFLAGS=$CPPFLAGS 
        OLD_LIBS=$LIBS 
        OLD_LDFLAGS=$LDFLAGS 
 
        AC_MSG_CHECKING(for location of mSQL include files) 
        AC_CACHE_VAL(pike_cv_msql_include_dir, [ 
                for pike_cv_msql_include_dir in $pike_msql_reasonable_include_searchpath no 
                do 
                        if test -f $pike_cv_msql_include_dir/msql.h; then 
                                break 
                        fi 
                done ]) 
        if test x$pike_cv_msql_include_dir != xno; then 
                AC_MSG_RESULT(found.) 
        else 
                AC_MSG_RESULT(not found.) 
        fi 
dnl   AC_MSG_RESULT($pike_cv_msql_include_dir) 
 
        if test x$pike_cv_msql_include_dir != xno; then 
                CPPFLAGS="$CPPFLAGS -I$pike_cv_msql_include_dir" 
        fi 
 
        AC_CHECK_HEADERS(msql.h) 
 
        if test "$ac_cv_header_msql_h" != "no"; then 
                AC_MSG_CHECKING(for location of mSQL library) 
                AC_CACHE_VAL(pike_cv_msql_lib_dir, [ 
                        for pike_cv_msql_lib_dir in $pike_msql_reasonable_lib_searchpath no 
                        do 
                                if test -f $pike_cv_msql_lib_dir/libmsql.a; then 
                                        break 
                                fi 
                        done 
                ] ) 
                if test x$pike_cv_msql_lib_dir != xno; then 
                        AC_MSG_RESULT(found.) 
                else 
                        AC_MSG_RESULT(not found.) 
                fi 
dnl           AC_MSG_RESULT($pike_cv_msql_lib_dir) 
      fi 
 
        if test "$pike_cv_msql_lib_dir" != "no" ; then 
                LDFLAGS="$LDFLAGS -L$pike_cv_msql_lib_dir" 
        fi 
 
                # On some OS's (Solaris 2) these are requiered 
              AC_CHECK_LIB(socket, socket, [], []) 
                AC_CHECK_LIB(nsl, gethostbyname, [], []) 
 
                AC_CHECK_LIB(msql, msqlClose) 
                if test "$ac_cv_lib_msql_msqlClose" != "no"; then 
                        pike_cv_found_msql="yes" 
                        MSQL_SUPPORTED="yes" 
                fi 
 
        if test x$pike_cv_found_msql = xyes; then 
                AC_CHECK_FUNCS(msqlListIndex) 
                if test "$ac_cv_func_msqlListIndex" = "yes"; then 
                        echo "We're supporting mSQL version 2.0, good..." 
                else 
                        echo "We're supporting mSQL version 1.0" 
                fi 
        fi 
fi 
 
if test "x$pike_cv_found_msql" != "xyes"; then 
        CPPFLAGS=$OLD_CPPFLAGS 
        LDFLAGS=$OLD_LDFLAGS 
        LIBS=$OLD_LIBS 
fi 
 
AC_SUBST(LIBS) 
AC_SUBST(MSQL_SUPPORTED) 
 
AC_OUTPUT(./Makefile)