Merge pull request #4 from tfzxyinhao/master

update compile optional
pull/1/merge
YuQing 2015-08-26 18:38:51 +08:00
commit c7c9d2a19f
3 changed files with 13 additions and 7 deletions

View File

@ -5,7 +5,7 @@ cat <<EOF > $tmp_src_filename
#include <fcntl.h>
int main()
{
printf("%d\n", (int)sizeof(long));
printf("%d\n", (int)sizeof(void*));
printf("%d\n", (int)sizeof(off_t));
return 0;
}
@ -23,6 +23,8 @@ fi
count=0
int_bytes=4
off_bytes=8
LIB_VERSION=lib64
for col in $output; do
if [ $count -eq 0 ]; then
int_bytes=$col
@ -36,8 +38,10 @@ done
/bin/rm -f a.out $tmp_src_filename
if [ "$int_bytes" -eq 8 ]; then
OS_BITS=64
LIB_VERSION=lib64
else
OS_BITS=32
LIB_VERSION=lib
fi
if [ "$off_bytes" -eq 8 ]; then
@ -118,5 +122,6 @@ cd src
cp Makefile.in Makefile
perl -pi -e "s#\\\$\(CFLAGS\)#$CFLAGS#g" Makefile
perl -pi -e "s#\\\$\(LIBS\)#$LIBS#g" Makefile
make $1 $2
perl -pi -e "s#\\\$\(LIB_VERSION\)#$LIB_VERSION#g" Makefile
make $1 $2 $3

View File

@ -3,6 +3,7 @@
COMPILE = $(CC) $(CFLAGS)
INC_PATH =
LIB_PATH = $(LIBS)
LIB_VERSION = $(LIB_VERSION)
FAST_SHARED_OBJS = hash.lo chain.lo shared_func.lo ini_file_reader.lo \
logger.lo sockopt.lo base64.lo sched_thread.lo \
@ -46,12 +47,12 @@ libfastcommon.a: $(FAST_STATIC_OBJS)
.c.lo:
$(COMPILE) -c -fPIC -o $@ $< $(INC_PATH)
install:
mkdir -p $(DESTDIR)/usr/lib64
install -m 755 $(SHARED_LIBS) $(DESTDIR)/usr/lib64
mkdir -p $(DESTDIR)/usr/$(LIB_VERSION)
install -m 755 $(SHARED_LIBS) $(DESTDIR)/usr/$(LIB_VERSION)
mkdir -p $(DESTDIR)/usr/include/fastcommon
install -m 644 $(HEADER_FILES) $(DESTDIR)/usr/include/fastcommon
# cd $(DESTDIR)/usr/lib64 && ln -fs libfastcommon.so.1 libfastcommon.so
# ln -fs $(DESTDIR)/usr/local/lib/libfastcommon.so.1 $(DESTDIR)/usr/local/lib/libfastcommon.so
# cd $(DESTDIR)/usr/$(LIB_VERSION) && ln -fs libfastcommon.so.1 libfastcommon.so
# ln -fs $(DESTDIR)/usr/local/$(LIB_VERSION)/libfastcommon.so.1 $(DESTDIR)/usr/local/$(LIB_VERSION)/libfastcommon.so
# sh ./fast_link_library.sh
clean:
rm -f $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS)

View File

@ -38,7 +38,7 @@ int init_pthread_lock(pthread_mutex_t *pthread_lock)
return result;
}
if ((result=pthread_mutexattr_settype(&mat, \
PTHREAD_MUTEX_ERRORCHECK)) != 0)
PTHREAD_MUTEX_ERRORCHECK_NP)) != 0)
{
logError("file: "__FILE__", line: %d, " \
"call pthread_mutexattr_settype fail, " \