1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4
5AC_INIT(libdingaling, 0.1)
6AC_CONFIG_AUX_DIR(build)
7AM_INIT_AUTOMAKE
8AC_CONFIG_SRCDIR([src])
9AC_CONFIG_HEADERS([src/config.h])
10
11CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
12CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
13LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
14
15#Set default language
16AC_LANG_C
17# Checks for programs.
18AC_PROG_CC
19AC_PROG_MAKE_SET
20AC_PROG_LIBTOOL
21AC_PROG_INSTALL
22
23#Check for compiler vendor
24AX_COMPILER_VENDOR
25
26#  Optimize
27AC_ARG_ENABLE(optimization,
28[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
29
30if test "${enable_optimizer}" = "yes" ; then
31        AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
32        AX_CC_MAXOPT
33fi
34
35#  Enable debugging
36AC_ARG_ENABLE(debug,
37[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"])
38
39if test "${enable_debug}" = "yes"; then
40        AC_DEFINE([DEBUG],[],[Enable extra debugging.])
41        AX_CFLAGS_WARN_ALL_ANSI
42fi
43
44AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
45
46
47case "$host" in
48                *-solaris2*)
49                        if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
50                                SOLINK="-Bdynamic -dy -G"
51                                new_AM_CFLAGS="-KPIC -DPIC"
52                                new_AM_LDFLAGS="-R${prefix}/lib"
53                                FUNC_DEF=__func__
54                                IN_LINE=""
55                        elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
56                                SOLINK="-Bdynamic -dy -G"
57                                new_AM_CFLAGS="-fPIC"
58                                new_AM_LDFLAGS=""
59                                IN_LINE=inline
60                        fi
61                ;;
62                *-darwin*)
63                        if test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
64                                SOLINK="-dynamic -bundle -force-flat-namespace"
65                                new_AM_CFLAGS="-DMACOSX"
66                                new_AM_LDFLAGS=""
67                        fi
68                        IN_LINE=inline
69                ;;
70                x86_64-*-linux-gnu)
71                        if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
72                                SOLINK="-Bdynamic -dy -G"
73                                new_AM_CFLAGS="-KPIC -DPIC"
74                                new_AM_LDFLAGS="-R${prefix}/lib"
75                                FUNC_DEF=__func__
76                        elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
77                                SOLINK="-shared -Xlinker -x"
78                                new_AM_CFLAGS="-fPIC"
79                                new_AM_LDFLAGS=""
80                        fi
81                        IN_LINE=inline
82                ;;
83                i*6-*-linux-gnu)
84                        if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
85                                SOLINK="-Bdynamic -dy -G"
86                                new_AM_CFLAGS="-KPIC -DPIC"
87                                new_AM_LDFLAGS="-R${prefix}/lib"
88                                FUNC_DEF=__func__
89                        elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
90                                SOLINK="-shared -Xlinker -x"
91                                new_AM_CFLAGS="-fpic"
92                                new_AM_LDFLAGS=""
93                        fi
94                        IN_LINE=inline
95                ;;
96                *)
97                        if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
98                                SOLINK="-Bdynamic -dy -G"
99                                new_AM_CFLAGS="-KPIC -DPIC"
100                                new_AM_LDFLAGS="-R${prefix}/lib"
101                                FUNC_DEF=__func__
102                        elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
103                                SOLINK="-shared -Xlinker -x"
104                                new_AM_CFLAGS="-fPIC"
105                                new_AM_LDFLAGS=""
106                        fi
107                        IN_LINE=inline
108esac
109
110#  Enable 64 bit build
111AC_ARG_ENABLE(64,
112[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
113
114if test "x${ax_cv_c_compiler_vendor}"  =  "xsun" ; then
115    if test "${enable_64}" = "yes"; then
116        new_AM_CFLAGS="$new_AM_CFLAGS -m64"
117    fi
118fi
119
120AC_SUBST(new_AM_CFLAGS)
121AC_SUBST(new_AM_LDFLAGS)
122AC_SUBST(SOLINK)
123AC_DEFINE_UNQUOTED([__inline__],[$IN_LINE],[sunpro is bad at inline])
124
125# Checks for header files.
126AC_HEADER_DIRENT
127AC_HEADER_STDC
128#AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
129
130# Checks for typedefs, structures, and compiler characteristics.
131AC_C_CONST
132AC_C_INLINE
133AC_TYPE_SIZE_T
134AC_HEADER_TIME
135AC_STRUCT_TM
136
137# Checks for library functions.
138AC_PROG_GCC_TRADITIONAL
139AC_TYPE_SIGNAL
140AC_FUNC_STRFTIME
141#AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr])
142
143AC_C_BIGENDIAN(AC_DEFINE([__BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([__BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
144AC_DEFINE([__LITTLE_ENDIAN],1234,[for the places where it is not defined])
145AC_DEFINE([__BIG_ENDIAN],4321,[for the places where it is not defined])
146
147AC_CONFIG_FILES([Makefile])
148
149AC_OUTPUT
150